]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Merge "Print console messages to IDE by default"
authorHannu Niemistö <hannu.niemisto@semantum.fi>
Fri, 29 Dec 2017 09:43:23 +0000 (11:43 +0200)
committerGerrit Code Review <gerrit2@www.simantics.org>
Fri, 29 Dec 2017 09:43:23 +0000 (11:43 +0200)
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/contexts/TranslationContext.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/EConstant.java
bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ELiteral.java
tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/ModuleRegressionTests.java
tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/RepeatedVariableDefinitionBug.scl [new file with mode: 0644]

index 0e7df755c3a5eede4b52db6b355611afe3fd7708..535cc8c8b6cc1f17311945523447bc2f01c2da3b 100644 (file)
@@ -119,7 +119,7 @@ public class TranslationContext extends TypeTranslationContext implements Enviro
     public static boolean isConstructorName(String name) {
         int p = name.lastIndexOf('.');
         char firstChar = name.charAt(p<0 ? 0 : p+1);
-        return Character.isUpperCase(firstChar);
+        return Character.isUpperCase(firstChar) || firstChar == '(';
     }
     
     /* Tries to resolve name as a local variable. It is assumed
index b33ebcf2551ca99ad34612bd2a978d53ce975025..eb3f5ca4a74ff3e192c7647153f5f1d14cd36bcd 100644 (file)
@@ -261,4 +261,9 @@ public class EConstant extends Expression {
         EConstant other = (EConstant)expression;
         return value == other.value && Types.equals(typeParameters, other.typeParameters);
     }
+    
+    @Override
+    public boolean isConstructorApplication() {
+        return true;
+    }
 }
index bef28f20ff298a75b65f594cf4bbea08446017d7..f82ae5101910bfe4c84c165392dc209f145fdf78 100644 (file)
@@ -119,4 +119,8 @@ public class ELiteral extends Expression {
         return value.equals(other.value);
     }
 
+    @Override
+    public boolean isConstructorApplication() {
+        return true;
+    }
 }
index 9e5d79216261816b76820ce148b35c550925cc74..e11755fc3c7ed4c899c7966ce8d50d646102bb63 100644 (file)
@@ -228,6 +228,7 @@ public class ModuleRegressionTests extends TestBase {
     @Test public void RedBlackTrees() { test(); }
     @Test public void Relations1() { test(); }
     @Test public void Relations2() { test(); }
+    @Test public void RepeatedVariableDefinitionBug() { test(); }
     @Test public void RepeatedVariableInPattern() { test(); }
     @Test public void Scanl() { test(); }
     @Test public void Search() { test(); }
diff --git a/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/RepeatedVariableDefinitionBug.scl b/tests/org.simantics.scl.compiler.tests/src/org/simantics/scl/compiler/tests/scl/RepeatedVariableDefinitionBug.scl
new file mode 100644 (file)
index 0000000..e5ae389
--- /dev/null
@@ -0,0 +1,18 @@
+import "Prelude"
+
+test1 :: ()
+test1 = do
+  (problem, foo) = (1, 2)
+  problem = 1
+  (problem, bar) = (3, 4)
+  ()
+
+test2 :: ()
+test2 = do
+  (problem, foo) = (1, 2)
+  (problem, bar) = (3, 4)
+  ()
+  
+main = ()
+--
+()
\ No newline at end of file