@@ -2027,12 +2027,19 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
2027
2027
var checkedArgs = preCheckKinds(args1, paramBounds)
2028
2028
// check that arguments conform to bounds is done in phase PostTyper
2029
2029
val tycon = tpt1.symbol
2030
- if (tycon == defn.andType)
2031
- checkedArgs = checkedArgs.mapconserve(arg =>
2032
- checkSimpleKinded(checkNoWildcard(arg)))
2033
- else if (tycon == defn.orType)
2030
+ if tycon == defn.andType || tycon == defn.orType then
2034
2031
checkedArgs = checkedArgs.mapconserve(arg =>
2035
2032
checkSimpleKinded(checkNoWildcard(arg)))
2033
+ else if tycon.isProvisional then
2034
+ // A type with Provisional flag is either an alias or abstract type.
2035
+ // If it is an alias type, it would mean the type is cyclic
2036
+ // If it is an abstract type, it would mean the type is an irreducible
2037
+ // application of a higher-kinded type to a wildcard argument.
2038
+ // Either way, the wildcard argument is illegal. The early test of
2039
+ // `checkNoWildcard` here is needed, so that we do not accidentally reduce
2040
+ // an application of a Provisional type away, which would mean that the type constructor
2041
+ // is no longer present on the right hand side. See neg/i15507.scala.
2042
+ checkedArgs = checkedArgs.mapconserve(checkNoWildcard)
2036
2043
else if tycon == defn.throwsAlias
2037
2044
&& checkedArgs.length == 2
2038
2045
&& checkedArgs(1 ).tpe.derivesFrom(defn.RuntimeExceptionClass )
0 commit comments