aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/VarianceChecker.scala
Commit message (Collapse)AuthorAgeFilesLines
* Make positions fit for metaMartin Odersky2016-09-241-3/+3
| | | | | | | | | | | | | | | | | | In particular: - get rid of envelope, it's too complicated and hides too many errors - check that everywhere in parsed trees the position range of a parent node contains the position ranges of its children. - check that all non-empty trees coming from parser have positions. The commit contains lots of fixes to make these checks pass. In particular, it changes the scheme how definitions are positioned. Previously the position of a definition was the token range of the name defined by it. That does obviously not work with the parent/children invariant. Now, the position is the whole definition range, with the point at the defined name (care is taken to not count backticks). Namer is changed to still use the token range of defined name as the position of the symbol.
* Address reviewer comments.Martin Odersky2016-03-141-2/+2
|
* Add patch for variance errorsMartin Odersky2016-03-121-7/+10
|
* Fix two private leaks in dotty compiler itself.Martin Odersky2016-02-191-1/+1
|
* Fix of too strict variance checking.Martin Odersky2015-12-141-1/+1
| | | | | | When following an alias type, go directly to aliased type. Going via the TypeAlias link causes the current variance ot be narrowed to 0.
* Disregard BaseTypeArg parameters when variance checking.Martin Odersky2015-12-141-1/+1
| | | | Allows us to compile immutable.Set.
* Swap order of arguments in annotationsMartin Odersky2015-11-221-1/+1
| | | | | | | | | The fact that the annotation comes first is weird, because when I write an annotated type it's <type> @<annotation>. Also, annotated types are like RefinedTypes in that they derive from a parent type. And in RefinedTypes the parent comes first. So swapping the arguments improves consistency.
* Handle variance unsoundness in scalacMartin Odersky2015-11-051-4/+8
| | | | | | | | | | | | | | | | | The included test pos-special/variances-constr.scala demonstrates an unsoundness in the variance checking of scalac. Scalac excludes symbols owned by constructors from the checking. This is unsound, as can be demonstrated by compiling the test and observing output of the program run: Exception in thread "main" java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String at Test$.main(variances-constr.scala:17) at Test.main(variances-constr.scala) Dotty allows this code only under -language:Scala2 and issues a migration warning.
* Avoid capturing context in lazy treesMartin Odersky2015-03-181-1/+1
| | | | | | | | | | | | | | | | | | Lazy trees can live longer than runs, so it is important that they capture as little as possible. In particular they should not capture contexts. This change led with a ripple through effect to many changes where operations now have to parameterzied with contexts, in particular in what concerns tree folding. The changes in turn uncovered some areas where dotc was incompatible with scalac, and flagged correct things as errors. These will be fixed in the next commits. Another small twist: EmptyTrees will not be read in delayed mode, so that one can check for lacking definitions without deserializing the rhs.
* Drop modifiers as separate data from MemberDef treesMartin Odersky2014-11-101-1/+1
| | | | Typed MemberDef trees now take the modifiers from their symbol's data.
* Added method to help traversing children in a TreeTraverserMartin Odersky2014-10-111-2/+2
|
* More targeted eta-liftingMartin Odersky2014-08-101-1/+2
| | | | | | | | Eta-lifting picked some arbitrary base type. It turned out that i94-nada failed once we add a product trait to case classes (in the next commit) because Eta-Kifting picked Product as the base type, even though the target type was bounded by Monad. We now change the scheme so that the target type is included in the lifting, in order to avoid that we lift to useless types.
* Updated commentMartin Odersky2014-08-031-2/+4
|
* Enabled variance checkingMartin Odersky2014-08-031-0/+138
Variance checking is now run as part of type-checking. Fixed tests that exhibited variance errors. Added tests where some classes of variance errors should be detected.