From: Hannu Niemistö Date: Mon, 10 Apr 2017 21:27:16 +0000 (+0300) Subject: Accept existential variables as record shorthand fields X-Git-Tag: v1.29.0~112^2 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F409%2F1;p=simantics%2Fplatform.git Accept existential variables as record shorthand fields Change-Id: I2d4ca35f26ba80795696b357f81d778420f40d51 --- diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java index 6ef9e9e72..a41c0f042 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/expressions/ERecord.java @@ -54,11 +54,14 @@ public class ERecord extends ASTExpression { THashMap recordMap = new THashMap(fields.length); for(FieldAssignment field : fields) { if(field.value == null) { + String actualName = field.name; + if(actualName.charAt(0) == '?') + actualName = actualName.substring(1); String bestMatch = null; int bestMatchLength = 0; for(int i=0;i bestMatchLength) { + if(actualName.startsWith(fieldName) && fieldName.length() > bestMatchLength) { bestMatch = fieldName; bestMatchLength = fieldName.length(); }