X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Ftests%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FMacros3.scl;fp=bundles%2Forg.simantics.scl.compiler%2Ftests%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftests%2Fscl%2FMacros3.scl;h=ec1571dc02000138ec5c901f9e2e6a544cbe01cb;hp=0000000000000000000000000000000000000000;hb=969bd23cab98a79ca9101af33334000879fb60c5;hpb=866dba5cd5a3929bbeae85991796acb212338a08 diff --git a/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl new file mode 100644 index 000000000..ec1571dc0 --- /dev/null +++ b/bundles/org.simantics.scl.compiler/tests/org/simantics/scl/compiler/tests/scl/Macros3.scl @@ -0,0 +1,16 @@ +import "JavaBuiltin" as Java + +@JavaType "java.util.Collection" +data Collection a + +@macro +collectionToList :: Collection a -> [a] +collectionToList = Java.unsafeCoerce + +singleton :: a -> Collection a +singleton = Java.staticMethod "java.util.Collections.singletonList" + +main :: [Integer] +main = collectionToList (singleton 15) +-- +[15] \ No newline at end of file