aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Desugar.scala
Commit message (Collapse)AuthorAgeFilesLines
...
* Renamings in DefinitionsMartin Odersky2015-11-091-2/+2
| | | | | | TypeRef becomes Type, thus removing duplicates. Where ...Type was used in an extraction (e.g. ArrayType(...), FunctionType(...)), we now use ...Of.
* First versions of Definitions based on TypeRefs not Symbols.Martin Odersky2015-11-091-4/+4
| | | | | | | | | | | | | | | Symbols are not stable between runs, so if some symbol referred to from Definitions gets recompiled, there are then two Symbols that are both visible, one referenced from Definitions, the other the one that got compiled. Thos led to a crash when e.g. compiling scala.Short, because the newly compiled symbol was not recognized as a primitive value class. The present commit tries to make systematic changes without regard to simplicity or aesthetics. This will be polished in future commits. // ### comments signal areas that need further attention.
* Merge pull request #889 from dotty-staging/fix-#877odersky2015-11-051-1/+1
|\ | | | | Fix #877
| * Fix #877Martin Odersky2015-10-301-1/+1
| | | | | | | | Use freshName to name evidence parameters.
* | Retain `case` flags for module classes representing case objectsMartin Odersky2015-11-021-8/+10
| | | | | | | | | | This will cause them to automatically implement a certain number of synthetic methods.
* | Revert nullary function patchMartin Odersky2015-10-301-2/+2
| | | | | | | | Nullary functions are handled by scalac, and dotty should do the same.
* | Fix case expansion for nullary functions.Martin Odersky2015-10-301-3/+3
| | | | | | | | Always expand to at least one parameter.
* | Allow pattern matching anonymous functions of arity > 1Martin Odersky2015-10-301-5/+11
|/ | | | This is sepcified in Sec. 8.5 of the SLS. Fixes #873. Review by @smarter.
* Avoif follow-on errors for illegal implicit classesMartin Odersky2015-10-221-8/+12
| | | | Supporess creation of implicit factory if it would be illegal.
* Fix desugaring problemMartin Odersky2015-09-121-6/+11
| | | | Desugaring worked incorrectly when both context bounds and default parameters were present.
* Add @sharable annotationMartin Odersky2015-07-061-1/+1
| | | | | | | Add @sharable annotation for classes and vals that are presumed to be safely sharable between threads. Also: Document CtxLazy.
* Fix a few Scaladoc warningsJason Zaugg2015-05-141-3/+3
|
* Correct a large number of typos.Jason Zaugg2015-05-141-2/+2
| | | | | I scanned the main sources with IntellIJ's spell checker and corrected what showed up.
* Fix parameter name in Scaladoc.Jason Zaugg2015-05-141-1/+1
|
* Allow byname repated parametersMartin Odersky2015-04-241-1/+6
| | | | Implements #499
* Tweaks relative to error reportingMartin Odersky2015-04-131-1/+1
|
* Remove trailing spaces in Dotty source.Dmitry Petrashko2015-04-091-3/+3
|
* Simplify methods implemented in #436Dmitry Petrashko2015-04-021-4/+3
|
* Add companion link symbols early only if companion actually existsDmitry Petrashko2015-03-261-12/+3
| | | | Otherwise we'll trigger early creation of companions that could shadow something.
* #353 use methods to find companion classDmitry Petrashko2015-03-251-5/+18
|
* Companion objects of abstract case classes are not functions.Martin Odersky2015-03-181-1/+4
| | | | | They do not have a generated apply method, so cannot be functions. Problem was unvovered when changing the definition of LazyAnnotation.
* Make some tree fields lazyMartin Odersky2015-03-181-4/+4
| | | | | | | | | | | | | | | | Lazy fields are - the rhs field of a ValDef or DefDef - the body field of a Template These can be instantiated with Lazy instances. The scheme is such that lazy fields are completely transparent for users of the Trees API. The only downside is that the parameter used to initialize a potentially lazy field has a weak type (now it's Any, with Dotty it would be a union type of the form `T | Lazy[T]`. Therefore, the parameter cannot be recovered through pattern matching.
* Fix desugaring of refined types with "&"-parent.Martin Odersky2015-03-181-9/+10
| | | | need to generate more than one parent class.
* Deleted diagnostics output that caused cyclic referencesMartin Odersky2015-01-061-1/+0
| | | | | | | | Cyclic reference was caused when compiling pos/i94-nada.scala with typer = new Printer and -Yfront set.
* Don't emit copy method for case classes with repeated parameters.Martin Odersky2014-12-201-1/+5
| | | | | | | | scalac has the same restriction. The reason is that we do not have a means to specify a sequence-valued default for a vararg parameter. It would be nice if we could, but this requires a more substantial development effort.
* Allow refinements that refine already refined types.Martin Odersky2014-11-261-7/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a double definition errorfor `T` was produced in a case like this: type T1 = C { T <: A } type T2 = T1 { T <: B } This was caused by the way T1 was treated in the refinement class that is used to typecheck the type. Desugaring of T2 with `refinedTypeToClass` would give trait <refinement> extends T1 { type T <: B } and `normalizeToClassRefs` would transform this to: trait <refinement> extends C { type T <: A; type T <: B } Hence the double definition. The new scheme desugars the rhs of `T2` to: trait <refinement> extends C { this: T1 => type T <: B } which avoids the problem. Also, added tests that #232 (fix/boundsPropagation) indeed considers all refinements together when comparing refined types.
* desugar Java repeated parms into an Array instead of SeqOndrej Lhotak2014-11-221-3/+4
|
* Drop modifiers as separate data from MemberDef treesMartin Odersky2014-11-101-61/+64
| | | | Typed MemberDef trees now take the modifiers from their symbol's data.
* Postponing desugaring of Try nodes.Dmitry Petrashko2014-10-301-0/+10
| | | | Instead of desugaring in parser desugaring is now done during desugaring.
* Create setters also for private varsMartin Odersky2014-10-121-1/+1
| | | | | Reason: We might need hooks for data representation transformations also for private vars. Private[this] vars in non-trait classes remain setterless.
* Setters are not case accessorsMartin Odersky2014-10-111-1/+1
|
* Make productArity a synthetic method which can be overriddenMartin Odersky2014-10-111-2/+1
| | | | | | Like other synthetic methods, productArity will not be generated if an explicit definition is given. Used to be generated unconditionally in desugaring.
* Fix #167Martin Odersky2014-10-111-1/+1
| | | | Can handle now vararg arguments in patterns.
* Restrict treee copiers with default arguments to trees with more than 2 ↵Martin Odersky2014-08-131-2/+2
| | | | | | | elements. It's not really an abbreviation to do it for trees with fewer elements and it leads to unncessessary syntactic variation.
* Switched to new cpy scheme.Martin Odersky2014-08-131-25/+27
| | | | Avoid mentioning arguments that are unchanged.
* Changes to tree copyingMartin Odersky2014-08-131-36/+35
| | | | | | | | 1) Add copiers with default arguments, to avoid boilerplate 2) All copiers are now curried wrt first argument (which is the original tree). We already make use of the new features in cpy.DefDef, but not yet elsewhere.
* Two fixes in desugarMartin Odersky2014-08-121-2/+4
| | | | | | | (1) set position of companion object def (2) companions of case classes taking multiple parameter lists do not inherit from a function type (reason: we can't straightforwardly converyt a curried method with multiple parameter lists to a function value).
* Use _1 intstead of get for accessing unary case class parametersMartin Odersky2014-08-111-3/+1
| | | | | Now that caes classes always inherit from ProductX, we can avoid the special case. (We need to define _1 anyway to implement Product1).
* Add CaseAccessor flag for case accessorsMartin Odersky2014-08-111-1/+2
| | | | Was missing before.
* Add Product{1,2} supertrait to case classesMartin Odersky2014-08-101-2/+2
| | | | | | | | Case classes with arity <= 1 now also get a ProductN parent trait. This is necessary because we inherit productArity and Element methods in case classes from the ProdictN trait. Needed to add Product0 for this, which is not defined in Scala2.x.
* Two variance-related fixes in DesugarMartin Odersky2014-08-031-5/+14
| | | | | | 1) Type parameter accessors inherit their variance from the type parameter 2) Copy method parameter defaults are annotated @uncheckedVariance. This is necessary because default methods will be checked for variance.
* Fix of t2660.Martin Odersky2014-05-301-1/+9
| | | | | Auxiliary constructors need to be wrapped in the type parameters of the primary constructor. Otherwise they will not take part in type inference.
* Changed handling of repeated parameters.Martin Odersky2014-05-081-1/+3
| | | | | | | | | | | | | | Previously, repeated parameters were typed as `<repeated>[T]`. The method `underlyingWithRepeated` converts `<repeated>[T]` to `Seq[T]`. This method was called in typedIdent, but the call was ineffective because the type of a repeated parameter ident is a TermRef. This led to a retyping error in Decorators.scala under -Ycheck:front. We now distinguish between the type of the internal parameter ValDef and the type of the parameter in the MethodType. The former has the type `Seq[T] @dotty.annotation.internal.repeated`, the latter has the type `<repeated>[T]`. The translation with `underlyingWithRepeated` thus becomes unneccessary.
* move InfoString from ErrorReporting to Decorators andSamuel Gruetter2014-04-021-1/+0
| | | | remove all isSensical/SuppressedMessage logic from InfoString
* Hygienic desugaringMartin Odersky2014-03-201-57/+115
| | | | | | | | | | | | Made desugaring hygienic. Trees that are derived from some other tree are no longer stored as simple untyped Ident trees, but as TypeTrees that know how to derive their types from some other type. Test cases in pos: hygiene.scala, t0054.scala and t0085.scala. The comment in hygiene.scala points to the difficulties we are facing. In particular, we need type trees that can rebind some references of a source type to local occurrences with the same name. t0054.scala is similar to hygiene.scala. t0085.scala is trickier, but also related. Essentially the problem there is that we have a class that inherits its outer class. In this case it is important to resolve an identifier in the right context. The identifier added to the copy method of a case class must be resolved outside the class (just like the same identifier in the constructor of that case class).
* Generalize derived type tree scheme.Martin Odersky2014-03-201-19/+13
| | | | | | To get truly hygienic desugared trees, we need a derived type tree scheme that's more flexible than just the previous two choices of info-of-symbol and typeref-of-symbol. The new scheme based on DerivedTypeTrees allows arbitrary methods to derive the type tree's type.
* New scheme for TypeTrees that refer to othersMartin Odersky2014-03-201-1/+39
| | | | | Adds a new scheme by which a TypeTree() can refer for its type to the symbol of some other type. Applies the scheme to setter parameters, replacing the previous ad-hoc solution.
* Removed annotations forced by union typesMartin Odersky2014-03-201-2/+3
| | | | | Removed annotations from the dotty codebase that were necessary because the inferred union types caused inference errors later on.
* Removed explicit tuplings from dotc codebase.Martin Odersky2014-03-201-1/+1
| | | | Eliminated all "Dotty deviations" which were due to lack of auto-tupling.
* Fix problem when handling structural types without a nominal parent type.Martin Odersky2014-03-011-1/+3
| | | | We need to use Object as parent then, but this was forgotten.