summaryrefslogtreecommitdiff
path: root/test/files/pos
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5102 from milessabin/2.12.xJason Zaugg2016-05-2718-0/+206
|\ | | | | SI-2712 Add support for partial unification of type constructors
| * SI-2712 Add support for higher order unificationMiles Sabin2016-05-2418-0/+206
| |
* | Rename -Yopt to -opt, -Yopt-warnings to -opt-warningsLukas Rytz2016-05-256-6/+6
| | | | | | | | Keep -Yopt-inline-heuristics and -Yopt-trace unchanged
* | Merge pull request #4935 from som-snytt/issue/8044-tickvarAdriaan Moors2016-05-241-0/+15
|\ \ | |/ |/| SI-8044 Allow binding backquoted varid in patterns
| * SI-8044 Allow any id in explicit pattern bindingSom Snytt2016-05-201-0/+8
| | | | | | | | | | | | | | | | | | | | Allows arbitrary identifier in `X @ pat`, including non-varids. This goes to regularity. Users of this syntax are not likely to be confused by the "backquoted var id is stable" rule. Also for sequence pattern, `X @ _*`.
| * SI-8044 Allow binding backquoted varid in patternsSom Snytt2016-05-201-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a varid could not be backquoted, so that it was not possible to introduce variables with names such as `type` in a match expression. This commit allows backquoted varids in `case x @ _` and `case x: Int`. In neither position is a stable id accepted, that is, an id with leading uppercase. Therefore, this commit merely relaxes the backquoted varid to be taken as a normal varid in these contexts.
* | Merge pull request #5106 from milessabin/topic/hkgadtAdriaan Moors2016-05-231-0/+35
|\ \ | | | | | | SI-9760 Fix for higher-kinded GADT refinement
| * | Added pos test with multiple cases; added neg tests.Miles Sabin2016-05-061-4/+21
| | |
| * | Added missing result type to test.Miles Sabin2016-04-201-1/+1
| | |
| * | SI-9760 Fix for higher-kinded GADT refinementMiles Sabin2016-04-191-0/+18
| | |
* | | Merge pull request #4988 from som-snytt/issue/backtick-barAdriaan Moors2016-05-201-0/+7
|\ \ \ | |_|/ |/| | SI-9665 Backquoted vbar in extractor pattern
| * | SI-9665 Backquoted vbar in extractor patternSom Snytt2016-03-151-0/+7
| | | | | | | | | | | | Allow an infix extractor named `|`, when backquoted.
* | | Test case for SI-5183, tagged primitives in case classes (#5144)Ben Hutchison2016-05-192-0/+42
| | | | | | | | | Test for SI-7088, arrays containing tagged primitives
* | | SI-9397 Add "_root_" to "GenUtils.scalaFactoryCall" to avoid the scala ↵Shixiong Zhu2016-05-111-0/+12
| | | | | | | | | | | | | | | package name conflits (#5150) When a user imports some package ending with `scala`, the macro expansion of TypeTag may not work because it uses `scala.collection.immutable.List` but it's overrided. This patch adds the `_root_` prefix to avoid the scala package name conflits. Of cause, after this fix, importing a package ending with `_root_` has the same issue. However, people rarely do that.
* | | Emit a warning when a constant expression evaluates to an ↵Olli Helenius2016-05-023-0/+8
| | | | | | | | | | | | ArithmeticException (#5123)
* | | SI-9684 Deprecate JavaConversionsSom Snytt2016-04-226-12/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit conversions are now in package convert as ImplicitConversions, ImplicitConversionsToScala and ImplicitConversionsToJava. Deprecated WrapAsJava, WrapAsScala and the values in package object. Improve documentation.
* | | Merge pull request #5096 from lrytz/traitParentsLukas Rytz2016-04-201-0/+4
|\ \ \ | | | | | | | | Ensure ClassBTypes constructed from symbol and classfile are identical
| * | | SD-98 don't emit unnecessary mixin forwardersLukas Rytz2016-04-121-0/+4
| | |/ | |/| | | | | | | | | | | | | | | | | | | In most cases when a class inherits a concrete method from a trait we don't need to generate a forwarder to the default method in the class. t5148 is moved to pos as it compiles without error now. the error message ("missing or invalid dependency") is still tested by t6440b.
* / | Remove dead-code runtime hash() methods.Sébastien Doeraene2016-04-131-4/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | | | ScalaRunTime had a bunch of overloads of the `hash()` method, but only the `Any` version is ever used by the codegen. Worse, their implementation was not in sync with the actual implementations in BoxesRunTime, called by the `Any` version. For example, hash(0x80000000L) != hash(0x80000000L: Any) This commit simply removes all of this dead code. Similarly, we remove BoxesRunTime.hashFromObject(), which was never called either.
* | Merge pull request #5068 from retronym/topic/jdk8ism2v2.12.0-M4Lukas Rytz2016-04-012-0/+10
|\ \ | | | | | | Accomodate and exploit new library, lang features JDK 8
| * | Java types and type parameters can be annotated since JSR 308Jason Zaugg2016-03-292-0/+10
| | |
* | | Merge pull request #4971 from adriaanm/genbcode-delambdafyAdriaan Moors2016-03-3118-15/+100
|\ \ \ | | | | | | | | Unify treatment of built-in functions and SAMs
| * | | typedFunction undoes eta-expansion regardless of expected typeAdriaan Moors2016-03-301-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | When recovering missing argument types for an eta-expanded method value, rework the expected type to a method type.
| * | | Additional SAM restrictions identified by JasonAdriaan Moors2016-03-264-8/+38
| | | | | | | | | | | | | | | | | | | | Also test roundtripping serialization of a lambda that targets a SAM that's not FunctionN (it should make no difference).
| * | | More fixes based on feedback by LukasAdriaan Moors2016-03-263-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Crucially, the fully-defined expected type must be checked for conformance to the original expected type!! The logic in adaptToSam that checks whether pt is fully defined probably needs some more thought. See pos/t8310 for a good test case. Argument type checking is a challenge, as we first check against a lenient pt (this lenient expected type has wildcards, and thus is not fully defined, but we should still consider sam adaptation a success even if we end up with wildcards for some unknown type parameters, they should be determined later).
| * | | Treat `Function` literals uniformly, expecting SAM or FunctionN.Adriaan Moors2016-03-262-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They both compile to INDY/MetaLambdaFactory, except when they occur in a constructor call. (TODO: can we lift the ctor arg expression to a method and avoid statically synthesizing anonymous subclass altogether?) Typers: - no longer synthesize SAMs -- *adapt* a Function literal to the expected (SAM/FunctionN) type - Deal with polymorphic/existential sams (relevant tests: pos/t8310, pos/t5099.scala, pos/t4869.scala) We know where to find the result type, as all Function nodes have a FunctionN-shaped type during erasure. (Including function literals targeting a SAM type -- the sam type is tracked as the *expected* type.) Lift restriction on sam types being class types. It's enough that they dealias to one, like regular instance creation expressions. Contexts: - No longer need encl method hack for return in sam. Erasure: - erasure preserves SAM type for function nodes - Normalize sam to erased function type during erasure, otherwise we may box the function body from `$anonfun(args)` to `{$anonfun(args); ()}` because the expected type for the body is now `Object`, and thus `Unit` does not conform. Delambdafy: - must set static flag before calling createBoxingBridgeMethod - Refactored `createBoxingBridgeMethod` to wrap my head around boxing, reworked it to generalize from FunctionN's boxing needs to arbitrary LMF targets. Other refactorings: ThisReferringMethodsTraverser, TreeGen.
| * | | Review feedback from LukasAdriaan Moors2016-03-261-1/+1
| | | |
| * | | SI-9449 sam expansion for explicitly eta-expanded methodAdriaan Moors2016-03-261-0/+19
| | | |
| * | | Refactor typedFunction, rework synthesizeSAMFunction for sammyAdriaan Moors2016-03-265-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `typedFunction` uniformly recognizes Single Abstract Method types and built-in `FunctionN` types, type checking literals regardless of expected type. `adapt` synthesizes an anonymous subclass of the SAM type, if needed to meet the expected (non-`FunctionN`) type. (Later, we may want to carry `Function` AST nodes with SAM types through the whole pipeline until the back-end, and treat them uniformly with built-in function types there too, emitting the corresponding `invokedynamic` & `LambdaMetaFactory` bytecode. Would be faster to avoid synthesizing all this code during type checking...) Refactor `typedFunction` for performance and clarity to avoid non-local returns. A nice perk is that the error message for missing argument types now indicates with `<error>` where they are missing (see updated check file). Allow pattern matching function literals when SAM type is expected (SI-8429). Support `return` in function body of SAM target type, by making the synthetic `sam$body` method transparent to the `enclMethod` chain, so that the `return` is interpreted in its original context. A cleaner approach to inferring unknown type params of the SAM method. Now that `synthesizeSAMFunction` operates on typed `Function` nodes, we can take the types of the parameters and the body and compare them against the function type that corresponds to the SAM method's signature. Since we are reusing the typed body, we do need to change owners for the symbols, and substitute the new method argument symbols for the function's vparam syms. Impl Notes: - The shift from typing as a regular Function for SAM types was triggered by limitation of the old approach, which deferred type checking the body until it was in the synthetic SAM type subclass, which would break if the expression was subsequently retypechecked for implicit search. Other problems related to SAM expansion in ctor args also are dodged now. - Using `<:<`, not `=:=`, in comparing `pt`, as `=:=` causes `NoInstance` exceptions when `WildcardType`s are encountered. - Can't use method type subtyping: method arguments are in invariant pos. - Can't use STATIC yet, results in illegal bytecode. It would be a better encoding, since the function body should not see members of SAM class. - This is all battle tested by running `synthesizeSAMFunction` on all `Function` nodes while bootstrapping, including those where a regular function type is expected. The only thing that didn't work was regarding Function0 and the CBN transform, which breaks outer path creation in lambdalift.
| * | | SI-9415 Turn on SAM by defaultJason Zaugg2016-03-268-8/+0
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Initial work to change settings and test by Svyatoslav Ilinskiy Thanks! To avoid cycles during overload resolution (which showed up during bootstrapping), and to improve performance, I've guarded the detection of SAM types in `isCompatible` to cases when the LHS is potentially compatible.
* | | Merge pull request #5008 from janekdb/2.12.x-remove-Predef-errorSeth Tisue2016-03-292-2/+2
|\ \ \ | | | | | | | | Remove deprecated Predef.error
| * | | Remove deprecated Predef.errorJanek Bogucki2016-03-262-2/+2
| |/ / | | | | | | | | | | | | | | | error was deprecated in 2.9.0 but remained to ensure compatibility with sbt. This changes follows on from an update to the latest sbt version (0.13.11).
* | | Merge pull request #5021 from szeiger/wip/remove-deprecationsSeth Tisue2016-03-291-1/+2
|\ \ \ | |/ / |/| | Seal collection classes that were annotated with deprecatedInheritance in 2.11.0
| * | Make some collection classes final or sealedStefan Zeiger2016-03-231-1/+2
| | | | | | | | | | | | | | | | | | | | | They were all annotated with `@deprecatedInheritance` in 2.11.0. Some deprecated classes are moved to new source files in order to seal the parent class. The package-private class `DoublingUnrolledBuffer` is moved from `scala.collection.parallel.mutable` to `scala.collection.mutable` in order to seal `UnrolledBuffer`.
* | | New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-181-4/+4
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | 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.
* | Remove -Y settings that are no longer used in 2.12Lukas Rytz2016-02-161-1/+1
| | | | | | | | | | | | 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-159-40/+3
|/
* Merge pull request #4868 from retronym/ticket/9542-comboJason Zaugg2016-02-101-0/+8
|\ | | | | SI-9542 Fix regression in value classes (served two ways)
| * SI-9542 Unify different reprs. of module type refsJason Zaugg2016-02-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by https://github.com/scala/scala/pull/4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds.
* | Merge pull request #4920 from lrytz/oldOptimizerTestsLukas Rytz2016-02-0325-664/+2
|\ \ | |/ |/| restore / rewrite various tests
| * Re-write and Re-enable optimizer testsLukas Rytz2016-02-0325-664/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite tests for new optimizer - SI-6941 - SI-2171 - t3430 - t3252 - t4840 - t2171 - t3430 - t3252 - t6157 - t6547 - t8062 - t8306 - t8359 - t9123 - trait-force-info - private-inline test cases for bugs fixed in the new optimizer - SI-9160, the unnecessary boxing mentioned in the ticket is optimzied since push-pop elimination (#4858). - SI-8796 - SI-8524 - SI-7807 fix flags file for t3420 remove an empty flags file remove unnecessary partest filters explicit inliner warnings in test t7582 Restore the lisp test. Removing the flags file - our build runs with the (new) optimizer enabled anyway. The test spent the past few years as an optimizer test in pos/ see https://issues.scala-lang.org/browse/SI-4512. The attempt may fail, but why not give it a try. $ git lg -S"lisp" ... | * | | | f785785 - SI-4579 Yoke the power of lisp.scala as a stress for the optimizer. (3 years, 8 months ago) <Jason Zaugg> ... * | | | | | | 622cc99 - Revert the lisp test. (3 years, 10 months ago) <Paul Phillips> ... * | | | | | | 97f0324 - Revived the lisp test. (3 years, 10 months ago) <Paul Phillips> ... * | 1e0f7dc - Imprison the lisp test, no review. (4 years, 4 months ago) <Paul Phillips> ... * | 6b09630 - "Freed the lisp test." Tweaked partest defaults... (4 years, 6 months ago) <Paul Phillips> ... * | fec42c1 - Lisp test wins again, no review. (4 years, 8 months ago) <Paul Phillips> ... * | 1c2d44d - Restored the lisp.scala test. (4 years, 8 months ago) <Paul Phillips> ... * | 15ed892 - Temporarily sending lisp.scala to be interprete... (4 years, 8 months ago) <Paul Phillips> ...
* | SI-9398 Treat case classes as one-element ADTs for analysisJason Zaugg2016-01-291-0/+1
| | | | | | | | | | | | | | | | Currently, exhaustivity analysis only runs for scrutinees with a sealed type. This commit treats any case class as a one-element, sealed type to enable additional analysis, such as in the new test case.
* | SI-9630 Fix spurious warning related to same-named case accessorsJason Zaugg2016-01-299-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.
* SI-9622 Native method may be privateSom Snytt2016-01-131-0/+4
| | | | | | This was lost in a refactor. https://github.com/scala/scala/commit/290f687fb6ab91b6aef62d871036ddc3829f12b4
* Merge commit '8eb1d4c' into merge-2.11-to-2.12-nov-24Lukas Rytz2015-11-243-0/+15
|\
| * Attacking exponential complexity in TypeMapsJason Zaugg2015-11-133-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't normalize existentials during the `contain`-s type map; `ExistentialType#normalize' calls contains internally and an exponential blowup ensues. - Ensure that the type map used in variance validation never returns modified types in order to avoid needless cloning of symbols. The enclosed test case still gets stuck in Uncurry, thanks to the way that `TypeMap#mapOver(List[Symbol])` recurses through the type first to check whether the type map would be an no-op or not. If not, it repeats the type map with cloned symbols. Doing the work twice at each level of recursion blows up the complexity. Removing that "fast path" allows the enclosed test to compile completely. As at this commit, it gets stuck in uncurry, which dealiases `s.List` to `s.c.i.List` within the type. Some more background on the troublesome part of `TypeMap`: http://lrytz.github.io/scala-aladdin-bugtracker/displayItem.do%3Fid=1210.html https://github.com/scala/scala/commit/f8b2b21050e7a2ca0f537ef70e3e0c8eead43abc
| * Merge pull request #4757 from lrytz/t9375-2.11Lukas Rytz2015-09-221-0/+18
| |\ | | | | | | [backport] SI-9375 add synthetic readResolve only for static modules
| | * [backport] SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-09-221-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | For inner modules, the synthetic readResolve method would cause the module constructor to be invoked on de-serialization in certain situations. See the discussion in the ticket. Adds a comprehensive test around serializing and de-serializing modules.
* | | Merge pull request #4822 from retronym/ticket/9178Lukas Rytz2015-11-184-0/+22
|\ \ \ | | | | | | | | SI-9178 Don't eta expand to an Function0-like SAM expected type