summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
Commit message (Collapse)AuthorAgeFilesLines
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-291-4/+5
|
* Lower-case spelling of @deprecated messagesSimon Ochsenreither2016-05-281-1/+1
|
* SI-9084 Add `since` (if available) to deprecation warningsSimon Ochsenreither2016-05-281-2/+3
|
* New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-181-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, concrete methods in traits were encoded with "trait implementation classes". - Such a trait would compile to two class files - the trait interface, a Java interface, and - the implementation class, containing "trait implementation methods" - trait implementation methods are static methods has an explicit self parameter. - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method - classes that mixin a trait install "trait forwarders", which implement the abstract method in the interface by forwarding to the trait implementation method. The new encoding: - no longer emits trait implementation classes or trait implementation methods. - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) pave the way) - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`) - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here. - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution. Here's an example: ``` trait T { println("T") def m1 = m2 private def m2 = "m2" } trait U extends T { println("T") override def m1 = super[T].m1 } class C extends U { println("C") def test = m1 } ``` The old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580 Some notes in the implementation: - No need to filter members from class decls at all in AddInterfaces (although we do have to trigger side effecting info transformers) - We can now emit an EnclosingMethod attribute for classes nested in private trait methods - Created a factory method for an AST shape that is used in a number of places to symbolically bind to a particular super method without needed to specify the qualifier of the `Super` tree (which is too limiting, as it only allows you to refer to direct parents.) - I also found a similar tree shape created in Delambdafy, that is better expressed with an existing tree creation factory method, mkSuperInit.
* Merge commit 'fcc20fe' into merge/2.11-to-2.12-apr-1Lukas Rytz2015-04-011-2/+16
|\
| * Merge pull request #4195 from lrytz/t8841Adriaan Moors2015-02-131-2/+16
| |\ | | | | | | SI-8841 report named arg / assignment ambiguity also in silent mode.
| | * SI-8841 report named arg / assignment ambiguity also in silent mode.Lukas Rytz2014-12-121-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For local definitions (eg. in a block that is an argument of a method call), the type completer may have a silent context. A CyclicReference is then not thrown but transformed into a NormalTypeError. When deciding if 'x = e' is an assignment or a named arg, we need to report cyclic references, but not other type errors. In the above case, the cyclic reference was not reported. Also makes sure that warnings are printed after typing argument expressions.
* | | SI-9140 Minor refactor for readabilitySom Snytt2015-02-091-58/+56
| | | | | | | | | | | | Make a couple of functions and use cases for if-else if-else etc.
* | | SI-9140 Allow omitting pleonastic parameter nameSom Snytt2015-02-091-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable simply: ``` scala> def f(@deprecatedName foo: String) = foo.reverse f: (foo: String)String scala> f(foo = "bar") <console>:9: warning: naming parameter foo has been deprecated. f(foo = "bar") ^ res0: String = rab ``` `Symbol.deprecatedParamName` conventionally returns `NO_NAME` when the name is omitted.
* | | SI-9140 Allow deprecating current parameter nameSom Snytt2015-02-081-8/+16
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow deprecatedName to specify the name of the parameter it qualifies. This tells the user, That's my name, don't wear it out. I.e., don't use my name when calling me. Use cases include: the name will change; normally a name should be provided for a boolean, but not in this case (perhaps because there is only one argument). ``` scala> def f(@deprecatedName('foo) bar: String) = bar.reverse f: (bar: String)String scala> f(foo = "hello") <console>:9: warning: the parameter name foo has been deprecated. Use bar instead. f(foo = "hello") ^ res0: String = olleh scala> def g(@deprecatedName('foo) foo: String) = foo.reverse g: (foo: String)String scala> g(foo = "hello") <console>:9: warning: naming parameter foo has been deprecated. g(foo = "hello") ^ res1: String = olleh ```
* / Fix many typos in docs and commentsmpociecha2014-12-141-1/+1
|/ | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
* SI-8117 Fix bug when mixing well-positioned named and positional argsLukas Rytz2014-07-111-11/+30
| | | | | | The method `missingParams` which returns undefined parameters of a given invocation expression still assumed that named arguments can only appear after positional ones.
* Route type checker reporting through contextAdriaan Moors2014-07-041-1/+1
| | | | | | | | | | Continue the work started in SI-8450 (no "implicit numeric widening" warning in silent mode), which was caused by going straight to the reporter instead of using the context for type error reporting (which buffers in silent mode). Ideally, this mistake should not be possible: typer should change the current reporter to buffer where appropriate.
* Track symbol that caused a deprecation warning.Adriaan Moors2014-07-041-2/+2
| | | | | | | | | | | | So that we can filter deprecations based on defining package. Configurable error reporting will support a rule like: "In compilation unit X, escalate deprecation warnings that result from accessing members in package P that have been deprecated since version V. Report an error instead of a warning for those." TODO: remove deprecationWarning overload that doesn't take a `Symbol`? (Replace by a default value of `NoSymbol` for the deprecated symbol arg?)
* Merge remote-tracking branch 'origin/2.10.x' into ↵Jason Zaugg2014-06-041-2/+2
|\ | | | | | | | | | | | | merge/2.10.x-to-2.11.x-20140604 Conflicts: src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
| * SI-8596 Fix rangepos crasher with defaults, poly methodsJason Zaugg2014-05-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regressed in SI-7915 / 3009a525b5 We should be deriving the position of the synthetic `Select` from `basefun1`, rather than `basefun`. In the new, enclosed test, the difference amounts to: new Container().typeParamAndDefaultArg[Any]() `------------ basefun1 --------------' `----------------- basefun ---------------' For monomorphic methods, these are one and the same, which is why `presentation/t7915` was working. I've extended that test to a polymorphic method to check that hyperlink resolution works.
| * SI-7915 Corrected range positions created during default args expansionMirco Dotta2013-11-191-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tree created during expansion of default arguments contained trees with the wrong type of positions. Let's discuss this with an example. Below is the tree generated for the `foo` method in the test class included in this commit. Before this commit: ``` [54:94]def foo(): [58]Unit = <70:90>{ [70:79]<artifact> val qual$1: [70]Bar = [70:79][70:79][70:79]new [74:77]Bar(); [80]<artifact> val x$1: [80]Int = [80]qual$1.bar$default$1; <70:90><70:83>qual$1.bar([80]x$1) } ``` Now: ``` [54:99]def foo(): [58]Unit = <70:95>{ <70:84><artifact> val qual$1: [70]Bar = [70:84][70:84][70:84]new [74:77]Bar(); [85]<artifact> val x$1: [85]Int = [85]qual$1.bar$default$1; <70:95>[84:88]qual$1.bar([85]x$1) } ``` Here are the list of changes: * The synthetic `qual$1` has a transparent position, instead of a range position. * The new Select tree (i.e., `qual$1.bar`) should always have a range position, because `selected` (i.e., the called method) is always visible in the source (in fact, this is the whole point of the fix, we need a range position or hyperlinking request from the Scala IDE won't work). * The Block that contains the expanded default arguments is forced to have a transparent position, as it never exist in the original source. The tricky part of the fix is the position assigned to the new Select tree, which needs to respect the range position's invariants. In the specific case, we ought to make sure that range positions don't overlap. Therefore, the position assigned to the new Select tree is computed by intersecting the original Select position (i.e., `baseFun`'s position) and the original qualifier's position (i.e., `qual`'s position). If you take a closer look at the range positions assigned in the tree after this commit, you'll notice that the range position of the `qual$1`'s rhs (i.e., [70:84]), and `qual$1.bar` (i.e., [84:88]) might seem to overlap, because the former ends where the latter begins. However, this not the case because of the range position's invariant 2, which states: > Invariant 2: in a range position, start <= point < end Hence, the above two positions aren't overlapping as far as the compiler is concerned. One additional aspect (that may look like a detail) is that we make sure to never generate a position such that its start is after its end. This is why we take the position with the smallest end point. Furthermore, calling `withStart` would turn any position in a range position, which isn't desiderable in general (and, even worse, this can lead to generation of invalid positions - bad offsets - if the computation is performed on offset positions). Hence, the position's computation is only performed when both `baseFun` and `qual` positions are range positions. Indeed, I expect this to be always the case if the compiler is started with -Yrangepos. (cherry picked from commit 3009a525b58a4c7865ff524899b85518884ee5f7)
* | standardizes prefixes used in named/default desugaringEugene Burmako2014-02-101-2/+2
| |
* | renames resetLocalAttrs to resetAttrsEugene Burmako2014-02-071-3/+3
| | | | | | | | | | Now when resetAllAttrs is gone, we can use a shorter name for the one and only resetLocalAttrs.
* | SI-7915 Corrected range positions created during default args expansionMirco Dotta2013-11-151-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tree created during expansion of default arguments contained trees with the wrong type of positions. Let's discuss this with an example. Below is the tree generated for the `foo` method in the test class included in this commit. Before this commit: ``` [54:94]def foo(): [58]Unit = <70:90>{ [70:79]<artifact> val qual$1: [70]Bar = [70:79][70:79][70:79]new [74:77]Bar(); [80]<artifact> val x$1: [80]Int = [80]qual$1.bar$default$1; <70:90><70:83>qual$1.bar([80]x$1) } ``` Now: ``` [54:99]def foo(): [58]Unit = <70:95>{ <70:84><artifact> val qual$1: [70]Bar = [70:84][70:84][70:84]new [74:77]Bar(); [85]<artifact> val x$1: [85]Int = [85]qual$1.bar$default$1; <70:95>[84:88]qual$1.bar([85]x$1) } ``` Here are the list of changes: * The synthetic `qual$1` has a transparent position, instead of a range position. * The new Select tree (i.e., `qual$1.bar`) should always have a range position, because `selected` (i.e., the called method) is always visible in the source (in fact, this is the whole point of the fix, we need a range position or hyperlinking request from the Scala IDE won't work). * The Block that contains the expanded default arguments is forced to have a transparent position, as it never exist in the original source. The tricky part of the fix is the position assigned to the new Select tree, which needs to respect the range position's invariants. In the specific case, we ought to make sure that range positions don't overlap. Therefore, the position assigned to the new Select tree is computed by intersecting the original Select position (i.e., `baseFun`'s position) and the original qualifier's position (i.e., `qual`'s position). If you take a closer look at the range positions assigned in the tree after this commit, you'll notice that the range position of the `qual$1`'s rhs (i.e., [70:84]), and `qual$1.bar` (i.e., [84:88]) might seem to overlap, because the former ends where the latter begins. However, this not the case because of the range position's invariant 2, which states: > Invariant 2: in a range position, start <= point < end Hence, the above two positions aren't overlapping as far as the compiler is concerned. One additional aspect (that may look like a detail) is that we make sure to never generate a position such that its start is after its end. This is why we take the position with the smallest end point. Furthermore, calling `withStart` would turn any position in a range position, which isn't desiderable in general (and, even worse, this can lead to generation of invalid positions - bad offsets - if the computation is performed on offset positions). Hence, the position's computation is only performed when both `baseFun` and `qual` positions are range positions. Indeed, I expect this to be always the case if the compiler is started with -Yrangepos.
* | decrease duplication of fresh* function definitionsDen Shabalin2013-10-181-1/+1
| | | | | | | | | | | | | | | | This commit extracts out freshTermName and freshTypeName to the top-level with implicit fresh name creator argument. This will let to refactor out more methods out of tree builder into treegen that are dependent on fresh name generator. We also save quite a bit of boilerplate by not having to redefined fresh functions all over the place.
* | Merge remote-tracking branch 'scala/2.10.x'Grzegorz Kossakowski2013-08-291-4/+5
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the merge, the test/run/t7733 started to fail on Jenkins. I tried to reproduce it locally but I couldn't so I think it's system dependent failure. Per @retronym's suggestion I moved it to pending to not block the whole merge. Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala src/compiler/scala/tools/nsc/typechecker/Macros.scala src/compiler/scala/tools/nsc/typechecker/Namers.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/util/MsilClassPath.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/reflect/scala/reflect/internal/ClassfileConstants.scala src/reflect/scala/reflect/internal/Importers.scala src/reflect/scala/reflect/internal/Trees.scala src/reflect/scala/reflect/runtime/JavaMirrors.scala test/files/run/macro-duplicate/Impls_Macros_1.scala test/files/run/t6392b.check test/files/run/t7331c.check
| * Merge remote-tracking branch 'origin/2.10.2' into merge/2.10.2-to-2.10.xJason Zaugg2013-08-211-8/+13
| |\ | | | | | | | | | | | | | | | | | | Better late than never. Conflicts: src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
| * | SI-7694 @uncheckedBounds, an opt-out from type bounds checkingJason Zaugg2013-08-131-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge branch 'pr/merge-2.10.2' into masterPaul Phillips2013-06-041-8/+13
|\ \ \ | | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pr/merge-2.10.2: SI-7375 ClassTag for value class aliases SI-7507 Fix lookup of private[this] member in presence of self type. SI-7532 Fix regression in Java inner classfile reader SI-7517 Fix higher kinded type inference regression SI-7516 Revert "SI-7234 Make named args play nice w. depmet types" A test case for a recent LUB progression. SI-7421 remove unneeded extra-attachement in maven deploy SI-7486 Regressions in implicit search. SI-7509 Avoid crasher as erronous args flow through NamesDefaults SI-6138 Centralize and refine detection of `getClass` calls SI-7497 Fix scala.util.Properties.isMac SI-7473 Bad for expr crashes postfix Increase build.number to 2.10.3 SI-7391 Always use ForkJoin in Scala actors on ... ... Java 6 and above (except when the porperty actors.enableForkJoin says otherwise) Reimplementing much of the DefaultPromise methods Optimizations: 1) Avoiding to call 'synchronized' in tryComplete and in tryAwait 2) Implementing blocking by using an optimized latch so no blocking ops for non-blockers 3) Reducing method size of isCompleted to be cheaper to inline 4) 'result' to use Try.get instead of patmat c.typeCheck(silent = true) now suppresses ambiguous errors Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf src/compiler/scala/reflect/macros/contexts/Typers.scala src/compiler/scala/reflect/reify/package.scala src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/compiler/scala/tools/reflect/ToolBoxFactory.scala src/library/scala/concurrent/impl/Promise.scala src/reflect/scala/reflect/internal/Types.scala
| * | SI-7516 Revert "SI-7234 Make named args play nice w. depmet types"Jason Zaugg2013-05-291-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 83c9c764b528a7a1c1d39c480d22c8e3a71d5a58. The tests are shunted to 'pending'. Why revert this seemingly innocous commit? 83c9c764 generates a ValDef whose tpt TypeTree has no original; this contains a reference to the symbol for `d`. resetAttrs and the retypecheck assigns a new symbol for d and leaves a the reference to the prior symbol dangling. The real bug is the resetAttrs concept.
| * | SI-7509 Avoid crasher as erronous args flow through NamesDefaultsJason Zaugg2013-05-231-3/+6
| |/ | | | | | | | | | | | | | | The fix for SI-7238 caused this regression. This commit marks taints whole Apply with an ErrorType if it has an erroneous argument, so as to stop a later crash trying to further process the tree.
* | Cleaning up isApplicable and neighbors.Paul Phillips2013-05-201-0/+2
| | | | | | | | | | I'd really like these methods to receive greater scrutiny. To that end I'm scrutinizing them.
* | SI-6815 untangle isStable and hasVolatileTypeAdriaan Moors2013-05-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Symbol::isStable` is now independent of `Symbol::hasVolatileType`, so that we can allow stable identifiers that are volatile in ident patterns. This split is validated by SI-6815 and the old logic in RefChecks, which seems to assume this independence, and thus I don't think ever worked: ``` if (member.isStable && !otherTp.isVolatile) { if (memberTp.isVolatile) overrideError("has a volatile type; cannot override a member with non-volatile type") ``` Introduces `admitsTypeSelection` and `isStableIdentifierPattern` in treeInfo, and uses them instead of duplicating that logic all over the place. Since volatility only matters in the context of type application, `isStableIdentifierPattern` is used to check patterns (resulting in `==` checks) and imports.
* | Created utility function for dropping by-name-ness.Paul Phillips2013-04-251-4/+1
| | | | | | | | And applied it in three locations.
* | SI-7345 Drive by refactoring of pattern matching for `arg: _*`.Jason Zaugg2013-04-211-7/+5
| |
* | SI-7345 Factor out method to clear and restore undetparams.Jason Zaugg2013-04-211-16/+2
| | | | | | | | Also refactored `handleOverloaded` to avoid use of a mutable Buffer
* | SI-7345 Doc and TODO comments around Context.Jason Zaugg2013-04-211-0/+1
| |
* | Merge remote tracking branch 'origin/2.10.x' into ↵Jason Zaugg2013-04-021-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | topic/merge-2.10.x-to-v2.11.0-M2-74-g00e6c8b Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf build.xml src/compiler/scala/reflect/reify/utils/Extractors.scala src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/partest/scala/tools/partest/nest/ReflectiveRunner.scala src/reflect/scala/reflect/internal/Types.scala src/reflect/scala/reflect/runtime/JavaUniverse.scala test/files/run/inline-ex-handlers.check test/files/run/t6223.check test/files/run/t6223.scala test/scaladoc/scalacheck/IndexTest.scala
| * SI-6921 SI-7239 Tread lightly during exploratory typingJason Zaugg2013-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When deciding whether an Assign is a named argument or and assignment expression, or when looking at arguments that the current selection is applied to in order to evaluate candidate implicit views, we risk polluting the tree by setting error types. This happens even if we are in 'silent' mode; that mode does silence the error report, but not the side effect on the tree. This commit adds strategic `duplicate` calls to address the problem symptomatically. Duplicating trees and retyping in general reach into the domain of bugs umbrella-ed under SI-5464, but in these places we should be safe because the tree is in the argument position, not somewhere where, for example, a case class-es synthetic companion object might be twice entered into the same scope. Longer term, we'd like to make type checking side effect free, so we wouldn't need to play whack-a-mole like this. That idea is tracked under SI-7176.
* | Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-2/+2
| | | | | | | | | | unmoored doc comment" warning when building distribution for scala itself.
* | Merge 2.10.x into masterAdriaan Moors2013-03-121-10/+13
|\| | | | | | | | | | | Conflicts: src/compiler/scala/reflect/reify/Errors.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala
| * Merge pull request #2224 from retronym/ticket/7238Adriaan Moors2013-03-111-3/+3
| |\ | | | | | | SI-7328 Bail out of names/defaults when args are error typed
| | * SI-7328 Bail out of names/defaults if args are error typedJason Zaugg2013-03-091-3/+3
| | | | | | | | | | | | | | | To avoid a crasher later on with a null type inside a sequence argument.
| * | SI-7234 Make named args play nice with dep. method typesJason Zaugg2013-03-091-7/+10
| |/ | | | | | | | | | | Some care is needed to avoid interaction with constant types (e.g pos/z1730.scala) and with existentials (e.g. t3507-old.scala).
* | Merge commit 'b403234a27' into wip/fresh-merge2Paul Phillips2013-02-011-28/+36
|\| | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/matching/ParallelMatching.scala src/compiler/scala/tools/nsc/transform/ExplicitOuter.scala src/compiler/scala/tools/nsc/typechecker/NamesDefaults.scala test/files/neg/t6963.check
| * SI-3353 don't extract <unapply-selector> into named-arg local valLukas Rytz2013-01-311-28/+36
| | | | | | | | | | | | | | | | | | | | | | | | This already fixes all of SI-3353 because no named-args-block is generated anymore (they are avoided if they have a single expr). So the same NPE in extractorFormalTypes as described in the ticket is no longer triggered. I think that's all there is to fix, since extractor patterns are translated to unapply calls with one argument, i think it's not possible to write a pattern that would result in a named-apply block.
* | Renamed methods to be less ambiguous in intent.Paul Phillips2013-01-261-7/+7
| | | | | | | | | | | | | | | | isNamed => isNamedArg isIdentity => allArgsArePositional nameOf => nameOfNamedArg Moved mkNamedArg into TreeGen.
* | Made "mode" into a value class.Paul Phillips2013-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is an obvious place to apply value class goodness and collect some safety/sanity in typing modes. It does show off a challenge in introducing value classes without disruption: there's no way to deprecate the old signature of 'typed', 'adapt', etc. because they erase the same. class Bippy(val x: Int) extends AnyVal class A { @deprecated("Use a bippy") def f(x: Int): Int = 5 def f(x: Bippy): Int = x.x } ./a.scala:5: error: double definition: method f:(x: Bippy)Int and method f:(x: Int)Int at line 4 have same type after erasure: (x: Int)Int An Int => Mode implicit handles most uses, but nothing can be done to avoid breaking anything which e.g. extends Typer and overrides typed.
* | adds c.introduceTopLevelEugene Burmako2013-01-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The first in the family of mutators for the global symbol table, `introduceTopLevel` is capable of creating synthetic top-level classes and modules. The addition of nme.EMPTY_PACKAGE_NAME is necessary to let programmers insert definitions into the empty package. That's explicitly discouraged in the docs, but at times might come in handy. This patch introduce workarounds to avoid incompatibilities with SBT. First of all SBT doesn't like VirtualFiles having JFile set to null. Secondly SBT gets confused when someone depends on synthetic files added by c.introduceTopLevel. Strictly speaking these problems require changes to SBT, and that will be done later. However the main target of the patch is paradise/macros, which needs to be useful immediately, therefore we apply workarounds.
* | Removed code from the typechecker.Paul Phillips2012-11-201-2/+0
| | | | | | | | | | Removing code from this neighborhood is more difficult than elsewhere, making it all the more important that it be done.
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-1/+1
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* | Removed unused imports.Paul Phillips2012-11-061-1/+0
| | | | | | | | | | | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* | Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled