Skip to content

Commit

Permalink
Supress false-positive match exhastivity warning
Browse files Browse the repository at this point in the history
  • Loading branch information
WojciechMazur committed Jun 23, 2024
1 parent 99dd85d commit 8fa14e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1104,13 +1104,14 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
// transform the `Ident` into a `Select` to ensure that the prefix
// is retained with a `TypedSplice` (see `case Select` bellow).
// See tests/pos/i18713.scala for an example.
fn.tpe match
(fn.tpe match
case TermRef(qual: TermRef, _) =>
toSetter(ref(qual).select(fn.symbol).withSpan(fn.span))
case TermRef(qual: ThisType, _) =>
toSetter(This(qual.cls).select(fn.symbol).withSpan(fn.span))
case TermRef(NoPrefix, _) =>
untpd.cpy.Ident(fn)(name.setterName)
): @annotation.nowarn // false-positive match exhastivity warning
case fn @ Select(qual, name: TermName) =>
untpd.cpy.Select(fn)(untpd.TypedSplice(qual), name.setterName)
case fn @ TypeApply(fn1, targs) =>
Expand Down

0 comments on commit 8fa14e5

Please sign in to comment.