summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* SI-3346 implicit parameters can now guide implicit view inferenceEugene Burmako2013-10-1128-19/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simple patch makes it possible for implicit views to benefit from fundep-guided type inference, eliminating a nasty special case in implicit inference. Here are the changes that I had to apply to the tests (they exposed quite a number of interesting questions that I was happy to answer): 1) neg/t5845.scala now works, so I moved it to pos. That easily makes sense, because the test was just a canary to track previous state of things. 2) neg/divergent_implicit.scala, neg/t5578.scala and neg/t7519.scala changed their messages to less informative ones, because inapplicable implicit views now get disqualified early and therefore don't display their error messages to the user. This is an unfortunate but necessary byproduct of this change, and one can argue that the behavior is now completely consistent with implicit vals (that also don't explain why this or that implicit val got disqualified, but rather display a generic implicit value not found message). 3) scaladoc/implicits-chaining.scala and scaladoc/implicits-base.scala. Immediate culling of apriori inapplicable implicit views messes things up for Scaladoc, because it's interested in potentially applicable views, having infrastructure to track various constraints (type bounds, requirements for implicit parameters, etc) that guide applicability of views and then present it to the user. Therefore, when scaladoc is detected, implicit search reverts to the old behavior. 4) We still cannot have Jason's workaround to type constructor inference mentioned in comments to SI-3346, because it's not really about implicit parameters of implicit views, but about type inference flowing from the implicit parameter list to a preceding parameter list in order to affect inference of an implicit view. This is something that's still too ambitious.
* Merge pull request #3005 from paulp/pr/7886Paul Phillips2013-10-0322-7/+193
|\ | | | | SI-7886 unsoundness in pattern matcher.
| * SI-6680 unsoundness in gadt typing.Paul Phillips2013-10-0117-2/+160
| | | | | | | | | | | | | | 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-015-5/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #3013 from retronym/topic/unspec-fix-windowsAdriaan Moors2013-10-031-1/+1
|\ \ | | | | | | Rework cff8b569 to heal the windows build.
| * | Rework cff8b569 to heal the windows build.Jason Zaugg2013-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - 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 #2965 from retronym/ticket/7859Grzegorz Kossakowski2013-10-038-26/+125
|\ \ \ | | | | | | | | SI-7859 Value classes may wrap a non-public member
| * | | SI-7859 Value classes may wrap a non-public memberJason Zaugg2013-09-298-26/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | macro bundles are now usable in replEugene Burmako2013-10-022-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | clearly establishes what macro bundles areEugene Burmako2013-10-0220-3/+169
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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?)
* | | Removing unused code.Paul Phillips2013-10-022-8/+4
| |/ |/| | | | | | | | | | | 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.
* | Merge pull request #2991 from xeno-by/topic/unapply-copierEugene Burmako2013-09-303-0/+34
|\ \ | | | | | | transformers no longer ignore UnApply.fun
| * | transformers no longer ignore UnApply.funEugene Burmako2013-09-263-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-1/+44
| | | | | | | | | | | | | | | | | | | | | 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-273-0/+16
|\ \ \ | | | | | | | | SI-7629 Deprecate view bounds
| * | | SI-7629 Deprecate view boundsSimon Ochsenreither2013-09-253-0/+16
| |/ / | | | | | | | | | | | | | | | 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-0/+20
|\ \ \ | | | | | | | | Only look for unapplies in term trees
| * | | SI-7877 Only look for unapplies in term treesJason Zaugg2013-09-272-0/+20
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2710-28/+73
|\ \ \ | | | | | | | | SI-7848 Xlint no warn on $sym with params
| * | | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-2310-28/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+33
|\ \ \ \ | | | | | | | | | | SI-3971 error message carat mispoints at curried methods.
| * | | | SI-3971 error message carat mispoints at curried methods.Paul Phillips2013-09-272-0/+33
| | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2717-11/+112
|\ \ \ \ | | | | | | | | | | SI-6120 multiple warnings at same position.
| * | | | SI-6120 multiple warnings at same position.Paul Phillips2013-09-2717-11/+112
| |/ / / | | | | | | | | | | | | | | | | 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-275-5/+7
|\ \ \ \ | | | | | | | | | | SI-6762 rename emptyValDef to emptySelfType.
| * | | | SI-6762 rename emptyValDef to noSelfType.Paul Phillips2013-09-275-5/+7
| |/ / / | | | | | | | | | | | | | | | | Looks like emptyValDef.isEmpty was already changed to return false, so now all that's left is a name which means something.
* | | | Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-master-2Jason Zaugg2013-09-275-4/+133
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-242-0/+67
| |\ \ \
| | * | | SI-7861 Don't execute internal callbacks on the user ExecutorJason Zaugg2013-09-212-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0/+30
| |\ \ \ \ | | |/ / / | |/| | | SI-7815 Dealias before deeming method type as dependent
| | * | | SI-7815 Dealias before deeming method type as dependentJason Zaugg2013-09-071-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-4/+36
| |\ \ \ \ | | | | | | | | | | | | SI-7825 Consider DEFAULTMETHOD when refchecking concreteness
| | * | | | SI-7398 Enable test for Java 8 source parser under Java 8Jason Zaugg2013-09-101-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to skip it as it only depends on our changes to our JavaParser, and not on any bytecode features of Java 8.
| | * | | | SI-7825 Consider DEFAULTMETHOD when refchecking concretenessJason Zaugg2013-09-101-0/+34
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A class should not be required to implement a Java default method. This commit uses `isDeferredNotDefault` in place of `isDeferred` when finding unimplemented methods. The test itself does not depend on Java 8 as we use scalac's Java source parser to set things up.
* | | | | Merge pull request #2979 from retronym/ticket/7870Jason Zaugg2013-09-262-0/+7
|\ \ \ \ \ | | | | | | | | | | | | SI-7870 Detect default getter clashes in constructors
| * | | | | SI-7870 Detect default getter clashes in constructorsJason Zaugg2013-09-232-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Default getters for constructors live in the companion module. These eluded the check for clashes in default getter names due to overloading, which aims to give a more user friendly error than "double definition: meth$default$1". This commit checks for default getters in the companion module, in addition to those in the template itself.
* | | | | | SI-7876 Scaladoc crasher due to regression in isFunctionType.Jason Zaugg2013-09-261-0/+26
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `isFunctionType` and `isTupleType` started returing true for type constructors as of aeb73314. This led to a crash in type printing in ScalaDoc (specfically, in ModelFactoryTypeSupport.scala) This commit: - fixes those methods by guarding with !isHigherKinded - unit tests said methods - tests the reported crasher with a ScalaDoc test.
* | | | | Merge pull request #2982 from retronym/topic/checkinitAdriaan Moors2013-09-242-0/+8
|\ \ \ \ \ | | | | | | | | | | | | SI-4742 Make -Xcheckinit aware of constants.
| * | | | | SI-4742 Make -Xcheckinit aware of constants.Jason Zaugg2013-09-242-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Members defined as `final val x = <literal>` are given a ConstantType. The constant is folded into the accessor method `x`, and the field itself is never initialized. (Related discussion: SI-4605) As such, -Xcheckinit spuriously warns when calling that accessor. This commit disables the checks for constants. This will also fix the checkinit build (failure tracked as SI-7839), which is the victim of this a spurious scolding.
* | | | | | Merge pull request #2980 from huitseeker/revert-2957Jason Zaugg2013-09-2455-244/+177
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Revert #2957
| * | | | | Add position check for regression introduced by #2957François Garillot2013-09-242-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The starting bound for ValDefs in #2957 is distinct from the expected result, e.g. [4:9]val x = [8:9]0 instead of [0:9]val x = [8:9]0
| * | | | | Revert "Merge pull request #2957 from paulp/pr/parser-improvements"François Garillot2013-09-2453-244/+121
| | |_|_|/ | |/| | | | | | | | | | | | | | | | | | This reverts commit 884e1ce762d98b29594146d37b85384581d9ba96, reversing changes made to f6fcc4431f272c707d49de68add532c452dd4b0f.
* | | | | Merge pull request #2975 from retronym/ticket/7868Jason Zaugg2013-09-233-0/+30
|\ \ \ \ \ | |/ / / / |/| | | | SI-7868 Account for numeric widening in match translation
| * | | | SI-7868 Account for numeric widening in match translationJason Zaugg2013-09-233-0/+30
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pattern match translation was unprepared for trees of the shape: (0: Short) match { case A.unapply(<unapply-selector>.toInt) <unapply> (_) => () case _ => () } While a scrutinee is inelibigle for implicit views in order to conform to the type of the extractor call, it is allowed to weakly conform. In this case, the typechecker will add the numeric widening with a `toInt` call. This commit: - Changes treeInfo.Unapplied to recognize this tree shape - Changes spliceApply to recognize and preserve the widening when substituting the unapply selector with the binder - Tests reification of such pattern matches, which also depends on treeInfo.Unapplied.
* | | | Merge pull request #2956 from som-snytt/issue/7848-forgotten-interp-msgJason Zaugg2013-09-235-3/+73
|\ \ \ \ | | | | | | | | | | SI-7848 Xlint says what looks interpolated
| * | | | SI-7848 Xlint no warn on $sym with paramsSom Snytt2013-09-182-1/+48
| | | | | | | | | | | | | | | | | | | | This idea brought to you by retronym.
| * | | | SI-7855 No missing interpolator warning post-typerSom Snytt2013-09-181-4/+1
| | | | | | | | | | | | | | | | | | | | Avoid extra work, extra warnings.
| * | | | SI-7848 Xlint says what looks interpolatedSom Snytt2013-09-174-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The motivating use case was an Expecty debug string getting flagged for `$eq`. The test case demonstrates a different bug, in which the position of the literal tree is changed when typer gets rid of the unused local, so that when the tree is re-typed in erasure, a second, spurious warning is emitted at the start of the method. Specifically, the second warning is not suppressed because of the different position.
* | | | | Merge pull request #2962 from densh/topic/syntactic-assignJason Zaugg2013-09-233-1/+45
|\ \ \ \ \ | | | | | | | | | | | | Quasiquotes: add syntactic extractor for assignment-like trees
| * | | | | add syntactic extractor for assignment-like treesDen Shabalin2013-09-183-1/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three kinds of assign-like trees: 1. Assign(lhs, rhs) // $lhs = $rhs 3. AssignOrNamedArg(lhs, rhs) // $lhs = $rhs 2. Apply(Select(f, nme.update), args :+ rhs) // $f(..$args) = $rhs New syntactic combinator unifies all of them and lets users not to think about these implementations details.