Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions compiler/src/dotty/tools/dotc/transform/PatternMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,10 @@ object PatternMatcher {
val scrutinee = plan.scrutinee
(plan.test: @unchecked) match {
case NonEmptyTest =>
scrutinee
.select(nme.isEmpty, _.info.isParameterless)
.select(nme.UNARY_!, _.info.isParameterless)
constToLiteral(
scrutinee
.select(nme.isEmpty, _.info.isParameterless)
.select(nme.UNARY_!, _.info.isParameterless))
case NonNullTest =>
scrutinee.testNotNull
case GuardTest =>
Expand Down
14 changes: 14 additions & 0 deletions tests/pos/i11605.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package example

class Extractor[A](val get: A) extends AnyVal {
// https://github.com/scala/scala/pull/9343
def isEmpty: false = false
}

object Foo {
def unapply(x: String): Extractor[String] = new Extractor(x)
}

object Main {
val Foo(a) = "a"
}