Skip to content

Commit 40b99ff

Browse files
committed
Reject ? as an import bound
1 parent 099074c commit 40b99ff

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3121,7 +3121,7 @@ object Parsers {
31213121
in.nextToken()
31223122
ImportSelector(givenSelectorId(start)) // Let the selector span all of `given _`; needed for -Ytest-pickler
31233123
else if canStartTypeTokens.contains(in.token) then
3124-
ImportSelector(givenSelectorId(start), bound = infixType())
3124+
ImportSelector(givenSelectorId(start), bound = rejectWildcardType(infixType()))
31253125
else
31263126
ImportSelector(givenSelectorId(start))
31273127
case _ =>

tests/neg/import-implied.scala renamed to tests/neg/import-given.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ object E {
2525
foo // ok
2626
foo(using tc) // ok
2727
}
28+
object F:
29+
import A.{given ?} // error: unbound wildcard type
30+

0 commit comments

Comments
 (0)