X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FPolymorphicRecursion.scl;h=ba5df53f474d05eb93beeedb43819906a8b70180;hp=ed84193b7f62339402e9499424e56622a7d3c8c2;hb=HEAD;hpb=591f4572f18d20a08a797a8e5c4a8dfc1b3320c1 diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/PolymorphicRecursion.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/PolymorphicRecursion.scl index ed84193b7..ba5df53f4 100644 --- a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/PolymorphicRecursion.scl +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/PolymorphicRecursion.scl @@ -1,16 +1,15 @@ -// Idea here is to test the following property: -// When a function is called recursively it has locally a monomorphic type. -// Therefore the definition of cons does not work even if it works -// with a proper type annotation. - -data Vec a = Nil | Zero (Vec (a,a)) | One a (Vec (a,a)) - -// cons :: a -> Vec a -> Vec a -cons x Nil = One x Nil -cons x (Zero ps) = One x ps -cons x (One y ps) = Zero (cons (x, y) ps) --- -11:21-11:42: Expected got . -11:33-11:34: Type (a, a) is not a subtype of a. -11:36-11:37: Type (a, a) is not a subtype of a. +// Idea here is to test the following property: +// When a function is called recursively it has locally a monomorphic type. +// Therefore the definition of cons does not work even if it works +// with a proper type annotation. + +data Vec a = Nil | Zero (Vec (a,a)) | One a (Vec (a,a)) + +// cons :: a -> Vec a -> Vec a +cons x Nil = One x Nil +cons x (Zero ps) = One x ps +cons x (One y ps) = Zero (cons (x, y) ps) +-- +11:21-11:42: Expected got . +11:32-11:38: Expected got <(b, c)>. 11:39-11:41: Expected got . \ No newline at end of file