@@ -23,8 +23,6 @@ using ModulePtr = std::shared_ptr<Module>;
2323
2424bool isSubtype (TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
2525bool isSubtype (TypePackId subTy, TypePackId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
26- bool isConsistentSubtype (TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
27- bool isConsistentSubtype (TypePackId subTy, TypePackId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
2826
2927class TypeIds
3028{
@@ -336,6 +334,7 @@ struct NormalizedType
336334};
337335
338336
337+ using SeenTablePropPairs = Set<std::pair<TypeId, TypeId>, TypeIdPairHash>;
339338
340339class Normalizer
341340{
@@ -390,7 +389,13 @@ class Normalizer
390389 void unionTablesWithTable (TypeIds& heres, TypeId there);
391390 void unionTables (TypeIds& heres, const TypeIds& theres);
392391 NormalizationResult unionNormals (NormalizedType& here, const NormalizedType& there, int ignoreSmallerTyvars = -1 );
393- NormalizationResult unionNormalWithTy (NormalizedType& here, TypeId there, Set<TypeId>& seenSetTypes, int ignoreSmallerTyvars = -1 );
392+ NormalizationResult unionNormalWithTy (
393+ NormalizedType& here,
394+ TypeId there,
395+ SeenTablePropPairs& seenTablePropPairs,
396+ Set<TypeId>& seenSetTypes,
397+ int ignoreSmallerTyvars = -1
398+ );
394399
395400 // ------- Negations
396401 std::optional<NormalizedType> negateNormal (const NormalizedType& here);
@@ -407,16 +412,26 @@ class Normalizer
407412 void intersectClassesWithClass (NormalizedClassType& heres, TypeId there);
408413 void intersectStrings (NormalizedStringType& here, const NormalizedStringType& there);
409414 std::optional<TypePackId> intersectionOfTypePacks (TypePackId here, TypePackId there);
410- std::optional<TypeId> intersectionOfTables (TypeId here, TypeId there, Set<TypeId>& seenSet);
411- void intersectTablesWithTable (TypeIds& heres, TypeId there, Set<TypeId>& seenSetTypes);
415+ std::optional<TypeId> intersectionOfTables (TypeId here, TypeId there, SeenTablePropPairs& seenTablePropPairs, Set<TypeId>& seenSet);
416+ void intersectTablesWithTable (TypeIds& heres, TypeId there, SeenTablePropPairs& seenTablePropPairs, Set<TypeId>& seenSetTypes);
412417 void intersectTables (TypeIds& heres, const TypeIds& theres);
413418 std::optional<TypeId> intersectionOfFunctions (TypeId here, TypeId there);
414419 void intersectFunctionsWithFunction (NormalizedFunctionType& heress, TypeId there);
415420 void intersectFunctions (NormalizedFunctionType& heress, const NormalizedFunctionType& theress);
416- NormalizationResult intersectTyvarsWithTy (NormalizedTyvars& here, TypeId there, Set<TypeId>& seenSetTypes);
421+ NormalizationResult intersectTyvarsWithTy (
422+ NormalizedTyvars& here,
423+ TypeId there,
424+ SeenTablePropPairs& seenTablePropPairs,
425+ Set<TypeId>& seenSetTypes
426+ );
417427 NormalizationResult intersectNormals (NormalizedType& here, const NormalizedType& there, int ignoreSmallerTyvars = -1 );
418- NormalizationResult intersectNormalWithTy (NormalizedType& here, TypeId there, Set<TypeId>& seenSetTypes);
419- NormalizationResult normalizeIntersections (const std::vector<TypeId>& intersections, NormalizedType& outType, Set<TypeId>& seenSet);
428+ NormalizationResult intersectNormalWithTy (NormalizedType& here, TypeId there, SeenTablePropPairs& seenTablePropPairs, Set<TypeId>& seenSetTypes);
429+ NormalizationResult normalizeIntersections (
430+ const std::vector<TypeId>& intersections,
431+ NormalizedType& outType,
432+ SeenTablePropPairs& seenTablePropPairs,
433+ Set<TypeId>& seenSet
434+ );
420435
421436 // Check for inhabitance
422437 NormalizationResult isInhabited (TypeId ty);
@@ -426,7 +441,7 @@ class Normalizer
426441
427442 // Check for intersections being inhabited
428443 NormalizationResult isIntersectionInhabited (TypeId left, TypeId right);
429- NormalizationResult isIntersectionInhabited (TypeId left, TypeId right, Set<TypeId>& seenSet);
444+ NormalizationResult isIntersectionInhabited (TypeId left, TypeId right, SeenTablePropPairs& seenTablePropPairs, Set<TypeId>& seenSet);
430445
431446 // -------- Convert back from a normalized type to a type
432447 TypeId typeFromNormal (const NormalizedType& norm);
0 commit comments