Skip to content

Commit 40e6397

Browse files
committed
Resolve SeqType based on alias defined in scala package object
- in 2.12: scala.collection.Seq - in 2.13: scala.collection.immutable.Seq Revert when we drop support for 2.12?
1 parent fe6ab99 commit 40e6397

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,14 @@ class Definitions {
401401
List(AnyClass.typeRef), EmptyScope)
402402
lazy val SingletonType: TypeRef = SingletonClass.typeRef
403403

404-
lazy val SeqType: TypeRef = ctx.requiredClassRef("scala.collection.Seq")
404+
lazy val SeqType: TypeRef = {
405+
// We load SeqType from the alias in scala package object
406+
// - in 2.12: scala.collection.Seq
407+
// - in 2.13: scala.collection.immutable.Seq
408+
val alias = ctx.base.staticRef("scala.Seq".toTypeName).requiredSymbol(_.isAliasType)
409+
alias.info.classSymbol.typeRef
410+
}
411+
405412
def SeqClass(implicit ctx: Context) = SeqType.symbol.asClass
406413
lazy val Seq_applyR = SeqClass.requiredMethodRef(nme.apply)
407414
def Seq_apply(implicit ctx: Context) = Seq_applyR.symbol

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ object Implicits {
7171
/** The implicit references */
7272
def refs: List[ImplicitRef]
7373

74-
private var SingletonClass: ClassSymbol = null
74+
private[this] var SingletonClass: ClassSymbol = null
7575

7676
/** Widen type so that it is neither a singleton type nor a type that inherits from scala.Singleton. */
7777
private def widenSingleton(tp: Type)(implicit ctx: Context): Type = {

0 commit comments

Comments
 (0)