summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Regex.unapplySeq should not take Any (Fixes SI-6406)Som Snytt2012-09-203-0/+12
| | | | | | | | | | | | | | | | | | This deprecates unapplySeq(Any) and adds overloaded unapplySeq(CharSequence) and unapplySeq(Match), with the putative advantage that you can't try to extract the unextractable. Regex is massaged so that the underlying Pattern is primary, rather than the String-valued expression. Regex and its unanchored companion (I almost wrote unmoored) share a Pattern object, so that unapplySeq(Match) can easily test whether the Match was generated by this Regex; in that case, the match result is used immediately, instead of reapplying the regex to the matched string. The documentation is massaged to reflect unanchored and also to align with the underlying terminology, e.g., "subgroup" really just means "group."
* Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-1548-69/+378
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * origin/2.10.x: (68 commits) Eliminate breaking relative names in source. "Hot fix" for broken build. Fix SI-4813 - Clone doesn't work on LinkedList. Made 'def clone()' consistent with parens everywhere. accommodates pull request feedback SI-6310 redeploys the starr SI-6310 AbsTypeTag => WeakTypeTag SI-6323 outlaws free types from TypeTag SI-6323 prohibits reflection against free types improvements for reification of free symbols removes build.newFreeExistential SI-6359 Deep prohibition of templates in value class Fixes SI-6259. Unable to use typeOf in super call of top-level object. Fixes binary repo push for new typesafe repo layouts. Better error message for pattern arity errors. Rescued TreeBuilder from the parser. Pending test for SI-3943 Test case for a bug fixed in M7. Fix for SI-6367, exponential time in inference. SI-6306 Remove incorrect eta-expansion optimization in Uncurry ... Conflicts: src/compiler/scala/tools/nsc/transform/AddInterfaces.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala
| * Eliminate breaking relative names in source.Paul Phillips2012-09-143-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These things are killing me. Constructions like package scala.foo.bar.baz import foo.Other DO NOT WORK in general. Such files are not really in the "scala" package, because it is not declared package scala package foo.bar.baz And there is a second problem: using a relative path name means compilation will fail in the presence of a directory of the same name, e.g. % mkdir reflect % scalac src/reflect/scala/reflect/internal/util/Position.scala src/reflect/scala/reflect/internal/util/Position.scala:9: error: object ClassTag is not a member of package reflect import reflect.ClassTag ^ src/reflect/scala/reflect/internal/util/Position.scala:10: error: object base is not a member of package reflect import reflect.base.Attachments ^ As a rule, do not use relative package paths unless you have explicitly imported the path to which you think you are relative. Better yet, don't use them at all. Unfortunately they mostly work because scala variously thinks everything scala.* is in the scala package and/or because you usually aren't bootstrapping and it falls through to an existing version of the class already on the classpath. Making the paths explicit is not a complete solution - in particular, we remain enormously vulnerable to any directory or package called "scala" which isn't ours - but it greatly limts the severity of the problem.
| * Merge pull request #1295 from scalamacros/ticket/6323Eugene Burmako2012-09-1417-28/+59
| |\ | | | | | | improvements for type tags
| | * SI-6310 AbsTypeTag => WeakTypeTagEugene Burmako2012-09-1414-28/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new name for AbsTypeTag was a matter of a lengthy discussion: http://groups.google.com/group/scala-internals/browse_thread/thread/fb2007e61b505c4d I couldn't decide until having fixed SI-6323 today, which is about trying to reflect against a local class using typeOf. The problem with local classes is that they aren't pickled, so their metadata isn't preserved between Scala compilation runs. Sure, we can restore some of that metadata with Java reflection, but you get the idea. Before today typeOf of a local class created a free type, a synthetic symbol, with a bunch of synthetic children that remember the metadata, effectively creating a mini symbol table. That might be useful at time, but the problem is that this free type cannot be reflected, because the global symbol table of Scala reflection doesn't know about its mini symbol table. And then it struck me. It's not the presence of abs types (type parameters and abs type members) that differentiates arbitrary type tags from good type tags. It's the presence of types that don't map well on the runtime world - ones that can't be used to instantiate values, ones that can't be reflected. So we just need a name for these types. Phantom types are compile-time only concept, whereas our types can have partial correspondence with the runtime. "Weak types" sound more or less okish, so let's try them out.
| | * SI-6323 outlaws free types from TypeTagEugene Burmako2012-09-143-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Free types are no longer acceptable in normal type tags. Like type parameters or abstract type members they don't map on any real type, therefore I think this is a justified change. The main reason for doing is this is to prohibit people from using `typeOf` on local classes. Sure, the guard introduced in the previous commit will raise runtime errors about that, but this commit provides static checking. Those especially persistent might use `absTypeOf` and then try to play around with the weak type it returns, but that's advanced usage scenario, and I don't worry much about it. Bottom line: `typeOf` should just work. Things that work with additional effort should be explicitly marked as such.
| * | Merge pull request #1272 from paulp/issue/6340Josh Suereth2012-09-142-0/+31
| |\ \ | | |/ | |/| Fix for SI-6340, error message regression.
| | * Fix for SI-6340, error message regression.Paul Phillips2012-09-122-0/+31
| | |
| * | Merge pull request #1300 from retronym/ticket/6359Josh Suereth2012-09-132-0/+15
| |\ \ | | | | | | | | SI-6359 Deep prohibition of templates in value class
| | * | SI-6359 Deep prohibition of templates in value classJason Zaugg2012-09-142-0/+15
| | |/ | | | | | | | | | This seems to have been the intent of 95d532 / SI-5882.
| * | Better error message for pattern arity errors.Paul Phillips2012-09-123-1/+11
| | | | | | | | | | | | | | | | | | Because friends don't tell friends: "wrong number of arguments for <none>"
| * | Merge remote-tracking branch 'origin/2.10.x' into fix-duration-issues-RKRoland2012-09-1219-5/+192
| |\ \
| | * | Avoid spurious warning for `def foo = x.foo`.Jason Zaugg2012-09-112-6/+27
| | |/ | | | | | | | | | Followup to SI-6276.
| | * Merge pull request #1274 from retronym/ticket/6335Grzegorz Kossakowski2012-09-112-0/+16
| | |\ | | | | | | | | SI-6335 More precise location of the implicit class synthetic method.
| | | * More tests for SI-6335.Jason Zaugg2012-09-092-0/+16
| | | |
| | * | Merge pull request #1284 from retronym/topic/deprecated-inheritanceGrzegorz Kossakowski2012-09-116-0/+55
| | |\ \ | | | | | | | | | | SI-6162 Adds private[scala] @deprecatedInheritance/@deprecatedOverriding
| | | * | Rescues @deprecated{Inheritance, Overriding}Jason Zaugg2012-09-114-6/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While they ought to be generalized to aribirary modifier changes before being offered in the standard library, the opportunity to use them in 2.10 is too important to pass up. So for now, they're private[scala]. En route: - made the error messages more concise - fix positioning of inheritance error - improve test coverage
| | | * | SI-6162 Adds @deprecatedInheritance/@deprecatedOverridingSimon Ochsenreither2012-09-106-0/+22
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | These annotations are meant to warn from inheriting a class or from overriding a member, due to the reasons given in `msg`. The naming and placement of the methods is in line with @deprecated and @deprecatedName.
| | * | Merge pull request #1275 from retronym/ticket/6276Grzegorz Kossakowski2012-09-115-2/+45
| | |\ \ | | | | | | | | | | SI-6276 Warn on def or val that trivially loops infinitely
| | | * | SI-6276 Warn on def or val that trivially loops infinitelyJason Zaugg2012-09-095-2/+45
| | | |/
| | * | Merge pull request #1168 from retronym/ticket/6258-2Josh Suereth2012-09-062-0/+41
| | |\ \ | | | | | | | | | | SI-6258 Reject partial funs with undefined param types
| | | * | SI-6258 Reject partial funs with undefined param typesJason Zaugg2012-08-232-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This regressed with virtpatmat. With -Xoldpatmat, pattern matching anonymous functions with an expected type of PartialFunction[A, B] are translated to a Function tree, and typed by typedFunction, which issues an error of the parameter types are not fully defined. This commit adds the same check to MatchFunTyper. It doesn't plug the hole in RefChecks#validateVariance (which is reminiscent of SI-3577.) Seems to me that in general one should handle: a) both BoundedWildcardType and WildcardType when in a place that can be called during inference, or b) neither otherwise
| | * | | More fix for invalid companions.Paul Phillips2012-09-054-3/+14
| | | |/ | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eliminated InvalidCompanions exception entirely. Anyone's guess why we unholstered this exception every time someone calls "isCodefinedWith" rather than when symbols are created. I moved the check into Namers, where it can be done once and with sufficient finesse not to crash so much. With this patch in place, "playbench" can be built with java7.
| * / | restrict Deadline to finite durations (would have to throw otherwise)Roland2012-09-122-0/+23
| |/ /
* | | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-0413-4/+159
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Eugene Burmako (10) and others # Via Josh Suereth (10) and Paul Phillips (9) * origin/2.10.x: (32 commits) Removing duplication from Duration. Fixed positions in de-aliased special symbols and for automatically added `apply` methods. Fixes SI-6285 - ParIterableLike no longer says sequential foreach. SI-6274 Fix owners when eta-expanding function with byName param Fixes typos in the ScalaDoc of StringContext Allow nested calls to `askForResponse` in the presentation compiler. Made Dynamic extend Any. Fix for SI-6273, repl string interpolation. Formatting cleanup in def typed. Better errors for Any/AnyRef issues. Fix for SI-6263, futile adaptation. Suppressed 'possible cause' mis-warning. Fix for SI-6034, covariant value classes. Fixes SI-6290 by creating real instnaces of language features. SBT build now works with SBT 0.12. Removed previosuly uncommented code, added more diagnosis output to REPL. Made instrumenter more robust by looking at tokens Removed dead code. Two fixes for the worksheet instrumenter Fix SI-6294. ...
| * | Merge pull request #1231 from paulp/issue/6273Josh Suereth2012-09-021-1/+1
| |\ \ | | | | | | | | Fix for SI-6273, repl string interpolation.
| | * | Fix for SI-6273, repl string interpolation.Paul Phillips2012-09-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | As usual the hard part is tracing through all the needless abstraction. Begone, 25 layers of parsing error issuing methods!
| * | | Better errors for Any/AnyRef issues.Paul Phillips2012-09-016-6/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an error occurs because some type does not conform to AnyRef (and an AnyRef-derived type would have sufficed) try to say something useful about the situation. This commit also initializes scope members before printing error messages because the + version seems more useful than the - version (taken from one of the checkfile diffs.) - def <init>: <?> - def methodIntIntInt: <?> + def <init>(): X + def methodIntIntInt(x: scala.Int,y: scala.Int): scala.Int
| * | | Fix for SI-6263, futile adaptation.Paul Phillips2012-09-012-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | Don't try to implicitly convert an unstable prefix to a stable one by applying a view. As the matrix spoon kid says, "that's impossible."
| * | | Suppressed 'possible cause' mis-warning.Paul Phillips2012-09-012-0/+13
| |/ / | | | | | | | | | | | | I have seen this warning a bunch of times and it has not yet been close to right.
| * | Merge pull request #1201 from axel22/issue/4581Josh Suereth2012-09-014-1/+33
| |\ \ | | | | | | | | Fix SI-4581.
| | * | Fix SI-4581.Aleksandar Prokopec2012-08-274-1/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifically, the final flag on the generated static field is no longer ommitted. Fix 2 failing test-cases.
* | | | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-09-0114-6/+69
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Ruediger Klaehn (14) and others # Via Josh Suereth (13) and others * origin/2.10.x: (49 commits) More useful -Xlog-implicits output. Reflection tuning Two more value classes. Fixed cloning a double-linked list. Expanded the reach of value classes. Added/fixed test files for SI-6227 Two fixes for the worksheet instrumenter Fix crasher from bug in maven ant tasks. Yippie. Closes SI-6227 Fix for SI-6283, no abstract value classes. hotfix for SI-6293 Commented out assertions removes Symbol.kind and Type.kind Add missing tests for SI-6190 SI-6281 macroArgs for defs with implicit args SI-6280 Scaladoc: Reloading preserves anchors Added test to ensure that ListMap.tail is O(1) Made ListMap.tail O(1) instead of O(N) SI-6052 - fix groupBy on parallel collections SI-6272 Support lazy vals defined in try in template. ...
| * | | More useful -Xlog-implicits output.Jason Zaugg2012-09-013-0/+25
| | | | | | | | | | | | | | | | | | | | The test exercises the most important case, when implicits are invalidated through shadowing. (See SI-4270)
| * | | Merge pull request #1213 from paulp/topic/anyvalJosh Suereth2012-08-302-6/+0
| |\ \ \ | | | | | | | | | | Expanded the reach of value classes.
| | * | | Expanded the reach of value classes.Paul Phillips2012-08-292-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now extending AnyVal: - RichInt, RichDouble, etc. - ArrayOps.ofRef, ofBoolean, etc - StringAdd - StringFormat The rest of it is the changes necessary to enable those.
| * | | | Merge pull request #1209 from odersky/ticket/6227Josh Suereth2012-08-302-0/+10
| |\ \ \ \ | | |/ / / | |/| | | Closes SI-6227
| | * | | Added/fixed test files for SI-6227Martin Odersky2012-08-291-0/+4
| | | | |
| | * | | Closes SI-6227Martin Odersky2012-08-291-0/+6
| | |/ / | | | | | | | | | | | | I added some general hook where one can add validation code before a name conflict involving at least one implicit symbol is reported.
| * / / Fix for SI-6283, no abstract value classes.Paul Phillips2012-08-282-0/+5
| |/ / | | | | | | | | | | | | | | | | | | | | | The needless abstraction penalty was in full flower in Namers. I managed to find somewhere else to issue this error, where I can still just write an error message without tracking down an enumeration in a separate file and inventing an intermediate name for the enum member.
| * | Merge pull request #1172 from Blaisorblade/topic/deprecated-conversionJosh Suereth2012-08-232-0/+16
| |\ \ | | | | | | | | JavaConversions: Restore source compatibility with 2.9
| | * | Ensure implicit conversions to concurrent map are unambiguousPaolo Giarrusso2012-08-222-0/+16
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Even after the parent change, implicit conversions should still convert ConcurrentHashMap to concurrent.Map and not to mutable.ConcurrentMap. I'll include the comment by axel22 which prompting this change (taken from https://github.com/scala/scala/pull/1172#issuecomment-7928285) since it is highly informative and links to pull request comments might not be very stable: << Instead of just testing an implicit conversion to ConcurrentMap, the test should call ConcurrentMap methods such as putIfAbsent (which returns an Option[T]) and replace, to see if the correct Scala concurrent map trait is being resolved. The problem is that putIfAbsent already exists on juc.ConcurrentMap so instead of triggering an implicit conversion, a type mismatch error is output anyway. And we cannot test that the correct concurrent map trait is returned using methods like map, flatMap and friends, because concurrent map traits extends mutable.Map anyway. For this reason, I recommend to add this to the test: scala> val a = new java.util.concurrent.ConcurrentHashMap[String, String]() += (("", "")) a: scala.collection.concurrent.Map[String,String] = Map("" -> "") and make sure that the returned map is concurrent.Map, not mutable.ConcurrentMap (the above += is one of the few methods in collection that has the return type this.type). >>
| * / Fix for SI-6264, crash in checkCheckable.Paul Phillips2012-08-213-0/+11
| |/ | | | | | | | | The classic fail of assuming you will only receive a specific subclass of Type.
* | Merge branch '2.10.x'amin2012-08-214-1/+1
|\| | | | | | | | | | | | | | | | | | | | | Review by @paulp or @gkossakowski. Conflicts: src/compiler/scala/tools/nsc/ast/parser/Scanners.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/reflect/scala/reflect/internal/Types.scala
| * cleanup for macroExpandEugene Burmako2012-08-184-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Error reporting is moved to ContextErrors to disentangle stuff in Macros.scala. With logics and error reporting intertwined it was an awful mess. Exceptions are used for the same reason. Instead of threading failures through the code polluting it with options/ifs, I outline the success path. It worked much better for typedMacroBody, but I'm also happy with the resulting code of macroExpand. To me a major factor towards applicability of exceptions was that they are short-lived and that there might be max one error per domain, after which we unconditionally bail.
* | Merge remote-tracking branch 'origin/2.10.x' into merge-210Paul Phillips2012-08-179-19/+32
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | # By Eugene Burmako (12) and others # Via Paul Phillips (4) and others * origin/2.10.x: Fixes SI-6236. Fixes SI-6189. Hunting down eliminable :: allocations. Absolutize tools.nsc => scala.tools.nsc. more cleanup for typedMacroBody shaves more than 150 lines off typedMacroBody Optimization in SubstMap. removes dead code pull request feedback more macro cleanup further cleanup of transformTypeTagEvidenceParams macroImplSigs => macroImplSig Dominik's comments on api.Mirrors phaseId(currentPeriod) >= erasurePhase.id materializeImplicit and implicitsOfExpectedType cleanup of reflection- and macro-related stuff adds the `skipPackage` attribute to Scaladoc Fixes backend crash due to incorrect consumedTypes Fix SI-6208. mutable.Queue now returns mutable.Queue for collection methods rather than MutableList.
| * Merge pull request #1151 from scalamacros/topic/cleanupEugene Burmako2012-08-179-20/+26
| |\ | | | | | | more cleanup in Macros.scala
| | * more cleanup for typedMacroBodyEugene Burmako2012-08-175-11/+17
| | |
| | * shaves more than 150 lines off typedMacroBodyEugene Burmako2012-08-174-9/+9
| | |
| * | Fixes SI-6189.Aleksandar Prokopec2012-08-171-0/+6
| |/ | | | | | | | | | | | | | | Disable @static for the REPL code. The problem is that there are no companion classes generated for objects that contain the top-level declarations in the REPL. When there is no companion class, the selecting a @static field will translate to a getter call, instead of to a field load.