Skip to content

Commit 361004f

Browse files
noti0na1tgodzik
authored andcommitted
Revert the PolyType case in scala#21744
[Cherry-picked 00e92b1]
1 parent 44dfad5 commit 361004f

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

compiler/src/dotty/tools/dotc/typer/Applications.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -1960,7 +1960,7 @@ trait Applications extends Compatibility {
19601960
resultType.revealIgnored match {
19611961
case resultType: ValueType =>
19621962
altType.widen match {
1963-
case tp: PolyType => resultConforms(altSym, tp.resultType, resultType)
1963+
case tp: PolyType => resultConforms(altSym, instantiateWithTypeVars(tp), resultType)
19641964
case tp: MethodType =>
19651965
val wildRes = wildApprox(tp.resultType)
19661966

tests/pos/i22724.scala

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import java.util.concurrent.atomic.AtomicReference
2+
3+
object UnboundedHub:
4+
final class Node[A](var value: A, val pointer: AtomicReference[Pointer[A]])
5+
final case class Pointer[A](node: Node[A], subscribers: Int)
6+
7+
private final class UnboundedHub[A]:
8+
import UnboundedHub.*
9+
10+
val publisherHead: AtomicReference[Node[A]] = new AtomicReference(
11+
new Node[A](
12+
null.asInstanceOf[A],
13+
new AtomicReference(
14+
Pointer(null, 0) // error: too many arguments for constructor AtomicReference
15+
)
16+
)
17+
)

0 commit comments

Comments
 (0)