diff --git a/src/org/rascalmpl/interpreter/matching/TypedVariablePattern.java b/src/org/rascalmpl/interpreter/matching/TypedVariablePattern.java index 6e3ccdb6c26..e94a28eddaa 100644 --- a/src/org/rascalmpl/interpreter/matching/TypedVariablePattern.java +++ b/src/org/rascalmpl/interpreter/matching/TypedVariablePattern.java @@ -113,7 +113,7 @@ public boolean next() { if (dynMatchType.isOpen()) { // type parameter hygiene required (consider self-application of a function like `&T id(&T v) = v`) - dynMatchType = AbstractFunction.renameType(dynMatchType, new HashMap<>(), Integer.toString(ctx.getCurrentAST().getLocation().getOffset())); + dynMatchType = AbstractFunction.renameType(dynMatchType, new HashMap<>(), ctx.getCurrentAST().getLocation()); } if (!declaredType.match(dynMatchType, dynBindings)) { @@ -134,7 +134,7 @@ public boolean next() { Type dynType = subject.getValue().getType(); if (dynType.isOpen()) { // type parameter hygiene required (consider self-application of a function like `&T id(&T v) = v`) - dynType = AbstractFunction.renameType(dynType, new HashMap<>(), Integer.toString(ctx.getCurrentAST().getLocation().getOffset())); + dynType = AbstractFunction.renameType(dynType, new HashMap<>(), ctx.getCurrentAST().getLocation()); } if (!dynType.isSubtypeOf(declaredType.instantiate(ctx.getCurrentEnvt().getDynamicTypeBindings()))) { diff --git a/src/org/rascalmpl/interpreter/result/AbstractFunction.java b/src/org/rascalmpl/interpreter/result/AbstractFunction.java index c68b5beccda..a0a29e38fc2 100644 --- a/src/org/rascalmpl/interpreter/result/AbstractFunction.java +++ b/src/org/rascalmpl/interpreter/result/AbstractFunction.java @@ -43,6 +43,7 @@ import io.usethesource.vallang.IConstructor; import io.usethesource.vallang.IExternalValue; import io.usethesource.vallang.IListWriter; +import io.usethesource.vallang.ISourceLocation; import io.usethesource.vallang.IValue; import io.usethesource.vallang.IValueFactory; import io.usethesource.vallang.IWithKeywordParameters; @@ -345,7 +346,7 @@ protected Type bindTypeParameters(Type actualStaticTypes, IValue[] actuals, Type if (actualStaticTypes.isOpen()) { // we have to make the environment hygenic now, because the caller scope // may have the same type variable names as the current scope - actualStaticTypes = renameType(actualStaticTypes, renamings, Integer.toString(env.getLocation().getOffset())); + actualStaticTypes = renameType(actualStaticTypes, renamings, env.getLocation()); } @@ -393,7 +394,7 @@ protected static Type unrenameType(Map renamings, Type resultType) { return resultType; } - public static Type renameType(Type actualTypes, Map renamings, String uniquePrefix) { + public static Type renameType(Type actualTypes, Map renamings, ISourceLocation uniquePrefix) { actualTypes.match(TypeFactory.getInstance().voidType(), renamings); // rename all the bound type parameters diff --git a/src/org/rascalmpl/interpreter/result/NamedFunction.java b/src/org/rascalmpl/interpreter/result/NamedFunction.java index 9523c20c6a1..4323f410129 100644 --- a/src/org/rascalmpl/interpreter/result/NamedFunction.java +++ b/src/org/rascalmpl/interpreter/result/NamedFunction.java @@ -164,7 +164,7 @@ protected void checkReturnTypeIsNotVoid(List formals, IValue[] actua Map bindings = new HashMap<>(); for (int i = 0; i < actuals.length; i++) { - formals.get(i).typeOf(declarationEnvironment, getEval(), false).match(renameType(actuals[i].getType(), renamings, Integer.toString(ctx.getCurrentAST().getLocation().getOffset())), bindings); + formals.get(i).typeOf(declarationEnvironment, getEval(), false).match(renameType(actuals[i].getType(), renamings, ctx.getCurrentAST().getLocation()), bindings); } if (!getReturnType().isBottom() && getReturnType().instantiate(bindings).isBottom()) {