From a4efa8c091bb41968c2a2e198fa239625ed8a24e Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 10 Oct 2019 11:55:52 +0200 Subject: pkg/compiler: fix infinite recursion in template instantiation Currently we replace a template argument and then recurse into the new type AST to see if there is more to replace. If the description is buggy and the template argument contains itself, then we will recurse infintiely trying to replace it more and more. Use post-order traversal when replacing template argument to fix this. --- pkg/compiler/compiler_test.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'pkg/compiler/compiler_test.go') diff --git a/pkg/compiler/compiler_test.go b/pkg/compiler/compiler_test.go index 8f10ac586..4ea5b2721 100644 --- a/pkg/compiler/compiler_test.go +++ b/pkg/compiler/compiler_test.go @@ -201,6 +201,11 @@ l t type D[e]l`, "E", "#", + ` +type p b[L] +type b[L] { + e b[L[L]] +}`, } { Fuzz([]byte(data)[:len(data):len(data)]) } -- cgit mrf-deployment