summaryrefslogtreecommitdiff
path: root/src/scalap
Commit message (Collapse)AuthorAgeFilesLines
* SI-6669 Add . to the default scalap classpathJames Iry2013-01-301-1/+1
| | | | | | | The default classpath for scalap did not include '.' which made it behave differently from javap in an annoying way. This commit adds it to the default. Also included is a test to make sure it's in the default but does not corrupt a user specified classpath.
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-0212-12/+12
|
* Fix problem with names encoding in scalap.Grzegorz Kossakowski2012-09-191-3/+8
| | | | | | | | | | | | | | The refactoring performed in 020053c321 made use of naming encoding more consisted but introduced a regression in scalap. The problem is that the old encoder that scalap had didn't escape any characters that were not included in its opcode list. `NameTransformer` performs full encoding so it also encodes dots that are being used as separators for packages. Therefore, in order to retain the old behaviour we need to split the name by dots before feeding each fragment to `NameTransformer`. Review by @paulp.
* More relative path elimination.Paul Phillips2012-09-152-5/+5
| | | | | | | | | | | | | | | | Some names I missed in 55b609458fd . How one might know when one is done: mkdir scratch && cd scratch mkdir annotation beans collection compat concurrent io \ math parallel ref reflect runtime scala sys testing \ text tools util xml scalac $(find ../src/library -name '*.scala') Until recently that would fail with about a billion errors. When it compiles, that's when you're done. And that's where this commit takes us, for src/library at least.
* Eliminate breaking relative names in source.Paul Phillips2012-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Absolutize tools.nsc => scala.tools.nsc.Paul Phillips2012-08-171-3/+3
| | | | | | Relative references to scala.tools which omit the "scala" are uncompilable by themselves if you happen to have a directory called "tools" which shadows scala/tools. As we do in trunk.
* Eliminated all the current feature warnings.Paul Phillips2012-07-273-3/+12
| | | | This pretty much takes us down to deprecation and inliner warnings.
* Eliminated remainder of "catches Throwable" warnings.Paul Phillips2012-07-272-3/+3
| | | | | | | | And also non-exhaustive matches. And added -nowarn to the build options for scalacheck, we don't need to hear the warnings for code we aren't able to fix.
* Handled some of our new exhaustiveness warnings.Paul Phillips2012-05-261-1/+1
| | | | Who could have suspected it would actually be right most of the time?
* Pushing ClassfileParser toward a new day.Paul Phillips2012-05-031-27/+6
| | | | | | Removed JacoMetaATTR. Removed MetaParser.
* SI-5189 fixed: safe type infer for constr patternAdriaan Moors2012-03-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | several fixes to the standard library due to - the safer type checker this fix gives us (thus, some casts had to be inserted) - SI-5548 - type inference gets a bit more complicated, it needs help (chainl1 in combinator.Parsers) To deal with the type slack between actual (run-time) types and statically known types, for each abstract type T, reflect its variance as a skolem that is upper-bounded by T (covariant position), or lower-bounded by T (contravariant). Consider the following example: class AbsWrapperCov[+A] case class Wrapper[B](x: Wrapped[B]) extends AbsWrapperCov[B] def unwrap[T](x: AbsWrapperCov[T]): Wrapped[T] = x match { case Wrapper(wrapped) => // Wrapper's type parameter must not be assumed to be equal to T, // it's *upper-bounded* by it wrapped // : Wrapped[_ <: T] } this method should type check if and only if Wrapped is covariant in its type parameter before inferring Wrapper's type parameter B from x's type AbsWrapperCov[T], we must take into account that x's actual type is: AbsWrapperCov[Tactual] forSome {type Tactual <: T} since AbsWrapperCov is covariant in A -- in other words, we must not assume we know T exactly, all we know is its upper bound since method application is the only way to generate this slack between run-time and compile-time types (TODO: right!?), we can simply replace skolems that represent method type parameters as seen from the method's body by other skolems that are (upper/lower)-bounded by that type-parameter skolem (depending on the variance position of the skolem in the statically assumed type of the scrutinee, pt) this type slack is introduced by adaptConstrPattern: before it calls inferConstructorInstance, it creates a new context that holds the new existential skolems the context created by adaptConstrPattern must not be a CaseDef, since that confuses instantiateTypeVar and the whole pushTypeBounds/restoreTypeBounds dance (CaseDef contexts remember the bounds of the type params that we clobbered during GADT typing) typedCase deskolemizes the existential skolems back to the method skolems, since they don't serve any further purpose (except confusing the old pattern matcher) typedCase is now better at finding that context (using nextEnclosing)
* Whitespace commit.Paul Phillips2012-02-291-1/+1
| | | | | | | Removed all the trailing whitespace to make eugene happier. Will try to keep it that way by protecting at the merge level. Left the tabs in place because they can't be uniformly changed to spaces, some are 2, some are 4, some are 8, whee.
* Refining the reflection api.Paul Phillips2012-02-051-26/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the pursuit of simplicity and consistency. - Method names like getType, getClass, and getValue are far too ambiguous, both internally and especially with java reflection names. Methods which accept or return scala symbols should not refer to them as "classes" in the reflection library. (We can live with the FooClass convention for naming the well-known symbols, it's names like "getClass" and "classToType" which are needlessly conflationary.) - Meaningless names like "subst" have to be expanded. - We should hew closely to the terms which are used by scala programmers wherever possible, thus using "thisType" to mean "C.this" can only beget confusion, given that "thisType" doesn't mean "this.type" but what is normally called the "self type." - It's either "enclosing" or "encl", not both, and similar consistency issues. - Eliminated getAnnotations. - Removed what I could get away with from the API; would like to push those which are presently justified as being "required for LiftCode" out of the core. - Changed a number of AnyRefs to Any both on general principles and because before long it may actually matter. - There are !!!s scattered all over this commit, mostly where I think the name could be better. - I think we should standardize on method names like "vmSignature, vmClass" etc. when we are talking about jvm (and ostensibly other vm) things. There are a bunch more places to make this distinction clear (e.g. Symbol's javaBinaryName, etc.) - There is a lot more I want to do on this and I don't know where the time will come from to do it. Review by @odersky, @scalamacros.
* More consistent use of Names.Paul Phillips2012-01-054-109/+13
| | | | | | | | Several large helpings of tedium later, fewer strings are being discarded like so much refuse. Some names now cache a String, but only "named Names", so it's not very many and they pay for themselves pretty quickly. Many fewer name-related implicit conversions now taking place. A number of efficiency related measures.
* Low-level optimization.Paul Phillips2011-12-302-3/+6
| | | | Eliminated a bunch of unnecessary array expense.
* ScalaClassLoader changes.Paul Phillips2011-11-031-5/+5
| | | | | Lots of fiddling in the interests of a better classloading future.
* Tired of ugly-printing in the repl, I sort of f...Paul Phillips2011-08-011-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Tired of ugly-printing in the repl, I sort of finished some old code for pretty printing token streams. It is at least a lot prettier than it once was, and I threw in some power mode helpers. Now you can do this. % scala -Dscala.repl.power Welcome to Scala version 2.10.0.r25427-b20110801144412 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26). // .u turns a string into an URL like .r does into a regex, and .pp pretty prints the url scala> "https://raw.github.com/scalaz/scalaz/master/example/src/main/scala/scal az/example/ExampleIteratee.scala".u.pp package scalaz.example object ExampleIteratee { def main (args: Array[String]) = run import scalaz._ import Scalaz._ import IterV._ [etc it's all there in real life] } No review.
* Following up on things that -Xlint told me, som...Paul Phillips2011-07-291-1/+1
| | | | | | | | | | | | | | | Following up on things that -Xlint told me, sometimes because Mr. Linty was being sensible and other times just to shut him up so we can hear better in the future. - made xml.Equality public because it occurs in public method signatures - made some actor classes with inaccessible-unoverridable methods final - eliminated a bunch of "dead code follows" warnings by deleting the dead code which really did follow - improved the reliability of warnings about inaccessible types For the changes in actors, review by phaller.
* Changes to reflection.Martin Odersky2011-07-162-2/+2
|
* Adding some Sets/Maps to perRunCaches, and elim...Paul Phillips2011-07-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Adding some Sets/Maps to perRunCaches, and eliminating ambiguously named imports. Did a tour of the compiler adding a few longer-lived mutable structures to the per-run cache clearing mechanism. Some of these were not a big threat, but there is (almost) literally no cost to tracking them and the fewer mutable structures which are created "lone wolf style" the easier it is to spot the one playing by his own rules. While I was at it I followed through on long held ambition to eliminate the importing of highly ambiguous names like "Map" and "HashSet" from the mutable and immutable packages. I didn't quite manage elimination but it's pretty close. Something potentially as pernicious which I didn't do much about is this import: import scala.collection._ Imagine coming across that one on lines 407 and 474 of a 1271 file. That's not cool. Some poor future programmer will be on line 1100 and use "Map[A, B]" in some function and only after the product has shipped will it be discovered that the signature is wrong and the rocket will now be crashing into the mountainside straightaway. No review.
* ByteCodecs move to reflect.internal.Martin Odersky2011-07-082-2/+2
|
* Fixes #4490 and #4467.Kato Kazuyoshi2011-06-181-1/+1
|
* Takes 30+% off the startup time for scala/scala...Paul Phillips2011-05-081-6/+7
| | | | | | | | | | | | | | | | | Takes 30+% off the startup time for scala/scalac with a variety of optimizations pinpointed by tracing method invocations. Frequent guest stars in the parade of slowness were: using Lists and ListBuffers when any amount of random access is needed, using Strings as if one shouldn't have to supply 80 characters of .substring noise to drop a character here and there, imagining that code can be reused in any way shape or form without a savage slowness burn being unleashed upon you and everything you have ever loved, String.format, methods which return tuples, and any method written with appealing scala features which turns out to be called a few orders of magnitude more often than the author probably supposed. This may be only the tip of the iceberg. No review.
* I wrote a warning when nullary methods return U...Paul Phillips2011-04-284-5/+5
| | | | | | | | | | | | | | | I wrote a warning when nullary methods return Unit. I wimped out of including it in this patch because we had about 200 of them, and that's what is fixed in this patch. I will add the warning to some kind of "-Xlint" feature after 2.9. This is motivated at least partly by the resolution of #4506, which indicates the distinction between "def foo()" and "def foo" will continue to jab its pointy stick into our eyes, so I believe we have a minimal duty of at least following our own advice about what they mean and not making a semirandom choice as to whether a method has parens or not. Review by community.
* Found there was still all kinds of detritus rem...Paul Phillips2011-04-113-9/+9
| | | | | | | | Found there was still all kinds of detritus remaining from the deceased IMPLICITMETHODtpe and ImplicitMethodType. Applied wrecking ball, review by moors. (Can I do the same thing with DEBRUIJNINDEXtpe and DeBruijnIndex?)
* Deleted SourcelessComments.Paul Phillips2011-04-071-28/+2
| | | | | | | | | | | | | Nothing and Null with improved documentation of their particulars and convinced scaladoc to parse them without leaving scalac institutionalized. Now rather than seeing our hardcoded documentation strings bitrot in a shadowy flight from classes which do not exist, we are championing the cause of the innocent and powerless. Nothing and Null aren't above the law! So now any responsible party can fire up their text editor and go to town on Nothing.scala. As I'm sure they will. Review by malayeri.
* Some minor sensibility improvements to previous...Paul Phillips2011-03-311-137/+66
| | | | | | Some minor sensibility improvements to previous patch, and tearing out some obsolete pieces of scalap. No review.
* Polishing the programmatic interface to the rep...Paul Phillips2011-03-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Polishing the programmatic interface to the repl and other bits of machinery which we'll have to live with for a while. The repl classloader now works more like you'd expect a classloader to, as seen here: % scala -Dscala.repl.power scala> class Bippus extends Traversable[Int] { def foreach[U](f: Int => U) = () } defined class Bippus scala> intp.classLoader.getResourceAsStream("Bippus").bytes() res0: Array[Byte] = Array(-54, -2, -70, ... scala> res0.size res1: Int = 23954 scala> case class Bippy(x: Int) defined class Bippy // classBytes is shorter way to say the same thing scala> intp.classLoader.classBytes("Bippy").size res2: Int = 2356 scala> intp.classLoader.classBytes("Bippy$").size res3: Int = 1741 Closes #4399, no review.
* Rename io.Code.toUTF8 and io.Code.fromUTF8 so t...Donna Malayeri2011-03-073-5/+5
| | | | | | | Rename io.Code.toUTF8 and io.Code.fromUTF8 so that the names match what the methods do, with an added migration warning. Closes #4203. No review.
* brought scalap up to date with minimal patch.Adriaan Moors2011-01-263-1/+5
|
* Updated copyright notices to 2011Antonio Cunei2011-01-2014-14/+14
|
* Imported sbt.Process into trunk, in the guise o...Paul Phillips2011-01-121-2/+2
| | | | | | | | | | | | | | | | | | | Imported sbt.Process into trunk, in the guise of package scala.sys.process. It is largely indistinguishable from the version in sbt, at least from the outside. Also, I renamed package system to sys. I wanted to do that from the beginning and the desire has only grown since then. Sometimes a short identifier is just critical to usability: with a function like error("") called from hundreds of places, the difference between system.error and sys.error is too big. sys.error and sys.exit have good vibes (at least as good as the vibes can be for functions which error and exit.) Note: this is just the first cut. I need to check this in to finish fixing partest. I will be going over it with a comb and writing documentation which will leave you enchanted, as well as removing other bits which are now redundant or inferior. No review.
* I'm wandering around trunk looking for slowness.Paul Phillips2010-12-201-66/+30
| | | | | | | | | | | | | | | | | are constant distractions which I've meant forever to fix anyway, such as the importing of collection.mutable._ (or any other package with lots of reused names.) Why is this relevant to performance? Well, var x = new HashSet[Int] What's that? What does 'x += 1' mean? These are questions we can all live without. There's almost nothing left which references HashSet or HashMap or Stack or other ambiguous classes without a qualifier: I can finish trunk but I can't keep it clean on my own. (Where should I be writing this stuff down, I wonder.) No review.
* Mopping up after the deprecation of exit and er...Paul Phillips2010-12-052-7/+7
| | | | | | | | | | | | | | Mopping up after the deprecation of exit and error. It is decidedly non-trivial (at least for the IDE-impaired) to be completely sure of which error function was being called when there were about twenty with the same signature in trunk and they are being variously inherited, imported, shadowed, etc. So although I was careful, the possibility exists that something is now calling a different "error" function than before. Caveat programmer. (And let's all make it our policy not to name anything "error" or "exit" from here on out....) No review.
* Eliminated SYNTHETICMETH flag.Paul Phillips2010-12-031-1/+0
| | | | | | | meaningful name inside the pattern matcher. Created a tracker for TRANS_FLAG which could enforce the transience it promises us, but didn't turn it on. No review.
* It's a big one!Paul Phillips2010-12-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TermName and TypeName are exposed throughout the compiler based on what kind of name a given abstraction ought to have. (There remain places where one needs to create a name without knowing yet what it will be, and those will always be Names.) The nme object in the compiler now holds only term names. To reference a known type name, use tpnme: nme.List == ("List": TermName) tpnme.List == ("List": TypeName) The contents of nme and tpname are defined in traits, many of which are shared, so if a name should exist only as a Type and not a Term, it should be defined in CompilerTypeNames, but otherwise in CompilerTermNames or CompilerCommonNames. This is partially complete but I'm sure there are still many shared which should pick a side. Usage of .toTermName and .toTypeName is strongly discouraged. After the dust has settled, there will be very few places where it will make sense to hop between namespaces like that. There are some implicits to smooth everything out, most of which should be removable eventually. // these two are in no hurry to go anywhere String => TermName String => TypeName // but not String => Name: def view in the compiler is no longer implicit // these two are temporary, and can log when they kick off to help us flush // out remaining issues of "name migration" Name => TermName Name => TypeName There is more work to be done before we're properly protected from naming errors, but I will not allow another eight hour tragedy to befall lukas or anyone else! Review by rytz. (Formality.)
* Changed the behavior of -cp for scalap.Iulian Dragos2010-09-031-4/+10
|
* Generalized the scala sig "look in both attribu...Paul Phillips2010-08-032-36/+37
| | | | | | | Generalized the scala sig "look in both attribute and annotation" code so it can be reused outside of scalap main. Closes #3717, review by ilyas.
* Removed a few instances of redundant or dead co...Paul Phillips2010-05-241-15/+0
| | | | | | | Removed a few instances of redundant or dead code, most of which was marked as waiting for a new starr which has long since arrived. No review.
* It's clearly not a long term solution to go hun...Paul Phillips2010-05-221-1/+1
| | | | | | | | It's clearly not a long term solution to go hunting them one by one, but for the short term goal of shipping 2.8.0 without accidental java 6 dependencies, removed what should be all uses of String.isEmpty from the source. No review.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-1212-12/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* scalap: signature for case classes fixedilyas2010-04-282-0/+5
|
* Since pickled data moved into annotations ShowP...Paul Phillips2010-04-211-2/+25
| | | | | | | | | Since pickled data moved into annotations ShowPickled has been confusedly scratching its head. Made tools/showPickled work again. In the process created a simple interface for creating command line tools for the (majority of) commands which would just like to specify a handful of options. No review.
* ScalaSigPrinter fixed for multiline string valu...ilyas2010-04-111-0/+5
| | | | | ScalaSigPrinter fixed for multiline string values in annotations
* Some tweaks to classpath handling I had left ov...Paul Phillips2010-04-061-0/+1
| | | | | | Some tweaks to classpath handling I had left over from trying to figure out the continuations plugin issue. No review.
* As a brief diversion from real work, implemente...Paul Phillips2010-04-063-5/+5
| | | | | | | | | As a brief diversion from real work, implemented Damerau–Levenshtein and ran it on trunk to elicit obvious misspellings. Unfortunately they're mostly in places like compiler comments which real people never see, but I fixed them anyway. All those English Lit majors who peruse our sources are sure to be pleased. No review.
* Rearranging IndexedSeq/LinearSeq and related workMartin Odersky2010-04-051-1/+1
|
* Fix to the way Scalap decodes ScalaSignature an...Gilles Dubochet2010-03-293-8/+23
| | | | | | Fix to the way Scalap decodes ScalaSignature annotations. Contributed by ilyas. Already reviewed by dubochet, no review.
* some output polishingilyas2010-03-261-3/+7
|
* missing quotes for annotation values addedilyas2010-03-261-2/+2
|