From 5bed099be36a76e204265abb2f471d84050c0d66 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Thu, 5 Oct 2017 08:21:13 +0300 Subject: [PATCH] Fixed incorrect interaction of EAmbigious and TMetaVar.setRef refs #7530 Change-Id: I6b06e164861fd5eaf7dba9377311106133dd775f --- .../elaboration/expressions/EAmbiguous.java | 6 ++--- .../simantics/scl/compiler/types/TFun.java | 2 +- .../scl/compiler/types/TMetaVar.java | 12 ++++++--- .../simantics/scl/compiler/types/Type.java | 8 +++++- .../types/util/TypeUnparsingContext.java | 1 + .../org.simantics.scl.runtime/scl/Debug.scl | 9 +++++++ .../compiler/tests/ModuleRegressionTests.java | 3 ++- .../scl/compiler/tests/scl/Overloading4.scl | 25 +++++++++++++++++++ 8 files changed, 57 insertions(+), 9 deletions(-) create mode 100644 tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Overloading4.scl diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java index 1d17281dd..0afb14b89 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EAmbiguous.java @@ -56,7 +56,7 @@ public class EAmbiguous extends SimplifiableExpression { THashMap unifications = new THashMap(); Type requiredType = getType(); if(DEBUG) - System.out.println("EAmbigious.filterActive with " + requiredType); + System.out.println("EAmbigious.filterActive with " + requiredType.toStringSkeleton()); for(int i=0;i names; int nameId; + public boolean showSkeletons; public TypeUnparsingContext() { this.names = new THashMap(); diff --git a/bundles/org.simantics.scl.runtime/scl/Debug.scl b/bundles/org.simantics.scl.runtime/scl/Debug.scl index 941120100..858f87c80 100644 --- a/bundles/org.simantics.scl.runtime/scl/Debug.scl +++ b/bundles/org.simantics.scl.runtime/scl/Debug.scl @@ -15,6 +15,15 @@ time f = do endTime = nanoTime () (result, Java.l2d (endTime-beginTime) * 1e-9) +reportTime :: ( a) -> a +reportTime f = runProc do + beginTime = nanoTime () + result = f + endTime = nanoTime () + time = Java.l2d (endTime-beginTime) * 1e-9 + print "time \(time) s" + result + """ Prints the given text and returns the second parameter. diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java index 91ddbc5e9..a61dc965d 100644 --- a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java @@ -196,7 +196,8 @@ public class ModuleRegressionTests extends TestBase { @Test public void OverloadedArithmetic2() { test(); } @Test public void OverloadedArithmetic3() { test(); } @Test public void OverloadedLiterals2() { test(); } - @Test public void Overloading1() { test(); } + @Test public void Overloading1() { test(); } + @Test public void Overloading4() { test(); } @Test public void Parsing() { test(); } @Test public void PolymorphicRecursion() { test(); } @Test public void PolymorphicRecursion2() { test(); } diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Overloading4.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Overloading4.scl new file mode 100644 index 000000000..040e435be --- /dev/null +++ b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/Overloading4.scl @@ -0,0 +1,25 @@ +// module M1 +import "Prelude" + +foo :: Integer -> Integer -> Integer +foo = (+) +-- +// module M2 +import "Prelude" + +foo :: String -> String -> String -> () +foo a b c = do + print a + print b + print c +-- +import "Prelude" +import "M1" +import "M2" + +main = ignore (foo "Hello" "world" "!") +-- +Hello +world +! +() \ No newline at end of file -- 2.47.0