Skip to content

Rename isDependent #4039

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

Merged
merged 1 commit into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ object Types {
val funType = defn.FunctionOf(
formals1 mapConserve (_.underlyingIfRepeated(mt.isJavaMethod)),
mt.nonDependentResultApprox, isImplicit, isUnused)
if (mt.isDependent) RefinedType(funType, nme.apply, mt)
if (mt.isResultDependent) RefinedType(funType, nme.apply, mt)
else funType
}

Expand Down Expand Up @@ -2668,7 +2668,7 @@ object Types {

override def resultType(implicit ctx: Context) = resType

def isDependent(implicit ctx: Context): Boolean
def isResultDependent(implicit ctx: Context): Boolean
def isParamDependent(implicit ctx: Context): Boolean

final def isTermLambda = isInstanceOf[TermLambda]
Expand All @@ -2683,7 +2683,7 @@ object Types {
}

final def instantiate(argTypes: => List[Type])(implicit ctx: Context): Type =
if (isDependent) resultType.substParams(this, argTypes)
if (isResultDependent) resultType.substParams(this, argTypes)
else resultType

def companion: LambdaTypeCompanion[ThisName, PInfo, This]
Expand Down Expand Up @@ -2845,7 +2845,7 @@ object Types {
/** Does result type contain references to parameters of this method type,
* which cannot be eliminated by de-aliasing?
*/
def isDependent(implicit ctx: Context): Boolean = dependencyStatus == TrueDeps
def isResultDependent(implicit ctx: Context): Boolean = dependencyStatus == TrueDeps

/** Does one of the parameter types contain references to earlier parameters
* of this method type which cannot be eliminated by de-aliasing?
Expand All @@ -2856,7 +2856,7 @@ object Types {

/** The least supertype of `resultType` that does not contain parameter dependencies */
def nonDependentResultApprox(implicit ctx: Context): Type =
if (isDependent) {
if (isResultDependent) {
val dropDependencies = new ApproximatingTypeMap {
def apply(tp: Type) = tp match {
case tp @ TermParamRef(thisLambdaType, _) =>
Expand Down Expand Up @@ -3007,7 +3007,7 @@ object Types {
type This <: TypeLambda
type ParamRefType = TypeParamRef

def isDependent(implicit ctx: Context): Boolean = true
def isResultDependent(implicit ctx: Context): Boolean = true
def isParamDependent(implicit ctx: Context): Boolean = true

def newParamRef(n: Int) = new TypeParamRef(this, n) {}
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ object ProtoTypes {
* replaced by either wildcards (if typevarsMissContext) or TypeParamRefs.
*/
def resultTypeApprox(mt: MethodType)(implicit ctx: Context): Type =
if (mt.isDependent) {
if (mt.isResultDependent) {
def replacement(tp: Type) =
if (ctx.mode.is(Mode.TypevarsMissContext)) WildcardType else newDepTypeVar(tp)
mt.resultType.substParams(mt, mt.paramInfos.map(replacement))
Expand Down Expand Up @@ -464,7 +464,7 @@ object ProtoTypes {
normalize(constrained(poly).resultType, pt)
case mt: MethodType =>
if (mt.isImplicitMethod) normalize(resultTypeApprox(mt), pt)
else if (mt.isDependent) tp
else if (mt.isResultDependent) tp
else {
val rt = normalize(mt.resultType, pt)
pt match {
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/TypeAssigner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ trait TypeAssigner {
val ownType = fn.tpe.widen match {
case fntpe: MethodType =>
if (sameLength(fntpe.paramInfos, args) || ctx.phase.prev.relaxedTyping)
if (fntpe.isDependent) safeSubstParams(fntpe.resultType, fntpe.paramRefs, args.tpes)
if (fntpe.isResultDependent) safeSubstParams(fntpe.resultType, fntpe.paramRefs, args.tpes)
else fntpe.resultType
else
errorType(i"wrong number of arguments at ${ctx.phase.prev} for $fntpe: ${fn.tpe}, expected: ${fntpe.paramInfos.length}, found: ${args.length}", tree.pos)
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ class Typer extends Namer
case SAMType(meth) =>
val mt @ MethodTpe(_, formals, restpe) = meth.info
(formals,
if (mt.isDependent)
if (mt.isResultDependent)
untpd.DependentTypeTree(syms => restpe.substParams(mt, syms.map(_.termRef)))
else
typeTree(restpe))
Expand Down