From 0fef79ab46ef07e8f7af6ff211c2b884fc4b735d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Hannu=20Niemist=C3=B6?= Date: Tue, 13 Sep 2016 16:49:01 +0300 Subject: [PATCH 1/1] Small SCL changes Removed error message from subsumption constraints that cannot be simplified away, because the simplification is not working correctly in certain standard cases. Removed Json2 from StandardLibrary Small efficiency fix in Prelude Check if the input block expression is empty in ExpressionEvalutor. Change-Id: I1b1843cb7847886618aea5063aff53fef35814cb --- .../compiler/internal/elaboration/subsumption/SubSolver.java | 2 +- .../src/org/simantics/scl/compiler/top/ExpressionEvaluator.java | 2 +- bundles/org.simantics.scl.runtime/scl/Prelude.scl | 2 +- bundles/org.simantics.scl.runtime/scl/StandardLibrary.scl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/subsumption/SubSolver.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/subsumption/SubSolver.java index 70adf524b..f9b5efc3b 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/subsumption/SubSolver.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/elaboration/subsumption/SubSolver.java @@ -49,7 +49,7 @@ public class SubSolver { reduceChains(); propagateUpperBounds(); checkLowerBounds(); - errorFromUnsolvedEquations(); + //errorFromUnsolvedEquations(); //System.out.println("--"); //print(); } diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java index 5c8f59bb2..39f0ac721 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/top/ExpressionEvaluator.java @@ -182,7 +182,7 @@ public class ExpressionEvaluator { final Environment environment = runtimeEnvironment.getEnvironment(); // Parse expression - if(expressionText != null) { + if(expressionText != null && !expressionText.trim().isEmpty()) { try { switch(parseMode) { case BLOCK: { diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index b29b04a2f..84f8b91b6 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -1266,7 +1266,7 @@ instance MonadZero Maybe where mzero = Nothing instance MonadOr Maybe where - morelse (Just a) _ = Just a + morelse a@(Just _) _ = a morelse _ b = b "`execJust v f` executes the function `f` with parameter value `x`, if `v=Just x`. If `v=Nothing`, the function does nothing." diff --git a/bundles/org.simantics.scl.runtime/scl/StandardLibrary.scl b/bundles/org.simantics.scl.runtime/scl/StandardLibrary.scl index 6b43166e3..76ecece9c 100644 --- a/bundles/org.simantics.scl.runtime/scl/StandardLibrary.scl +++ b/bundles/org.simantics.scl.runtime/scl/StandardLibrary.scl @@ -15,7 +15,7 @@ include "MSet" as MSet include "MList" as MList include "MMultiMap" as MMultiMap include "Coercion" -include "Json2" +//include "Json2" include "IterN" as Extra -- 2.43.2