summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3014 from ceedubs/pr/implicitNotFound-scaladocAdriaan Moors2013-10-071-2/+5
|\ | | | | Describe type parameter interpolation in @implicitNotFound documentation
| * Describe type parameter interpolation in @implicitNotFound documentationCody Allen2013-10-031-2/+5
| | | | | | | | | | | | Using this feature is necessary for helpful error messages, so it should be documented. Thank you to @adriaanm for recommending the this description.
* | Merge pull request #3005 from paulp/pr/7886Paul Phillips2013-10-035-23/+28
|\ \ | | | | | | SI-7886 unsoundness in pattern matcher.
| * | SI-6680 unsoundness in gadt typing.Paul Phillips2013-10-013-21/+25
| | | | | | | | | | | | | | | | | | | | | Introduces -Xstrict-inference to deal with the significant gap between soundness and what presently compiles. I'm hopeful that it's TOO strict, because it finds e.g. 75 errors compiling immutable/IntMap.scala, but it might be that bad.
| * | SI-7886 unsoundness in pattern matcher.Paul Phillips2013-10-013-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I tracked down what was behind the issue described here: // TODO: fix the illegal type bound in pos/t602 -- type inference // messes up before we get here: /*override def equals(x$1: Any): Boolean = ... // Span[Any] --> Any is not a legal type argument for Span! val o5: Option[com.mosol.sl.Span[Any]] = */ ...which led straight to the unsoundness seen in neg/t7886. It is dangerous to have an expected type of "Any" because the type system will blithely ignore kind errors, since "Any" can absorb anything. The consequence in this instance was that inferring the case constructor for a type like Foo[T <: Bound] if done with expected type Any, this would come up with Foo[Any]. I altered it to use expected type Foo[T], which lets the dummy type parameter survive to carry the bound forward and restores sense to the inference. The before/after output for -Xprint:patmat on pos/t602.scala is: 15c15 < if (x1.isInstanceOf[com.mosol.sl.Span[Any]]) --- > if (x1.isInstanceOf[com.mosol.sl.Span[K]]) 17c17 < <synthetic> val x2: com.mosol.sl.Span[Any] = \ (x1.asInstanceOf[com.mosol.sl.Span[Any]]: com.mosol.sl.Span[Any]); --- > <synthetic> val x2: com.mosol.sl.Span[K] = \ (x1.asInstanceOf[com.mosol.sl.Span[K]]: com.mosol.sl.Span[K]); 19,20c19,20 < val low$0: Option[Any] = x2.low; < val high$0: Option[Any] = x2.high; --- > val low$0: Option[K] = x2.low; > val high$0: Option[K] = x2.high; A file in the library depended (needlessly) on the unsoundness. It was easy to fix but reminds us this may affect existing code.
* | | Correct build command for scala-ideSimon Schaefer2013-10-031-1/+1
| | |
* | | Merge pull request #3013 from retronym/topic/unspec-fix-windowsAdriaan Moors2013-10-032-19/+17
|\ \ \ | | | | | | | | Rework cff8b569 to heal the windows build.
| * | | Rework cff8b569 to heal the windows build.Jason Zaugg2013-10-032-19/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - change newTermName to fix negative length names rather than reject them - restore the old logic in unspecializedName for names that result from AnyRef specialized type parameters. Why does fix the windows build? I remain none the wiser.
* | | | Merge pull request #2973 from sschaef/eclipse-update3Adriaan Moors2013-10-039-112/+57
|\ \ \ \ | |_|_|/ |/| | | Update of Eclipse project files
| * | | Update of Eclipse project filesSimon Schaefer2013-09-229-112/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Update of project dependencies - Deletion of scala-xml project - Deletion of scala-parser-combinators project - Update of .gitignore to match nested .cache files
* | | | Merge pull request #2965 from retronym/ticket/7859Grzegorz Kossakowski2013-10-032-11/+22
|\ \ \ \ | | | | | | | | | | SI-7859 Value classes may wrap a non-public member
| * | | | SI-7859 Value classes may wrap a non-public memberJason Zaugg2013-09-292-11/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We allow value class constructors to be non-public, so to be regular, we should also allow the same for the param accessor. This commit uses the 'makeNotPrivate' machinery to ensure that the backend can generate the requisite unboxing calls. This commit: - refactors the code that enforced the restrictions, improving a few error messages and positions. The remaining restrictions needed some rewording in light of this change. - allows value classes to have non-public, val parameters. private[this] / protected[this] are still disallowed as value classes don't have a concept of `this`, and because trying to accomdate then would complicate the implementation. This means that `class C(x: Int) extends AnyVal` is not allowed, the user still must write `private val x: Int` or `val x: Int`. - Outlaw `class C()()(val x: Int) extends AnyVal` to curtail any bugs that might lurk in such a formulation. The tests: - Show that the privacy is respected in the typer phase, under joint and separate compilation. We don't want a repeat performance of SI-6601. - Show that code that needs compiler-generated unboxes works under both compilation scenarios - Checks that the remaining restrictions are enforced and well communicated.
* | | | | Merge pull request #2994 from xeno-by/topic/bundlesJason Zaugg2013-10-037-40/+63
|\ \ \ \ \ | | | | | | | | | | | | assorted fixes for bundles
| * | | | | macro bundles are now usable in replEugene Burmako2013-10-021-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the previous commits relaxed the top-level restriction for bundles, turning it into a requirement of staticness (i.e. bundles nested in static objects are also okay now). This means that we can now define bundles in repl. Almost. There's still a little problem remaining that arises from the fact that when compiling a line of input, repl doesn't automatically import all previously defined symbols, but rather uses an heuristic to scan the input and guess what symbols need to be imported. Unfortunately for bundles, this heuristic fails, because when scanning a macro definition that looks like `def foo = macro Macros.foo`, it thinks that it's only necessary to import a term symbol called Macros (a vanilla way of defining macro impls), but not a type symbol called Macros (a new way of writing macro impls in bundles). This commit fixes the problem by making the repl look for both term and type symbols corresponding to the identifiers used in macro definitions.
| * | | | | gets rid of randomness in virtual filenames for bundlesEugene Burmako2013-10-022-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bundles are emitted in compilation units that wrap virtual source files. Previously we had those virtual files named randomly to ensure freshness, but that led to infinite compilation loops in SBT (see the commit message for more details and a link to a scala-user discussion). Now the names are generated deterministically from full names of bundles, which fixes the problems with SBT.
| * | | | | clearly establishes what macro bundles areEugene Burmako2013-10-025-26/+47
| | |_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously it was enough to just extend scala.reflect.macros.Macro, which created some loopholes, but now scalac enforces that bundles: 1) Are static (not necessarily top-level, but just static) 2) Are traits (objects shouldn't be bundles anyway, and classes bring complications with their ctors which require special treatment in generated classes, so why support them if they don't bring anything new to the table?) 3) Are monomorphic (again, this brings unnecessary complications wrt auxiliary code generation, so I don't see merit in supporting polymorphic bundles, whatever that a polymorphic bundle could mean) 4) Don't provide concrete implementation for Macro.c (if they do then what is the point?)
* | | | | Merge pull request #2977 from ↵Jason Zaugg2013-10-033-4/+12
|\ \ \ \ \ | |/ / / / |/| | | | | | | | | | | | | | sjrd/topic/remove-classpath-logic-dependent-on-inline Don't avoid to load trait impl .class without inliner.
| * | | | Add -Yno-load-impl-class disabling loading of $class.class files.Sébastien Doeraene2013-09-272-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The parent commit, a3f71badf67bbaac1a4ba16f68211ea6e31aa473, removed some logic preventing $class.class files to be loaded. It did so only when the inliner was off. Should this cause any issue, this option provides a means to restore the old behavior by *never* loading $class.class files. So, using -inline -Yno-load-impl-class will not load $class.class files either (where previously -inline would load them). The two old behaviors being available by *either* using -inline *or* -Yno-load-impl-class (not both).
| * | | | Don't avoid to load trait impl .class without inliner.Sébastien Doeraene2013-09-192-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the inliner is on, it is necessary to load class files containing the implementation of traits, i.e., those ending in $class.class. This is needed to be able to inline these methods. However it is useless if the inliner is disabled. The previous logic avoided to put these files on the classpath when the inliner was off. However, this complicates things, and it makes the classpath mechanism dependent on something totally unrelated. On this basis, this commit removes that logic, and instead trait impl .class files are always kept on the classpath.
* | | | | Removing unused code.Paul Phillips2013-10-0282-1047/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of this was revealed via -Xlint with a flag which assumes closed world. I can't see how to check the assumes-closed-world code in without it being an ordeal. I'll leave it in a branch in case anyone wants to finish the long slog to the merge.
* | | | | Remove 'hasDefaultFlag'.Paul Phillips2013-10-022-5/+3
| |_|_|/ |/| | | | | | | | | | | | | | | This is the change which broke the compiler until I made the changes found in 693ecffbaf.
* | | | Merge pull request #3003 from paulp/pr/position-catchupPaul Phillips2013-10-0119-83/+98
|\ \ \ \ | | | | | | | | | | Updating Position call sites.
| * | | | Updating Position call sites.Paul Phillips2013-09-2719-83/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling position factories rather than instantiating these particular classes. Not calling deprecated methods. Added a few position combinator methods.
* | | | | Merge pull request #2991 from xeno-by/topic/unapply-copierEugene Burmako2013-09-302-37/+58
|\ \ \ \ \ | | | | | | | | | | | | transformers no longer ignore UnApply.fun
| * | | | | refactors ToolBoxGlobal wrappersEugene Burmako2013-09-271-64/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Centralizes wrappers in a single location and makes it impossible to use the compiler without going through that location. Also fixes the option string tokenization bug that was there for ages. This time I figured out that there's already an implementation of the tokenizer in our compiler, so I just used it :)
| * | | | | transformers no longer ignore UnApply.funEugene Burmako2013-09-262-26/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Second time's the charm. I remember trying to do exactly the same somewhen around 2.10.0-M4, but then some continuations tests were failing. Luckily, today everything went smoothly. Please note that this fix changes the way that SI-5465 manifests itself. Previously it produced type errors, now it simply crashes the compiler. Therefore I had to attach the try/catch FatalError clause to invocations of toolbox methods, so that compiler crashes get caught and translated to ToolBoxErrors. Also fixes SI-7871, and that clears the way for implementing quasiquotes with conventional macros rather than relying on a special case in typer.
* | | | | | Some refinement of -Xlint interpolation warning.Paul Phillips2013-09-272-43/+41
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | I had covered a few more cases working on this recently. The warnings in several more cases involving polymorphism, currying, and selects vs. idents receive more refined handling.
* | | | | Merge pull request #2909 from soc/SI-7629-deprecate-view-boundsJason Zaugg2013-09-271-4/+6
|\ \ \ \ \ | | | | | | | | | | | | SI-7629 Deprecate view bounds
| * | | | | SI-7629 Deprecate view boundsSimon Ochsenreither2013-09-251-4/+6
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a warning(/error with -Xfuture) with a general migration advice. The IDE can use the warning to offer a quick fix with the specific refactoring necessary.
* | | | | Merge pull request #2992 from retronym/ticket/7877Jason Zaugg2013-09-272-2/+3
|\ \ \ \ \ | | | | | | | | | | | | Only look for unapplies in term trees
| * | | | | SI-7877 Only look for unapplies in term treesJason Zaugg2013-09-272-2/+3
| |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Scala 2.10.2, the enclosed test case has crashed in the backend. Before, we correctly rejected this pattern match. My bisection landed at a merge commit f16f4ab157, although both parents were good. So I don't quite trust that. I do think the regression stems from the changes to allow: case rx"AB(.+)" => Examples of this are in run/t7715.scala. This commit limits the search for extractors to cases where the function within the Apply is a term tree.
* | | | | Merge pull request #2978 from som-snytt/issue/7848-forgotten-interp-msg-lgtmPaul Phillips2013-09-274-27/+35
|\ \ \ \ \ | | | | | | | | | | | | SI-7848 Xlint no warn on $sym with params
| * | | | | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-234-27/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This idea brought to you by retronym. Also improve implicitNotFound detection at typer; and avoid checking the standard interpolation expression for cases like s"some $$x". Some minor refactorings of implicitNotFound strings. The intersobralator allows extra spaces, i.e., trims.
* | | | | | Merge pull request #2996 from paulp/pr/3971Jason Zaugg2013-09-272-1/+14
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-3971 error message carat mispoints at curried methods.
| * | | | | | SI-3971 error message carat mispoints at curried methods.Paul Phillips2013-09-272-1/+14
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Point at the beginning of the first argument list when reporting an error, as this is most easily associated with the application taking place (which may involve multiple applies in succession.) Thanks to retronym for figuring out why issuing a better error message broke the compiler on non-erroneous compile runs. The changes to "treesInResult" are the consequence.
* | | | | | Merge pull request #2998 from paulp/pr/6120Paul Phillips2013-09-271-7/+18
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6120 multiple warnings at same position.
| * | | | | | SI-6120 multiple warnings at same position.Paul Phillips2013-09-271-7/+18
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | An error suppresses all further warnings at the same position, but multiple warnings can be heard.
* | | | | | Merge pull request #2987 from paulp/pr/emptySelfTypePaul Phillips2013-09-2723-52/+50
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-6762 rename emptyValDef to emptySelfType.
| * | | | | | SI-6762 rename emptyValDef to noSelfType.Paul Phillips2013-09-2723-52/+50
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something.
* | | | | | Merge pull request #2995 from paulp/pr/defaultparamJason Zaugg2013-09-276-14/+15
|\ \ \ \ \ \ | | | | | | | | | | | | | | Fix up DEFAULTPARAM semantics.
| * | | | | | Fix up DEFAULTPARAM semantics.Paul Phillips2013-09-276-14/+15
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I foolishly believed the deprecation message on "hasDefaultFlag" which suggested I use "hasDefault" instead. After lots of head scratching, I hardened the semantics so it's like this: - A method parameter with a default value is PARAM | DEFAULTPARAM - A default getter for such a parameter is METHOD | DEFAULTPARAM - And "hasDefault" is has(DEFAULTPARAM) && has(PARAM | METHOD) Why all the bonus logic, why not just hasFlag(DEFAULTPARAM)? For some reason we have a handful of overloaded flags spanning uses which someone apparently thinks can never intersect but I have not been so lucky overall. So since DEFAULTPARAM is overloaded with TRAIT, unless we think it's fine that default getters and method parameters with defaults will pose as traits all the time, there has to be an anchor bit alongside it.
* | | | | | Merge pull request #2963 from sjrd/topic/hooks-for-scala-jsAdriaan Moors2013-09-272-4/+17
|\ \ \ \ \ \ | | | | | | | | | | | | | | Small refactorings giving hooks for Scala.js
| * | | | | | Move logic checking valid names from ClassPath to ClassPathContextSébastien Doeraene2013-09-231-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Other methods taking the same kind of decisions were already in ClassPathContext, e.g., isValidName() or, in some sense, even toBinaryName(). This makes ClassPath itself be completely agnostic of how particular kinds of files or directories are named. It also allows to override this logic at the context level. Without it, overriding this logic required a fair amount of code duplication from ClassPath.
| * | | | | | Add back the newClassLoader hook in SymbolLoaders.Sébastien Doeraene2013-09-231-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was previously an overridable method of Platform. The loader creation was moved in afbee09c8e0e7b1a4da1f8517c723dad9f1adb6f directly in SymbolLoaders, but inside a method doing more logic, namely initializeFromClassPath(). This commit simply moves the actual creation of the class loader (`new ClassfileLoader(bin)`) into its own method `newClassLoader`, but in SymbolLoaders. This allows to override only that method in subclasses of SymbolLoaders.
* | | | | | | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-master-2Jason Zaugg2013-09-275-11/+11
|\ \ \ \ \ \ \ | |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf build.xml src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/library/scala/concurrent/Future.scala src/reflect/scala/reflect/internal/Types.scala
| * | | | | | Merge remote-tracking branch 'origin/2.10.3' into merge/2.10.3-to-2.10.xJason Zaugg2013-09-241-7/+4
| |\ \ \ \ \ \
| | * | | | | | SI-7861 Don't execute internal callbacks on the user ExecutorJason Zaugg2013-09-211-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callbacks internal to the implementation of Futures should be executed with the `InternalCallbackExecutor`, rather than the user supplied `Executor`. In a refactoring da54f34a6, `recoverWith` and `flatMap` no longer played by these rules. This was noticed by a persnickety test in Play. Before this patch, the enclosed test outputs: % scala-hash v2.10.3-RC2 test/files/run/future-flatmap-exec-count.scala mapping execute() flatmapping execute() execute() recovering execute() execute()
| * | | | | | | Merge pull request #2919 from retronym/ticket/7815Jason Zaugg2013-09-231-2/+2
| |\ \ \ \ \ \ \ | | |/ / / / / / | |/| | | | | | SI-7815 Dealias before deeming method type as dependent
| | * | | | | | SI-7815 Dealias before deeming method type as dependentJason Zaugg2013-09-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To enable eta-expansion of method types seen from a prefix that renders the result type as independent from the parameter symbols. The enclosed test shows that we dealias types before checking dependence, and that we do this deeply (e.g. type arguments are also dealised.) An existing test, neg/error_dependentMethodTpeConversionToFunction, confirms that bona-fide dependent methods are still prohibited from eta expansion.
| * | | | | | | Merge pull request #2923 from retronym/ticket/7825Grzegorz Kossakowski2013-09-112-2/+5
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-7825 Consider DEFAULTMETHOD when refchecking concreteness