Skip to content

Commit 2229f59

Browse files
authored
Merge pull request #9301 from dotty-staging/fix-#9298
Fix #9298: Be resilient to missing args
2 parents 9b3fea1 + e895fb0 commit 2229f59

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeApplications.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ class TypeApplications(val self: Type) extends AnyVal {
385385
if (self.derivesFrom(from)) {
386386
def elemType(tp: Type): Type = tp.widenDealias match
387387
case tp: AndOrType => tp.derivedAndOrType(elemType(tp.tp1), elemType(tp.tp2))
388-
case _ => tp.baseType(from).argInfos.head
388+
case _ => tp.baseType(from).argInfos.headOption.getOrElse(defn.NothingType)
389389
val arg = elemType(self)
390390
val arg1 = if (wildcardArg) TypeBounds.upper(arg) else arg
391391
to.typeRef.appliedTo(arg1)

tests/neg/i9298.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Foo {
2+
val foo = Nil
3+
object foo // error
4+
foo(foo: _*) // error
5+
}

0 commit comments

Comments
 (0)