summaryrefslogtreecommitdiff
path: root/test/files/neg
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'master' into topic/inlinePaul Phillips2012-02-039-1/+63
|\
| * Fix for parser OOM.Paul Phillips2012-02-012-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | The scanner performs some sketchy heuristics when it sees an ascii 1A since it may be EOF or it may be part of a literal. Due to this, it failed to detect an unterminated string literal if the opening quote was unicode-escaped, leading to memory exhaustion as it read SUs until the universe ended. We're parsing a fixed input with known length! There's no reason to be guessing about whether a char is EOF. If we're at the end of the file, it's the end of file. Otherwise, it is not the end of the file.
| * Test case closes SI-5352.Paul Phillips2012-01-313-0/+29
| |
| * Improved warning for insensible comparisons.Paul Phillips2012-01-314-1/+28
| | | | | | | | | | Utilize knowledge of case class synthetic equals to rule out some comparisons statically. Closes SI-5426.
* | intermediate work towards a new starr for value classes.Martin Odersky2012-02-031-6/+6
| |
* | More work on inline classes.Paul Phillips2012-01-304-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Removed obsolete checkfile.Paul Phillips2012-01-302-13/+0
| |
* | Merge branch 'master' into inlinePaul Phillips2012-01-302-0/+47
|\| | | | | | | | | Conflicts: src/compiler/scala/reflect/internal/Definitions.scala
| * Test case closes SI-4515.Paul Phillips2012-01-292-0/+47
| |
* | Merge remote-tracking branch 'paulp/inline' into topic/inlineMartin Odersky2012-01-298-17/+31
|\| | | | | | | | | | | | | Temporarily removed getClass from AnyVal to get build going. Disabled anyval-childen test. Fixed some other build problems. Implemented step 1 + 2 of inline classes proposal.
| * Test case closes SI-3854.Paul Phillips2012-01-272-0/+20
| |
| * Disabled "not found" suggestions.Paul Phillips2012-01-263-5/+5
|/ | | | | The benchmarks charts are confusing me and I want to rule it out as a problem by not having it exist for a while.
* Use context for buffering errors that cannot/shouldn't be reported in the ↵Hubert Plociniczak2012-01-258-30/+30
| | | | | | | | given moment (instead of throwing type errors). This avoids previous problems where we were creating fake error trees in some incorrect places like in type completers in Namers etc. Implicits relied heavily on type errors being thrown but performance should stay the same due to some explicit checks/returns. Some of the problems involved how ambiguous error messages were collected/reported because it was very random (similarly for divergent implicits). This should be more explicit now. Reduced the number of unnecessary cyclic references being thrown (apart from those in Symbols/Types which don't have a context and need to stay for now as is). Review by @paulp, @odersky.
* Test case for already closed SI-4271.Paul Phillips2012-01-202-0/+22
|
* Improved a cyclic reference error message.Paul Phillips2012-01-164-6/+42
| | | | | "illegal cyclic reference involving value <import>" not so useful.
* Test case backing spec.Paul Phillips2012-01-143-0/+39
| | | | Added code from SLS 2.0.2.
* Symbols making friends with Polly Morphism.Paul Phillips2012-01-141-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since I have established (no small effort, this) that there is no need for certain important flags to be mutable for the entire lifetime of a symbol, I have codified this knowledge by moving it out of the flags entirely and into the inheritance hierarchy where its constant nature can find true happiness. AliasTypeSymbol ... it's an alias (forever!) AbstractTypeSymbol ... it's an abstract type (forever!) The only time DEFERRED is inspected is if the generic creation function is called (e.g. "newTypeSymbol", not "newAliasType") in which case the presence of the flag is used to determine which symbol to create. This is mostly for legacy support. Certain symbols were being created inconsistently with the others. Now every symbol is created by invoking a creation method on the owner, with the exception of FreeVar. I changed the owner of those from RootClass to NoSymbol because there is no reason for them to pollute the symbol hierarchy at the root. The signature of cloneSymbolImpl is now def cloneSymbolImpl(owner: Symbol, newFlags: Long): Symbol There is an overload with the old signature which calls that one with no flags. With this step, every symbol creation in trunk is performed with knowledge of the initial flags, opening the door to many optimizations in the Symbol and Type logic, not to mention boosting my sanity by at least five sanity points.
* Disambiguate some type printing.Paul Phillips2012-01-123-1/+32
| | | | Functions of functions use parens for grouping.
* Optimizing TypeRef, starting with Symbols.Paul Phillips2012-01-111-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are too many potential optimizations unavailable to us due to the lack of bright lines among different kinds of symbols. For instance the difference between a TypeSymbol which represents a type alias and one which represents an abstract type is only whether the DEFERRED flag is set. This creates issues. 1) There are many (many) places where tests are performed on every symbol which could be done more efficiently and (especially) more verifiably correctly with polymorphism. 2) TypeRefs based on those symbols are also checking that flag constantly, in perpetuity. A symbol created as an alias is never (to the best of my knowledge) going to intentionally morph into one representing an abstract type, nor vice versa. 3) One has no guarantees, because anyone can set or reset the DEFERRED flag at any time. So tackling more than one problem at once herein: 1) I created canonical symbol creation points which take the flags as an argument, so that there can be a difference between initializing a symbol's flags and setting/resetting them at arbitrary times. 2) I structured all the symbol creators to take arguments in the same order, which is: def newXXX(name: Name, ..., pos: Position = NoPosition, flags: Long = 0L) (Where "..." is for those symbols which require something beyond the name to create, such as a TypeSkolem's origin.) The name is first because it's the only always required argument. I left but deprecated the variations which take (pos, name). 3) I created subclasses of TypeRef based on the information which should be stable from creation time onward: - args or no args? - abstract type, type alias, or class? 2x3 == 6 and that's how many subclasses of TypeRef there are now. So now, for example, every TypeRef doesn't have to carry null symInfoCache and thisInfoCache fields for the benefit of the minority which use them. I still intend to realize the gain possible once we can evade the fields for pre and args without losing pattern matcher efficiency.
* Better error reporting regarding main methods.Paul Phillips2012-01-094-10/+83
| | | | | | Now notices most things which look like main methods and says something useful if they aren't usable as entry points. Closes SI-4749.
* TypeVar tracing.Paul Phillips2012-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | % scala -Dscalac.debug.tvar scala> class Foo[CC[X] <: Traversable[X]] { def bar[T](xs: CC[T]) = xs.head } defined class Foo scala> new Foo bar List(1,2,3) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ setInst] Nothing ( In Foo[CC[X] <: Traversable[X]], CC=Nothing ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?T ( In Foo[CC[X] <: Traversable[X]]#bar[T] ) [ create] ?A ( In List#apply[A] ) [ create] ?A ( In List#apply[A] ) [ setInst] Int ( In List#apply[A], A=Int ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ create] ?T ( In Foo[CC[X] <: Traversable[X]]#bar[T] ) [ create] ?CC ( In Foo[CC[X] <: Traversable[X]] ) [ applyArgs] ?CC ( In Foo[CC[X] <: Traversable[X]], apply args ?T to CC ) [ setInst] List ( In Foo[CC[X] <: Traversable[X]], CC=List ) [ setInst] Int ( In Foo[CC[X] <: Traversable[X]]#bar[T], T=Int ) res0: Int = 1 Also, I gave TypeVar some polymorphism. Review by @moors.
* Error message improvement.Paul Phillips2012-01-052-0/+13
| | | | | | | | | | | | | | | | % scalac files/neg/t5357.scala files/neg/t5357.scala:5: error: '=>' expected but ':' found. case A: N => 1 ^ one error found That's uggo! Now it says: % scalac files/neg/t5357.scala files/neg/t5357.scala:5: error: Pattern variables must start with a lower-case letter. (SLS 8.1.1.) case A: N => 1 ^ one error found
* Optimization in Constructors.Paul Phillips2012-01-051-1/+1
| | | | | Reworked some old code which was far too expensive for the job it was performing.
* Closes SI-5354.Martin Odersky2012-01-042-0/+22
| | | | | | The reason why the test case compiled without error is pretty devious: When checking the `Foo.x' implicit, a CyclicReference error occurs which causes the alternative to be discarded. Why a CylicReference? Because the inferencer tries to decide whether the owner of `z` is a subclass of the owner od `x`. To do this, it computed the info of the owner of `z1`, which is not complete because no result type for `f1` was given. Hence a CyclicReference error. The fix is twofold: (1) We make isNonBottomSubClass smarter so that it always returns false if the symbol in question is not a type; hence the info need not be computed. (2) It's dubious to swallow CyclicReference errors anywhere, but I deemed it too risky to propagate them. But at least the CyclicReference is now logged if -Ylog-implicit is true. This hopefully spares future maintainers the same detective work I had to go through when digging this out.
* Added -Xlog-implicit-conversions.Paul Phillips2012-01-023-0/+45
| | | | | | | | | | | | | | | | | New command line option prints a message whenever the compiler inserts an implicit conversion. Implicit parameters are not under consideration here, since the primary motivation is to make it easy to inspect your code for unintentional conversions, since they can have dramatic performance implications. class A { def f(xs: Array[Byte]) = xs.size def g(xs: Array[Byte]) = xs.length } % scalac -Xlog-implicit-conversions logImplicits.scala logImplicits.scala:2: applied implicit conversion from xs.type to ?{val size: ?} = implicit def byteArrayOps(xs: Array[Byte]): scala.collection.mutable.ArrayOps[Byte] def f(xs: Array[Byte]) = xs.size ^
* More performance work.Paul Phillips2011-12-301-10/+5
| | | | | | | Custom versions of collections which methods which operate on 2 or 3 collections. Eliminated most users of zip/zipped. Cleaned up the kinds checking code somewhat. Reduced the number of silent typechecks being performed at named argument sites.
* Tone down insensible-equality warning.Paul Phillips2011-12-271-7/+1
| | | | Closes SI-5175.
* Migration message and version cleanupSimon Ochsenreither2011-12-071-3/+2
| | | | | | | | | | The @migration annotation can now be used like @deprecation. Old syntax is still supported, but deprecated. Improve wording and consistency of migration messages, migration warnings also print the version in which the change occurred now. Partially fixes SI-4990.
* Tweaked ident suggestions.Paul Phillips2011-12-045-10/+6
| | | | | | | Rolled damaru-levenshtein algorithm back to my original "pure" version. Cut max distance to 1. Turned on by default because now it offers nothing unexpected, and removed short-lived -Ysuggest-idents option.
* Added -Ysuggest-idents.Paul Phillips2011-12-033-0/+25
| | | | | | | | | | | | | | | | Suggest possible alternatives when an identifier is not in scope. % scala -Ysuggest-idents scala> import scala.collection.mutable._ import scala.collection.mutable._ scala> new MistBuffer <console>:11: error: not found: type MistBuffer (similar: ListBuffer, Buffer) new MistBuffer ^ Too bad, no MistBuffer. We'll settle for ListBuffer.
* Eliminated redundant error message.Paul Phillips2011-12-033-1/+21
| | | | | No secondary "reassignment to val" for unknown identifiers in assignment position.
* Tests for SI-3481.Simon Ochsenreither2011-12-022-0/+57
| | | | Closes SI-3481.
* Fix for octal test.Paul Phillips2011-11-291-1/+4
| | | | | | At the last minute I made -Xfuture leading-0 an error and failed to update the checkfile.
* Fixed -Xfuture 5.ds, deprecated 0-octal.Paul Phillips2011-11-294-18/+25
| | | | | | | | I messed up my trip to the future the first time around; now in the future 5.f is not an error but an attempt to call method "f" on 5 like nature intended. (Thank you simon for catching this.) And deprecated leading 0 for octal. Closes SI-5205.
* Reworked AnnotationInfo patch.Paul Phillips2011-11-231-10/+4
| | | | | | | | Took a more ambitious swing based on input from martin. Eliminated the external map and gave annotations a more useful inheritance hierarchy. Eliminated AnnotationInfoBase and made LazyAnnotationInfo an AnnotationInfo (just like LazyType is a Type.) Review by odersky.
* revert r25877. no reviewLukas Rytz2011-11-149-0/+0
|
* Deprecated ambiguous dot syntaxes.Paul Phillips2011-11-116-0/+46
| | | | | | | | | | | | | | | 1.+(2) - what is it? Is it 3 or 3.0? Come scala 2.11 you won't have to not know (or even not know there's something you don't know.) 1.+(2) will then be safely considered equivalent to 1 + 2, because any dot not followed by a digit is not part of a number. Primarily, that's these forms: 3.f 3.d 3. If you prefer an error to a warning, use -Xfuture. Let's deprecate 012 == 10 too! (See comment.) References SI-5089, no review.
* Fixing tests, no review.Paul Phillips2011-11-101-1/+1
|
* Updates for the ten tests I broke recently.Paul Phillips2011-11-081-0/+1
| | | | | Wow, ten tests, that's unexpected. No review.
* Fix crash with HK types.Paul Phillips2011-11-072-0/+26
| | | | | | | Another page in the storied history of "call .tpe when one should have called .tpeHK", in this case leading to a crash of stacktraciness. Closes SI-5152, review by moors.
* Begone t1737...Hubert Plociniczak2011-11-02120-301/+301
|
* Added *.log and build/ to gitignore so partest/...Josh Suereth2011-11-2311-15/+15
| | | | | | | Added *.log and build/ to gitignore so partest/ant artifacts don't show up in our commit messages. Also fixed whitespace issues arising from the filter-branch history rewrite for git move.
* Fixed type unsoundness problem in t5120 and als...Martin Odersky2011-11-013-3/+44
| | | | | | | Fixed type unsoundness problem in t5120 and also discovered by roman.kalukiewicz@gmail.com. Fix should be refined further, as I am not convinced we are quite done yet. Review by moors.
* Fixed paths for 'neg' tests.Hubert Plociniczak2011-11-013-6/+6
|
* Disabled test.Paul Phillips2011-10-292-40/+0
| | | | | Guess that was a bad choice of class. No review.
* Better report on missing methods.Paul Phillips2011-10-283-4/+48
| | | | | | Discovered an overloaded method with multiple unimplemented variants only had one listed. Fixed, no review.
* fixed svn props in test directorymichelou2011-10-229-0/+0
|
* Warn about surprising shadowing.Paul Phillips2011-10-223-0/+59
| | | | | | It's hidden behind -Xlint and pretty specific, but makes me feel better anyway. References SI-4762, no review.
* Overhaul of Namers.Paul Phillips2011-10-211-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A digression into motivations: It's not there yet but the future looks bright. I have winnowed the number of mutation points down and I will take it down much further. There are only a few fundamental state changes which take place and these can be made to happen in a systematic fashion at well-known junctions. 1) Fresh symbols are allocated and (usually) assigned to a tree. 2) Symbol flags and access are manipulated. 3) A (possibly lazy) info is assigned to a symbol. 4) Synthetics are created or lazily positioned for creation Among the complications is that the symbol's info often cannot be determined in a straightforward fashion lest cycles develop. Type inference is obviously dependent on having some type information, so the black art is to pursue a) only the right information and b) only as far as necessary to avoid cycles. Compounding the difficulty is that synthetic methods must be introduced before the typer phase. Over time a variety of ad-hoc mechanisms have evolved to deal with these difficulties, and they have gotten us a good distance (we have bean setter/getters, case classes, copy methods, default getters, and more) but there are big disadvantages: - they are heavily custom fitted to the specific uses - because of the intertwingling of namer and typer, it is all only possible from the inside. Compiler plugins are shut out. A particularly difficult scenario has recently arisen with case classes. They now receive a ProductN parent, but because a class's parents must be completed before it can be completed, we encounter this: object Foo { type T = String } case class Foo(x: Foo.T, y: Foo.T) { } Now one of class Foo's parents is Product2[T, T]. So class Foo cannot be completed without information from object Foo. But object Foo needs to be given these synthetic methods: def apply(x: T, y: T): Foo def unapply(x: Foo): Option[(T, T)] You can see these two have their hands all over one another. The good news is that I have established in principle that the problem can be overcome, for that use and I think in a sufficiently general way that plugins will be able to perform this kind of method synthesis, with the following approach. For synthetic methods which require type information before they can be created (this is the catch-22: once type information is available, it's too late to add new synthetic methods) we create a "stub symbol" like so: val sym = owner.newMethod("nameOfMethod") sym setInfo stubMethodInfo stubMethodInfo will be some very general method type like Any* => Any (or Nothing => Any, it really depends on how or whether it is used), whatever it takes to pass type checking. At the same time, we enter the stub symbol into a map along with a thunk which creates the symbol and tree the way we would if we had full type information. Then, immediately after a class is typed, the template is examined for stub method symbols and when found, they are updated with the symbol info found in the map, assigned to the associated tree, and added to the class template. This approach will probably break down under some uses, but I think it can take us a long way. So all these changes in Namers are about evolving it to a point where I can roll out a principled division of responsibility for those entities which cannot be naively typed, and to unify the several different approaches to lazy typing under a consistent and predictable mechanism. If anyone would like to review this, please be my guest, but you might want to wait one more commit.
* dependent methods types are now always enabledAdriaan Moors2011-10-203-6/+1
| | | | | | | | | | for now, left the old if(settings.YdepMethTpes.value) guards in comments removed *.flags containing -Ydependent-method-types also updated one check file with one fewer error no review