summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Add since arg to deprecationWarning and use itSimon Ochsenreither2016-05-292-6/+6
|
* Lower-case spelling of @deprecated messagesSimon Ochsenreither2016-05-285-14/+13
|
* SI-9084 Add `since` (if available) to deprecation warningsSimon Ochsenreither2016-05-2815-49/+49
|
* Merge pull request #5102 from milessabin/2.12.xJason Zaugg2016-05-278-0/+78
|\ | | | | SI-2712 Add support for partial unification of type constructors
| * SI-2712 Add support for higher order unificationMiles Sabin2016-05-248-0/+78
| |
* | Rename -Yopt to -opt, -Yopt-warnings to -opt-warningsLukas Rytz2016-05-256-7/+7
| | | | | | | | Keep -Yopt-inline-heuristics and -Yopt-trace unchanged
* | Merge pull request #4935 from som-snytt/issue/8044-tickvarAdriaan Moors2016-05-244-0/+16
|\ \ | |/ |/| SI-8044 Allow binding backquoted varid in patterns
| * SI-8044 Test for quoted not-a-varidSom Snytt2016-05-202-0/+8
| |
| * SI-8044 Allow binding backquoted varid in patternsSom Snytt2016-05-202-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | 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 #5179 from liff/topic/SI-9781Adriaan Moors2016-05-232-0/+8
|\ \ | | | | | | Check left side of an assignment expression for errors; fixes SI-9781
| * | SI-9781 Don't convert erroneous expression to assignmentOlli Helenius2016-05-202-0/+8
| |/ | | | | | | | | | | | | | | | | `convertToAssignment` is triggered on a type error but it doesn't seem to really care what the error is as long as the expression can be converted to an assignment expression. This patch fixes that by checking whether the qualifier of the selection contains any errors before deciding to continue with the conversion.
* | Merge pull request #5106 from milessabin/topic/hkgadtAdriaan Moors2016-05-232-0/+66
|\ \ | | | | | | SI-9760 Fix for higher-kinded GADT refinement
| * | Added pos test with multiple cases; added neg tests.Miles Sabin2016-05-062-0/+66
| | |
* | | SI-9361 fixed assert allowing display of improved error message.Miles Sabin2016-05-142-0/+16
| |/ |/|
* | SI-9045 Error on recursive ctorSom Snytt2016-05-045-3/+18
| | | | | | | | If the constructor invokes itself, say so.
* | More efficient code for deciding if a mixin forwarder is needed (#5116)Lukas Rytz2016-04-254-0/+15
| | | | | | | | Also adds a warning on junit test methods that compile as default methods.
* | Rename the (deprecated) implicit conversion methods in JavaConversionsLukas Rytz2016-04-222-0/+21
| | | | | | | | | | | | Provide higher-priority implicit conversion methods whose names don't clash with methods in JavaConverters. This allows implicit conversions to work when importing both JavaConverters._ and JavaConversions._.
* | SI-9684 Deprecate JavaConversionsSom Snytt2016-04-225-4/+23
| | | | | | | | | | | | | | | | | | Implicit conversions are now in package convert as ImplicitConversions, ImplicitConversionsToScala and ImplicitConversionsToJava. Deprecated WrapAsJava, WrapAsScala and the values in package object. Improve documentation.
* | SD-98 don't emit unnecessary mixin forwardersLukas Rytz2016-04-123-21/+1
|/ | | | | | | | 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.
* LMF cannot instantiate SAM of trait with non-trait superclassAdriaan Moors2016-03-291-1/+1
| | | | | | | | | | | | Also, drop AbstractFunction for parent of anonymous subclass of function type that must have its class spun up at compile time (rather than at linkage time by LambdaMetaFactory). This revealed an old problem with typedTemplate, in which parent types may be normalized at the level of trees, while this change does not get propagated to the class's info in time for the constructor to be located when we type check the primary constructor.
* SAM conversion can be disabled using `-Xsource:2.11`Adriaan Moors2016-03-263-0/+8
| | | | For completeness, `-Xsource:2.11 -Xexperimental` does enable it.
* Soften sam restrictionsAdriaan Moors2016-03-262-54/+68
| | | | | | | | | | | | | Some of the earlier proposals were too strongly linked to the requirements of the Java 8 platform, which was problematic for scala.js & friends. Instead of ruling out SAM types that we can't compile to use LambdaMetaFactory, expand those during compilation to anonymous subclasses, instead of invokedynamic + LMF. Also, self types rear their ugly heads again. Align `hasSelfType` with the implementation suggested in `thisSym`'s docs.
* Don't adapt erroneous tree to SAM type.Adriaan Moors2016-03-262-0/+11
| | | | | | Do not report second error. Go straight to the exit. Based on review by Jason.
* Additional SAM restrictions identified by JasonAdriaan Moors2016-03-263-62/+60
| | | | | 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-264-0/+31
| | | | | | | | | | | | | 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).
* Refactoring. Simplify inferImplicit's boolean leversAdriaan Moors2016-03-261-1/+1
|
* Treat `Function` literals uniformly, expecting SAM or FunctionN.Adriaan Moors2016-03-262-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Refactor typedFunction, rework synthesizeSAMFunction for sammyAdriaan Moors2016-03-262-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-263-3/+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 #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.
* | Remove manual mixins in JFunctionN.v2.12.0-M3-dc9effeJason Zaugg2016-03-181-1/+6
|/ | | | | | | | | | | | | | | | | | | 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
* Improved outer ref checking in pattern matches:Adriaan Moors2016-03-075-2/+142
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* Remove -Y settings that are no longer used in 2.12Lukas Rytz2016-02-167-9/+7
| | | | | | 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-151-1/+1
|
* SI-9650 Refchecks on case apply transformSom Snytt2016-02-104-1/+107
| | | | | Apply checks for unsavoriness when transforming a case apply.
* SI-9574 Prevent illegal overrides of members with module typesStefan Zeiger2016-02-082-1/+20
| | | | | | | | | | | Commit f32a32b1b33c9d7ccd62467e3e10cb69930023c8 introduced the ability to override objects with other objects. The exception that allows these overrides (where the usual subtyping check fails) was applied to all members whose type is a module class. This is too broad, however, because it not only applies to members of the form `object foo` but also `def foo: bar.type` (where `bar` is an `object`). The fix is to restrict the exception to those cases where both definitions actually are objects.
* Merge remote-tracking branch 'origin/2.12.x' into ↵Jason Zaugg2016-02-044-1/+11
|\ | | | | | | merge/2.11.x-to-2.12.x-20160203
| * Update partest to 1.0.12, test case for reporting invalid flagsLukas Rytz2016-02-034-1/+11
| |
* | Merge commit 'cc6fea6' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-042-0/+13
|\ \ | |/ |/| | | | | | | Conflicts: build.sbt scripts/jobs/integrate/bootstrap
| * SI-9572 Check for illegal tuple sizes in the parserStefan Zeiger2016-01-282-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds explicit checks with syntax errors for tuple literals and types of more than 22 elements. An alternative approach to fixing SI-9572 would be to revert to the old failure mode of Scala 2.10 where references to arbitrary `scala.TupleXY` would be generated in the parser, which then leads to “type/object not found” errors in the typechecker. This fix here is more intrusive but arguably provides a better user experience. Methods `stripParens` and `makeBinop` are moved from `TreeBuilder` to `Parsers` because they can now generate syntax errors. New methods `makeSafeTupleType` and `makeSafeTupleTerm` implement the error checking on top of `makeTupleType` and `makeTupleTerm`. They are overridden with no-op versions in the quasiquotes parser because it also overrides `makeTupleType` and `makeTupleTerm` in a way that supports arbitrary tuple sizes.
| * [backport] SI-9616 False positive in unused import warningSom Snytt2016-01-073-12/+81
| | | | | | | | This is a minimal backport of the fix for SI-9383.
* | Merge pull request #4917 from retronym/ticket/9629Jason Zaugg2016-01-292-0/+29
|\ \ | | | | | | SI-9629 Emit missing 'pattern must be a value' error
| * | SI-9629 Emit missing 'pattern must be a value' errorJason Zaugg2016-01-252-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | The error used to only be emitted for top-level patterns. This commit moves it into `typedInternal` so it works for nested patterns. It uses the typer mode to know when to fire.
* | | SI-9398 Treat case classes as one-element ADTs for analysisJason Zaugg2016-01-294-0/+19
|/ / | | | | | | | | | | | | | | 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-8700 Exhaustiveness warning for enums from Java sourceSimon Ochsenreither2016-01-1410-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | Until now, the warning was only emitted for enums from Java class files. This commit fixes it by - aligning the flags set in JavaParsers with the flags set in ClassfileParser (which are required by the pattern matcher to even consider checking exhaustiveness) - adding the enum members as childs to the class holding the enum as done in ClassfileParser so that the pattern matcher sees the enum members when looking for the sealed children of a type
* | Merge commit '8eb1d4c' into merge-2.11-to-2.12-nov-24Lukas Rytz2015-11-247-8/+8
|\|
| * Merge pull request #4839 from SethTisue/reword-dependent-type-errorSeth Tisue2015-11-141-2/+2
| |\ | | | | | | less confusing wording for a dependent method type error