summaryrefslogtreecommitdiff
path: root/test/files/pos
Commit message (Collapse)AuthorAgeFilesLines
* Merge 2.11.x into 2.12.xAdriaan Moors2017-04-071-0/+15
|\ | | | | | | Include 99f41a1 Merge pull request #5736
| * Merge pull request #5736 from adriaanm/t10206Adriaan Moors2017-03-211-0/+15
| |\ | | | | | | SI-10206 tighten fix for SI-6889
| | * Test case for SI-10206Jason Zaugg2017-03-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search implements a restriction that the target type for an implicit view should be more specific that AnyRef or AnyVal. scala> def foo(s: String): AnyVal = s <console>:12: error: the result type of an implicit conversion must be more specific than AnyVal def foo(s: String): AnyVal = s ^ Without this, an implicit value classes over `String` would be applied, which is unlikely to be what was intended. Implicit views are implemented as an implicit search for a function type with a structural type as its result. This structural type is created with: scala> val schema = analyzer.HasMethodMatching.apply(TermName("clone"), Nil, WildcardType) schema: $r.intp.global.analyzer.global.Type = ?{def clone(): ?} The quirk arises when, as above, we're seeking a member with the same name as a member of AnyRef. AnyRef is seen to be a subtype of the result type: scala> AnyRefClass.tpe <:< schema res23: Boolean = true Which leads to the implicit in the test case being disqualified. The typer opts to report the error about the inapplicability of the inherited clone method, so we don't even know why the implicit was discarded.
| * | Improvements based on reviews by Lukas & JasonAdriaan Moors2017-03-021-0/+18
| | |
| * | Allow user-defined `[un]apply` in case companionAdriaan Moors2017-02-271-0/+36
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Don't emit a synthetic `apply` (or `unapply`) when it would clash with an existing one. This allows e.g., a `private apply`, along with a `case class` with a `private` constructor. We have to retract the synthetic method in a pretty roundabout way, as we need the other methods and the owner to be completed already. Unless we have to complete the synthetic `apply` while completing the user-defined one, this should not be a problem. If this does happen, this implies there's a cycle in computing the user-defined signature and the synthetic one, which is not allowed.
* | SI-8969 Accept poly+implicit for assignment syntaxSom Snytt2017-03-091-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to fb061f22d4c35df626d9651e017820a11f8fe56e which allowed the type param only. Reported: ``` scala> object Test { | def a[R](implicit s: List[R]):Int = 0 | def a_=[R](v: Int)(implicit s: List[R]) = () | } ```
* | Merge pull request #5708 from szeiger/issue/si10194Lukas Rytz2017-02-211-0/+15
|\ \ | | | | | | SI-10194: Fix abstract type resolution for overloaded HOFs
| * | SI-10194: Fix abstract type resolution for overloaded HOFsStefan Zeiger2017-02-211-0/+15
| | | | | | | | | | | | | | | | | | Types in the applicable overload alternatives need to be seen from the respective owners of the individual alternative, not from the target’s owner (which can be a subtype of the types that define the methods).
* | | Ignore BoundedWildcardType in erasure type mapAdriaan Moors2017-02-191-0/+11
| | | | | | | | | | | | This case can be triggered as illustrated in the test.
* | | Merge branch '2.12.x' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-171-0/+38
|\| |
| * | Merge pull request #5542 from retronym/ticket/10066Adriaan Moors2017-02-161-0/+38
| |\ \ | | | | | | | | SI-10066 Fix crash in erroneous code with implicits, dynamic
| | * | SI-10066 Fix crash in erroneous code with implicits, dynamicJason Zaugg2016-11-181-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compiler support in the typechecker for `scala.Dynamic` is very particular about the `Context` in which it is typechecked. It looks at the `tree` in the enclosing context to find the expression immediately enclosing the dynamic selection. See the logic in `dyna::mkInvoke` for the details. This commit substitutes the result of `resetAttrs` into the tree of the typer context before continuing with typechecking.
* | | | Merge commit '36967321c7' into merge-2.11.x-to-2.12.x-20170214Seth Tisue2017-02-161-0/+6
|\ \ \ \ | |/ / / |/| | / | | |/ | |/|
| * | SI-9331 Fix canEqual for case classes with HK type paramsJason Zaugg2017-01-091-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Time for the courage of our convictions: follow the advice of my TODO comment from SI-8244 / f62e280825 and fix `classExistentialType` once and for all. This is the change in the generated `canEquals` method in the test case; we no longer get a kind conformance error. ``` --- sandbox/old.log 2015-05-27 14:31:27.000000000 +1000 +++ sandbox/new.log 2015-05-27 14:31:29.000000000 +1000 @@ -15,7 +15,7 @@ case _ => throw new IndexOutOfBoundsException(x$1.toString()) }; override <synthetic> def productIterator: Iterator[Any] = runtime.this.ScalaRunTime.typedProductIterator[Any](Stuff.this); - <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[Proxy[PP]]](); + <synthetic> def canEqual(x$1: Any): Boolean = x$1.$isInstanceOf[Stuff[_ <: [PP]Proxy[PP]]](); override <synthetic> def hashCode(): Int = ScalaRunTime.this._hashCode(Stuff.this); override <synthetic> def toString(): String = ScalaRunTime.this._toString(Stuff.this); override <synthetic> def equals(x$1: Any): Boolean = x$1 match { @@ -38,9 +38,3 @@ } } ``` I also heeded my own advice to pass in a prefix to this method.
| * | SI-9630 Fix spurious warning related to same-named case accessors [backport]Jason Zaugg2016-12-219-0/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hash consing of trees within pattern match analysis was broken, and considered `x1.foo#1` to be the same tree as `x1.foo#2`, even though the two `foo`-s referred to different symbols. The hash consing was based on `Tree#correspondsStructure`, but the predicate in that function cannot veto correspondance, it can only supplement the default structural comparison. I've instead created a custom tree comparison method for use in the pattern matcher that handles the tree shapes that we use. (cherry picked from commit 79a52e6807d2797dee12bab1730765441a0e222d)
| * | Merge pull request #5343 from milessabin/topic/si-2712-backportAdriaan Moors2016-10-1818-0/+206
| |\ \ | | | | | | | | SI-2712 Add support for higher order unification
| | * | SI-2712 Add support for higher order unificationMiles Sabin2016-08-1518-0/+206
| | | |
| * | | Merge pull request #5345 from milessabin/topic/si-7046-backportAdriaan Moors2016-10-182-0/+23
| |\ \ \ | | | | | | | | | | [nomerge] Partial fix for SI-7046
| | * | | Partial fix for SI-7046Miles Sabin2016-08-152-0/+23
| | |/ /
| * / / SI-9760 Fix for higher-kinded GADT refinementMiles Sabin2016-08-151-0/+18
| |/ /
* | | Merge pull request #5654 from retronym/ticket/10154Adriaan Moors2017-02-142-0/+27
|\ \ \ | | | | | | | | SI-10154 Fix implicit search regression for term-owned objects
| * | | SI-10154 Fix implicit search regression for term-owned objectsJason Zaugg2017-01-202-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change to fix lookup of companion implicits of term-owned classes (#5550) caused a regression in the enclosed test case. The previous approach of calling `Scope#lookup(companionName)` was replaced by a lookup of the scope entry of the original name followed by a narrower search lookup for the companion name, to ensure that it was a true companion, and not just a same-named module from defined at a different nested scope. However, module class symbols are not themselves entered into scopes, so the first part of the new scheme fails. We need to add a special case modules here. I've chosen to just call `.sourceModule` on module classes. For module classes in the current run (all term owned symbols will fall into this category), this amounts to using the value of the field `ModuleClassSymbol#module`.
* | | | Merge pull request #5245 from dwijnand/trailing-commasAdriaan Moors2017-02-081-0/+155
|\ \ \ \ | |/ / / |/| | | SI-4986 The glorious return of Comma McTraily
| * | | SIP-27 Tweak and test wildstar in REPLDale Wijnand2017-01-081-0/+4
| | | | | | | | | | | | | | | | From https://github.com/scala/scala/pull/5245#issuecomment-266658070
| * | | SIP-27 Test varargs, "@", and ": _*"Dale Wijnand2017-01-081-0/+23
| | | | | | | | | | | | | | | | From https://gist.github.com/lrytz/e10b166ffbed2e47348a7ef8cd072fd9
| * | | SI-4986 SIP-27 Trailing Comma (multi-line only) supportDale Wijnand2016-12-111-0/+128
| | | |
* | | | Merge pull request #5583 from lrytz/t10093Adriaan Moors2016-12-212-0/+6
|\ \ \ \ | | | | | | | | | | SI-10093 don't move member traits to constructor body in constructors
| * | | | SI-10093 don't move member traits to constructor body in constructorsLukas Rytz2016-12-062-0/+6
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression introduced in c8e6050. Member traits with only abstract definitions (`isInterface`) were moved into the primary constructor by mistake. (Flatten moved the classes back.) The member trait was duplicated into the constructor of specialized subclasses, causing it to be generated multiple times. Also removes some unnecessary `isMixinConstructor` checks: the mixin constructor is always the primary constructor. This commit also clarifies (and tests) what `isInterface` means: for scala-defined traits, it means there are only abstract members. For java-defined interfaces, it is always true.
* | | | Fix how "sbt" is writtenDale Wijnand2016-12-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "sbt" is not an acronym (it used to be, but it isn't any longer). It's a proper name, like "iPhone" or "eBay". So, just like you wouldn't write "Get Started With EBay" or "How To Reset Your IPhone", we don't write "Using the Sbt Build".
* | | | Merge pull request #5550 from retronym/ticket/3772Lukas Rytz2016-12-122-20/+8
|\ \ \ \ | |/ / / |/| | | SI-3772 Fix detection of term-owned companions
| * | | SI-3772 Fix detection of term-owned companionsJason Zaugg2016-11-292-20/+8
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Companion detection consults the scopes of enclosing Contexts during typechecking to avoid the cycles that would ensue if we had to look at into the info of enclosing class symbols. For example, this used to typecheck: object CC { val outer = 42 } if ("".isEmpty) { case class CC(c: Int) CC.outer } This logic was not suitably hardened to find companions in exactly the same nesting level. After fixing this problem, a similar problem in `Namer::inCurrentScope` could be solved to be more selective about synthesizing a companion object. In particular, if a manually defined companion trails after the case class, don't create an addiotional synthetic comanpanion object.
* | | Merge pull request #5284 from milessabin/topic/si-7046Adriaan Moors2016-11-302-0/+23
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SI-7046 reflection doesn't see all knownDirectSubclasses This appears to do the right thing in the most typical scenarios in which `knownDirectSubclasses` would be used. The missing 5% is that subclasses defined in local scopes might not be seen by `knownDirectSubclasses` (see `Local` and `Riddle` in the test below). In mitigation, though, it is almost certain that a local subclass would represent an error in any scenario where `knownDirectSubclasses` might be used. Errors for such situations are reported by recording (via a symbol attachment) that `knownDirectSubclasses` has been called and reporting an error if any additional children are added subsequently. Despite these limitations and caveats, I believe that this represents a huge improvement over the status quo, and would eliminate 100% of the failures that I've seen in practice with people using shapeless for type class derivation.
| * | | Partial fix for SI-7046Miles Sabin2016-11-282-0/+23
| |/ /
* | | Merge pull request #5376 from milessabin/topic/clean-experimentalAdriaan Moors2016-11-301-6/+0
|\ \ \ | | | | | | | | Clean up of code guarded by bare -Xexperimental
| * | | Typevar experimentals now default; t5729 pos -> neg.Miles Sabin2016-11-281-6/+0
| |/ /
* | | Merge pull request #5554 from retronym/ticket/10009Adriaan Moors2016-11-291-0/+6
|\ \ \ | | | | | | | | SI-10009 Fields survive untypecheck/retypecheck
| * | | SI-10009 Fields survive untypecheck/retypecheckJason Zaugg2016-11-281-0/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some places in the compiler, and many places in macros, use `untypecheck` (aka `resetAttrs`) to strip types and local symbols from a tree before retypechecking it under some different context. The refactoring of the desugaring of vals and vars in Scala 2.12.0 broke an assumption in this facility. When a ValDef must be split into multiple members (e.g. a field and a getter, or a perhaps also a setter), the ValDef that was parsed assumes the role of the `field`, and the trees for other members are stached by `Namer` to the `synthetics` map of the compilation unit, in order to spliced into the right statement list by typechecking. See `enterGetterSetter` for more details. However, the parsed ValDef is now used verbatim, carrying the meaning (ie, the symbol) of the `private[this]` field. This tree now had an inconsistency between the flags in `tree.mods.flags` and `tree.symbol.flags`. `tree.name` also differed from `tree.symbol.name` (the latter was renamed to be a local name, ie one with a trailing space.) When `ResetAttrs` stripped off the symbol and we retypechecked, we'd end up with two symbols in scope with the same name. In the first from the `run` test: ``` ================================================================================ { class a extends scala.AnyRef { def <init>(): a = { a.super.<init>(); () }; private[this] val x: Int = 42; <stable> <accessor> def x: Int = a.this.x }; new a() } { class a extends scala.AnyRef { def <init>() = { super.<init>(); () }; val x = 42; // oops, the name is "x" rather than "x " and we've missing `private[this]`! <stable> <accessor> def x: Int = a.this.x }; new a() } scala.tools.reflect.ToolBoxError: reflective typecheck has failed: x is already defined as value x ``` This commit uses the flags and name of the symbol in `typedValDef`. I've also had to modify the internals of `CodePrinter` to use the implicit, override, and deferred flags from the modifiers of an accessor when recovering pre-typer tree for a ValDef.
* / / Fix more compiler crashes with fields, refinement typesJason Zaugg2016-11-211-0/+17
|/ / | | | | | | | | | | | | | | | | | | | | In the same manner as scala/scala-dev#219, the placement of the fields phase after uncurry is presenting some challenges in keeping our trees type correct. This commit whacks a few more moles by adding a casts in the body of synthetic methods. Fixes scala/scala-dev#268
* | Merge pull request #5460 from som-snytt/issue/6978Jason Zaugg2016-11-103-0/+13
|\ \ | | | | | | SI-6978 No linting of Java parens
| * | SI-6978 No linting of Java parensSom Snytt2016-10-153-0/+13
| | | | | | | | | | | | | | | Don't lint overriding of nullary by non-nullary when non-nullary is Java-defined. They can't help it.
* | | Merge pull request #5486 from som-snytt/issue/6734-synthsJason Zaugg2016-11-101-0/+17
|\ \ \ | | | | | | | | SI-6734 Synthesize companion near case class
| * | | SI-6734 CommentSom Snytt2016-10-311-15/+9
| | | |
| * | | SI-6734 Synthesize companion near case classSom Snytt2016-10-271-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | Tweak the "should I synthesize now" test for case modules, so that the tree is inserted in the same tree as the case class.
* | | | For scala classfiles, only parse the scala signature annotationLukas Rytz2016-10-288-20/+25
| | | | | | | | | | | | | | | | | | | | | | | | Skipping other annotations not only saves some cycles / GC, but also prevents some spurious warnings / errors related to cyclic dependencies when parsing annotation arguments refering to members of the class.
* | | | Ensure companionClass returns a class, not a type aliasLukas Rytz2016-10-263-0/+10
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes scala/scala-dev#248, where a type alias reached the backend through this method. This is very similar to the fix for SI-5031, which changed it only in ModuleSymbol, but not in Symbol. The override in ModuleSymbol is actually unnecessary (it's identical), so it's removed in this commit. It was added for unclear reasons in 296b706.
* | | Merge pull request #5393 from som-snytt/issue/nowarn-thistype-discardLukas Rytz2016-10-211-0/+6
|\ \ \ | | | | | | | | No warn when discarding r.f(): r.type
| * | | No warn when discarding r.f(): r.typeSom Snytt2016-09-101-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The paradigm is `def add(x: X): Unit = listBuffer += x`. The value that is discarded is not new information. Also cleans up the recent tweaks to help messaging. Adds newlines in case they ask for multiple helps.
* | | | Detect clash of mixedin val and existing member.Adriaan Moors2016-10-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, we looked only at the result type, which was silly. This was originally motivated by a hack to get to the error about conflicting paramaccessors. The error detection for that can now be formulated more directly. Fixes scala/scala-dev#244
* | | | Merge pull request #5429 from lrytz/sd224Adriaan Moors2016-10-111-4/+0
|\ \ \ \ | | | | | | | | | | Default -Xmixin-force-forwarders to true
| * | | | Default -Xmixin-force-forwarders to trueLukas Rytz2016-09-301-4/+0
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also eliminates the warning when a mixin forwarder cannot be implemented because the target method is a java-defined default method in an interface that is not a direct parent of the class. The test t5148 is moved to neg, as expected: It was moved to pos when disabling mixin forwarders in 33e7106. Same for the changed error message in t4749.