Add union type checks and list literal inference
This commit is contained in:
1 parent
9db5b12c31
commit
c31343a040
7 files changed
+421
-18
No files matched your search
@@ -49,7 +49,11 @@ class WhenIsCondition(
|
||||
override val pos: Pos,
|
||||
) : WhenCondition(expr, pos) {
|
||||
override suspend fun matches(scope: Scope, value: Obj): Boolean {
|
||||
val result = value.isInstanceOf(expr.execute(scope))
|
||||
val typeExpr = expr.execute(scope)
|
||||
val result = when (typeExpr) {
|
||||
is net.sergeych.lyng.obj.ObjTypeExpr -> net.sergeych.lyng.obj.matchesTypeDecl(scope, value, typeExpr.typeDecl)
|
||||
else -> value.isInstanceOf(typeExpr)
|
||||
}
|
||||
return if (negated) !result else result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user