Skip to content

Commit a90f930

Browse files
Merge pull request #6418 from dotty-staging/fix-#5039
Fix #5039: Handle null:_* as varargs parameter
2 parents 6cddb42 + 11120a7 commit a90f930

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,8 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
556556
args match {
557557
case arg :: Nil if isVarArg(arg) =>
558558
addTyped(arg, formal)
559+
case Typed(Literal(Constant(null)), _) :: Nil =>
560+
addTyped(args.head, formal)
559561
case _ =>
560562
val elemFormal = formal.widenExpr.argTypesLo.head
561563
val typedArgs =

tests/pos/i5039.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class I0 {
2+
List(null:_*)
3+
List[Null](null:_*)
4+
List[Nothing](null:_*)
5+
List(1, 2, null:_*)
6+
List(null, null:_*)
7+
List(???, null:_*)
8+
}

0 commit comments

Comments
 (0)