Skip to content

Commit 5bdef59

Browse files
dwijnandKordyjan
authored andcommitted
Fix expandParam's use of argForParam/isArgPrefixOf.
1 parent 60b77ed commit 5bdef59

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5984,7 +5984,7 @@ object Types {
59845984
*/
59855985
def expandParam(tp: NamedType, pre: Type): Type =
59865986
tp.argForParam(pre) match {
5987-
case arg @ TypeRef(pre, _) if pre.isArgPrefixOf(arg.symbol) =>
5987+
case arg @ TypeRef(`pre`, _) if pre.isArgPrefixOf(arg.symbol) =>
59885988
arg.info match {
59895989
case argInfo: TypeBounds => expandBounds(argInfo)
59905990
case argInfo => useAlternate(arg)

tests/pos/i19354.orig.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import javax.annotation.processing.{ AbstractProcessor, RoundEnvironment }
2+
import javax.lang.model.element.{ ElementKind, PackageElement, TypeElement }
3+
4+
import java.util as ju
5+
6+
class P extends AbstractProcessor {
7+
override def process(annotations: ju.Set[? <: TypeElement], roundEnv: RoundEnvironment): Boolean = {
8+
annotations
9+
.stream()
10+
.flatMap(annotation => roundEnv.getElementsAnnotatedWith(annotation).stream())
11+
.filter(element => element.getKind == ElementKind.PACKAGE)
12+
.map(element => element.asInstanceOf[PackageElement])
13+
.toList()
14+
true
15+
}
16+
}

tests/pos/i19354.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class Foo; class Bar
2+
class Test:
3+
def t1(xs: java.util.stream.Stream[? <: Foo]) =
4+
xs.map(x => take(x))
5+
6+
def take(x: Foo) = ""
7+
def take(x: Bar) = ""

0 commit comments

Comments
 (0)