Skip to content

Commit 8943ebb

Browse files
authored
Merge pull request #11620 from dotty-staging/fix-11614
Avoid crash when emitting error message
2 parents 5154f36 + 311717e commit 8943ebb

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3281,8 +3281,11 @@ class Typer extends Namer
32813281
def issueErrors(): Tree = {
32823282
def paramSymWithMethodTree(paramName: TermName) =
32833283
if tree.symbol.exists then
3284-
val paramSyms = tree.symbol.paramSymss.flatten.map(sym => sym.name -> sym).toMap
3285-
Some((paramSyms(paramName), tree))
3284+
tree.symbol.paramSymss.flatten
3285+
.map(sym => sym.name -> sym)
3286+
.toMap
3287+
.get(paramName)
3288+
.map((_, tree))
32863289
else
32873290
None
32883291

tests/neg/i11614.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class I
2+
val c: (i: I) ?=> i.type = x ?=> x
3+
val d: (i: I) ?=> i.type = c
4+
val i = c // error

0 commit comments

Comments
 (0)