summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* SI-7259 Fix detection of Java defined SelectsJason Zaugg2013-03-162-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | The fix for SI-3120, 3ff7743, introduced a fallback within `typedSelect` that accounted for the ambiguity of a Java selection syntax. Does `A.B` refer to a member of the type `A` or of the companion object `A`? (The companion object here is a fiction used by scalac to group the static members of a Java class.) The fallback in `typedSelect` was predicated on `context.owner.enclosingTopLevelClass.isJavaDefined`. However, this was incorrectly including Select-s in top-level annotations in Scala files, which are owned by the enclosing package class, which is considered to be Java defined. This led to nonsensical error messages ("type scala not found.") Instead, this commit checks the compilation unit of the context, which is more direct and correct. (As I learned recently, `currentUnit.isJavaDefined` would *not* be correct, as a lazy type might complete a Java signature while compiling some other compilation unit!) A bonus post factum test case is included for SI-3120.
* Merge pull request #2224 from retronym/ticket/7238Adriaan Moors2013-03-112-0/+13
|\ | | | | 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-092-0/+13
| | | | | | | | | | To avoid a crasher later on with a null type inside a sequence argument.
* | Merge pull request #2223 from scalamacros/ticket/7235Adriaan Moors2013-03-112-0/+18
|\ \ | |/ |/| reifier is now aware of SI-7235
| * reifier is now aware of SI-7235Eugene Burmako2013-03-092-0/+18
| | | | | | | | | | | | | | | | | | | | SI-7235 is caused by a long-standing todo in typedRefinement, which leads to originals of compound type trees swallowing their stats. I'm not sure how exactly to fix SI-7235, but what I am sure about is that we shouldn't silently discard stats during reification. This patch introduces a new implementation restrictions, which now reports that reify of compound type trees with non-empty stats isn't going to work.
* | Merge pull request #2193 from adriaanm/patmat-refactorAdriaan Moors2013-03-053-63/+0
|\ \ | | | | | | merge 2.10.1 into 2.10.x
| * \ Merge 2.10.1 into 2.10.xAdriaan Moors2013-03-033-63/+0
| |\ \ | | |/ | |/| | | | | | | | | | | | | The fix for SI-7183 in 440bf0a8c2 was forward ported in f73d50f46c. Conflicts: src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
| | * [nomaster] SI-7195 minor version mustn't introduce warningsAdriaan Moors2013-03-013-63/+0
| | | | | | | | | | | | | | | | | | | | | | | | We want 2.10.1 to be a drop-in replacement for 2.10.0, so we can't start warning where we weren't warning in 2.10.0. See SI-5954 (#1882, #2079) for when it was an implementation restriction, which was then weakened to a warning. It's now hidden behind -Ydebug.
* | | SI-7185 Avoid NPE in TreeInfo.isExprSafeToInlineJason Zaugg2013-03-022-0/+10
|/ / | | | | | | | | | | | | | | | | We got there typechecking code with a redundant layer of Block. We can't express that in source code, so we test this with manual tree construction and with XML literals, which as reported produce such trees.
* | SI-7171 Consider prefix when assessing type finality.Jason Zaugg2013-02-226-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `Type#isFinalType` determines if a type could have a non-bottom subtype. This property is exploited by the pattern matcher to flag impossible patterns. This check was ignoring the type's prefix, and incorrectly deemed that `T#A` in `trait T { final class A }` was a final type. But it could have been subtyped by `U#A` where `U` <:< `T`, or, more simply, by `T.this.A`. Now, type finality requires that the prefix is stable. The existing test cases in neg/patmat-type-check.scala still correctly flag incompatiblities. `isFinalType` is also used by some code that massages pattern matches post specialization. That is actually either broken or obsolete under virtpatmat, I've opened SI-7172 to invesigate that. It is also used by GenICode to determine whether to emit the appropriate equality checks that are correct in the face of boxing. It is possible that this change will force the slow path in some rare cases, but it won't affect correctness.
* | silences t6323aEugene Burmako2013-02-111-0/+6
|/ | | | | | Tag materialization notices enabled with -Xlog-implicits are now echoes not printlns. Therefore, they go into stderr, not stdout, getting logged by partest and not spamming stdout of partest.
* Merge pull request #2095 from hubertp/ticket/5675James Iry2013-02-084-1/+11
|\ | | | | SI-5675 Discard duplicate feature warnings at a position
| * SI-5675 Discard duplicate feature warnings at a positionJason Zaugg2013-02-084-1/+11
| | | | | | | | | | | | | | | | | | | | When -feature has not been enabled, we were double counting identical feature warnings that were emitted at the same position. Normal error reporting only reports the first time a warning appears at a position; feature warning counter incrementing should behave the same way. @hubertp: Fixed .check files that were broken in the original commit.
* | Merge pull request #2017 from retronym/ticket/6666James Iry2013-02-0810-32/+105
|\ \ | | | | | | Booking more progress on SI-6666
| * | SI-6666 Catch VerifyErrors in the making in early defs.Jason Zaugg2013-02-022-4/+15
| | | | | | | | | | | | | | | | | | As we did for self/super calls, add a backstop into explicitouter and lambdalift to check when we try to get an outer pointer to an under-construction instance.
| * | Broader checks for poisonous this references.Jason Zaugg2013-02-0210-49/+90
| | | | | | | | | | | | Replaces more VerifyErrors with implementation restrictions.
| * | Add a test case from the comments of SI-6666.Jason Zaugg2013-02-022-0/+21
| | | | | | | | | | | | | | | This one lands in the new implementation restriction which beats the VerifyError.
* | | Merge pull request #2079 from JamesIry/2.10.x_SI-7070James Iry2013-02-073-6/+7
|\ \ \ | | | | | | | | SI-7070 Turn restriction on companions in pkg objs into warning
| * | | SI-7070 Turn restriction on companions in pkg objs into warningJames Iry2013-02-063-6/+7
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation restriction created from SI-5954 in 3ef487ecb6733bfe3c13d89780ebcfc81f9a5ea0 has two problems. 1) The problematic code works fine if compile with sbt. That means the restriction is breaking some people needlessly. 2) It's not binary compatible. To fix all that this commit changes the error into a warning and removes the setting used to get around the restriction.
* | | Merge pull request #2068 from scalamacros/ticket/7064Adriaan Moors2013-02-0710-13/+28
|\ \ \ | | | | | | | | [nomaster] SI-7064 Reflection: forward compat for 2.10.1
| * | | [nomaster] Revert "refactors handling of parent types"Eugene Burmako2013-02-057-10/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 40063b0009d55ed527bf1625d99a168a8faa4124. Conflicts: src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * | | [nomaster] Revert "introduces global.pendingSuperCall"Eugene Burmako2013-02-053-3/+6
| |/ / | | | | | | | | | | | | | | | | | | | | | This reverts commit 0ebf72b9498108e67c2133c6522c436af50a18e8. Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/Trees.scala
* / / [nomerge] SI-6667 Demote a new ambiguity error to a lint warning.Jason Zaugg2013-02-044-2/+6
|/ / | | | | | | | | | | | | In the interests of not breaking source compability. A few projects are relying on this bug. Should not be merged to master.
* | Merge pull request #2022 from lrytz/analyzerPlugins210Lukas Rytz2013-02-033-3/+32
|\ \ | | | | | | Analyzer Plugins
| * | SI-1803, plus documentation and cleanups in Namers, mainly in typeSigLukas Rytz2013-02-033-3/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - when typing (and naming) a ValDef, tpt and rhs are now type checked in the same context (the inner / ValDef context). this does not change any behavior, but is more uniform (same as for DefDef). martin told me (offline) that this change is desirable if it doesn't break anything. (it doesn't). - typeSig is now more uniform with a separate method for each case (methodSig, valDefSig, etc). methodSig was cleaned up (no more variables) and documented. the type returned by methodSig no longer contains / refers to type skolems, but to the actual type parameters (so we don't need to replace the skolems lateron). - documentation on constructor contexts, type skolems - more tests for SI-5543
* | | Merge pull request #2019 from scalamacros/ticket/6539Eugene Burmako2013-02-012-1/+7
|\ \ \ | |/ / |/| | SI-6539 moves @compileTimeOnly away from scala-reflect
| * | SI-6539 moves @compileTimeOnly away from scala-reflectEugene Burmako2013-01-312-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | The move is done to provide forward compatibility with 2.10.0. The annotation isn't replaced with one of the macro-based solutions right away (see comments for more information about those), because we lack necessary tech in 2.10.x.
* | | Merge pull request #1975 from retronym/ticket/6601-revertJames Iry2013-02-013-8/+0
|\ \ \ | | | | | | | | Revert "SI-6601 Publicise derived value contstructor after pickler"
| * | | Revert "SI-6601 Publicise derived value contstructor after pickler"Jason Zaugg2013-01-263-8/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b07228aebe7aa620af45a681ef60d945ffc65665. The remedy was far worse than the disease: % cat sandbox/test.scala class V private (val a: Any) extends AnyVal % RUNNER=scalac scala-hash b07228aebe sandbox/test.scala [info] b07228aebe => /Users/jason/usr/scala-v2.10.0-256-gb07228a % scala-hash b07228aebe [info] b07228aebe => /Users/jason/usr/scala-v2.10.0-256-gb07228a Welcome to Scala version 2.10.1-20130116-230935-b07228aebe (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27). Type in expressions to have them evaluated. Type :help for more information. scala> def foo(v: V) = v.a == v.a exception when typing v.a().==(v.a())/class scala.reflect.internal.Trees$Apply constructor V in class V cannot be accessed in object $iw in file <console> scala.reflect.internal.Types$TypeError: constructor V in class V cannot be accessed in object $iw
* | | Merge pull request #1980 from retronym/backport/1518Adriaan Moors2013-02-014-0/+47
|\ \ \ | | | | | | | | [backport] SI-2968 Fix brace healing for `^case (class|object) {`
| * | | [backport] SI-2968 Fix brace healing for `^case (class|object) {`Jason Zaugg2013-01-264-0/+47
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 24828531f62ce05402c96c04d7096e82d5f4e3bf Author: Jason Zaugg <jzaugg@gmail.com> Date: Sun Oct 21 23:34:35 2012 +0200 SI-2968 Fix brace healing for `^case (class|object) {` The scanner coalesces the pair of tokens into CASEOBJECT or CASECLASS, but fails to set `offset` back to the start of `case`. Brace healing is then unable to correctly guess the location of the missing brace. This commit resets `offset` and `lastOffset`, as though caseobject were a single keyword. Only the former was neccessary to fix this bug; I haven't found a test that shows the need for the latter. (cherry picked from commit cbad218dba47d49a39897b86d467c384538fdd53)
* | | Merge pull request #1998 from JamesIry/2.10.x_6963_2Adriaan Moors2013-02-019-6/+45
|\ \ \ | | | | | | | | SI-6963 Add version to -Xmigration
| * | | SI-6963 Add version to -XmigrationJames Iry2013-01-299-6/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds an optional version parameter to the -Xmigration compiler setting. Doing -Xmigration without version number behaves as it used to by dumping every possible migration warning. This commit adds a ScalaVersion class (plus ancillary stuff), and a ScalaVersionSetting.
* | | | Merge pull request #2015 from paulp/rc1-backportsPaul Phillips2013-01-316-2/+21
|\ \ \ \ | | | | | | | | | | 10 backports
| * | | | SI-6426, importable _.Paul Phillips2013-01-302-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | [backport] Prohibit `_` as an identifier, it can only bring badness.
| * | | | SI-5353, imperfect error message.Paul Phillips2013-01-304-2/+9
| |/ / / | | | | | | | | | | | | | | | | [backport] The fix of course is a perfect error message.
* | | | Merge pull request #2000 from adriaanm/backport-pr-1873Paul Phillips2013-01-312-0/+85
|\ \ \ \ | | | | | | | | | | [backport] SI-5378, unsoundness with type bounds in refinements.
| * | | | [backport] SI-5378, unsoundness with type bounds in refinements.Paul Phillips2013-01-282-0/+85
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As the comment says: Not enough to look for abstract types; have to recursively check the bounds of each abstract type for more abstract types. Almost certainly there are other exploitable type soundness bugs which can be seen by bounding a type parameter by an abstract type which itself is bounded by an abstract type. SPECIAL: BUY ONE UNSOUNDNESS, GET ONE FREE In refinement types, only the first parameter list of methods was being analyzed for unsound uses of abstract types. Second parameter list and beyond had free unsoundness reign. That bug as well is fixed here.
* | | | Merge pull request #2036 from scalamacros/ticket/5716Paul Phillips2013-01-313-0/+20
|\ \ \ \ | | | | | | | | | | [backport] the scanner is now less eager about deprecations
| * | | | changes the flags to not depend on partestEugene Burmako2013-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to some reason, partest always enables -deprecation. Since Paul has just submitted a pull request, which removes this behavior, I'm updating the flags to make sure this test works even after Paul's change. Backport from https://github.com/scala/scala/pull/1807 Original commit is https://github.com/scala/scala/commit/2015ad3ebd833225e93ed19604760a6da2522bb1
| * | | | the scanner is now less eager about deprecationsEugene Burmako2013-01-313-0/+20
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When healing braces it isn't very useful to report deprecation warnings, especially since this process is just simple context-free skimming, which can't know about what positions can accept what identifiers. Backport from https://github.com/scala/scala/pull/1807. Original commit is https://github.com/scala/scala/commit/e5d34d70499504e085ddf957c1c818ffb63f4e8d.
* | | | Merge pull request #1989 from adriaanm/rework-pr-1945Paul Phillips2013-01-313-56/+0
|\ \ \ \ | | | | | | | | | | SI-6968 Simple Tuple patterns aren't irrefutable
| * | | | SI-6968 Simple Tuple patterns aren't irrefutableJason Zaugg2013-01-273-56/+0
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reverts part of c82ecab. The parser can't assume that a pattern `(a, b)` will match, as results of `.isInstanceOf[Tuple2]` can't be statically known until after the typer. The reopens SI-1336, SI-5589 and SI-4574, in exchange for fixing this regression SI-6968. Keeping all of those fixed will require a better definition of irrefutability, and some acrobatics to ensure safe passage to the ambiguous trees through typechecking.
* / | | SI-6728 Fixes crash in parser on incomplete for expressionJames Iry2013-01-302-0/+9
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | The parser was trying to take the position of an empty expression which would crash. Son on the empty expression case in TreeBuilder# makeWhile it tries to do that and, if that failed, gets a position that wraps both the condition and the body. I also made a slight improvement to the UnsupportedOperationEx messages in Position.
* | | Merge pull request #1857 from retronym/ticket/6443-2.10.xAdriaan Moors2013-01-272-0/+28
|\ \ \ | |/ / |/| | SI-6443 Widen dependent param types in uncurry
| * | SI-6443 Widen dependent param types in uncurryJason Zaugg2013-01-162-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bridge building operates on unusual method signatures: after uncurry, so parameter lists are collapsed; but before erasure, so dependently typed parameters are still around. Original: def foo(a: T)(b: a.type, c: a.U): Unit During computeBridges: (a: T, b: a.type, c: a.U)Unit This signature no longer appears to override the corresponding one in a superclass, because the types of `b` and `c` are dependent on method parameters. The root of the problem is uncurry, which leaves the trees in a poor state. This commit changes uncurry to remedy this. An example illustrates it best: // source def foo(a: A)(b: a.type): b.type = b // post uncurry before this patch. // not well typed code! def foo(a: A, b: a.type): a.type = { // post uncurry after this patch def foo(a: A, b: A): A = { val b$1 = b.asInstanceOf[a.type] b$1 }
* | | Merge pull request #1946 from retronym/ticket/6231Paul Phillips2013-01-252-0/+21
|\ \ \ | | | | | | | | SI-6231 Report unsupported free var capture by a trait.
| * | | SI-6231 Report unsupported free var capture by a trait.Jason Zaugg2013-01-212-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a class nested in a trait captures a free variable from the enclosing scope of the trait, the transformation to add that variable to the `init` method of the trait implementation class happens *after* the abstract trait interface has been extracted. This would lead to a crash when trying to find the corresponding interface method. This commit detects this situation and reports an implementation restriction. The enclosed test case shows a workaround. To lift this restriction, LambdaLifter should add the getters and make sure they end up in the trait interface. Looks like Martin tried this once: // LambdaLift.scala // // Disabled attempt to to add getters to freeParams // this does not work yet. Problem is that local symbols need local names // and references to local symbols need to be transformed into // method calls to setters. // def paramGetter(param: Symbol): Tree = { // val getter = param.newGetter setFlag TRANS_FLAG resetFlag PARAMACCESSOR // mark because we have to add them to interface // sym.info.decls.enter(getter) // val rhs = Select(gen.mkAttributedThis(sym), param) setType param.tpe // DefDef(getter, rhs) setPos tree.pos setType NoType // } // val newDefs = if (sym.isTrait) freeParams ::: (ps map paramGetter) else freeParams
* | | | Merge pull request #1938 from retronym/ticket/6666Paul Phillips2013-01-252-0/+172
|\ \ \ \ | | |_|/ | |/| | SI-6666 Restrict hidden `this` access in self/super calls.
| * | | SI-6666 Restrict hidden `this` access in self/super calls.Jason Zaugg2013-01-202-0/+172
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Detect when classes (user authored or compiler generated) local to a self or super constructor argument would require premature access to the in-construction instance. The same restriction applies for classes and objects; for objects, the premature access would result in a null via MODULE$ field. A residual error has been lodged as SI-6997. I'd like to remove calls to `Symbol#outerClass` (which relies on the flaky flag INCONSTRUCTOR, see my comments in the JIRA issue for more discussion) from `LambdaLift` and `ExplicitOuter`, and instead use the stack of active self/super calls to know when to skip an enclosing class. That will obviate that flag.