]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Throw1.scl
(refs #7567) Added throw function to builtins
[simantics/platform.git] / tests / org.simantics.scl.compiler.tests / src / org / simantics / scl / compiler / tests / scl / Throw1.scl
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Throw1.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Throw1.scl
new file mode 100644 (file)
index 0000000..bc75889
--- /dev/null
@@ -0,0 +1,10 @@
+import "Prelude"
+
+importJava "java.lang.Exception" where
+    @JavaName "<init>"
+    createException :: String -> <Proc> Exception
+
+main = throw (createException "Foo") `catch` \(e :: Exception) -> print e
+--
+java.lang.Exception: Foo
+()
\ No newline at end of file