Skip to content

AppliedTypes returned by baseType shouldn't have type lambdas as constructors #17071

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
Mar 16, 2023
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
5 changes: 2 additions & 3 deletions compiler/src/dotty/tools/dotc/core/SymDenotations.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2226,13 +2226,12 @@ object SymDenotations {
def computeApplied = {
btrCache(tp) = NoPrefix
val baseTp =
if (tycon.typeSymbol eq symbol) tp
else (tycon.typeParams: @unchecked) match {
if (tycon.typeSymbol eq symbol) && !tycon.isLambdaSub then tp
else (tycon.typeParams: @unchecked) match
case LambdaParam(_, _) :: _ =>
recur(tp.superType)
case tparams: List[Symbol @unchecked] =>
recur(tycon).substApprox(tparams, args)
}
record(tp, baseTp)
baseTp
}
Expand Down
9 changes: 9 additions & 0 deletions tests/pos/argDenot-alpakka.min.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import scala.annotation.unchecked.uncheckedVariance as uV

trait Test:
def test[S] =
val a: (([O] =>> Foo[O, S]) @uV)[Int] = ???
a.m()

class Foo[X, Y]:
def m(): Y = ???
21 changes: 21 additions & 0 deletions tests/pos/argDenot-alpakka.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import scala.annotation.unchecked.uncheckedVariance as uV

trait Test:
def split[I, M](in: Flow[I, Byte, M]): SubFlow[Byte, M, in.Repr]
def test =
split(new Flow[Int, Byte, Unit])
.via[Char]
.merge
.filter()

trait FlowOps[+Out, +Mat]:
type Repr[+O] <: FlowOps[O, Mat] { type Repr[+O] = FlowOps.this.Repr[O] }
def via[O]: Repr[O] = ???
def filter(): Repr[Out] = ???

class Flow[-In, +Out, +Mat] extends FlowOps[Out, Mat]:
type Repr[+O] = Flow[In @uV, O, Mat @uV]

class SubFlow[+Out, +Mat, +F[+_]] extends FlowOps[Out, Mat]:
type Repr[+O] = SubFlow[O, Mat @uV, F @uV]
def merge: F[Out] = ???