Skip to content

Commit

Permalink
LambdaType.derivedLambdaType return a LambdaType.This (#18428)
Browse files Browse the repository at this point in the history
This makes it possible to know for example that if we have a
`MethodType` and we use `derivedLambdaType` we get another `MethodType`.

Part of #18305
  • Loading branch information
nicolasstucki authored Aug 21, 2023
2 parents ea1d8f9 + aa2c851 commit 41d45a7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/dotc/core/Types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3680,7 +3680,7 @@ object Types {
trait LambdaType extends BindingType with TermType { self =>
type ThisName <: Name
type PInfo <: Type
type This <: LambdaType{type PInfo = self.PInfo}
type This >: this.type <: LambdaType{type PInfo = self.PInfo}
type ParamRefType <: ParamRef

def paramNames: List[ThisName]
Expand Down Expand Up @@ -3738,7 +3738,7 @@ object Types {

final def derivedLambdaType(paramNames: List[ThisName] = this.paramNames,
paramInfos: List[PInfo] = this.paramInfos,
resType: Type = this.resType)(using Context): LambdaType =
resType: Type = this.resType)(using Context): This =
if ((paramNames eq this.paramNames) && (paramInfos eq this.paramInfos) && (resType eq this.resType)) this
else newLikeThis(paramNames, paramInfos, resType)

Expand Down Expand Up @@ -3857,7 +3857,7 @@ object Types {
import DepStatus._
type ThisName = TermName
type PInfo = Type
type This <: TermLambda
type This >: this.type <: TermLambda
type ParamRefType = TermParamRef

override def resultType(using Context): Type =
Expand Down Expand Up @@ -4154,7 +4154,7 @@ object Types {
trait TypeLambda extends LambdaType {
type ThisName = TypeName
type PInfo = TypeBounds
type This <: TypeLambda
type This >: this.type <: TypeLambda
type ParamRefType = TypeParamRef

def isResultDependent(using Context): Boolean = true
Expand Down

0 comments on commit 41d45a7

Please sign in to comment.