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.
2 parents 9b3fea1 + e895fb0 commit 2229f59Copy full SHA for 2229f59
compiler/src/dotty/tools/dotc/core/TypeApplications.scala
@@ -385,7 +385,7 @@ class TypeApplications(val self: Type) extends AnyVal {
385
if (self.derivesFrom(from)) {
386
def elemType(tp: Type): Type = tp.widenDealias match
387
case tp: AndOrType => tp.derivedAndOrType(elemType(tp.tp1), elemType(tp.tp2))
388
- case _ => tp.baseType(from).argInfos.head
+ case _ => tp.baseType(from).argInfos.headOption.getOrElse(defn.NothingType)
389
val arg = elemType(self)
390
val arg1 = if (wildcardArg) TypeBounds.upper(arg) else arg
391
to.typeRef.appliedTo(arg1)
tests/neg/i9298.scala
@@ -0,0 +1,5 @@
1
+object Foo {
2
+ val foo = Nil
3
+ object foo // error
4
+ foo(foo: _*) // error
5
+}
0 commit comments