Skip to content

Commit

Permalink
Merge pull request scala#6243 from som-snytt/issue/8343
Browse files Browse the repository at this point in the history
Allow Nothing sequence argument
  • Loading branch information
lrytz authored Jan 5, 2018
2 parents ba293a4 + 38813bf commit 722530b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/compiler/scala/tools/nsc/typechecker/PatternTypers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ trait PatternTypers {
val Typed(expr, tpt) = tree
val exprTyped = typed(expr, mode)
val baseClass = exprTyped.tpe.typeSymbol match {
case ArrayClass => ArrayClass
case _ => SeqClass
case ArrayClass => ArrayClass
case NothingClass => NothingClass
case _ => SeqClass
}
val starType = baseClass match {
case ArrayClass if isPrimitiveValueType(pt) || !isFullyDefined(pt) => arrayType(pt)
Expand All @@ -143,8 +144,9 @@ trait PatternTypers {
}
val exprAdapted = adapt(exprTyped, mode, starType)
exprAdapted.tpe baseType baseClass match {
case TypeRef(_, _, elemtp :: Nil) => treeCopy.Typed(tree, exprAdapted, tpt setType elemtp) setType elemtp
case _ => setError(tree)
case TypeRef(_, _, elemtp :: Nil) => treeCopy.Typed(tree, exprAdapted, tpt setType elemtp) setType elemtp
case _ if baseClass eq NothingClass => exprAdapted
case _ => setError(tree)
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/files/pos/t8343.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

trait T {
def f = List[Int](??? : _*)
}

0 comments on commit 722530b

Please sign in to comment.