You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use given pattern names when compiling patterns (#841)
~~Addresses one part of #793:~~
Resolves#793 completely.
> I also think we could sometimes use the original pattern names, but
I'm not 100% certain of that, would need to investigate.
I'm doing this since it helps me to debug problems just a little bit
more easily :)
Note that this does not actually use the names of the fields as
declared.
---
```scala
def isShorterThan(x: List[Int], y: List[Int]): Bool =
(x, y) match {
case (_head, Nil()) => false
case (Nil(), _tail) => true
case (Cons(_x, xs),Cons(_y, ys)) => isShorterThan(xs, ys)
}
```
Here's a comparison before (red) vs after (green).
Just to drive my point home further, I removed the numbers after the
identifier :)
<img width="478" alt="Screenshot 2025-02-21 at 22 37 44"
src="https://github.com/user-attachments/assets/9c3db8a9-1c1d-4994-999e-7508be530af0"
/>
valfieldVars= fieldVarsFor(constructor, patternsAndTypes.map { case (pat, tpe) => tpe })
195
+
// NOTE: Ideally, we would use a `DeclarationContext` here, but we cannot: we're currently in the Source->Core transformer, so we do not have all of the details yet.
0 commit comments