Skip to content

Commit 7888e43

Browse files
author
Florent Ferrari
committed
fixed todos
1 parent a0c9c87 commit 7888e43

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

hkmc2/shared/src/main/scala/hkmc2/semantics/ucs/Normalization.scala

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ class Normalization(elaborator: Elaborator)(using raise: Raise, ctx: Ctx):
5454
fieldName1 == fieldName2 && p1 =:= p2
5555
}
5656
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
6058
case (_:Pattern.ClassLike, _) | (_:Pattern.Lit, _) |
6159
(_:Pattern.Tuple, _) | (_:Pattern.Synonym, _) | (_:Pattern.Record, _) => false
6260
/** Checks if `lhs` can be subsumed under `rhs`. */
@@ -292,8 +290,7 @@ object Normalization:
292290
case (Lit(Tree.StrLit(_)), ClassLike(blt.`Str`, _, _, _)) => true
293291
case (Lit(Tree.DecLit(_)), ClassLike(blt.`Num`, _, _, _)) => true
294292
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
297294
case (Record(entries1), Record(entries2)) =>
298295
entries1.forall { (fieldName1, _) => entries2.exists { (fieldName2, _) => fieldName1 === fieldName2 } }
299296
case (Record(entries), ClassLike(cs: ClassSymbol, _, _, _)) =>
@@ -303,7 +300,7 @@ object Normalization:
303300
entries.forall { (fieldName, _) => clsParams.exists {
304301
case Param(flags = FldFlags(value = value), sym = sym) => value && fieldName === sym.id
305302
}}
306-
case (_:ClassLike, _) | (_:Tuple, _) | (_:Lit, _) | (_:Record, _) => false
303+
case (_: (ClassLike | Tuple | Lit | Record | Synonym), _) => false
307304

308305
final case class VarSet(declared: Set[BlockLocalSymbol]):
309306
def +(nme: BlockLocalSymbol): VarSet = copy(declared + nme)

0 commit comments

Comments
 (0)