Skip to content

Add regression test #3598 #3610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 15 commits into from
1 change: 1 addition & 0 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class ScalaSettings extends Settings.SettingGroup {
val YplainPrinter = BooleanSetting("-Yplain-printer", "Pretty-print using a plain printer.")
val YprintSyms = BooleanSetting("-Yprint-syms", "when printing trees print info in symbols instead of corresponding info in trees.")
val YprintDebug = BooleanSetting("-Yprint-debug", "when printing trees, print some extra information useful for debugging.")
val YshowPrintErrors = BooleanSetting("-Yshow-print-errors", "don't suppress exceptions thrown during tree printing.")
val YtestPickler = BooleanSetting("-Ytest-pickler", "self-test for pickling functionality; should be used with -Ystop-after:pickler")
val YcheckReentrant = BooleanSetting("-Ycheck-reentrant", "check that compiled program does not contain vars that can be accessed from a global root.")
val YkeepComments = BooleanSetting("-Ykeep-comments", "Keep comments when scanning source files.")
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/core/Definitions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Definitions {
enterTypeField(cls, name, flags | ClassTypeParamCreationFlags, scope)

private def enterSyntheticTypeParam(cls: ClassSymbol, paramFlags: FlagSet, scope: MutableScope, suffix: String = "T0") =
enterTypeParam(cls, suffix.toTypeName.expandedName(cls), paramFlags, scope)
enterTypeParam(cls, suffix.toTypeName, paramFlags, scope)

// NOTE: Ideally we would write `parentConstrs: => Type*` but SIP-24 is only
// implemented in Dotty and not in Scala 2.
Expand Down
3 changes: 1 addition & 2 deletions compiler/src/dotty/tools/dotc/core/NameKinds.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Names._
import NameOps._
import StdNames._
import util.DotClass
import tasty.TastyFormat._
import NameTags._
import Decorators._
import Contexts.Context
import collection.mutable
Expand Down Expand Up @@ -358,7 +358,6 @@ object NameKinds {
override def mkString(underlying: TermName, info: ThisInfo) = underlying.toString
}
val ExtMethName = new SuffixNameKind(EXTMETH, "$extension")
val ModuleVarName = new SuffixNameKind(OBJECTVAR, "$module")
val ModuleClassName = new SuffixNameKind(OBJECTCLASS, "$", optInfoString = "ModuleClass")
val ImplMethName = new SuffixNameKind(IMPLMETH, "$")
val AdaptedClosureName = new SuffixNameKind(ADAPTEDCLOSURE, "$adapted") { override def definesNewName = true }
Expand Down
58 changes: 58 additions & 0 deletions compiler/src/dotty/tools/dotc/core/NameTags.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package dotty.tools
package dotc
package core

import tasty.TastyFormat

/** The possible tags of a NameKind */
object NameTags extends TastyFormat.NameTags {

final val FLATTENED = 5 // A flat name, generated by Flatten

final val TRAITSETTER = 6 // A Scala-2 trait setter, generated by AugmentScala2Traits

final val INITIALIZER = 24 // A mixin initializer method

final val AVOIDCLASH = 25 // Adds a suffix to avoid a name clash;
// Used in FirstTransform for synthesized companion objects of classes
// if they would clash with another value.

final val DIRECT = 26 // Used by ShortCutImplicits for the name of methods that
// implement implicit function result types directly.

final val FIELD = 27 // Used by Memoize to tag the name of a class member field.

final val EXTMETH = 28 // Used by ExtensionMethods for the name of an extension method
// implementing a value class method.

final val ADAPTEDCLOSURE = 29 // Used in Erasure to adapt closures over primitive types.

final val IMPLMETH = 30 // Used to define methods in implementation classes
// (can probably be removed).

def nameTagToString(tag: Int): String = tag match {
case UTF8 => "UTF8"
case QUALIFIED => "QUALIFIED"
case FLATTENED => "FLATTENED"
case EXPANDED => "EXPANDED"
case EXPANDPREFIX => "EXPANDPREFIX"
case TRAITSETTER => "TRAITSETTER"
case UNIQUE => "UNIQUE"
case DEFAULTGETTER => "DEFAULTGETTER"
case VARIANT => "VARIANT"
case OUTERSELECT => "OUTERSELECT"

case SUPERACCESSOR => "SUPERACCESSOR"
case PROTECTEDACCESSOR => "PROTECTEDACCESSOR"
case PROTECTEDSETTER => "PROTECTEDSETTER"
case INITIALIZER => "INITIALIZER"
case AVOIDCLASH => "AVOIDCLASH"
case DIRECT => "DIRECT"
case FIELD => "FIELD"
case EXTMETH => "EXTMETH"
case ADAPTEDCLOSURE => "ADAPTEDCLOSURE"
case OBJECTCLASS => "OBJECTCLASS"

case SIGNED => "SIGNED"
}
}
12 changes: 1 addition & 11 deletions compiler/src/dotty/tools/dotc/core/TypeComparer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -527,14 +527,6 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
case _ => isSubType(tp1.widenExpr, restpe2)
}
compareExpr
case tp2: TypeArgRef =>
def sameTypeArgRef = tp1 match {
case tp1: TypeArgRef =>
tp1.clsRef == tp2.clsRef && tp1.idx == tp2.idx && tp1.prefix =:= tp2.prefix
case _ =>
false
}
sameTypeArgRef || isSubType(tp1, tp2.underlying.loBound) || fourthTry(tp1, tp2)
case tp2 @ TypeBounds(lo2, hi2) =>
def compareTypeBounds = tp1 match {
case tp1 @ TypeBounds(lo1, hi1) =>
Expand Down Expand Up @@ -605,8 +597,6 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {
isNewSubType(tp1.parent, tp2)
case tp1: RecType =>
isNewSubType(tp1.parent, tp2)
case tp1: TypeArgRef =>
isSubType(tp1.underlying.hiBound, tp2)
case tp1: HKTypeLambda =>
def compareHKLambda = tp1 match {
case EtaExpansion(tycon1) => isSubType(tycon1, tp2)
Expand Down Expand Up @@ -829,7 +819,7 @@ class TypeComparer(initctx: Context) extends DotClass with ConstraintHandling {

def compareCaptured(arg1: Type, arg2: Type): Boolean = arg1 match {
case arg1: TypeBounds =>
val captured = TypeArgRef.fromParam(tp1, tparam.asInstanceOf[TypeSymbol])
val captured = TypeRef(tp1, tparam.asInstanceOf[TypeSymbol])
isSubArg(captured, arg2)
case _ =>
false
Expand Down
Loading