diff --git a/src/org/rascalmpl/interpreter/result/ConstructorFunction.java b/src/org/rascalmpl/interpreter/result/ConstructorFunction.java index 67ecdd6f130..4766c47a402 100644 --- a/src/org/rascalmpl/interpreter/result/ConstructorFunction.java +++ b/src/org/rascalmpl/interpreter/result/ConstructorFunction.java @@ -157,7 +157,12 @@ public Result computeDefaultKeywordParameter(String label, IConstructor } else { Expression def = getKeywordParameterDefaults().get(kwparam); - kwResult = ResultFactory.makeResult(kwType, def.interpret(eval).value, ctx); + IValue res = def.interpret(eval).value; + + if (!res.getType().isSubtypeOf(kwType)) { + throw new UnexpectedKeywordArgumentType(kwparam, kwType, res.getType(), ctx.getCurrentAST()); + } + kwResult = ResultFactory.makeResult(kwType, value, ctx); } if (kwparam.equals(label)) {