Please sign in to comment.
SI-7694 @uncheckedBounds, an opt-out from type bounds checking
Synthetic defs introduced by transforms like named/default arguments, ANF (in scala-async) often introduce a type tree (the tpt of the temporary) that are based on the types of expressions. These types are scrutinized in RefChecks to check that type parameter bounds are satisfied. However, the type of the expression might be based on slack a LUB that fails to capture constraints between type parameters. This slackness is noted in `mergePrefixAndArgs`: // Martin: I removed this, because incomplete. Not sure there is a // good way to fix it. For the moment we just err on the conservative // side, i.e. with a bound that is too high. The synthesizer can now opt out of bounds by annotating the type as follows: val temp: (<expr.tpe> @uncheckedBounds) = expr This facility is now used in named/default arguments for the temporaries used for the reciever and arguments. The annotation is hidden under scala.reflect.internal, rather than in the more prominent scala.annotation.unchecked, to reflect the intention that it should only be used in tree transformers. The library component of this change and test case will be included in the next commit. Why split like this? It shows that the 2.10.3 compiler will work with 2.10.2 scala-reflect.jar.
- Loading branch information...
Showing with 74 additions and 13 deletions.
- +4 −0 bincompat-backward.whitelist.conf
- +16 −0 bincompat-forward.whitelist.conf
- +5 −4 src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
- +42 −9 src/compiler/scala/tools/nsc/typechecker/RefChecks.scala
- +1 −0 src/reflect/scala/reflect/internal/Definitions.scala
- +6 −0 src/reflect/scala/reflect/internal/Types.scala