File tree Expand file tree Collapse file tree 2 files changed +27
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -6073,7 +6073,7 @@ object Types extends TypeUtils {
6073
6073
protected def range (lo : Type , hi : Type ): Type =
6074
6074
if variance > 0 then hi
6075
6075
else if variance < 0 then
6076
- if (lo eq defn.NothingType ) && hi.hasSimpleKind then
6076
+ if (lo eq defn.NothingType ) then
6077
6077
// Approximate by Nothing & hi instead of just Nothing, in case the
6078
6078
// approximated type is used as the prefix of another type (this would
6079
6079
// lead to a type with a `NoDenotation` denot and a possible
@@ -6084,8 +6084,14 @@ object Types extends TypeUtils {
6084
6084
// example if Nothing is the type of a parameter being depended on in
6085
6085
// a MethodType)
6086
6086
//
6087
- // Test case in tests/pos/i23530.scala
6088
- AndType (lo, hi)
6087
+ // Test case in tests/pos/i23530.scala (and tests/pos/i23627.scala for
6088
+ // the higher-kinded case which requires eta-expansion)
6089
+ hi.etaExpand match
6090
+ case expandedHi : HKTypeLambda =>
6091
+ expandedHi.derivedLambdaType(resType = AndType (lo, expandedHi.resType))
6092
+ case _ =>
6093
+ // simple-kinded case
6094
+ AndType (lo, hi)
6089
6095
else
6090
6096
lo
6091
6097
else if lo `eq` hi then lo
Original file line number Diff line number Diff line change
1
+ trait TestContainer :
2
+ trait TestPath [T ]:
3
+ type AbsMember
4
+
5
+ extension (path : TestPath [? ])
6
+ infix def ext (color : path.AbsMember ): Unit = ???
7
+ infix def ext (other : Int ): Unit = ???
8
+
9
+ object Repro :
10
+ val dc2 : TestContainer = ???
11
+ import dc2 .TestPath
12
+
13
+ def transition (path : TestPath [? ])(using DummyImplicit ): TestPath [? ] = ???
14
+
15
+ def test : Unit =
16
+ val di : TestPath [? ] = ???
17
+ // error
18
+ val z1 = transition(di).ext(1 )
You can’t perform that action at this time.
0 commit comments