Some fumbling with isSubTypeOf and add test for final.

This commit is contained in:
Juraj Kirchheim
2019-03-03 17:13:04 +01:00
parent 296cc6c861
commit 53868cc6f3
5 changed files with 28 additions and 10 deletions

View File

@@ -126,7 +126,8 @@ class Types {
static public function isSubTypeOf(t:Type, of:Type, ?pos)
return
ECheckType(ECheckType(macro null, toComplex(t)).at(pos), toComplex(of)).at(pos).typeof();
if (Context.unify(t, of)) ECheckType(ECheckType(macro null, toComplex(t)).at(pos), toComplex(of)).at(pos).typeof();
else Failure(new Error(t.toString() + ' should be ' + of.toString(), pos.sanitize()));
static public function isDynamic(t:Type)
return switch reduce(t) {