File tree 2 files changed +18
-2
lines changed
src/dotty/tools/dotc/core 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -133,7 +133,13 @@ object TypeApplications {
133
133
134
134
def unapply (tp : Type )(implicit ctx : Context ): Option [(Type , List [Type ])] = tp match {
135
135
case TypeRef (prefix, tpnme.hkApply) => unapp(prefix)
136
- case _ => unapp(tp)
136
+ case _ =>
137
+ unapp(tp) match {
138
+ case Some ((tycon : TypeRef , _)) if tycon.symbol.isLambdaTrait =>
139
+ // We are seeing part of a lambda abstraction, not an applied type
140
+ None
141
+ case x => x
142
+ }
137
143
}
138
144
139
145
private def unapp (tp : Type )(implicit ctx : Context ): Option [(Type , List [Type ])] = tp match {
Original file line number Diff line number Diff line change @@ -1899,7 +1899,17 @@ object Types {
1899
1899
1900
1900
override def underlying (implicit ctx : Context ) = parent
1901
1901
1902
- private def checkInst (implicit ctx : Context ): this .type = this
1902
+ private def badInst =
1903
+ throw new AssertionError (s " bad instantiation: $this" )
1904
+
1905
+ def checkInst (implicit ctx : Context ): this .type = {
1906
+ if (refinedName == tpnme.hkApply)
1907
+ parent.stripTypeVar match {
1908
+ case RefinedType (_, name) if name.isHkArgName => // ok
1909
+ case _ => badInst
1910
+ }
1911
+ this
1912
+ }
1903
1913
1904
1914
def derivedRefinedType (parent : Type , refinedName : Name , refinedInfo : Type )(implicit ctx : Context ): RefinedType =
1905
1915
if ((parent eq this .parent) && (refinedName eq this .refinedName) && (refinedInfo eq this .refinedInfo)) this
You can’t perform that action at this time.
0 commit comments