Skip to content

Commit

Permalink
Merge pull request #8900 from som-snytt/review/8558
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed Apr 21, 2020
2 parents 62aac17 + 2c61430 commit 51233da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/compiler/scala/tools/nsc/typechecker/Typers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4694,7 +4694,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper

def shadowsSetter =
lhs1 match {
case treeInfo.Applied(Select(qual, _), _, _) =>
case treeInfo.Applied(Select(qual, _), _, _) if qual.isTyped =>
qual.tpe.member(varsym.name.setterName).exists
case _ => false
}
Expand Down Expand Up @@ -4726,10 +4726,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
}
wrapErrors(t, _.typed1(t, mode, pt))
}
else if (shadowsSetter) {
val res = setterRewrite
if (!res.isEmpty) res else fail()
}
else if (shadowsSetter) setterRewrite orElse fail()
else fail()
}

Expand Down
4 changes: 4 additions & 0 deletions test/files/neg/t3194.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
t3194.scala:3: error: value z is not a member of object Nil
def zero(): Unit = Nil.z = 0
^
1 error
4 changes: 4 additions & 0 deletions test/files/neg/t3194.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

trait T {
def zero(): Unit = Nil.z = 0
}

0 comments on commit 51233da

Please sign in to comment.