aboutsummaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue with GADT not typechecking without bind in matchFelix Mulder2016-06-062-1/+11
|
* Merge pull request #1288 from dotty-staging/fix/implicit-caching-2Guillaume Martres2016-06-038-15/+103
|\ | | | | Implicit scope caching: bug fixes and performance improvements
| * Overloading resolution: prefer directly applicable methodsGuillaume Martres2016-06-033-4/+27
| | | | | | | | | | | | | | | | | | | | | | If directly applicable alternatives exists, do not try other alternatives. The original motivation for this change was to reduce the number of searches for implicit views we do since some overloaded methods like `Int#+` are used a lot, but it turns out that this also makes more code compile (see `overload_directly_applicable.scala` for an example), this change does not seem to match what the specification says (it does not define a notion of "directly applicable") but it does match the behavior of scalac, and it seems useful in general.
| * Don't compute implicit scopes for synthetic Lambda traitsGuillaume Martres2016-05-311-1/+4
| |
| * Avoid creating AndTypes with AnyGuillaume Martres2016-05-312-2/+7
| | | | | | | | This reduces the number of implicit scopes we cache.
| * OfTypeImplicits: compute refs lazilyGuillaume Martres2016-05-311-1/+1
| | | | | | | | | | | | Many intermediate `OfTypeImplicits` are created during a call to `implicitScope`, but they won't all be used so there is no need to compute `OfTypeImplicits#refs` unless it's actually used.
| * Never include self types in named parts of a typeGuillaume Martres2016-05-311-1/+1
| | | | | | | | | | | | | | | | | | According to SLS ยง 7.2, self types are not a named part of a type, so they're not part of the implicit scope. Before this commit, this was usually the case because we normally refer to a class using a TypeRef, but in some cases a class might appear as a ThisType, and ThisType#underlying returns the self type, we now use ThisType#tref instead which just returns a TypeRef corresponding to the class.
| * Do not miss implicits in type parameters of parentsGuillaume Martres2016-05-312-1/+13
| | | | | | | | | | This did not work before because we incorrectly looked for their value in the prefix of the type instead of the type itself.
| * Fix implicit scope caching bugGuillaume Martres2016-05-312-5/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The issue is subtle: the `tp` in scope in `def ofTypeImplicits` is the `tp` passed to the top-level `implicitScope` method, not the `tp` passed to the recursively called `iscope`, this means that before this commit, all intermediate `OfTypeImplicit` scopes cached while computing an implicit scope had their `tp` field incorrectly set, which means that we could miss implicits in later implicit searches. Note that the `implicit_cache.scala` test worked before this commit because of the restrictions on caching that exist since b8b0f381ef2cbcb7bad66fd3e7a9ae929baa45f6, it is included anyway because our caching strategy might change in the future.
| * Document why we cannot cache all implicit scopesGuillaume Martres2016-05-312-1/+29
| |
* | Merge pull request #1299 from felixmulder/topic/prepare-repl-for-bridgeDmitry Petrashko2016-06-034-16/+110
|\ \ | | | | | | Prepare REPL for dotty-bridge
| * | Add documentation to REPLFelix Mulder2016-06-031-6/+18
| | |
| * | Add ability to bind values from runtimeFelix Mulder2016-06-034-4/+78
| | |
| * | Add `initialCommands` and `cleanupCommands` to REPLFelix Mulder2016-06-022-12/+20
|/ /
* | Merge pull request #1297 from felixmulder/topic/add-position-switchDmitry Petrashko2016-06-023-11/+14
|\ \ | | | | | | Fix #1292: give position when failing to emit switch on annotated match
| * | Fix #1292: give position when failing to emit switch on annotated matchFelix Mulder2016-06-023-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix gives the position and refactors the code that gave off warnings, but it also begs the question - should we be able to handle emitting a switch for the following case: ```scala (x: @switch) match { case 'a' if somePredicate(x) => // ... case 'b' => // ... } ``` Currently if there is a guard, the patternmatcher will fail to emit a switch. Scalac can handle these cases currently.
* | | Merge pull request #1298 from dotty-staging/rename-organizationDmitry Petrashko2016-06-021-1/+1
|\ \ \ | | | | | | | | Switch organization from org.scala-lang to ch.epfl.lamp
| * | | Switch organization from org.scala-lang to ch.epfl.lampGuillaume Martres2016-06-021-1/+1
|/ / / | | | | | | | | | Publishing artifacts under ch.epfl.lamp is easier.
* | | Merge pull request #1251 from felixmulder/topic/fix-stdoutredirect-replFelix Mulder2016-06-016-10/+62
|\ \ \ | |_|/ |/| | Fix stdout redirect for REPL's println
| * | Disable "auto" alternative in `-color` flagFelix Mulder2016-06-012-2/+2
| | |
| * | Factor out coloring check to new method `Context#useColors`Felix Mulder2016-05-203-8/+10
| | |
| * | Use ChoiceSetting for coloringFelix Mulder2016-05-124-4/+6
| | |
| * | Add CLI option to disable REPL syntax highlightingFelix Mulder2016-05-125-7/+21
| | |
| * | Redirect System.{err,out} and Console.{err,out} in REPLFelix Mulder2016-05-121-7/+28
| | |
| * | Strip colors from output in TestREPLFelix Mulder2016-05-121-1/+2
| | |
| * | Fix stdout redirect for REPL's printlnFelix Mulder2016-05-121-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | When printing in the REPL via `println`, the output would end up on the same line, since stdout had not been redirected. This commit remedies that. It also adds syntax highlighting to result types.
* | | Merge pull request #1229 from dotty-staging/benchDmitry Petrashko2016-05-302-46/+40
|\ \ \ | |_|/ |/| | [do not merge] remove magic with benchmark tests
| * | fix benchmarks exceptionliu fengyun2016-05-301-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The benchmark project generates a dubious exception when compiling scala stdlib: java.lang.ClassCastException: scala.tools.nsc.backend.jvm.BTypes$ClassBType cannot be cast to scala.tools.nsc.backend.jvm.BTypes$ArrayBType Upon investigation, this turns out to be a backend incompatibility problem. The bench project runs with a previous version of scala-compiler. Explicitly designating the scala-compiler version for bench fixes the problem.
| * | remove magic with benchmark testsliu fengyun2016-05-301-43/+33
|/ / | | | | | | | | | | | | - remove dependence on junit - remove `pos` tests - merge all dotc related tests to a single `dotty` test - remove `Ycheck:all`
* | Merge pull request #1244 from dotty-staging/add/sbt-phaseGuillaume Martres2016-05-2917-17/+1032
|\ \ | | | | | | Add sbt incremental compilation support
| * | Add sbt incremental compilation supportGuillaume Martres2016-05-2813-11/+1009
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-273-6/+27
|\ \ | | | | | | 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-262-2/+14
| | | | | | | | | | | | 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 :-)
* | Merge pull request #1283 from felixmulder/topic/fix-seq-binding-patternmatcherDmitry Petrashko2016-05-279-13/+37
|\ \ | | | | | | Fix #1276: `_` binding in patternmatcher
| * | Add test for SI-9795Felix Mulder2016-05-271-0/+7
| | |
| * | Add test for previous ensuring correct bindsFelix Mulder2016-05-272-0/+5
| | |
| * | Fix `A*` propagating outside matchesFelix Mulder2016-05-271-2/+7
| | |
| * | Annotate repeated params with `case` flag to indicate that they are legalFelix Mulder2016-05-275-9/+14
| | | | | | | | | | | | | | | | | | | | | 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.