X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FClosureRecursion.scl;fp=tests%2Forg.simantics.scl.compiler.tests%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FClosureRecursion.scl;h=4b31b1d2f9fd8aa34a688545368d1e1f82fb52fe;hb=51a4b7a930406a4890258f598661edc4b44e181a;hp=0000000000000000000000000000000000000000;hpb=1463e5c4bbbd37f7ff86abe25da59b3e39977cee;p=simantics%2Fplatform.git diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ClosureRecursion.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ClosureRecursion.scl new file mode 100644 index 000000000..4b31b1d2f --- /dev/null +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/ClosureRecursion.scl @@ -0,0 +1,21 @@ +import "Prelude" + +countDown :: Ref Integer -> Boolean +countDown r = if currentValue <= 0 + then False + else do + r := currentValue - 1 + True + where + currentValue = getRef r + +strangeLoop :: ( Boolean) -> () +strangeLoop cond = if cond + then strangeLoop cond + else () + +main = do + r = ref 100000 :: Ref Integer + strangeLoop (countDown r) +-- +() \ No newline at end of file