summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Report error on code size overflow, log method name.Adriaan Moors2013-12-122-0/+27
| | | | | | | We used to silently skip class files that would exceed the JVM's size limits. While rare, this should still be an error. While I was at it, also included the name of the offending method.
* Merge pull request #3261 from adriaanm/ticket-6426Adriaan Moors2013-12-112-12/+0
|\ | | | | Revert ", importable _."
| * Revert "SI-6426, importable _."Adriaan Moors2013-12-102-12/+0
| | | | | | | | | | | | | | This reverts commit d2316df920ffa4804fe51e8f8780240c46efa982. We can't make `_` an illegal identifier -- it's legal in Java, so we must be able to name these Java underscores.
* | Merge pull request #3253 from retronym/ticket/8062Adriaan Moors2013-12-113-0/+9
|\ \ | |/ |/| Fix inliner cycle with recursion, separate compilation
| * SI-8062 Fix inliner cycle with recursion, separate compilationJason Zaugg2013-12-103-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICodeReaders, which decompiles JVM bytecode to ICode, was not setting the `recursive` attribute of `IMethod`. This meant that the inliner got into a cycle, repeatedly inlining the recursive call. The method name `filter` was needed to trigger this as the inliner heuristically treats that as a more attractive inlining candidate, based on `isMonadicMethod`. This commit: - refactors the checking / setting of `virtual` - adds this to ICodeReaders - tests the case involving `invokevirtual` I'm not sure how to setup a test that fails without the other changes to `ICodeReader` (for invokestatic and invokespecial).
* | Merge pull request #3249 from retronym/ticket/7912Adriaan Moors2013-12-101-0/+16
|\ \ | | | | | | SI-7912 Be defensive calling `toString` in `MatchError#getMessage`
| * | SI-7912 Be defensive calling `toString` in `MatchError#getMessage`Jason Zaugg2013-12-101-0/+16
| | | | | | | | | | | | | | | Otherwise, objects with exception-throwing `toString` lead to a cascading error far removed from the originally failed match.
* | | Merge pull request #3251 from retronym/ticket/8060Adriaan Moors2013-12-101-0/+11
|\ \ \ | | | | | | | | SI-8060 Avoid infinite loop with higher kinded type alias
| * | | SI-8060 Avoid infinite loop with higher kinded type aliasJason Zaugg2013-12-101-0/+11
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `dealiasLocals` map was assuming that: tp.isAliasType implies (tp.dealias ne tp) This isn't true if `!typeParamsMatchArgs`. This commit avoids the infinite loop by checking whether or not dealiasing progresses.
* | | Merge pull request #3248 from adriaanm/dist-cleanup-licensesAdriaan Moors2013-12-102-27/+0
|\ \ \ | |/ / |/| | Clean up Scala distribution a bit.
| * | Remove unused android test and corresponding license.Adriaan Moors2013-12-092-27/+0
| | |
* | | Merge pull request #3222 from skyluc/issue/completion-import-vals-210-7995Adriaan Moors2013-12-095-53/+107
|\ \ \ | |/ / |/| | SI-7995 completion imported vars and vals
| * | SI-7995 completion imported vars and valsLuc Bourlier2013-12-065-53/+107
| | | | | | | | | | | | | | | | | | Imported member vals and vars were always marked inaccessible, even if referencing them at the location of the completion is valid in code. The accessible flag is now set accordingly to the accessibility of the getter.
* | | Merge pull request #3229 from retronym/ticket/8029Adriaan Moors2013-12-091-0/+57
|\ \ \ | | | | | | | | SI-8029 Avoid multi-run cyclic error with companions, package object
| * | | SI-8029 Avoid multi-run cyclic error with companions, package objectJason Zaugg2013-12-061-0/+57
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug report suggests this problem only became visible in the IDE *after* 2.10.3, but I tested an IDE with exactly 2.10.3 and saw the same problem. In fact, my test case fails as far back as 2.10.0. I suspect the problem showed up after 816cecf9a9, which checks that pairs of companion symbols are codefined eagerly in Namers. This commit modifies the check of `rawInfo ne NoType` in `isCoDefinedWith` to avoid triggering adaptation of types from the previous run. I'm not sure of the precise intent of that check. I looked at c9861cd198 (genesis of isCoDefinedWith). Before that we get back to 3761cb4b3a1 (the dawn of Subversion.)
* | | Merge pull request #3230 from retronym/backport/7439Eugene Burmako2013-12-074-0/+38
|\ \ \ | | | | | | | | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.
| * | | [backport] SI-7439 Avoid NPE in `isMonomorphicType` with stub symbols.Jason Zaugg2013-12-074-0/+38
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `originalInfo` can return null for stub symbols; deal with that as we used to before a regression in 016bc3db. After this change, we can once again delete A_1.class and still compile code instantiating B_1. (A_1 is only referred to in a method signature of B_1 which is not called from our code.) scala> new B_1 warning: Class A_1 not found - continuing with a stub. res0: B_1 = B_1@5284b8f9 In practice, this situation arises when someone uses a third party class that was compiled against other libraries not avaialable on the current compilation classpath. (cherry picked from commit a95432168204964e4f6c4571e781559c1640f2d8)
* | | Merge pull request #3223 from retronym/ticket/8010-2.10.xEugene Burmako2013-12-071-0/+22
|\ \ \ | | | | | | | | SI-8010 Fix regression in erasure double definition checks
| * | | SI-8010 Fix regression in erasure double definition checksJason Zaugg2013-12-061-0/+22
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calls to `Symbol#info` during scope iteration considered harmful. Looks like calling `info` during this Scope iteration is triggering the ExplicitOuter info transformer, which "makes all super accessors and modules in traits non-private, mangling their names.". This name change necessitates a rehashing of the owning scope, which I suspect is enough to corrupt the ScopeEntry-s being traversed in `checkNoDeclaredDoubleDefs`. The upshot was that we encountered the same symbol twice, which was reported as being a double-definition. This problem only showed up after 086702d8a74, which did nothing worse then change the order in which `{e, e1}.sym.info` were forced. I inspected SymbolPairs/OverridingPairs which *appear* to be immune as they only test flags during scope iteration; infos are not used until later, at which point we're iterating a temporary scope that isn't part of the type of the owner of the symbols.
* | | [nomaster] better error messages for various macro definition errorsEugene Burmako2013-12-0618-24/+18
| |/ |/| | | | | backport of 1d3ec4e708154ec05554f540d7d68ed55dc12426
* | Merge pull request #3209 from dotta/SI-7982-on-2.10.xJason Zaugg2013-12-063-0/+35
|\ \ | | | | | | make askLoadedType unload arguments out of the PC by default,
| * | SI-7982 Changed contract of askLoadedType to unload units by defaultFrançois Garillot2013-12-063-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The rationale for not keeping units loaded by default is that the more units are loaded, the slower is background compilation. For instance, in the Scala IDE for Eclipse (which uses the presentation compiler), typechecking occurs every time the reconciler kicks-in (~500millis after you stop typing), hence it is important that units are not kept loaded unless strictly necessary (for some extra information about this, see https://www.assembla.com/spaces/scala-ide/tickets/1001388) While I agree that using a boolean argument (`keepLoaded`) for deciding if a unit should be loaded isn't a great design, other methods in `CompilerControl` also have a keepLoaded parameter, so at least we have some consistency. For the future, I'm thinking we should be able to remove the `keepLoaded` flag altogether, and change the implementation of `askLoadedType` to preserve the same units loaded in the presentation compiler before and after its execution. Basically, if you want a unit to be kept loaded, you should call `askReload` first, and then `askLoadedType`. However, to reduce impact, I think the changes carried by this commit will help us estimate if the solution I just outlined is viable (because `askLoadeType` won't be keeping units loaded by default, which wasn't the case with the former implementation). (While the patch was mostly contributed by @huitseeker, @dotta has edited the commit message to preserve the comments in the PR https://github.com/scala/scala/pull/3209)
* | | SI-6913 Fixing semantics of Future fallbackTo to be according to docsHeather Miller2013-12-052-4/+4
| |/ |/| | | | | Origin: viktorklang@1bbe854
* | SI-7458 Pres. compiler must not observe trees in silent modeJason Zaugg2013-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Otherwise we can think that `+` in `1 + BigInt(2)` refers to a method in `Int`. In general, this protects the IDE from observing results from "exploratory" typing which is discarded as the compiler backtracks to another possibility. This protection subsumes the condition that checked for overloaded types: presentation/t7458 now passes without this.
* | SI-7548 Test to demonstrate residual exploratory typing bugJason Zaugg2013-12-023-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | We shouldn't observe tree types under silent mode. The enclosed test is a standalone version of `1 + BigInt(2)`, a standard example of exploratory typing in Scala. Once we determine that none of the `+` methods in `Int` accepts (possibly implicitly coerced `BigInt`), we have to backtrack and look for a view from `Int => { +(_: BigInt): ? }`. The next commit will correct the problem.
* | SI-7548 askTypeAt returns the same type whether the source was fully or ↵Mirco Dotta2013-12-023-0/+25
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | targeted type-checked When asking for targeted typecheck, the located tree may have overloaded types is the source isn't yet fully typechecked (e.g., a select tree for an overloaded method). This is problematic as it can lead to unknown 'hovers', broken hyperlinking that suddenly starts working, unresolved ScalaDoc comments, and similar, in the Scala IDE. With this commit we are hardening the contract of `askTypeAt` to return the same type whether the file was fully type-checked or targeted type-checked. This is done by preventing the typechecker to stop too early if the `located` tree has an overloaded type. Furthermore, I'm assuming that if `located.tpe` is of type `OverloadedType`, by letting the compiler carry-on the typechecking, the `located.tpe` will eventually be resolved to a non-overloaded type. Said otherwise, I expect the targeted typechecking will always terminate (if my reasoning isn't sound, please say so). The test provided with this commit demonstrates the new behavior (the position used to execute the test is resolved to the `foo` method's call). In fact, before this commit, executing the test returned the following: (x: Int, y: String)Unit <and> (x: String)Unit <and> (x: Int)Unit Showing that the tree's type is an overloaded type. The ambiguity is fixed by this commit, and in fact the test's output is now: (x: Int)Unit
* Merge pull request #3180 from xeno-by/topic/toolbox-rangeposJason Zaugg2013-11-262-0/+9
|\ | | | | teaches toolbox about -Yrangepos
| * [nomaster] teaches toolbox about -YrangeposEugene Burmako2013-11-222-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | Unlike in master, in 2.10.x enabling -Yrangepos requires instantiating Global with mixed in RangePositions trait. Same story for toolboxes. Just setting Yrangepos is not enough - one needs to mix in RangePositions into ToolboxGlobal. I didn’t know that back then, so now I’m fixing the oversight. The commit is marked as [nomaster], because -Yrangepos doesn’t need special treatment in master.
* | SI-8005 Fixes NoPositon error for updateDynamic callsSimon Schaefer2013-11-262-0/+42
| | | | | | | | | | | | | | | | Previously there occurred a NoPosition error when one asks for position information in the AST because no positions were set to the trees created during the transformation for updateDynamic calls. This commit applies range positions to the trees in order to being able to highlight them inside of the scala-ide.
* | SI-8004 Resolve NoPosition error for applyDynamicNamed method callSimon Schaefer2013-11-262-0/+40
| | | | | | | | | | | | | | | | | | Previously, there were no positions created for the tuples that are generated while doing the transformation for an applyDynamicNamed call. This led to an NoPosition error in scalac when one tries to show position information in the AST. Furthermore, this simplifies semantic highlighting in the scala-ide because no position information for color ranges have to be created anymore.
* | SI-7463,SI-8003 Correct wrong position for {select,apply}Dynamic callsSimon Schaefer2013-11-265-4/+82
|/ | | | | | | | | | | | The new positions are range positions that directly refer to the beginning and the end of the method calls in the sources instead of simply point to the beginning of the expression. This allows the scala-ide to semantically highlight select- and applyDynamic method calls, because it has only to traverse the tree and apply the color ranges to the given position ranges. This also fixes the position marker of an error messages related to a wrong Dynamic method signature.
* Merge pull request #3166 from skyluc/issue/completion-import-object-7280-210Jason Zaugg2013-11-2224-16/+931
|\ | | | | Backport of
| * [nomaster] SI-7280 Scope completion not returning members provided by importsLuc Bourlier2013-11-213-0/+208
| | | | | | | | | | | | | | | | | | Updates localeContext() to return the best context possible when there are none directly associated with the given position. It happens when an expression cannot be successfully typed, as no precise ContextTree covers the expression location, or if the position is not inside any expression. Adds corresponding tests (cherry picked from commit 3028327e2a2b553b12ee45519413515c8aa0865f)
| * [nomaster] Adds test cases for scope completionLuc Bourlier2013-11-2112-0/+707
| | | | | | | | (cherry picked from commit 3d55fe723f1af91f4d2db421f0e0965c583346dc)
| * [nomaster] Test infrastructure for scope completionJason Zaugg2013-11-219-16/+16
| | | | | | | | | | | | Adds a new marker /*_*/ to trigger scope completion test. Original type completion test oracles update for the tweaked output (cherry picked from commit 9c7c66ff7907e3ab814f0f4375eeaf6cdd230d5e)
* | SI-7915 Corrected range positions created during default args expansionMirco Dotta2013-11-193-0/+28
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Merge pull request #3110 from xeno-by/topic/7776-backportEugene Burmako2013-11-082-0/+12
|\ | | | | [backport] SI-7776 post-erasure signature clashes are now macro-aware
| * [backport] SI-7776 post-erasure signature clashes are now macro-awareEugene Burmako2013-11-082-0/+12
| | | | | | | | | | | | | | "double definition: macro this and method that have same type after erasure" This error doesn't make sense when macros are involved, because macros expand at compile-time, where we're not affected by erasure. Moreover, macros produce no bytecode, which means that we're safe from VerifyErrors.
* | Merge pull request #3105 from retronym/ticket/completionGrzegorz Kossakowski2013-11-083-0/+44
|\ \ | |/ |/| Fix completion after application with implicit arguments
| * Fix completion after application with implicit argumentsJason Zaugg2013-11-063-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | `List(1, 2, 3).map(f).<ctrl-space>` now works; before the tree had the type `(bf: CanBuildFrom[...]):...` and did not contribute completions from the result type. This commit checks if the tree has an implicit method type, and typechecks it as a qualifier. That is enough to get to `adaptToImplicitMethod` in the type checker, infer the implicit arguments, and compute the final result type accordingly.
* | Merge pull request #3097 from paulp/issue/6546-for-210James Iry2013-11-063-0/+15
|\ \ | | | | | | SI-6546 InnerClasses attribute refers to absent class
| * | SI-6546 InnerClasses attribute refers to absent classPaul Phillips2013-11-043-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At issue is that the optimizer would eliminate closure classes completely, then neglect to eliminate those classes from the container's InnerClasses attribute. This breaks tooling which expects those entries to correspond to real classes. The code change is essentially mgarcia's - I minimized it and put the caches in perRunCaches, and added the test case which verifies that after being compiled under -optimise, there are no inner classes. Before/after: 7,8d6 < InnerClasses: < public final #22; //class A_1$$anonfun$f$1 37,45c35,40 < #21 = Utf8 A_1$$anonfun$f$1 < #22 = Class #21 // A_1$$anonfun$f$1 < #23 = Utf8 Code --- > #21 = Utf8 Code
* / SI-4012 Mixin and specialization work wellVlad Ureche2013-11-052-0/+22
|/ | | | The bug was fixed along with SI-7638 in 504b5f3.
* Merge pull request #3072 from retronym/backport/7519Adriaan Moors2013-10-245-0/+51
|\ | | | | [nomaster] SI-7519 Less brutal attribute resetting in adapt fallback
| * SI-7519: Additional test case covering sbt/sbt#914Mark Harrah2013-10-233-0/+26
| | | | | | | | (cherry picked from commit e72c32db03b44d6eaf1c1872765a578c5445e15f)
| * [nomaster] SI-7519 Less brutal attribute resetting in adapt fallbackJason Zaugg2013-10-232-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | Prefers `resetLocalAttrs` over `resetAllAttrs`. The latter loses track of which enclosing class of the given name is referenced by a `This` node which prefixes the an applied implicit view. The code that `resetAllAttrs` originally landed in: https://github.com/scala/scala/commit/d4c63b#L6R804 Cherry picked from 433880e91cba9e1e926e9fcbf04ecd4aeb1d73eb Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
* | [nomaster] SI-6026 backport getResource bug fixSom Snytt2013-10-182-0/+18
|/ | | | | Submitted to master under SI-4936, this fix allows :javap to work when tools.jar is discovered by REPL.
* Disable tests for SI-7020Jason Zaugg2013-10-173-0/+0
| | | | | | | | | | | | | | | | | | These are still impudently being non-deterministic. I've reopened the ticket so we can take another swing at it. A well targetted s/HashMap/LinkedHashMap/ will almost certainly be the salve. fail - neg/t7020.scala [output differs]% scalac t7020.scala t7020.scala:3: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^ t7020.scala:10: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^
* Disable flaky presentation compiler test.Jason Zaugg2013-10-175-0/+0
| | | | | | | | Francois is investigating the root cause as part of his work on stabilizing Scaladoc preview in the IDE. The test seems to only fail on the windows nightly build. I suspect this is due to a slower or loaded machine.
* Merge pull request #2985 from retronym/ticket/7783Jason Zaugg2013-10-035-10/+33
|\ | | | | Don't issue deprecation warnings for inferred TypeTrees