summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-7474 Record extra errors in Throwable#suppressedExceptionsJason Zaugg2016-03-292-5/+12
| | | | | | | ... in parallel collection operations. Followup to bcbe38d18, which did away with the the approach to use a composite exception when more than one error happened.
* Merge pull request #5053 from som-snytt/issue/9314Lukas Rytz2016-03-232-13/+44
|\ | | | | SI-9314 Marginal edge case to warn-missing-interp
| * SI-9314 No warn on ${nonid}Som Snytt2016-03-232-6/+25
| | | | | | | | | | Use the sym test on an expr that happens to be a subset of idents and is not in scope. Other `${ operator_* }` warn.
| * SI-9314 Ignore "${}"Som Snytt2016-03-201-0/+2
| | | | | | | | | | | | | | As an Easter egg, let "${} $x" forego the check on `x`. In other words, empty expression interpolation looks too degenerate to check.
| * SI-9314 Don't warn on "$pkg"Som Snytt2016-03-202-8/+18
| | | | | | | | | | Edge cases of things not to warn about include package names.
* | Support :require when using the flat classpath representation.Lukas Rytz2016-03-222-28/+23
| | | | | | | | | | | | :require was re-incarnated in https://github.com/scala/scala/pull/4051, it seems to be used by the spark repl. This commit makes it work when using the flat classpath representation.
* | Merge pull request #5043 from dongjoon-hyun/fix_typos_in_spec_and_commentsJason Zaugg2016-03-211-1/+1
|\ \ | | | | | | Fix some typos in `spec` documents and comments.
| * | Fix some typos in `spec` documents and comments.Dongjoon Hyun2016-03-151-1/+1
| |/
* | Remove manual mixins in JFunctionN.v2.12.0-M3-dc9effeJason Zaugg2016-03-1824-264/+195
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These manual mixins were forwarding to the impl classes have just been removed. We can now rely on default methods instead. Update Tests: - Fix test/files/pos/t1237.scala, we can't have an outer field in an interface, always use the outer method. - Don't crash on meaningless trait early init fields test/files/neg/t2796.scala - Remove impl class relate parts of inner class test - Remove impl class relate parts of elidable test - Remove impl class related reflection test. - Remove test solely about trait impl classes renaming - Update check file with additional stub symbol error - Disable unstable parts of serialization test. - TODO explain, and reset the expectation
* | New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-1810-77/+106
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, concrete methods in traits were encoded with "trait implementation classes". - Such a trait would compile to two class files - the trait interface, a Java interface, and - the implementation class, containing "trait implementation methods" - trait implementation methods are static methods has an explicit self parameter. - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method - classes that mixin a trait install "trait forwarders", which implement the abstract method in the interface by forwarding to the trait implementation method. The new encoding: - no longer emits trait implementation classes or trait implementation methods. - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) pave the way) - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`) - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here. - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution. Here's an example: ``` trait T { println("T") def m1 = m2 private def m2 = "m2" } trait U extends T { println("T") override def m1 = super[T].m1 } class C extends U { println("C") def test = m1 } ``` The old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580 Some notes in the implementation: - No need to filter members from class decls at all in AddInterfaces (although we do have to trigger side effecting info transformers) - We can now emit an EnclosingMethod attribute for classes nested in private trait methods - Created a factory method for an AST shape that is used in a number of places to symbolically bind to a particular super method without needed to specify the qualifier of the `Super` tree (which is too limiting, as it only allows you to refer to direct parents.) - I also found a similar tree shape created in Delambdafy, that is better expressed with an existing tree creation factory method, mkSuperInit.
* Merge pull request #4974 from szeiger/wip/patmat-outertestAdriaan Moors2016-03-146-2/+145
|\ | | | | More conservative optimization for unnecessary outer ref checks
| * Improved outer ref checking in pattern matches:Adriaan Moors2016-03-076-2/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old algorithm omitted necessary outer ref checks in some places. This new one is more conservative. It only omits outer ref checks when the expected type and the scrutinee type match up, or when the expected type is defined in a static location. For this specific purpose the top level of a method or other code block (which is not a trait or class definition) is also considered static because it does not have a prefix. This change comes with a spec update to clarify the prefix rule for type patterns. The new wording makes it clear that the presence of a prefix is to be interpreted in a *semantic* way, i.e. the existence of a prefix determines the necessity for an outer ref check, no matter if the prefix is actually spelled out *syntactically*. Note that the old outer ref check implementation did not use the alternative interpretation of requiring prefixes to be given syntactically. It never created an outer ref check for a local class `C`, no matter if the pattern was `_: C` or `_: this.C`, thus violating both interpretations of the spec. There is now explicit support for unchecked matches (like `case _: (T @unchecked) =>`) to suppress warnings for unchecked outer refs. `@unchecked` worked before and was used for this purpose in `neg/t7721` but never actually existed as a feature. It was a result of a bug that prevented an outer ref check from being generated in the first place if *any* annotation was used on an expected type in a type pattern. This new version will still generate the outer ref check if an outer ref is available but suppress the warning otherwise. Other annotations on type patterns are ignored. New tests are in `neg/outer-ref-checks`. The expected results of tests `neg/t7171` and `neg/t7171b` have changed because the compiler now tries to generate additional outer ref checks that were not present before (which was a bug).
* | Merge 2.11.x into 2.12.xAdriaan Moors2016-03-145-0/+70
|\ \ | | | | | | | | | Resolved conflicts as in b0e05b67c7
| * | SI-9425 Fix a residual bug with multi-param-list case classesJason Zaugg2016-03-041-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | During code review for the fix for SI-9546, we found a corner case in the SI-9425 that remained broken. Using `finalResultType` peels off all the constructor param lists, and solves that problem.
| * | SI-9546 Fix regression in rewrite of case apply to constructor callJason Zaugg2016-03-021-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In SI-9425, I disabled the rewrite of `CaseClass.apply(x)` to `new CaseClass(x)` if the constructor was was less accessible than the apply method. This solved a problem with spurious "constructor cannot be accessed" errors during refchecks for case classes with non-public constructors. However, for polymorphic case classes, refchecks was persistent, and even after refusing to transform the `TypeApply` within: CaseClass.apply[String]("") It *would* try again to transform the enclosing `Select`, a code path only intended for monomorphic case classes. The tree has a `PolyType`, which foiled the newly added accessibility check. I've modified the call to `isSimpleCaseApply` from the transform of `Select` nodes to exclude polymorphic apply's from being considered twice.
| * | Refactor transform of case apply in refchecksJason Zaugg2016-03-023-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've identified a dead call to `transformCaseApply` that seems to date back to Scala 2.6 vintages, in which case factory methods were a fictional companion method, rather than a real apply method in a companion module. This commit adds an abort in that code path to aide code review (if our test suite still passes, we know that I've removed dead code, rather than silently changing behaviour.) The following commit will remove it altogether I then inlined a slightly clunky abstraction in the two remaining calls to `transformCaseApply`. It was getting in the way of a clean fix to SI-9546, the topic of the next commit.
| * | Update partest to 1.0.12, test case for reporting invalid flagsLukas Rytz2016-02-175-2/+12
| | | | | | | | | | | | | | | | | | Conflicts: test/files/pos/t3420.flags versions.properties
* | | Merge pull request #5023 from dongjoon-hyun/fix_link_descriptionSeth Tisue2016-03-141-2/+2
|\ \ \ | | | | | | | | Fix link descriptions
| * | | Fix link descriptions.Dongjoon Hyun2016-03-131-2/+2
| | | |
* | | | Remove unused classes from ScaladocFelix Mulder2016-03-145-192/+4
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several elements of the old Scaladoc are not in use anymore. To help with any reverting, the removal of these is done in a single commit (this one). The removal includes: - Old `Index`, the old top "index.html" - The letter index (with "_" and "deprecated") - The old `Template` which is superceded by `Entity`
* | / SI-9658 Fix crosstalk between partial fun. and GADT matchJason Zaugg2016-03-041-0/+10
| |/ |/| | | | | | | | | | | | | | | | | | | | | When typechecking the synthetic default case of a pattern matching anonymous partial function, we failed to create a new `Context`. This led to crosstalk with the management of the saved type bounds of an enclosing GADT pattern match. This commit avoids the direct call to `typeCase` and instead indirects through `typedCases`, which spawns a new nested typer context, and hence avoids the crosstalk when `restoreSavedTypeBounds` runs.
* | Unclutter scaladoc entity membersFelix Mulder2016-03-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit attempts to fix some minor annoyances regarding the UI when it comes to how things are shown. I.e. the complete definition is now hidden. Long signatures like: ```scala class HashMap[A, +B] extends AbstractMap[A, B] with Map[A, B] with MapLike[A, B, HashMap[A, B]] with Serializable with CustomParallelizable[(A, B), ParHashMap[A, B]] ``` will be reduced to: `class HashMap[A, +B]`. Full signature will be shown on hover and unfold. The package-view has been tweaked to look better on non-HiDPI displays. Also, subpackages to current package are now displayed before other entities.
* | Add package view to scaladocFelix Mulder2016-02-261-5/+0
| | | | | | | | | | | | | | | | The package view shows the current package's: - siblings - children packages - path to root package - child entities (objects, traits, abstract types and classes)
* | Merge pull request #4968 from lrytz/oldOptCleanupAdriaan Moors2016-02-2459-155/+108
|\ \ | | | | | | Remove -Y settings that are no longer used in 2.12
| * | Remove -Y settings that are no longer used in 2.12Lukas Rytz2016-02-1645-111/+50
| | | | | | | | | | | | | | | | | | Added a deprecation warning for `-optimize`. Later we'll also graduate `-Yopt` to `-opt`, probably for 2.12.0-M5.
| * | Rewrite a few more tests to the new optimizerLukas Rytz2016-02-1515-44/+58
| | |
* | | Merge pull request #4958 from adriaanm/typerefrefactorAdriaan Moors2016-02-241-2/+2
|\ \ \ | | | | | | | | Simplify TypeRef hierarchy. baseType returns NoType, as needed for isSubtype. Also improves performance.
| * | | SI-9540 typedFunction is erasure awareAdriaan Moors2016-02-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When typer is running during erasure, must assign erased FunctionType in typedFunction. This removes a bunch of unneeded casts now we no longer assign a half-erased FunctionType. I poked around a bit, and it looks like erasure doesn't want typer to erase built-in types (like Unit/Any/Nothing). They are already treated specially during erasure.
* | | | Add doc annotation `@shortDescription` to enable explicit synopsisFelix Mulder2016-02-223-1/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Entities with this annotation will be able to control what is shown in the method summary on entity pages as well as the hover text on search results. Review: @VladUreche
* | | | Merge pull request #4969 from lrytz/valPatternOptStefan Zeiger2016-02-178-182/+183
|\ \ \ \ | | | | | | | | | | Tests for optimizing val patterns
| * | | | Clean up some bytecode testsLukas Rytz2016-02-166-168/+111
| | | | |
| * | | | Tests for optimizing val patternsLukas Rytz2016-02-162-14/+72
| | |/ / | |/| | | | | | | | | | Fixes https://github.com/scala/scala-dev/issues/28
* / | | Scaladoc: Add new search, featuring entity and member searchFelix Mulder2016-02-175-59/+29
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds a revamped search function for the scaladoc tool. It also contains a number of small fixes for HTML-layout and JavaScript issues. The search is implemented by enhancing the scheduler and using JavaScript promises. List of changes/additions: * Revamped search functionality - Search members as well as entities - Preserve keyboard navigation - Scroll to selected entity if outside of viewport - Non-blocking, cancelable * Display of library name (top left) * Refactored scheduler * Cleanup of HTML layout - Remove left pane - Better mobile layout, no need for dynamic offsets - Remove unused element classes - Remove iframe structure - Better layout for kinds
* | | SD-79 don't issue spurious inliner warnings under l:projectLukas Rytz2016-02-151-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When enabling `-Yopt:inline-project` (or `-Yopt:l:project`), the inliner would spuriously warn about callsites to methods marked `@inline` that are read from the classpath (not being compiled currently). This patch introduces yet another field to the `Callsite` class, which is growing a bit too large. But the call graph representation will get an overhaul when implementing the new inliner heuristics (2.12.0-M5), so this is just a temporary fix that would be nice to have in M4.
* | | Merge pull request #4963 from lrytz/simplerBranchingLukas Rytz2016-02-153-5/+127
|\ \ \ | | | | | | | | Generate leaner code for branches
| * | | Avoid generating ACONST_NULL; POP; ACONST_NULL when loading nullLukas Rytz2016-02-142-1/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When loading a value of type scala.runtime.Null$ we need to add POP; ACONST_NULL, see comment in BCodeBodyBuilder.adapt. This is however not necessary if the null value is a simple ACONST_NULL. This patch eliminates that redundancy.
| * | | Generate leaner code for branchesLukas Rytz2016-02-131-4/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GenBCode used to generate more bytecode for branching instructions than GenASM. A simple method def f(x: Int, b: Boolean) = if (b) 1 else 2 would generate ILOAD 2 IFNE L1 GOTO L2 L1 ICONST_1 GOTO L3 L2 ICONST_2 L3 IRETURN If the conditional branch is negated (IFEQ) the GOTO is unnecessary. While -Yopt:l:method would clean this up, it's also not too hard to generate the leaner bytecode in the first place.
* | | | SI-8790 test caseLukas Rytz2016-02-131-0/+20
|/ / / | | | | | | | | | | | | Tuples created for pattern matching are eliminated since https://github.com/scala/scala/pull/4858
* | | Merge pull request #4944 from lrytz/stringBuilderNoBoxLukas Rytz2016-02-123-37/+115
|\ \ \ | | | | | | | | SI-9571 Avoid boxing primitives in string concatenation
| * | | SI-9571 Avoid boxing primitives in string concatenationMarko Elezovic2016-02-062-37/+100
| | | |
| * | | test case for optimizing BooleanOrdering.compareLukas Rytz2016-02-041-0/+15
| | | |
* | | | Merge pull request #4896 from retronym/topic/indy-all-the-thingsJason Zaugg2016-02-128-23/+152
|\ \ \ \ | | | | | | | | | | Use invokedynamic for structural calls, symbol literals, lambda ser.
| * | | | Use invokedynamic for structural calls, symbol literals, lamba ser.Jason Zaugg2016-01-298-23/+152
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous encodings created static fields in the enclosing class to host caches. However, this isn't an option once emit code in default methods of interfaces, as Java interfaces don't allow private static fields. We could continue to emit fields, and make them public when added to traits. Or, as chosen in this commit, we can emulate a call-site specific static field by using invokedynamic: when the call site is linked, our bootstrap methid can perform one-time computation, and we can capture the result in the CallSite. To implement this, I've allowed encoding of arbitrary invokedynamic calls in ApplyDynamic. The encoding is: ApplyDynamic( NoSymbol.newTermSymbol(TermName("methodName")).setInfo(invokedType) Literal(Constant(bootstrapMethodSymbol)) :: ( Literal(Constant(staticArg0)) :: Literal(Constant(staticArgN)) :: Nil ) ::: (dynArg0 :: dynArgN :: Nil) ) So far, static args may be `MethodType`, numeric or string literals, or method symbols, all of which can be converted to constant pool entries. `MethodTypes` are transformed to the erased JVM type and are converted to descriptors as String constants. I've taken advantage of this for symbol literal caching and for the structural call site cache. I've also included a test case that shows how a macro could target this (albeit using private APIs) to cache compiled regexes. I haven't managed to use this for LambdaMetafactory yet, not sure if the facility is general enough.
* | | | | Merge pull request #4957 from retronym/topic/merge-2.11.x-to-2.12.x-20160210Seth Tisue2016-02-111-0/+28
|\ \ \ \ \ | | | | | | | | | | | | Merge 2.11.x to 2.12.x [ci:last-only]
| * \ \ \ \ Merge branch '2.11.x' into topic/merge-2.11.x-to-2.12.x-20160210Jason Zaugg2016-02-101-0/+28
| |\ \ \ \ \ | | | |_|_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/library/scala/collection/Iterator.scala | `-- trivial conflicts only. Parens were added to the next() calls in 2.12.x, while in the meantime `{Concat,Join}Iterator` were optimized in 2.11.x
| | * | | | Merge pull request #4937 from szeiger/issue/9623-2.11Seth Tisue2016-02-081-0/+28
| | |\ \ \ \ | | | | | | | | | | | | | | SI-9623 Avoid unnecessary hasNext calls in JoinIterator & ConcatIterator
| | | * | | | SI-9623 Avoid unnecessary hasNext calls in JoinIterator & ConcatIteratorStefan Zeiger2016-02-011-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These iterator implementations are used to concatenate two (JoinIterator) or more (ConcatIterator) other iterators with `++`. They used to perform many unnecessary calls to the child iterators’ `hasNext` methods. This improved state machine-based implementation reduces that number to the bare minimum, i.e. iterating over concatenated iterators with `foreach` calls the children's `hasNext` methods a total of (number of children) + (number of elements) times, the same as when iterating over all children separately.
* | | | | | | Merge pull request #4955 from som-snytt/issue/8685-depr-caseLukas Rytz2016-02-104-1/+107
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-9650 Refchecks on case apply transform
| * | | | | | | SI-9650 Refchecks on case apply transformSom Snytt2016-02-104-1/+107
| | |_|_|_|_|/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Apply checks for unsavoriness when transforming a case apply.
* | | | | | | Merge pull request #4924 from ShaneDelmore/SI-9452Lukas Rytz2016-02-103-1/+23
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | SI-9452: Extend BigDecimal with Ordered for java interop