compiler error for missing return value

This commit is contained in:
Irmen de Jong 2021-01-10 16:36:08 +01:00
parent 506ac8014c
commit a0ec37b35b

View File

@ -879,6 +879,10 @@ internal class AstChecker(private val program: Program,
override fun visit(typecast: TypecastExpression) {
if(typecast.type in IterableDatatypes)
errors.err("cannot type cast to string or array type", typecast.position)
if(!typecast.expression.inferType(program).isKnown)
errors.err("this expression doesn't return a value", typecast.expression.position)
super.visit(typecast)
}