aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Add sbt incremental compilation supportGuillaume Martres2016-05-289-5/+986
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To test this with sbt, see https://github.com/lampepfl/dotty/wiki/Using-Dotty-with-sbt The following flags are added: - -Yforce-sbt-phases: Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging. - -Ydump-sbt-inc: For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases. This commit introduces two new phases which do not transform trees: - `ExtractDependencies` which extracts the dependency information of the current compilation unit and sends it to sbt via callbacks - `ExtractAPI` which creates a representation of the API of the current compilation unit and sends it to sbt via callbacks Briefly, when a file changes sbt will recompile it, if its API has changed (determined by what `ExtractAPI` sent) then sbt will determine which reverse-dependencies (determined by what `ExtractDependencies` sent) of the API have to be recompiled depending on what changed. See http://www.scala-sbt.org/0.13/docs/Understanding-Recompilation.html for more information on how sbt incremental compilation works. This phase was originally based on https://github.com/adriaanm/scala/tree/sbt-api-consolidate/src/compiler/scala/tools/sbt which attempts to integrate the sbt phases into scalac (and is itself based on https://github.com/sbt/sbt/tree/0.13/compile/interface/src/main/scala/xsbt), but it has been heavily refactored and adapted to Dotty. The main functional differences are: - ExtractDependencies runs right after Frontend (so that we don't lose dependency informations because of the simplifications done by PostTyper), but ExtractAPI runs right after PostTyper (so that SuperAccessors are part of the API). - `ExtractAPI` only extract types as they are defined and never "as seen from" some some specific prefix, see its documentation for more details. - `ExtractDependenciesTraverser` and `ExtractUsedNames` have been fused into one tree traversal in `ExtractDependenciesCollector`. TODO: Try to run these phases in parallel with the rest of the compiler pipeline since they're independent (except for the sbt callbacks in `GenBCode`) ?
* Document why Trees#SelectFromTypeTree cannot be a TypTreeGuillaume Martres2016-05-281-1/+4
|
* Add Types#TypeTraverser for convenienceGuillaume Martres2016-05-281-0/+6
| | | | This works similarly to `Trees#TreeTraverser`.
* Fix typo in Desugar#refinedTypeToClass documentationGuillaume Martres2016-05-281-1/+1
|
* Fix memberExcluding for ClassInfoGuillaume Martres2016-05-281-2/+10
|
* Avoid issues when calling methods on root package symbolGuillaume Martres2016-05-282-2/+2
| | | | | SymDenotations#topLevelClass: don't throw an exception Symbols#associateFile: avoid infinite loop
* Merge pull request #1281 from dotty-staging/fix-lamda-liftodersky2016-05-272-6/+16
|\ | | | | Fixes to lambdalift that prevent memory leaks.
| * LambdaLift: do not close over members that are static.Dmitry Petrashko2016-05-271-2/+2
| |
| * Fix deadlock in t5375 and similar tests.Dmitry Petrashko2016-05-261-2/+3
| | | | | | | | See t5375.scala for details.
| * Backport from Linker: ElimStaticThis: allow more calls to static methodsDmitry Petrashko2016-05-261-2/+4
| | | | | | | | | | | | | | Before there was an implicit assumption that static methods are only present on objects. This assumption is invalidated both by linker optimizations and the new fix to lambdalift.
| * Backport from Linker: Fix to lambda lift. Fixes #1280.Dmitry Petrashko2016-05-261-2/+9
| | | | | | | | | | | | | | | | | | | | | | CollectDependencies had incorrect handling of `Ident`s. If it had ever met an `Ident` to a symbol defined outside of current owner-chain(e.g. Predef.println) it would issue narrowTo(enclosingClass). This is very conservative and leads to memory leaks even in trivial lambdas. My lambda-lift-foo groes stronger :-)
* | Fix `A*` propagating outside matchesFelix Mulder2016-05-271-2/+7
| |
* | Annotate repeated params with `case` flag to indicate that they are legalFelix Mulder2016-05-273-4/+12
| | | | | | | | | | | | | | One drawback with this approach is that the type seems to propagate. I.e. if the return type of an expression is `repeated` then the enclosing variable will get the `repeated` type instead of getting the expected `Seq` type
* | Change typer to infer repeated param instead of Seq in `_*` casesFelix Mulder2016-05-272-3/+5
| |
* | Merge pull request #1270 from dotty-staging/fix-bootstrapDmitry Petrashko2016-05-2715-112/+281
|\ \ | | | | | | Fix bootstrap
| * | Fix typos in commentsMartin Odersky2016-05-231-2/+2
| | |
| * | Make isCOmpanion test cheaperMartin Odersky2016-05-231-6/+27
| | | | | | | | | | | | | | | | | | | | | As explained in the comment, a scalacLinkedClass must also be a true companion unless the original symbol is a root. This avoids us to drop the (potentially large) unpickled map and save some memory.
| * | Remember owner in completerMartin Odersky2016-05-231-4/+4
| | | | | | | | | | | | | | | | | | Otherwise we might get a false owner if completing from somewhere else. We do not have a failing test to demonstrate the problem, but it looks like the right thing to do.
| * | Refine owner trees for templatesMartin Odersky2016-05-231-1/+1
| | | | | | | | | | | | | | | Include member defs inside templates in the enclosing class, otherwise they would get localDummy as onwer.
| * | Adopt new scheme for handling forward references in TastyMartin Odersky2016-05-231-66/+106
| | | | | | | | | | | | | | | Instead of stubbing with potentially wrong owners and hping for the best, we now compute owners on demand, using the lazy data structure of an OwnerTree.
| * | Maintain ownerTree data structure when unpickling TastyMartin Odersky2016-05-233-6/+87
| | | | | | | | | | | | | | | | | | First step for a more robust scheme to access symbols in Tasty. This entailed a swap of two fields in RefiendType, to make tree format more uniform in what concerns where references are found.
| * | Let createSymbol return a symbolMartin Odersky2016-05-232-23/+27
| | | | | | | | | | | | | | | | | | Compute initialization flags of possibly enclosing traits elsewhere (in indexStats). Cleans up the logic and makes the module more understandable.
| * | Make sure delayed Tasty unpicklings are done at the latest at Pickler phaseMartin Odersky2016-05-231-4/+6
| | |
| * | Fix withPhaseNoLaterMartin Odersky2016-05-231-1/+1
| | | | | | | | | | | | | | | It's possible that the given phase argument does not exist, in which case we do not want to set the current phase to NoPhase.
| * | Replace aliases to Unit by UnitMartin Odersky2016-05-231-1/+9
| | | | | | | | | | | | | | | | | | | | | Do this in the inferred (result-)type of ValDefs and DefDefs. Without this fix, TreeTraverser#traverseChildren in Trees.scala gets a result type of BoxedUnit (but only when co-compiled from source, not when unpickled).
| * | Make sure local data is unpickled at right phaseMartin Odersky2016-05-231-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We had a problem where unpickling an annotation containing a class constant had the wrong type. Unpickling was done after erasure. The type given to the constant was an alias but aliases got eliminated during erasure, so the constant was malformed. Unpickling annotation contents at the same phase as unpickling the annotation carrier solves the problem. It seems similar problems can arise when data is unpickled using a LocalUnpickler. So we now make sure local unpickling runs at the latest at phase Pickler.
| * | Don't force a symbol's denotation for isTerm/isTypeMartin Odersky2016-05-232-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Forcing it led to CyclicReferences involving RefChecks.OptLevelInfo when compiling dotc/*.scala against Tasty files. The problem was that when transforming OptLevelInfo the backend forced a transformInfo of RefChecks in TypeErasure which filtered RefCheck's scope to eliminate non-class type definitions. Without the tweak in this commit this tried to make all symbols current, and so came back to OptLevelInfo.
| * | Instrument Denotations#current to find CyclicReferenceMartin Odersky2016-05-231-1/+7
| | | | | | | | | | | | | | | Instrument Denotations#current to find CyclicReference errors arising during transforms.
| * | Decouple annotation transformers from info transformersMartin Odersky2016-05-234-25/+16
| | |
| * | Further improve doc commentMartin Odersky2016-05-231-2/+3
| | |
| * | Disable stub checkingMartin Odersky2016-05-231-4/+13
| | | | | | | | | | | | | | | | | | | | | It caused an assertion error when separately compiling parts of dotty against TASTY information. Not sure the test achieves anything or whether it produces a false negative.
| * | Use source module ref as assumed self type when reading TastyMartin Odersky2016-05-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | When reading Tasty we need to pre-set the info of a class to some ClassInfoType with (as yet) unknown parents and self type. But for module classes, we need to know the source module at all time, and this gets determined by the self type. So we now produce a TermRef for the assumed self type of a module class.
* | | Merge pull request #1256 from felixmulder/topic/test-bcodeDmitry Petrashko2016-05-273-4/+8
|\ \ \ | | | | | | | | Add bytecode checking infrastructure
| * | | Move `stripAnnots` to `isRef` instead of performing explicitly everywhereFelix Mulder2016-05-192-12/+6
| | | |
| * | | Fix #1258: correct behavior for annotated valuesFelix Mulder2016-05-172-5/+15
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | Annotated values are encapsulated in a `ConcreteAnnotation`, as such, the statement `tpe isRef defn.IntClass` would yield false despite the annotated reference being an Int. The tpe is now unwrapped if it has an annotation. If the transformation fails despite having the annotation the compiler will warn.
* | | Fix double evaluation of scrutinee with side-effects, add testFelix Mulder2016-05-261-10/+7
| | |
* | | Take side-effects into account during rewritingFelix Mulder2016-05-261-5/+10
| | |
* | | Don't evaluate isInstanceOf for value classes, disable bugged testsFelix Mulder2016-05-261-27/+36
| | | | | | | | | | | | | | | | | | | | | The tests `i1059.scala` and `t3480.scala` are failing due to a bug in pattern matcher that evaluates the `x` in `List(x: _*)` incorrectly. Concerned issue: #1276
* | | Address reviewer feedbackFelix Mulder2016-05-261-10/+19
| | |
* | | Fix primitive rewritingFelix Mulder2016-05-261-1/+1
| | |
* | | Rewrite `TypeApply` to null-check on rewrite to true, add docstringsFelix Mulder2016-05-261-23/+82
| | |
* | | Add initial partial evaluation of isInstanceOf callsFelix Mulder2016-05-263-2/+92
| | |
* | | Fix doc commentMartin Odersky2016-05-231-1/+1
| | |
* | | Move eqAny to PredefMartin Odersky2016-05-234-15/+14
| | |
* | | Add Eq instances of standard types to PredefMartin Odersky2016-05-232-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | To make tests pass, this required a looser specification of `assumedCanEquals`, so that an abstract type T can be compared to arbitrary values, as long as its upper bound can be compared. E.g. T == null T == "abc"
* | | Address reviewers commentsMartin Odersky2016-05-231-5/+5
| | |
* | | Tweak of valid eqAny conditionMartin Odersky2016-05-231-39/+30
| | |
* | | Fix comments in Eq class and make it a trait.Martin Odersky2016-05-231-4/+7
| | |
* | | Make use of implicitNotFound for eqaulity errorsMartin Odersky2016-05-233-4/+6
| | | | | | | | | | | | | | | Needed a fix in string interpolation for suriviving inserted types that contain `$` characters.
* | | Safe equality for core classes:Martin Odersky2016-05-236-6/+14
| | | | | | | | | | | | | | | | | | | | | Name, Symbol, Denotation, Type. This uncovered two nonsensical comparisons, one in CollectEntryPoints, the other in DottyBackendInterface.