Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@ class ExpressionValidator extends AbstractExpressionValidator {
var field = getAllFields(e.type).get(i)
if (f.recordField.name.equals(field.name)){
//type checking
if (!f.exp.typeOf.subTypeOf(field.type.typeObject)){
val expType = f.exp?.typeOf
if (expType !== null && !expType.subTypeOf(field.type.typeObject)){
error('Type mismatch', e, ExpressionPackage.Literals.EXPRESSION_RECORD__FIELDS, e.fields.indexOf(f))
}
}
Expand Down Expand Up @@ -311,10 +312,11 @@ class ExpressionValidator extends AbstractExpressionValidator {
val args = e.functionArgs
for (var i = 0; i < args.size; i++) {
val arg = args.get(i)

val param = e.function.params.get(i)
val paramType = param.type.inferActualType(arg)?.typeObject
val argType = arg.typeOf
if (!argType.subTypeOf(paramType) ) {
if (argType !== null && !argType.subTypeOf(paramType) ) {
error('''Function «e.function.name» expects argument «param.name» to be of type «paramType.typeName».''',
e, ExpressionPackage.Literals.EXPRESSION_FUNCTION_CALL__ARGS, i)
}
Expand Down
3 changes: 2 additions & 1 deletion bundles/nl.esi.xtext.types.tests/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

source.. = src/,\
src-gen/,\
xtend-gen/
xtend-gen/,\
resources/
bin.includes = .,\
META-INF/
bin.excludes = **/*.xtend
Loading