We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b2476a4 commit 8d9e220Copy full SHA for 8d9e220
compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
@@ -271,8 +271,12 @@ trait TypeAssigner {
271
def assignType(tree: untpd.Select, qual: Tree)(implicit ctx: Context): Select = {
272
def qualType = qual.tpe.widen
273
def arrayElemType = {
274
- val JavaArrayType(elemtp) = qualType
275
- elemtp
+ qualType match {
+ case JavaArrayType(elemtp) => elemtp
276
+ case _ =>
277
+ ctx.error("Array type conflict with " + qual.symbol.name, tree.pos)
278
+ defn.NothingType
279
+ }
280
}
281
val p = nme.primitive
282
val tp = tree.name match {
tests/neg/i4247.scala
@@ -0,0 +1,3 @@
1
+class Foo[U] { self : Array[U] & Nothing =>
2
+ val s = self(0) // error: Array type conflict with Foo
3
+}
0 commit comments