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%2FOverloadedArithmetic3.scl;h=f09d22453e3927cf7e21b8bb4adcdcb044c2cbb4;hp=230e486cf8ce03b5d33e6bf1573eb5fd13adc93c;hb=172abed5dbf73c1304a7a95bb8504ea293556948;hpb=fdbe87627e92805701d0672fbe8f1dc60b7f7b00 diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/OverloadedArithmetic3.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/OverloadedArithmetic3.scl index 230e486cf..f09d22453 100644 --- a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/OverloadedArithmetic3.scl +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/OverloadedArithmetic3.scl @@ -1,27 +1,27 @@ -import "JavaBuiltin" as Java - -infixl 7 (*) -infixl 6 (+) - -class Additive a where - (+) :: a -> a -> a - -class (Additive a) => Ring a where - (*) :: a -> a -> a - -instance Additive Double where - x + y = Java.dadd x y - -instance Ring Double where - x * y = Java.dmul x y - -instance Additive Integer where - x + y = Java.iadd x y - -instance Ring Integer where - x * y = Java.imul x y - -main = (1.0 :: Double)*(2.0 :: Double)+(3.0 :: Double)*(4.0 :: Double) --- -14.0 - +import "JavaBuiltin" as Java + +infixl 7 (*) +infixl 6 (+) + +class Additive a where + (+) :: a -> a -> a + +class (Additive a) => Ring a where + (*) :: a -> a -> a + +instance Additive Double where + x + y = Java.dadd x y + +instance Ring Double where + x * y = Java.dmul x y + +instance Additive Integer where + x + y = Java.iadd x y + +instance Ring Integer where + x * y = Java.imul x y + +main = (1.0 :: Double)*(2.0 :: Double)+(3.0 :: Double)*(4.0 :: Double) +-- +14.0 +