diff options
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/RefChecks.scala | 7 | ||||
-rw-r--r-- | test/files/run/t9546.scala | 13 |
2 files changed, 16 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala index f2607b6bde..517271e5eb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala +++ b/src/compiler/scala/tools/nsc/typechecker/RefChecks.scala @@ -1571,7 +1571,9 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans // term should have been eliminated by super accessors assert(!(qual.symbol.isTrait && sym.isTerm && mix == tpnme.EMPTY), (qual.symbol, sym, mix)) - if (isSimpleCaseApply(tree)) { + // SI-9546 isHigherKinded excludes generic case classes which are instead considered when transforming + // the enclosing `TypeApply`. + if (!tree.tpe.isHigherKinded && isSimpleCaseApply(tree)) { transformCaseApply(tree) } else { qual match { @@ -1725,9 +1727,6 @@ abstract class RefChecks extends InfoTransform with scala.reflect.internal.trans case Ident(name) => checkUndesiredProperties(sym, tree.pos) - if (isSimpleCaseApply(tree)) { - abort("case factory methods are now always selected from prefix (since https://github.com/scala/scala/commit/76c06b4)") - } if (name != nme.WILDCARD && name != tpnme.WILDCARD_STAR) { assert(sym != NoSymbol, "transformCaseApply: name = " + name.debugString + " tree = " + tree + " / " + tree.getClass) //debug enterReference(tree.pos, sym) diff --git a/test/files/run/t9546.scala b/test/files/run/t9546.scala new file mode 100644 index 0000000000..7016881084 --- /dev/null +++ b/test/files/run/t9546.scala @@ -0,0 +1,13 @@ +package foo { + case class Opt[A] private[foo](val get: A) extends AnyVal + object Opt { + def mkOpt = Opt("") + } +} + +object Test { + def main(args: Array[String]): Unit = { + foo.Opt.mkOpt + } +} + |