Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion compiler/src/dotty/tools/dotc/typer/Applications.scala
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,9 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
def typedUnApply(tree: untpd.Apply, selType: Type)(implicit ctx: Context): Tree = track("typedUnApply") {
val Apply(qual, args) = tree

def notAnExtractor(tree: Tree) = errorTree(tree, NotAnExtractor(qual))
def notAnExtractor(tree: Tree) =
if (!tree.tpe.isError && tree.tpe.isErroneous) tree
else errorTree(tree, NotAnExtractor(qual))

/** If this is a term ref tree, try to typecheck with its type name.
* If this refers to a type alias, follow the alias, and if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,8 @@ class ErrorMessagesTests extends ErrorMessagesTest {
@Test def notAnExtractor() =
checkMessagesAfter(FrontEnd.name) {
"""
| class Foo
| trait Foo
| object Foo
| object Test {
| def test(foo: Foo) = foo match {
| case Foo(name) => ???
Expand Down
9 changes: 9 additions & 0 deletions tests/neg/i2950.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class T1 {
case class Foo(x: Int, xs1: List[String], xs2: List[String])
}

object T2 {
val foo: T1#Foo = ???

val Foo(x1, xs1, xs2) = foo // error
}
2 changes: 1 addition & 1 deletion tests/neg/parser-stability-10.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ def unapply(i1: Int)(i6: List[Int]): Int = {
} // error
object i5 {
import collection.mutable._
try { ??? mutable { case i1(i5, i3, i4) => i5 }} // error // error // error
try { ??? mutable { case i1(i5, i3, i4) => i5 }} // error // error
}
// error