refactor: change typo in Unweakenable

This commit is contained in:
Gleb Koval 2025-02-07 18:43:30 +00:00
parent 9da2744cb9
commit 84932edb69
Signed by: cyclane
GPG Key ID: 15E168A8B332382C

View File

@ -28,7 +28,7 @@ object typeChecker {
// Allows weakening in both directions, useful for array literals // Allows weakening in both directions, useful for array literals
case IsSymmetricCompatible(ty: SemType, msg: String) case IsSymmetricCompatible(ty: SemType, msg: String)
// Does not allow weakening // Does not allow weakening
case IsUnweakanable(ty: SemType, msg: String) case IsUnweakenable(ty: SemType, msg: String)
case IsEither(ty1: SemType, ty2: SemType, msg: String) case IsEither(ty1: SemType, ty2: SemType, msg: String)
case Never(msg: String) case Never(msg: String)
} }
@ -57,8 +57,8 @@ object typeChecker {
KnownType.String KnownType.String
case (ty, Constraint.IsSymmetricCompatible(ty2, msg)) => case (ty, Constraint.IsSymmetricCompatible(ty2, msg)) =>
ty.satisfies(Constraint.Is(ty2, msg), pos) ty.satisfies(Constraint.Is(ty2, msg), pos)
// Change to IsUnweakanable to disallow recursive weakening // Change to IsUnweakenable to disallow recursive weakening
case (ty, Constraint.Is(ty2, msg)) => ty.satisfies(Constraint.IsUnweakanable(ty2, msg), pos) case (ty, Constraint.Is(ty2, msg)) => ty.satisfies(Constraint.IsUnweakenable(ty2, msg), pos)
case (ty, Constraint.Unconstrained) => ty case (ty, Constraint.Unconstrained) => ty
case (ty, Constraint.Never(msg)) => case (ty, Constraint.Never(msg)) =>
ctx.error(Error.SemanticError(pos, msg)) ctx.error(Error.SemanticError(pos, msg))
@ -66,7 +66,7 @@ object typeChecker {
(ty moreSpecific ty1).orElse(ty moreSpecific ty2).getOrElse { (ty moreSpecific ty1).orElse(ty moreSpecific ty2).getOrElse {
ctx.error(Error.TypeMismatch(pos, ty1, ty, msg)) ctx.error(Error.TypeMismatch(pos, ty1, ty, msg))
} }
case (ty, Constraint.IsUnweakanable(ty2, msg)) => case (ty, Constraint.IsUnweakenable(ty2, msg)) =>
(ty moreSpecific ty2).getOrElse { (ty moreSpecific ty2).getOrElse {
ctx.error(Error.TypeMismatch(pos, ty2, ty, msg)) ctx.error(Error.TypeMismatch(pos, ty2, ty, msg))
} }