summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/ScalaPrimitives.scala
Commit message (Collapse)AuthorAgeFilesLines
* Avoid forcing info transforms of primitive methodsJason Zaugg2017-02-191-3/+4
| | | | | | | | | Although this is cheap, when debugging log output of info transformer activity this was a major source of noise. This commit avoids the info lookup for methods other than `+`, and then for `+` uses the typer phase info to distinguish concatentation from addition.
* Fix comparisons involving NaNLukas Rytz2016-06-021-2/+2
| | | | | Floating point comparisons involving NaN should always return false, except for !=. Fixes a regression introduced by #4963.
* General cleanups and less warnings during a Scala buildsoc2016-04-041-1/+1
|
* Remove ICode's TypeKinds, use BTypes in the backend insteadLukas Rytz2015-11-061-31/+7
|
* Remove ICodeSimon Ochsenreither2015-10-311-5/+4
|
* Concision contribution.Paul Phillips2013-05-231-9/+11
| | | | | | | | | | | | | | | | | | | | | We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)
* Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* Banish needless semicolons.Jason Zaugg2013-02-241-3/+3
|
* Removed unused imports.Paul Phillips2012-11-061-1/+0
| | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* Merge commit 'refs/pull/1574/head' into merge-210Paul Phillips2012-11-051-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'refs/pull/1574/head': (24 commits) Fixing issue where OSGi bundles weren't getting used for distribution. Fixes example in Type.asSeenFrom Fix for SI-6600, regression with ScalaNumber. SI-6562 Fix crash with class nested in @inline method Brings copyrights in Scaladoc footer and manpage up-to-date, from 2011/12 to 2013 Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013 SI-6606 Drops new icons in, replaces abstract types placeholder icons SI-6132 Revisited, cleaned-up, links fixed, spelling errors fixed, rewordings Labeling scala.reflect and scala.reflect.macros experimental in the API docs Typo-fix in scala.concurrent.Future, thanks to @pavelpavlov Remove implementation details from Position (they are still under reflection.internal). It probably needs more cleanup of the api wrt to ranges etc but let's leave it for later SI-6399 Adds API docs for Any and AnyVal Removing actors-migration from main repository so it can live on elsewhere. Fix for SI-6597, implicit case class crasher. SI-6578 Harden against synthetics being added more than once. SI-6556 no assert for surprising ctor result type Removing actors-migration from main repository so it can live on elsewhere. Fixes SI-6500 by making erasure more regular. Modification to SI-6534 patch. Fixes SI-6559 - StringContext not using passed in escape function. ... Conflicts: src/actors-migration/scala/actors/migration/StashingActor.scala src/compiler/scala/tools/nsc/backend/jvm/GenASM.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala src/compiler/scala/tools/nsc/transform/Erasure.scala src/library/scala/Application.scala src/library/scala/collection/immutable/GenIterable.scala.disabled src/library/scala/collection/immutable/GenMap.scala.disabled src/library/scala/collection/immutable/GenSeq.scala.disabled src/library/scala/collection/immutable/GenSet.scala.disabled src/library/scala/collection/immutable/GenTraversable.scala.disabled src/library/scala/collection/mutable/GenIterable.scala.disabled src/library/scala/collection/mutable/GenMap.scala.disabled src/library/scala/collection/mutable/GenSeq.scala.disabled src/library/scala/collection/mutable/GenSet.scala.disabled src/library/scala/collection/mutable/GenTraversable.scala.disabled src/library/scala/collection/parallel/immutable/ParNumericRange.scala.disabled
| * Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
| |
* | Merge branch '2.10.x'Adriaan Moors2012-08-081-1/+1
|\| | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/ast/TreeGen.scala src/compiler/scala/tools/nsc/settings/AestheticSettings.scala
| * update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* | Renaming phase time-travel methods.Paul Phillips2012-07-191-1/+1
|/ | | | | | | | enteringPhase and exitingPhase are our unambiguously named phase time travel methods. atPhase is deprecated. Other methods and uses have all been brought into line with that. Review by @lrytz.
* Toward a higher level abstraction than atPhase.Paul Phillips2012-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I guess these are self-explanatory. @inline final def afterErasure[T](op: => T): T = afterPhase(currentRun.erasurePhase)(op) @inline final def afterExplicitOuter[T](op: => T): T = afterPhase(currentRun.explicitouterPhase)(op) ... @inline final def beforeTyper[T](op: => T): T = beforePhase(currentRun.typerPhase)(op) @inline final def beforeUncurry[T](op: => T): T = beforePhase(currentRun.uncurryPhase)(op) This commit is basically pure substitution. To get anywhere interesting with all the phase-related bugs we have to determine why we use atPhase and capture that reasoning directly. With the exception of erasure, most phases don't have much meaning outside of the compiler. How can anyone know why a block of code which says atPhase(explicitouter.prev) { ... } needs to run there? Too much cargo cult, and it should stop. Every usage of atPhase should be commented as to intention. It's easy to find bugs like atPhase(uncurryPhase.prev) which was probably intended to run before uncurry, but actually runs before whatever happens to be before uncurry - which, luckily enough, is non-deterministic because the continuations plugin inserts phases between refchecks and uncurry. % scalac -Xplugin-disable:continuations -Xshow-phases refchecks 7 reference/override checking, translate nested objects uncurry 8 uncurry, translate function values to anonymous classes % scalac -Xshow-phases selectivecps 9 uncurry 10 uncurry, translate function values to anonymous classes Expressions like atPhase(somePhase.prev) are never right or are at best highly suboptimal, because most of the time you have no guarantees about what phase precedes you. Anyway, I think most or all atPhases expressed that way only wanted to run before somePhase, and because one can never be too sure without searching for documentation whether "atPhase" means before or after, people err on the side of caution and overshoot by a phase. Unfortunately, this usually works. (I prefer bugs which never work.)
* 4th round of clean ups (see r25293, r25285, r25...michelou2011-07-201-24/+14
| | | | | 4th round of clean ups (see r25293, r25285, r25292)
* I wrote a warning when nullary methods return U...Paul Phillips2011-04-281-1/+1
| | | | | | | | | | | | | | | 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.
* Misc cleanups and crash avoidance, no review.Paul Phillips2011-04-061-2/+0
|
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Imported sbt.Process into trunk, in the guise o...Paul Phillips2011-01-121-1/+1
| | | | | | | | | | | | | | | | | | | 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.
* Some accumulated cleanup done while profiling a...Paul Phillips2010-12-291-6/+3
| | | | | | Some accumulated cleanup done while profiling and reducing uses of length. No review.
* Turned an assert/compiler crash into an error m...Paul Phillips2010-12-111-9/+3
| | | | | | | | Turned an assert/compiler crash into an error message. Admittedly the error output is still terrible (the XML positioning looks like it came from an RNG) but more helpful than the crash. Also misc advantage of a handy new method. Closes #4069, no review.
* Closes #3497.Iulian Dragos2010-08-261-12/+17
|
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* As a brief diversion from real work, implemente...Paul Phillips2010-04-061-2/+2
| | | | | | | | | 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.
* Added ## method to Any as our scala hashCode me...Paul Phillips2010-02-281-0/+2
| | | | | | | | | | | | | | Added ## method to Any as our scala hashCode method which provides consistent answers for primitive types. And I'm sure we're all tired of new starrs, but it's hard to add a method to Any without one. This patch only brings ## into existence, but nothing calls it yet. // some true assertions scala> assert(5.5f.## == 5.5f.hashCode) scala> assert(5.0f.## != 5.0f.hashCode && 5.0f.## == 5L.##) No review. (Already reviewed by odersky.)
* Updated copyright notices to 2010Antonio Cunei2009-12-071-1/+1
|
* Some organization & duplication removal in GenI...Paul Phillips2009-11-161-0/+12
| | | | | | Some organization & duplication removal in GenICode stemming from optimizer appeasement.
* This patch represents breaking out bits of code...Paul Phillips2009-09-241-0/+2
| | | | | | | | This patch represents breaking out bits of code generation related to equality so that I can log what they're doing and easily alter them; to that end there is some code generation refactoring and a couple minor XML issues that came up.
* Some minor logic simplifying falling out of equ...Paul Phillips2009-08-231-3/+0
| | | | | Some minor logic simplifying falling out of equality work.
* switch to unnested packages.Martin Odersky2009-07-241-1/+2
|
* More fleshing out of code generation DSL.Paul Phillips2009-06-281-6/+3
| | | | | | | consistent and reasonably aesthetic naming scheme for operators. Making progress on consolidating the several different places where code generation logic has been partially encapsulated.
* Removed unused Any_asInstanceOfErased and Any_i...Paul Phillips2009-06-261-2/+0
| | | | | | Removed unused Any_asInstanceOfErased and Any_isInstanceOfErased variations on is/as.
* Riffing off the removal of the cldc library, re...Paul Phillips2009-05-291-69/+58
| | | | | | Riffing off the removal of the cldc library, removed forCLDC and its special cases. Not as much fun as removing inIDE, but still fun.
* Updated (all) copyright notices to 2009Antonio Cunei2009-01-131-1/+1
|
* Massive check-in for IDE.Sean McDirmid2007-09-171-0/+1
|
* updated self aliases, for-comprehension, += opsmichelou2007-04-231-6/+6
|
* fixed unary_opsMartin Odersky2007-02-161-33/+7
|
* Added unary_ primitivesIulian Dragos2007-02-151-1/+1
|
* Added support for unary_+/-/!/~ primitives.Iulian Dragos2007-02-151-2/+33
|
* Merged the dotnet-scala branchmihaylov2007-02-061-1/+1
|
* Fixed bug ivolving corecions and default conver...Iulian Dragos2006-11-271-0/+11
| | | | | Fixed bug ivolving corecions and default conversions.
* removed Scala attributes '_mixin_' and '_trait_'michelou2006-10-041-7/+16
|
* removed leading/trailing tabs/blanks in scala/c...michelou2006-09-211-399/+399
| | | | | removed leading/trailing tabs/blanks in scala/concurrent/*.scala
* Added a 'cldc' target for J2ME CLDC 1.0mihaylov2006-05-031-51/+62
|
* Removed the source for the primitive types; cre...mihaylov2006-04-051-87/+0
| | | | | | Removed the source for the primitive types; create them in the compiler (in class Definitions) instead
* Removed unnecessary primitives for scala.Unitmihaylov2006-04-031-4/+0
|
* [backend] Do not treat equals,hashCode,toString...mihaylov2006-03-311-36/+0
| | | | | [backend] Do not treat equals,hashCode,toString as primitive operations
* Switching to the new build system and to the ne...Gilles Dubochet2005-12-191-0/+736
Switching to the new build system and to the new build system. This is a MAJOR commit, so be careful when updating.