@@ -489,9 +489,14 @@ def to_type_variable_free(self, factory):
489
489
# type variable free.
490
490
new_types = []
491
491
for t in self .types :
492
- new_types .append (t .to_type_variable_free (factory )
493
- if t .is_combound ()
494
- else t )
492
+ if t .is_combound ():
493
+ new_type = t .to_type_variable_free (factory )
494
+ elif t .is_type_var ():
495
+ bound = t .get_bound_rec (factory )
496
+ new_type = factory .get_any_type () if bound is None else bound
497
+ else :
498
+ new_type = t
499
+ new_types .append (new_type )
495
500
return UnionType (new_types )
496
501
497
502
def unify_types (self , t1 , factory , same_type = True ):
@@ -787,7 +792,7 @@ def __init__(self, name="Array"):
787
792
"T" , variance = tp .Covariant )])
788
793
789
794
790
- class FunctionType (tp .TypeConstructor , ObjectType ):
795
+ class FunctionType (tp .TypeConstructor ):
791
796
def __init__ (self , nr_type_parameters : int ):
792
797
name = "Function" + str (nr_type_parameters )
793
798
@@ -811,6 +816,7 @@ def __init__(self, nr_type_parameters: int):
811
816
features of typescript.
812
817
"""
813
818
819
+
814
820
def gen_type_alias_decl (gen ,
815
821
etype = None ) -> ts_ast .TypeAliasDeclaration :
816
822
""" Generate a Type Declaration (Type Alias)
@@ -836,6 +842,7 @@ def gen_type_alias_decl(gen,
836
842
gen ._add_node_to_parent (gen .namespace , type_alias_decl )
837
843
return type_alias_decl
838
844
845
+
839
846
def add_type_alias (gen , namespace , type_name , ta_decl ):
840
847
gen .context ._add_entity (namespace , 'types' , type_name , ta_decl .get_type ())
841
848
gen .context ._add_entity (namespace , 'decls' , type_name , ta_decl )
0 commit comments