summaryrefslogtreecommitdiff
path: root/test/files/pos
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit 'refs/pull/401/head'; commit 'refs/pull/402/head'; commit ↵Paul Phillips2012-04-142-0/+0
|\ | | | | | | 'refs/pull/403/head'; commit 'refs/pull/404/head'; commit 'refs/pull/405/head' into develop
| * implements reification of tough typesEugene Burmako2012-04-142-0/+0
| |
| |
| \
*-. \ Merge commit 'refs/pull/391/head'; commit 'refs/pull/390/head' into developPaul Phillips2012-04-1413-12/+17
|\ \ \
| * | | virtpatmat on by default; chicken out: -XoldpatmatAdriaan Moors2012-04-1412-12/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | some tests (unreachability, exhaustivity, @switch annotation checking) are still run under -Xoldpatmat, but that will change before we go into RC mode (then the test/ partest of this commit will be reverted) removed irrelevant dependency on patmat
| * | | synth PartialFunction in uncurryAdriaan Moors2012-04-141-0/+6
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | due to interaction with the CPS plugin, can't synth PartialFun during typer (the types don't work out: in PartialFun[T, U @cps[V]], U @cps[V] does not conform to Any, and we can't move the annot from the type arg directly to applyOrElse's result, since then it won't override anything) thus, we face the pain of mangling labeldefs again resetLocalAttrsKeepLabels can't use leaveAlone don't cast matcherror throw, uncurry gets confused uncurry: cast selector valdef's rhs to avoid skolem mismatch NOTE: I'm not happy about this code, but I don't know how to make the clean way (typedMatchAnonFun) compatible with the CPS plugin one avenue to explor would be to introduce PartialFunCPS, which is transformed into a regular PartialFun when T @cps[U] is turned into ControlContext[T, U]
* / | restores some disabled macro tests, makes checkFeature synchronous when used ↵Eugene Burmako2012-04-142-0/+57
|/ / | | | | | | for macros
* | Fixed tests to account for SIP 18Martin Odersky2012-04-132-2/+4
| |
* | Added languageFeature annotation (was missing before). Resolved problem with ↵Martin Odersky2012-04-132-2/+2
|/ | | | late loading of nested classes in Definitions. Resolved handling of deprecated idents `then` and `macro`. Massaged test flags.
* Next generation of macrosEugene Burmako2012-04-128-17/+12
| | | | | | | | | | | | | | | | | | | | | | Implements SIP 16: Self-cleaning macros: http://bit.ly/wjjXTZ Features: * Macro defs * Reification * Type tags * Manifests aliased to type tags * Extended reflection API * Several hundred tests * 1111 changed files Not yet implemented: * Reification of refined types * Expr.value splicing * Named and default macro expansions * Intricacies of interaction between macros and implicits * Emission of debug information for macros (compliant with JSR-45) Dedicated to Yuri Alekseyevich Gagarin
* Fix for SI-5644.Paul Phillips2012-04-062-0/+839
| | | | | | | Don't let OverloadedTypes reach the backend. When you want a method from a particular symbol, avoid getMember, which may inflict upon you an OverloadedType if an inherited member has the same name. Instead, use the (just now appearing) definitions.getDecl.
* Unify "object Foo" and "Foo.type".Paul Phillips2012-04-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The source of many bugs over the years is that the first is represented as a TypeRef and the second a SingleType. Over a great period of time I figured out how to shield us from the more obvious bug manifestations, but a recent comment by adriaan jarred me into realizing that we can fix it at the source. This commit changes <:< and =:= to recognize when those two representations are being compared and to treat them as equivalent regardless of which is on the left. The reason I don't quash one representation entirely is that a fair bit of code depends on singleton types having an underlying type which is not the same, and regardless of that it would entail more changes and more risk. The change allows removing the type inference conditions which worried about this, and also fixes SI-4910. scala> val t1 = typeRef(ScalaPackageClass.thisType, NoneModule.moduleClass, Nil) t1: $r.intp.global.Type = None.type scala> val t2 = t1.narrow t2: $r.intp.global.Type = None.type scala> (t1.getClass, t2.getClass) res20: (Class[?0], Class[?0]) forSome { type ?0 <: $r.intp.global.Type; type ?0 <: $r.intp.global.Type } = (class scala.reflect.internal.Types$ModuleTypeRef,class scala.reflect.internal.Types$UniqueSingleType) scala> ((t1 =:= t2, t2 =:= t1, t1 <:< t2, t2 <:< t1)) res21: (Boolean, Boolean, Boolean, Boolean) = (true,true,true,true)
* Fix for SI-3272.Paul Phillips2012-04-021-0/+8
| | | | | | | | "References to the type parameters in object-private or object-protected values, variables, or methods (§5.2) of the class are not checked for their variance position." Review by @odersky.
* Fix for regression with inference at arity 21+.Paul Phillips2012-03-301-0/+14
| | | | A classic "off by two" error. Closes SI-4545, SI-5633.
* Workaround for "package is not a value".Paul Phillips2012-03-272-0/+83
| | | | | | Not actually a fix, but when we see a package where a module is expected, it's not a great stretch to try the package object. References SI-5604.
* Overhaul of JavaConver{sions,ters}.Paul Phillips2012-03-211-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Initially motivated by SI-5580, then just motivated. I broke up the opaquely named JavaConversions and JavaConverters into the following traits encapsulating some permutation of { to java, to scala, bidirectional } { wrappers, decorators } I named everything consistently in terms of either Wrappers or Decorators. Decorators install those asJava/asScala methods onto collections of the right kind; Wrappers hide the process. JavaConversions then reduces to an object which (ill-advisedly) extends both WrapAsJava and WrapAsScala. And JavaConverters is an object extending DecorateAsScala and DecorateAsJava. However other more clearly named vals exist in the newly created scala.collection.convert package object. val decorateAsJava = new DecorateAsJava { } val decorateAsScala = new DecorateAsScala { } val decorateAll = new DecorateAsJava with DecorateAsScala { } val wrapAsJava = new WrapAsJava { } val wrapAsScala = new WrapAsScala { } val wrapAll = new WrapAsJava with WrapAsScala { } So for instance to import asScala decorators, and only those: scala> import scala.collection.convert.decorateAsScala._ import scala.collection.convert.decorateAsScala._ scala> new java.util.ArrayList[String].asScala groupBy (x => x) res0: scala.collection.immutable.Map[String,scala.collection.mutable.Buffer[String]] = Map() I propose we put those vals or a subset of them in the scala package object rather than way down in scala.collection.convert.
* Restore irrefutability commits.Paul Phillips2012-03-203-0/+54
| | | | This reverts commit d8ba5d091e5641553b438ef9930a6023a2709dcd.
* Fix for stability failure.Paul Phillips2012-03-201-0/+37
| | | | | | | Pattern matcher! Totally unrelated to irrefutability, the pattern matcher at some point stopped sorting its lookup switch cases, and the butterfly's wings flapped enough to swap two cases. Now they're sorted in ascending order like they're supposed to be.
* Revert irrefutability commits.Paul Phillips2012-03-203-54/+0
| | | | | Temporary reversion of irrefutability commits in interests of stable milestone. Expect to restore shortly.
* [vpm] fix half of my existential troublesAdriaan Moors2012-03-201-0/+35
| | | | | | | no need for the clunky repackExistential pack the type of each case instead, since the skolems we've created shouldn't last beyond the case anyway this way we don't end up with fresh, incompatible, skolems for every case, but a neatly packed existential
* [vpm] typer synths Function{} for empty-sel matchAdriaan Moors2012-03-202-0/+9
| | | | | | | | | | | | | | | | | typedMatchAnonFun is called from typedFunction when the function's body is a match this is work-in-progres: the compiler currently won't bootstrap under -Yvirtpatmat see also the pending test make sure to use the right context in typeFunction when the body is a Match when typer is set up for type checking a Function, the current owner is the symbol for the function, but we'll type check a Block(List(ClassDef(cd)), New(cd)) when the function is a match, and the function symbol is nowhere to be found, so go to outer context in patmatvirt: - simplified default case gen (no need for a Casegen instance) - using CASE | SYNTHETIC to detect generated matches (for switches) and avoid typing them endlessly more uniform, and necessary for new-style anon Function class instance gen for matches
* [vpm] test file for regression on old patmatAdriaan Moors2012-03-202-0/+9
| | | | it's a warning on new patmat -- TODO: dig deeper
* Discovered filter was still being generated.Paul Phillips2012-03-191-0/+22
| | | | | | | | | Rather than withFilter, for a subset of for comprehension structures. Not sure if this was somewhat by design - only seems possible because refchecks was only looking for nme.filter, not nme.withFilter, so perhaps this was intended as some secret irrefutability backchannel? Really have to document that sort of thing if it's intentional. I assumed it wasn't and unified everything.
* Finally did something about broken irrefutability.Paul Phillips2012-03-192-0/+32
| | | | | | | | | | | The parser has always been confused about tuple patterns in for comprehensions. It thinks it can fail to recognize an irrefutable pattern and have it removed in refchecks, but it is sadly mistaken, because the unnecessary filter has a tendency to fail the compile in typer. Look more intently for irrefutable patterns and don't insert the unnecessary filter. Closes SI-5589, SI-1336.
* Added alternate test for SI-5545.Paul Phillips2012-03-162-0/+8
|
* Revert "More uniformity for the parser."Paul Phillips2012-03-161-12/+0
| | | | | | | | This reverts commit f987afe55e6d4f71c7e9ad10d1ca9f6120dc1132. Looks like somebody misread the grammar. Look for it to return in one of paulp's exclusive branches for today's discriminating hacker.
* Finish fixing range positions.Paul Phillips2012-03-163-1/+5
| | | | At least, I think so.
* More uniformity for the parser.Paul Phillips2012-03-161-0/+12
| | | | | Type application and operator notation could not formerly be mixed. Now they can, as the grammar has always suggested.
* New option -Ypos-debug, and fixed range position breakage.Paul Phillips2012-03-152-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | (Looks like there is more range position breakage yet, but this gets the outermost layer.) Channeling my struggles into a slightly easier future. % scalac -Ypos-debug -d /tmp ./src/library/scala/Predef.scala ./src/library/scala/Predef.scala:222: warning: Positioned tree has unpositioned child in phase extmethods def x = __resultOfEnsuring ^ parent: #7109 line 222 Select // (value __resultOfEnsuring in class Ensuring) child: #7108 Ident // (value $this) ./src/library/scala/Predef.scala:258: warning: Positioned tree has unpositioned child in phase extmethods def x = __leftOfArrow ^ parent: #7280 line 258 Select // (value __leftOfArrow in class ArrowAssoc) child: #7279 Ident // (value $this) two warnings found Or try this to really see some output: % scalac -Yrangepos -Ypos-debug
* Merge remote-tracking branch 'odersky/topic/inline' into merge-inlinePaul Phillips2012-03-142-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/scala-compiler.jar.desired.sha1 lib/scala-library-src.jar.desired.sha1 lib/scala-library.jar.desired.sha1 src/compiler/scala/reflect/internal/Definitions.scala src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/tools/nsc/Global.scala src/compiler/scala/tools/nsc/transform/Constructors.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/SyntheticMethods.scala src/library/scala/Function0.scala src/library/scala/Function1.scala src/library/scala/Function10.scala src/library/scala/Function11.scala src/library/scala/Function12.scala src/library/scala/Function13.scala src/library/scala/Function14.scala src/library/scala/Function15.scala src/library/scala/Function16.scala src/library/scala/Function17.scala src/library/scala/Function18.scala src/library/scala/Function19.scala src/library/scala/Function2.scala src/library/scala/Function20.scala src/library/scala/Function21.scala src/library/scala/Function22.scala src/library/scala/Function3.scala src/library/scala/Function4.scala src/library/scala/Function5.scala src/library/scala/Function6.scala src/library/scala/Function7.scala src/library/scala/Function8.scala src/library/scala/Function9.scala test/files/codelib/code.jar.desired.sha1 test/files/neg/anyval-children-2.check test/files/run/programmatic-main.check
| * Allows case classes as value classesMartin Odersky2012-03-071-1/+1
| |
| * All steps of value class proposal implemented. Most restrictions are now ↵Martin Odersky2012-02-131-1/+0
| | | | | | | | enforced. Super calls and specialized still missing.
| * Merge branch 'master' into topic/inlinePaul Phillips2012-02-062-4/+4
| |\ | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/Global.scala test/files/run/programmatic-main.check
* | \ Merge branch 'master' into merge-inlinePaul Phillips2012-03-1419-6/+370
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: lib/scala-compiler.jar.desired.sha1 lib/scala-library-src.jar.desired.sha1 lib/scala-library.jar.desired.sha1 src/compiler/scala/reflect/internal/Definitions.scala src/compiler/scala/reflect/internal/Importers.scala src/compiler/scala/reflect/internal/Symbols.scala src/compiler/scala/reflect/internal/Trees.scala src/compiler/scala/reflect/internal/Types.scala src/compiler/scala/tools/nsc/Global.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/compiler/scala/tools/nsc/transform/LiftCode.scala src/compiler/scala/tools/nsc/transform/UnCurry.scala src/compiler/scala/tools/nsc/typechecker/RefChecks.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala test/files/run/programmatic-main.check test/files/speclib/instrumented.jar.desired.sha1
| * | #SI-5546 fixed: refine refined typing for getClassAdriaan Moors2012-03-061-0/+1
| | |
| * | Oops, all the preceding meant SI-5541.Paul Phillips2012-03-041-0/+0
| | |
| * | Revert attempt to limit private types in lubs.Paul Phillips2012-03-041-0/+61
| | | | | | | | | | | | | | | | | | Has to be somewhere more directly tied to structural refinements. See run/lub-visibility.scala before/after output for motivation. Closes SI-5534.
| * | Fix for typing of objects in patterns.Paul Phillips2012-02-281-0/+4
| | | | | | | | | | | | | | | An object in a pattern should have type "Foo.type" just as objects not in patterns do. Closes SI-5406. Review by @moors.
| * | Moved and edited tests.Paul Phillips2012-02-236-0/+76
| | | | | | | | | | | | | | | | | | Remove obsolete, move passing pending -> files, update those-kinds-are-high with some new info, added a couple new ones to pending.
| | |
| | \
| *-. \ Merge remote-tracking branches 'hubertp/issue/5452' and 'hubertp/issue/5493' ↵Paul Phillips2012-02-171-0/+32
| |\ \ \ | | | | | | | | | | | | | | | into develop
| | * | | Closes #5452.Hubert Plociniczak2012-02-171-0/+32
| | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of trying to track the fallback attempts we rely on the context state to inform us which fallback is the last one. setError cannot always be called in NoBestMethodAlternativeError because inferMethodAlternative relies on side-effects. Review by @paulp.
| * / / Disable execution context and futures implementation in the default package.Aleksandar Prokopec2012-02-161-1/+1
| |/ / | | | | | | | | | | | | | | | | | | Fixed some tests so that they work now. The Transactions.scala test was failing when defined in scala.concurrent package, reporting that type `_$1` is defined twice. Until we figure out the reason for this, the package name in that test is renamed.
| * | Specialization action.Paul Phillips2012-02-143-1/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crickets at http://www.scala-lang.org/node/11901 were in unanimous agreement that I should proceed as suggested. - No arguments to @specialize gets you 10/10, not 9/10 - Fixed bugs in AnyRef specialization revealed by trying to use it - Specialized Function1 on AnyRef. - Changed AnyRef specialization to use OBJECT_TAG, not TVAR_TAG. - Deprecated SpecializableCompanion in favor of Specializable, which has the virtue of being public so it can be referenced from outside the library. - Cooked up mechanism to group specializable types so we don't have to repeat ourselves quite so much, and create a few groups for illustrative purposes. I'm not too serious about those names but I used up all my name-thinking-up brain for the day. - Updated genprod and friends since I had to regenerate Function1. - Put tests for a bunch of remaining specialization bugs in pending. Closes SI-4740, SI-4770, SI-5267.
| * | Fix for SI-5444.Paul Phillips2012-02-131-0/+42
| | | | | | | | | | | | | | | Fix for trait/impl renaming in 5cbd7d06eb was incomplete. Looks more complete now.
| * | Updated existentials test with non-working parts.Paul Phillips2012-02-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lazy accessors have the same essential problem as described in recent commit messages, so this still doesn't work: def f() = { case class Bob(); Bob } ; lazy val g = f On the whole I'm trying to solve this at the wrong level. The derived accessor methods and fields of a declaration should not ever wander far enough apart that there is any challenge in reconciling them. (The same is true for case classes/objects.) They're dependent synthetics who know about one another from the beginning, all we have to do is not forget. In the meantime, test case.
| * | Another existential problem down.Paul Phillips2012-02-112-0/+63
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a window of danger when multiple related elements are being typed where something which is conceptually one thing can slip into two things, and those two things can be incompatible with one another. Less mysteriously, c478eb770d fixed this: def f = { object Bob ; Bob } ; val g = f But, it did not fix this: def f = { case class Bob() ; Bob } ; val g = f See test case pos/existentials-harmful.scala for an "in the wild" code example fixed by this commit. The root of the problem was that the getter and the field would each independently derive the same existential type to describe Bob, but those existentials were not the same as one another. This has been the most elusive bug I have ever fixed. I want to cry when I think of how much time I've put into it over the past half decade or so. Unfortunately the way the repl works it is particularly good at eliciting those grotesque found/required error messages and so I was never able to let the thing go. There is still a cosmetic issue (from the last commit really) where compound types wind up with repeated parents. Closes SI-1195, SI-1201.
| * Replaced LiftCode with a function in MacroContextEugene Burmako2012-02-052-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Major cleanup of reification: * LiftCode phase has been removed * Code has been deprecated and will be removed as we roll a new starr * Logic related to type-directed lifting has been purged scala.reflect.macro.Context#reify now provides the same services as LiftCode provided (except that it returns Tree, not Code). For testing purposes, I've retained the oh-so-convenient automagic lift. test/files/codelib/code.jar now hosts Code.lift reimplemented in a macro, so that the tests can continue working as if nothing has happened.
* | Simple test manipulating Any-derived traits.Paul Phillips2012-02-041-0/+16
| |
* | Updated checkfiles to subtract ScalaObject.Paul Phillips2012-02-041-1/+1
| |
* | More work on inline classes.Paul Phillips2012-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fail compile if AnyVal is inherited by a trait, a non-@inline class, or a class with an AnyRef parent somewhere. Added tests. Added logging, like [log extmethods] Inline class class Bippy spawns extension method. Old: def getClass: Class[_ <: Bippy] New: final def extension$getClass($this: Bippy): Class[_ <: Bippy] Fixed what I hope was a bug in ExtensionMethods where the original method params were dropped. Since adding a NonNull parent was also inflicting an AnyRef on AnyVal subclasses, suppressed that for those. Had the bright idea that AnyVal could extend NotNull. It doesn't seem to accomplish much, but then, I don't think NotNull accomplishes much. Still, maybe it's time to restrict the ways one can use AnyVal so one can't do this: scala> var x: AnyVal = _ x: AnyVal = null
* | Merge branch 'master' into inlinePaul Phillips2012-01-301-0/+19
|\|