@@ -8922,11 +8922,8 @@ a.types[i], b.types[i]), }
8922
8922
[" emptytable" ] = compare_true_inferring_emptytable ,
8923
8923
},
8924
8924
[" typedecl" ] = {
8925
- [" record" ] = function (self , a , b )
8926
- local def = a .def
8927
- if def .fields then
8928
- return self :subtype_record (def , b )
8929
- end
8925
+ [" *" ] = function (self , a , b )
8926
+ return self :is_a (a .def , b )
8930
8927
end ,
8931
8928
},
8932
8929
[" function" ] = {
@@ -9000,6 +8997,9 @@ a.types[i], b.types[i]), }
9000
8997
[" tuple" ] = function (self , a , b )
9001
8998
return self :is_a (a_type (a , " tuple" , { tuple = { a } }), b )
9002
8999
end ,
9000
+ [" typedecl" ] = function (self , a , b )
9001
+ return self :is_a (a , b .def )
9002
+ end ,
9003
9003
[" typevar" ] = function (self , a , b )
9004
9004
return self :compare_or_infer_typevar (b .typevar , a , nil , self .is_a )
9005
9005
end ,
@@ -9032,27 +9032,28 @@ a.types[i], b.types[i]), }
9032
9032
[" self" ] = 3 ,
9033
9033
[" tuple" ] = 4 ,
9034
9034
[" typevar" ] = 5 ,
9035
- [" any" ] = 6 ,
9036
- [" boolean_context" ] = 7 ,
9037
- [" union" ] = 8 ,
9038
- [" poly" ] = 9 ,
9035
+ [" typedecl" ] = 6 ,
9036
+ [" any" ] = 7 ,
9037
+ [" boolean_context" ] = 8 ,
9038
+ [" union" ] = 9 ,
9039
+ [" poly" ] = 10 ,
9039
9040
9040
- [" typearg" ] = 10 ,
9041
+ [" typearg" ] = 11 ,
9041
9042
9042
- [" nominal" ] = 11 ,
9043
+ [" nominal" ] = 12 ,
9043
9044
9044
- [" enum" ] = 12 ,
9045
- [" string" ] = 12 ,
9046
- [" integer" ] = 12 ,
9047
- [" boolean" ] = 12 ,
9045
+ [" enum" ] = 13 ,
9046
+ [" string" ] = 13 ,
9047
+ [" integer" ] = 13 ,
9048
+ [" boolean" ] = 13 ,
9048
9049
9049
- [" interface" ] = 13 ,
9050
+ [" interface" ] = 14 ,
9050
9051
9051
- [" tupletable" ] = 14 ,
9052
- [" record" ] = 14 ,
9053
- [" array" ] = 14 ,
9054
- [" map" ] = 14 ,
9055
- [" function" ] = 14 ,
9052
+ [" tupletable" ] = 15 ,
9053
+ [" record" ] = 15 ,
9054
+ [" array" ] = 15 ,
9055
+ [" map" ] = 15 ,
9056
+ [" function" ] = 15 ,
9056
9057
}
9057
9058
9058
9059
local function compare_types (self , relations , t1 , t2 )
@@ -12290,6 +12291,10 @@ self:expand_type(node, values, elements) })
12290
12291
return t
12291
12292
12292
12293
elseif node .op .op == " as" then
12294
+ local ok , err = ensure_not_abstract (ra )
12295
+ if not ok then
12296
+ return self .errs :invalid_at (node .e1 , err )
12297
+ end
12293
12298
return gb
12294
12299
12295
12300
elseif node .op .op == " is" and ra .typename == " typedecl" then
0 commit comments