]> gerrit.simantics Code Review - simantics/platform.git/blob - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/PolymorphicRecursion.scl
Fixed multiple issues causing dangling references to discarded queries
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / PolymorphicRecursion.scl
1 // Idea here is to test the following property:
2 // When a function is called recursively it has locally a monomorphic type.
3 // Therefore the definition of cons does not work even if it works
4 // with a proper type annotation.
5
6 data Vec a = Nil | Zero (Vec (a,a)) | One a (Vec (a,a))
7
8 // cons :: a -> Vec a -> Vec a
9 cons x Nil        = One x Nil
10 cons x (Zero ps)  = One x ps
11 cons x (One y ps) = Zero (cons (x, y) ps)
12 --
13 11:21-11:42: Expected <Vec (a, a)> got <Vec a>.
14 11:32-11:38: Expected <a> got <(b, c)>.
15 11:39-11:41: Expected <Vec a> got <Vec (a, a)>.