Commit dd37f07
authored
Fix ctx implicits under case unapplySeq (scala#21748)
A case class with a varargs has a unapplySeq extractor instead of
unapply. When we type an unapply, in typedUnapply, we first look for
unapply methods before unapplySeq methods. But when searching for
unapply, if a class method isn't found, then an extension method is
looked for, which causes context implicits to be cached. The bindings
from a pattern (such as from an unapply or unapplySeq extractor) are
added to the context in indexPattern. But Context's `implicitCache`
doesn't account for the scope changing.
I opted for giving the body its own scope context, rather than making
indexPattern reset the context implicits cache.
Fixes scala#21742File tree
3 files changed
+12
-2
lines changed- compiler/src/dotty/tools/dotc/typer
- tests/pos
3 files changed
+12
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2201 | 2201 | | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | | - | |
| 2204 | + | |
2205 | 2205 | | |
2206 | 2206 | | |
2207 | 2207 | | |
| |||
2231 | 2231 | | |
2232 | 2232 | | |
2233 | 2233 | | |
2234 | | - | |
| 2234 | + | |
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments