Commit 69f5f73
committed
Fix ctx implicits under case unapplySeq
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.1 parent 3408ed7 commit 69f5f73
File 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 | |
|---|---|---|---|
| |||
2198 | 2198 | | |
2199 | 2199 | | |
2200 | 2200 | | |
2201 | | - | |
| 2201 | + | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | 2204 | | |
| |||
2228 | 2228 | | |
2229 | 2229 | | |
2230 | 2230 | | |
2231 | | - | |
| 2231 | + | |
2232 | 2232 | | |
2233 | 2233 | | |
2234 | 2234 | | |
| |||
| 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