@@ -54,9 +54,7 @@ class Normalization(elaborator: Elaborator)(using raise: Raise, ctx: Ctx):
54
54
fieldName1 == fieldName2 && p1 =:= p2
55
55
}
56
56
case (Pattern .Synonym (sym1, args1), Pattern .Synonym (sym2, args2)) =>
57
- // TODO : there is surely some other conditions
58
- // and we may want to accept equality beween a synonym and its input pattern
59
- sym1 === sym2
57
+ args1 == args2 && sym1.params == sym2.params && sym1.body == sym2.body
60
58
case (_:Pattern .ClassLike , _) | (_:Pattern .Lit , _) |
61
59
(_:Pattern .Tuple , _) | (_:Pattern .Synonym , _) | (_:Pattern .Record , _) => false
62
60
/** Checks if `lhs` can be subsumed under `rhs`. */
@@ -292,8 +290,7 @@ object Normalization:
292
290
case (Lit (Tree .StrLit (_)), ClassLike (blt.`Str`, _, _, _)) => true
293
291
case (Lit (Tree .DecLit (_)), ClassLike (blt.`Num`, _, _, _)) => true
294
292
case (Lit (Tree .BoolLit (_)), ClassLike (blt.`Bool`, _, _, _)) => true
295
- case (_ : Synonym , _) => false
296
- // TODO there is probably a sensible condition
293
+ case (_ : Synonym , _ : Synonym ) => lhs =:= rhs
297
294
case (Record (entries1), Record (entries2)) =>
298
295
entries1.forall { (fieldName1, _) => entries2.exists { (fieldName2, _) => fieldName1 === fieldName2 } }
299
296
case (Record (entries), ClassLike (cs : ClassSymbol , _, _, _)) =>
@@ -303,7 +300,7 @@ object Normalization:
303
300
entries.forall { (fieldName, _) => clsParams.exists {
304
301
case Param (flags = FldFlags (value = value), sym = sym) => value && fieldName === sym.id
305
302
}}
306
- case (_:ClassLike , _) | (_: Tuple , _) | (_: Lit , _) | (_: Record , _) => false
303
+ case (_ : ( ClassLike | Tuple | Lit | Record | Synonym ) , _) => false
307
304
308
305
final case class VarSet (declared : Set [BlockLocalSymbol ]):
309
306
def + (nme : BlockLocalSymbol ): VarSet = copy(declared + nme)
0 commit comments