@@ -23,8 +23,6 @@ using ModulePtr = std::shared_ptr<Module>;
23
23
24
24
bool isSubtype (TypeId subTy, TypeId superTy, NotNull<Scope> scope, NotNull<BuiltinTypes> builtinTypes, InternalErrorReporter& ice);
25
25
bool 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);
28
26
29
27
class TypeIds
30
28
{
@@ -336,6 +334,7 @@ struct NormalizedType
336
334
};
337
335
338
336
337
+ using SeenTablePropPairs = Set<std::pair<TypeId, TypeId>, TypeIdPairHash>;
339
338
340
339
class Normalizer
341
340
{
@@ -390,7 +389,13 @@ class Normalizer
390
389
void unionTablesWithTable (TypeIds& heres, TypeId there);
391
390
void unionTables (TypeIds& heres, const TypeIds& theres);
392
391
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
+ );
394
399
395
400
// ------- Negations
396
401
std::optional<NormalizedType> negateNormal (const NormalizedType& here);
@@ -407,16 +412,26 @@ class Normalizer
407
412
void intersectClassesWithClass (NormalizedClassType& heres, TypeId there);
408
413
void intersectStrings (NormalizedStringType& here, const NormalizedStringType& there);
409
414
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);
412
417
void intersectTables (TypeIds& heres, const TypeIds& theres);
413
418
std::optional<TypeId> intersectionOfFunctions (TypeId here, TypeId there);
414
419
void intersectFunctionsWithFunction (NormalizedFunctionType& heress, TypeId there);
415
420
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
+ );
417
427
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
+ );
420
435
421
436
// Check for inhabitance
422
437
NormalizationResult isInhabited (TypeId ty);
@@ -426,7 +441,7 @@ class Normalizer
426
441
427
442
// Check for intersections being inhabited
428
443
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);
430
445
431
446
// -------- Convert back from a normalized type to a type
432
447
TypeId typeFromNormal (const NormalizedType& norm);
0 commit comments