Skip to content

Commit 41d45a7

Browse files
LambdaType.derivedLambdaType return a LambdaType.This (#18428)
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
2 parents ea1d8f9 + aa2c851 commit 41d45a7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: compiler/src/dotty/tools/dotc/core/Types.scala

+4-4
Original file line numberDiff line numberDiff line change
@@ -3680,7 +3680,7 @@ object Types {
36803680
trait LambdaType extends BindingType with TermType { self =>
36813681
type ThisName <: Name
36823682
type PInfo <: Type
3683-
type This <: LambdaType{type PInfo = self.PInfo}
3683+
type This >: this.type <: LambdaType{type PInfo = self.PInfo}
36843684
type ParamRefType <: ParamRef
36853685

36863686
def paramNames: List[ThisName]
@@ -3738,7 +3738,7 @@ object Types {
37383738

37393739
final def derivedLambdaType(paramNames: List[ThisName] = this.paramNames,
37403740
paramInfos: List[PInfo] = this.paramInfos,
3741-
resType: Type = this.resType)(using Context): LambdaType =
3741+
resType: Type = this.resType)(using Context): This =
37423742
if ((paramNames eq this.paramNames) && (paramInfos eq this.paramInfos) && (resType eq this.resType)) this
37433743
else newLikeThis(paramNames, paramInfos, resType)
37443744

@@ -3857,7 +3857,7 @@ object Types {
38573857
import DepStatus._
38583858
type ThisName = TermName
38593859
type PInfo = Type
3860-
type This <: TermLambda
3860+
type This >: this.type <: TermLambda
38613861
type ParamRefType = TermParamRef
38623862

38633863
override def resultType(using Context): Type =
@@ -4154,7 +4154,7 @@ object Types {
41544154
trait TypeLambda extends LambdaType {
41554155
type ThisName = TypeName
41564156
type PInfo = TypeBounds
4157-
type This <: TypeLambda
4157+
type This >: this.type <: TypeLambda
41584158
type ParamRefType = TypeParamRef
41594159

41604160
def isResultDependent(using Context): Boolean = true

0 commit comments

Comments
 (0)