Skip to content

Commit bbea62e

Browse files
committed
Reenable and fix -Ycheck of FirstTransform group
It was accidentally disabled because elimJavaPackages was renamed. This required a change to `isWildcardStarArg` to handle retyping repeated arguments that have been lifted in Typer, for example: foo(1, 2, 3) might be lifted to: val args: Int* = [1, 2, 3] foo(args)
1 parent 72b247b commit bbea62e

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

compiler/src/dotty/tools/dotc/ast/TreeInfo.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,14 +170,15 @@ trait TreeInfo[T >: Untyped <: Type] { self: Trees.Instance[T] =>
170170
case _ => false
171171
}
172172

173-
/** Is this argument node of the form <expr> : _* ?
173+
/** Is this argument node of the form <expr> : _*, or is it a reference to
174+
* such an argument ? The latter case can happen when an argument is lifted.
174175
*/
175176
def isWildcardStarArg(tree: Tree)(implicit ctx: Context): Boolean = unbind(tree) match {
176177
case Typed(Ident(nme.WILDCARD_STAR), _) => true
177178
case Typed(_, Ident(tpnme.WILDCARD_STAR)) => true
178-
case Typed(_, tpt: TypeTree) => tpt.hasType && tpt.tpe.isRepeatedParam
179+
case Typed(_, tpt: TypeTree) => tpt.typeOpt.isRepeatedParam
179180
case NamedArg(_, arg) => isWildcardStarArg(arg)
180-
case _ => false
181+
case arg => arg.typeOpt.widen.isRepeatedParam
181182
}
182183

183184
/** If this tree has type parameters, those. Otherwise Nil.

compiler/test/dotty/tools/vulpix/TestConfiguration.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ object TestConfiguration {
4545
}
4646

4747
// Ideally should be Ycheck:all
48-
val yCheckOptions = Array("-Ycheck:elimJavaPackages,refchecks,splitter,arrayConstructors,erasure,capturedVars,getClass,elimStaticThis,labelDef")
48+
val yCheckOptions = Array("-Ycheck:firstTransform,refchecks,splitter,arrayConstructors,erasure,capturedVars,getClass,elimStaticThis,labelDef")
4949

5050
val basicDefaultOptions = checkOptions ++ noCheckOptions ++ yCheckOptions
5151
val defaultUnoptimised = TestFlags(classPath, runClassPath, basicDefaultOptions)

0 commit comments

Comments
 (0)