summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | * less confusing wording for a dependent method type errorSeth Tisue2015-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | note to reviewers: the error messages in this file are over the place about whether they're called "parameter sections", or "argument lists", or what, so there's no point in being picky about that here for context see SI-823
| * | it's Scaladoc, not "ScalaDoc" or "Scala doc"Seth Tisue2015-11-126-6/+6
| |/ | | | | | | | | renaming the existing ScalaDoc and ScalaDocReporter classes might break stuff, sadly, but at least we can fix the rest
* | Remove ICodeSimon Ochsenreither2015-10-315-57/+11
| |
* | Merge pull request #4814 from soc/topic/drop-genasmLukas Rytz2015-10-298-36/+13
|\ \ | | | | | | Remove GenASM
| * | Remove GenASM, merge remaining common code snippetsSimon Ochsenreither2015-10-278-36/+13
| | | | | | | | | | | | | | | | | | | | | | | | With GenBCode being the default and only supported backend for Java 8, we can get rid of GenASM. This commit also fixes/migrates/moves to pending/deletes tests which depended on GenASM before.
* | | Merge pull request #4808 from retronym/ticket/9527Seth Tisue2015-10-274-0/+28
|\ \ \ | |/ / |/| | SI-9527 Fix NPE in ambiguous implicit error generation
| * | SI-9527 Fix NPE in ambiguous implicit error generationJason Zaugg2015-10-214-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #4673, an annotation was added to allow customization of the compiler error for ambigous implicits. This change had incorrect assumptions about the shape of trees that would be generated during implicit search, and failed to account for the results of eta expanded methods when searching for a function type. This commit: - Uses the symbol from `ImpilcitInfo`, rather than calling `Tree#symbol` which is fraught with the danger of returning a null symbol for something other than an application. - Adds a test for customized messages for a polymorphic, eta expanded method, and generalizes `treeTypeArgs` to handle the implicit tree of shape `{ (x: X) => f[A](x)}`.
* | | SI-9535 correct bytecode and generic signatures for @throws[TypeParam]Lukas Rytz2015-10-262-0/+14
|/ / | | | | | | | | | | | | For @throws[E] where E is not a class type, GenASM incorrectly writes the non-class type to the classfile. GenBCode used to crash before this commit. Now GenBCode correctly emits the erased type (like javac) and adds a generic signature.
* | Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-055-5/+51
|\|
| * Merge pull request #4720 from retronym/ticket/9029Jason Zaugg2015-09-295-5/+51
| |\ | | | | | | SI-9029 Fix regression in extractor patterns
| | * SI-8989 Better error message for invalid extractor patternJason Zaugg2015-09-215-5/+51
| | |
| * | [backport] SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-09-222-22/+0
| |/ | | | | | | | | | | | | | | | | 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 commit 'a170c99' into 2.12.xLukas Rytz2015-09-2213-0/+0
|\|
| * unset inappropriate execute bitsSeth Tisue2015-09-0213-0/+0
| | | | | | | | | | | | | | | | | | | | I imagine these date back to old Subversion days and are probably the result of inadvertent commits from Windows users with vcs client configs. having the bit set isn't really harmful most of the time, but it's just not right, and it makes the files stand out in directory listings for no reason
| * Fix typos in spec, docs and commentsMichał Pociecha2015-08-236-6/+6
| |
| * [backport] Java parser: default methods in interfaces are not `DEFERRED`Lukas Rytz2015-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Java parser should not set the `DEFERRED` flag for default methods or static methods in interfaces. Their bytecode doesn't have it either. Also tightens parsing of Java abstract methods to disallow a method body. Here's the log of how Lukas diagnosed this: ``` quick.bin: ... BUILD FAILED /Users/luc/scala/scala/build.xml:69: The following error occurred while executing this line: ... /Users/luc/scala/scala/build-ant-macros.xml:350: Could not create type mk-bin due to java.lang.BootstrapMethodError: call site initialization exception at java.lang.invoke.CallSite.makeSite(CallSite.java:341) at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297) at scala.sys.BooleanProp$.keyExists(BooleanProp.scala:72) at scala.sys.SystemProperties$.bool(SystemProperties.scala:78) at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:89) at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:89) at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31) at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala) at scala.util.control.NoStackTrace$class.fillInStackTrace(NoStackTrace.scala:22) at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:94) at java.lang.Throwable.<init>(Throwable.java:250) at scala.util.control.BreakControl.<init>(Breaks.scala:94) at scala.util.control.Breaks.<init>(Breaks.scala:29) at scala.collection.Traversable$.<init>(Traversable.scala:95) at scala.collection.Traversable$.<clinit>(Traversable.scala) at scala.package$.<init>(package.scala:40) at scala.package$.<clinit>(package.scala) at scala.Predef$.<init>(Predef.scala:89) at scala.Predef$.<clinit>(Predef.scala) at scala.tools.ant.ScalaTool.<init>(ScalaTool.scala:58) [...] Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method invokeStatic scala.sys.BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted:(String)Object; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193) at java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:473) at java.lang.invoke.CallSite.makeSite(CallSite.java:325) ``` [source code](https://github.com/scala/scala/blob/2.11.x/src/library/scala/sys/BooleanProp.scala#L72): ``` s => s == "" || s.equalsIgnoreCase("true") ``` bytecode: ``` INVOKEDYNAMIC $init$()Lscala/compat/java8/JFunction1; [ // handle kind 0x6 : INVOKESTATIC java/lang/invoke/LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; // arguments: ()V, // handle kind 0x6 : INVOKESTATIC scala/sys/BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted(Ljava/lang/String;)Ljava/lang/Object;, (Ljava/lang/String;)Ljava/lang/Object;, 3, 1, Lscala/Serializable;.class, 0 ] CHECKCAST scala/Function1 ``` The mistake seems to be that the Scala compiler incorrectly selects `$init$` ([which is a default method](https://github.com/scala/scala/blob/640ffe7fceb5d573b2c12a7c7da09bfd751036a0/src/library/scala/compat/java8/JFunction1.java#L10)) as the abstract method of `JFunction1`, whereas it should be `apply` (inherited from `Function1`). Since we're doing mixed compilation, this is almost certainly a problem of the Java parser.
* | SI-9473 Cleaner references to statically owned symbolsJason Zaugg2015-09-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Ever wonder why `identity("")` typechecks to `scala.this.Predef.identity("")`? It turns out that `mkAttributedRef` was importing `q"$scalaPackageClass.this.Predef._"` for all these years, rather than `q"$scalaModule.Predef._"`. This commit makes `mkAttributedRef` special case static owners by referring the the corresponding module, instead.
* | Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-09-086-6/+6
| | | | | | | | | | | | | | | | only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now
* | Merge pull request #4671 from lrytz/t9375-easyJason Zaugg2015-09-082-22/+0
|\ \ | | | | | | SI-9375 add synthetic readResolve only for static modules
| * | SI-9375 add synthetic readResolve only for static modulesLukas Rytz2015-07-302-22/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 #4673 from puffnfresh/issue/6806Jason Zaugg2015-09-087-0/+44
|\ \ \ | | | | | | | | SI-6806 Add an @implicitAmbiguous annotation
| * | | SI-6806 Add an @implicitAmbiguous annotationBrian McKenna2015-08-117-0/+44
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example usage: trait =!=[C, D] implicit def neq[E, F] : E =!= F = null @annotation.implicitAmbiguous("Could not prove ${J} =!= ${J}") implicit def neqAmbig1[G, H, J] : J =!= J = null implicit def neqAmbig2[I] : I =!= I = null implicitly[Int =!= Int] Which gives the following error: implicit-ambiguous.scala:9: error: Could not prove Int =!= Int implicitly[Int =!= Int] ^ Better than what was previously given: implicit-ambiguous.scala:9: error: ambiguous implicit values: both method neqAmbig1 in object Test of type [G, H, J]=> Main.$anon.Test.=!=[J,J] and method neqAmbig2 in object Test of type [I]=> Main.$anon.Test.=!=[I,I] match expected type Main.$anon.Test.=!=[Int,Int] implicitly[Int =!= Int] ^
* | | Merge pull request #4590 from som-snytt/issue/6810Lukas Rytz2015-08-242-0/+54
|\ \ \ | |/ / |/| | SI-6810 Disallow EOL in char literal
| * | SI-6810 Test for CRSom Snytt2015-06-292-3/+13
| | |
| * | SI-6810 Disallow EOL in char literalSom Snytt2015-06-292-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's clear that char literals are one-lined like normal string literals. By the same token, pun intended, char literals accept unicode escapes the same as string literals, including `\u000A`. This commit adds the usual exclusions (CR, NL, SU). The spec is outdated in outlawing chars that are not "printable", in particular, the ASCII control codes. The original intention may have been that the ordinary string escapes are required, such as "\b\n". Note that some common escapes are absent, such as "\a".
* | | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-07-233-1/+9
|\ \ \ | | |/ | |/| | | | merge/2.11.x-to-2.12.x-20152307
| * | Merge pull request #4631 from janekdb/2.11.x-typos-t-vSeth Tisue2015-07-201-1/+1
| |\ \ | | | | | | | | Fix 23 typos (t-v)
| | * | Fix 23 typos (t-v)Janek Bogucki2015-07-151-1/+1
| | | |
| * | | SI-9401 Avoid SOE with array + missing classtagJason Zaugg2015-07-162-0/+8
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implicit classtags required by the Array constructor are not expressed in the type signature of its constructor, and instead are summoned by a special case in the typechecker. This special case entails replacing the `new Array` tree with `implicitly[T].newArray(size)`, handled in `ArrayInstantiation`. This tree is recursively typechecked. However, if the implicit materialization/search fails, an error is issued to the current reporter and the original tree is marked with an error type. As above, this is recursively typechecked. In the normal course of affairs, the recursive typecheck of the erroneous tree would be a noop (the tree already has a type!). However, if we are both in silent mode (in which errors are buffered) and in retyping mode (in which the typer clears the type and symbols of trees), we were getting into an cycle. In the enclosed test, retyping mode was trying to recover from: Resetting.this.gencastarray_=(new Array[T](0).<ERROR>) By inserting a suitable a view: implicitly[Resetting => { def gencastarray_=(AT)}]( Resetting.this ).gencastarray_=(new Array[T](0)) Where AT is the type found by retypechecking the argument. It is during the argument retypechecking that we fell into cycle. Crazily enough, in 2.11.0, the ensuing `StackOverflowError` was being caught and treated as a failure. We would then back out of the retyping mode, and issue the error from the the very first attempt at the implicit search. This fragile state of affairs was disrupted by a refactoring to the error reporting system in 725c5c9, after which the SOE crashed the compiler. This commit avoids recursively typechecking error typed trees.
* | | Merge pull request #4616 from som-snytt/issue/9383Seth Tisue2015-07-203-12/+81
|\ \ \ | | | | | | | | SI-9383 Improved unused import warning
| * | | SI-9383 Improved unused import warningSom Snytt2015-07-083-12/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, implicit search would mark every import it touched as a lookup. Instead, let subsequent type check perform the lookup.
* | | | Merge pull request #4622 from retronym/merge/2.11.x-to-2.12.x-20150713Adriaan Moors2015-07-1314-5/+139
|\ \ \ \ | | | | | | | | | | Merge 2.11.x to 2.12.x [ci: last-only]
| * \ \ \ Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-07-1314-5/+139
| |\ \ \ \ | | |/ / / | |/| / / | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150713 Conflicts: src/eclipse/partest/.classpath src/eclipse/repl/.classpath test/files/run/nothingTypeNoFramesNoDce.scala test/files/run/repl-javap-app.check Also fixup two .classpath files with updated partest, xml and parser combinators JARs.
| | * | Fix 27 typos (p-r)Janek Bogucki2015-06-301-1/+1
| | | |
| | * | Merge pull request #4569 from retronym/ticket/6985Adriaan Moors2015-06-308-0/+99
| | |\ \ | | | | | | | | | | SI-6895 Test cases to explain the limitations in tcpoly inference
| | | * | SI-8892 Fix incorrect qualification in error messageJason Zaugg2015-06-232-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since beadafa2, we've ended up with nutty error messages for type errors involving aliases that target types in `java.lang` and `scala` packages. I think the intent of that change was to force the error messages to qualify types like `String` when needed, but to leave them unqualified by default. However, this led to this flat out wrong message in the enclosed test. found : B required: C.this.java.lang.B (which expands to) String I've changed the heuristic slightly limit this code to aliases that are eponymous with their targets. Still feels pretty kludgy, but we can at least book a little progress.
| | | * | SI-8777 Avoid redundant disambiguation in error messagesJason Zaugg2015-06-233-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When printing types in error messages, we attempt to disambiguate symbol names by qualifying them in various ways. Type paramters symbols are qualified by adding `(in someMethod)`. However, the type errors generated by higher kinded subtyping can contain clones of type parameter symbols, as creater in `isPolySubType`. The disambiguation tries fruitlessly to distinguish them but ended up adding the same suffix to both names repeatedly. ``` found : [F[_]]Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[F,X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] required: Foo[[X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]Bar[[X]Or[String,X],X(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)(in type L)]] ``` This commit limits the post qualification of type parameter symbols to a single attempt to limit the damage. An alternative might be to mark a clone (we could determine its status by checking whether it is a type parameter of its owner.) But I'm not sure how to present this information in a comphrenensible way, so for now I'm limiting my ambitions to stopping the stutter.