Skip to content

Commit 0daa71e

Browse files
committed
Approximate annotated types in wildApprox
1 parent 701fa8a commit 0daa71e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Diff for: compiler/src/dotty/tools/dotc/typer/ProtoTypes.scala

+2
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,8 @@ object ProtoTypes {
10171017
paramInfos = tl.paramInfos.mapConserve(wildApprox(_, theMap, seen, internal1).bounds),
10181018
resType = wildApprox(tl.resType, theMap, seen, internal1)
10191019
)
1020+
case AnnotatedType(parent, _) =>
1021+
WildcardType(TypeBounds.upper(wildApprox(parent, theMap, seen, internal)))
10201022
case _ =>
10211023
(if (theMap != null && seen.eq(theMap.seen)) theMap else new WildApproxMap(seen, internal))
10221024
.mapOver(tp)

Diff for: tests/pos/annot-default-arg-22839.scala

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package defaultArgBug
2+
3+
class annot(arg: Int) extends scala.annotation.StaticAnnotation
4+
5+
def foo(a: Int, b: Int @annot(a + a) = 42): Int = b

0 commit comments

Comments
 (0)