summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Fixing slightly damaged test.Paul Phillips2011-12-281-1/+1
|
* repl power mode improvements.Paul Phillips2011-12-282-3/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implemented great suggestion from moors. More imports in power mode, including the contents of treedsl. Also, another swing at overcoming the mismatched global singletons problem, this time taking advantage of dependent method types. Amazingly, it seems to work. Continuing in the quest to create a useful compiler hacking environment, there is now an implicit from Symbol which allows you to pretend a Symbol takes type parameters, and the result is the applied type based on the manifests of the type arguments and the type constructor of the symbol. Examples: // magic with manifests scala> val tp = ArrayClass[scala.util.Random] tp: $r.global.Type = Array[scala.util.Random] // evidence scala> tp.memberType(Array_apply) res0: $r.global.Type = (i: Int)scala.util.Random // treedsl scala> val m = LIT(10) MATCH (CASE(LIT(5)) ==> FALSE, DEFAULT ==> TRUE) m: $r.treedsl.global.Match = 10 match { case 5 => false case _ => true } // typed is in scope scala> typed(m).tpe res1: $r.treedsl.global.Type = Boolean
* Tone down insensible-equality warning.Paul Phillips2011-12-273-7/+11
| | | | Closes SI-5175.
* Merge branch 'type-currying-mini' of /scala/trunk into developPaul Phillips2011-12-272-0/+72
|\
| * Consecutive type application.Paul Phillips2011-12-272-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | The parser through I think a quirk of history would not allow back to back type applications, like expr[T1, T2][T3, T4] Now it does, meaning the only thing it can: val n0 = Partial[immutable.HashMap][String][Int] ++ Seq(("a", 1)) val n1 = Partial.apply[immutable.HashMap].apply[String].apply[Int] ++ Seq(("a", 1)) assert(n0 == n1)
| |
| \
| \
| \
| \
| \
| \
| \
*-------. \ Merge remote-tracking branches 'ijuma/issue/5341', ↵Paul Phillips2011-12-2723-0/+403
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | | | | | | | 'kepler/topic/reifyclosuretests', 'kepler/topic/antscalacheck', 'szabolcsberecz/SI-5104', 'kepler/ticket/5334' and 'kepler/topic/miscfixes' into develop
| | | | * | Tests for recently submitted SI-5334Eugene Burmako2011-12-232-0/+30
| | | | |/
| | | * / fixes #5104 and related NaN ordering inconsistenciesSzabolcs Berecz2011-12-251-0/+130
| | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bug was caused by the inconsistency between j.l.Math.min() and j.l.Double.compareTo() wrt NaN (j.l.Math.min() considers NaN to be less than any other value while j.l.Double.compareTo() says it's greater...) The fix changes Ordering.{FloatOrdering,DoubleOrdering) to base it's results on primitive comparisons and math.{min,max} instead of j.l.{Float,Double}.compareTo()
| * | / A handful of tests for closures under reificationEugene Burmako2011-12-2620-0/+243
|/ / /
* / / Fixed regression in lub calculation.Paul Phillips2011-12-261-0/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changing NullaryMethodType to be a SimpleTypeProxy because nearly all its operations forward to its result type was it seems not such a good idea, because it also meant that calling .underlying returned the result type rather than the method type. The way this materialized was in subtype checks of refinement types. A lub is calculated for two nullary method types in the course of calculating a refinement, and then the input types are checked against the calculated lub. However in the lub refinement, the nullary method type has become a bare typeref, and so the subtype check failed. Closes SI-5317. This does give me confidence that all the malformed lubs one sees logged under -Ydebug (and there are still many, especially with type constructors) are alerting us to real bugs elsewhere in Types.
* | [vpm] emitting switches -- BodyTreeMakerAdriaan Moors2011-12-245-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) introduce BodyTreeMaker to get rid of special casing for body now each case is a list of TreeMakers rather than a pair of such a list and a tree needed to do this since emitting switches requires access to the untranslated body 2) emitting switches - alternatives are flattened: each alternative block ends with a jump to the next alternative (if there is one) - to avoid stack overflow in typedMatch: detect when translateMatch returns a Match the patch to uncurry would be nicer with an extractor, but that breaks due to a bug in old patmat made trees into dags again -- NPE in erasure tree.duplicate seems to break lambdalift because it does not give fresh symbols (or trees?) to the valdefs for the arguments of duplicated functions duplicate enclosing tree, not subtrees improved propagateSubstitution for AlternativesTreeMaker - it now propagates to all its alternatives, so we don't have to do that in chainBefore - by making propagation more regular, a bug in substitution in AlternativesTreeMaker manifested itself it introduced a new binder, unnecessarily, which then was unbound -- now reusing binder of outer pattern having removeSubstOnly in propagateSubstitution unveiled a bug: guard treemaker should substitute move fixerUpper closer to what it fixes up
* | [vpm] common sub-expression elimination for conditionsAdriaan Moors2011-12-243-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TreeMakers (esp. CondTreeMakers) are approximated by hash-cons'ed Conds sharing is detected for prefixes of Conds, and shared conditions are only tested once their results are stored, and repeated tests branch on the last shared condition, reusing the results from the first time they were checked a Test is 1-to-1 with a TreeMaker, but may share its Cond TODO: clean separation of the two translation strategies: - naive flatMap/orElse (for virtualization) - less-naive if-then-else (with CSE etc coming) sharing trees caused wrong bytecode to be emitted (verifyerror) tentative explanation: "because lambdalift uses mutable state to track which variables have been captured if you refer to the same variable with the same tree twice it'll get confused" Sent at 8:27 PM on Thursday >> grzegorz.kossakowski: so we found a bug in jvm according to http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc2.html checkcast should throw a classcastexception becuase it's a shorthand for if !(x instanceof T) throw ClassCastExcpt but jvm decided to throw verifyerror and yeah, the check is wrong if jvm was not throwing verifyerror it would throw classcast exception saying that ObjectRef cannot be casted to $colon$colon ... >> me: so now where does it come from? since a ref is involved, i thought LambdaLift >> grzegorz.kossakowski: yup or now I don't think lambalift introduces that kind of low-level casts but I might be wrong btw. it's interesting that it unpacks stuff from objectref twice in your code and in one place checkcast is correct and in another is wrong Sent at 9:33 PM on Thursday >> grzegorz.kossakowski: also, since it's a verifyerror I think genjvm should have an assertion >> grzegorz.kossakowski: 193: getfield #54; //Field scala/runtime/ObjectRef.elem:Ljava/lang/Object; 196: checkcast #8; //class scala/runtime/ObjectRef 199: invokevirtual #95; //Method scala/collection/immutable/$colon$colon.tl$1:()Lscala/collection/immutable/List; it's this see you have checkcast for ObjectRef and then on that value, you try to call tl() method from List Sent at 9:56 PM on Thursday >> me: fixed sharing trees is bad very bad because lambdalift uses mutable state to track which variables have been captured if you refer to the same variable with the same tree twice it'll get confused
* | [vpm] unapplyProd: faster matching for case classesAdriaan Moors2011-12-243-0/+28
|/ | | | | | | | | | | | | | | | | | | | | | | | | | behold the mythical unapplyProd: it does not exist, yet it promises to speed up pattern matching on case classes instead of calling the synthetic unapply/unapplySeq, we don't call the mythical synthetic unapplyProd, since -- if it existed -- it would be the identity anyway for case classes eventually, we will allow user-defined unapplyProd's, which should give you almost the same speed as case class matching for user-defined extractors (i.e., you don't have to wrap in an option, just return something on which we can select _i for i = 1 to N, unless it is null, which indicates match failure) still need to figure out a way to derive the types for the subpatterns, without requiring you to wrap your result in a ProductN unapplyProd support for vararg case classes using caseFieldAccessors instead of synthetic _i now the compiler bootstraps again, and after this optimization, quick.lib overhead is 70%, quick.comp is 50% (compiling with a locker built using -Yvirtpatmat, and itself generating code for -Yvirtpatmat) before the optimization, I think the overhead for quick.comp was close to 100% in this scenario more robust tupleSel for case classes TODO: - pos/t602 -- clean up after type inference as in fromCaseClassUnapply - run/pf-catch -- implement new-style orElse for partial function in uncurry
* Omit non-essential TypeApply trees.Eugene Burmako2011-12-222-33/+0
| | | | Otherwise they cause type errors.
* Fix for classOf NPE.Paul Phillips2011-12-192-0/+14
| | | | Let type parameter be inferred. Closes SI-4871.
* Test case closes SI-5119.Paul Phillips2011-12-191-0/+13
|
* Merge remote-tracking branches 'axel22/issue/5293' and ↵Paul Phillips2011-12-1915-140/+307
|\ | | | | | | 'jsuereth/fix-5053-view-unzip' into develop
| * unzip(3) on view now returns view.Josh Suereth2011-12-182-0/+26
| | | | | | | | | | | | | | | | * Added unzip and unzip3 to TraversableViewLike * Added partest tests for unzip on views returning specific collection types. Closes SI-5053 Review by @paulp
| * Fixed "Definition Classes" in bug #5287Vlad Ureche2011-12-165-106/+104
| |
| * Fixed scalacheck test to fail if it's failing.Paul Phillips2011-12-161-7/+1
| |
| * Improve quality of scalacheck range tests input and output.Daniel C. Sobral2011-12-161-26/+55
| | | | | | | | | | | | | | Remove some dead code, activate ByOne generator again, add generators for inclusive ranges, add generators that concentrate on the boundaries, and add some print statements next to exceptions that might get eaten by out of memory errors.
| * Fix for seq/array varargs crasher.Paul Phillips2011-12-131-0/+11
| | | | | | | | Closes SI-4024.
| * Test case closes SI-4063.Paul Phillips2011-12-121-0/+39
| |
| * Test case closes SI-4273.Paul Phillips2011-12-121-0/+8
| |
| * Merge remote-tracking branch 'repo/develop'Paul Phillips2011-12-122-1/+2
| |\
| | *---. Merge remote-tracking branches 'kepler/topic/typeparamsfix', ↵Paul Phillips2011-12-122-1/+2
| | |\ \ \ | | | | | | | | | | | | | | | | | | 'kepler/ticket/5295' and 'blair/clarify-Map-withDefaultValue' into develop
| | | | * | Batch files no longer swallow exit codesEugene Burmako2011-12-092-1/+2
| | | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually scripts like scala.bat and scalac.bat correctly propagate exit codes from underlying Java invocations. However, if you run these scripts as follows: "cmd /c scala ...", then errorlevel gets swallowed. This simple patch fixes the aforementioned problem. Fixes SI-5295, no review.
| * | / / Range.foreach optimization.Paul Phillips2011-12-121-0/+61
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes code like 0 to 100 foreach (x += _) as fast as (often faster than, in fact) a while loop. See the comment in Range for the gory details. More investigation should be done regarding total impact on inlining behavior. Review by @odersky.
* / / / Fix #5293 - changed the way hashcode is improved in hash sets.aleksandar2011-12-192-4/+87
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The hash code is further improved by using a special value in the hash sets called a `seed`. For sequential hash tables, this value depends on the size of the hash table. It determines the number of bits the hashcode should be rotated. This ensures that hash tables with different sizes use different bits to compute the position of the element. This way traversing the elements of the source hash table will yield them in the order where they had similar hashcodes (and hence, positions) in the source table, but different ones in the destination table. Ideally, in the future we want to be able to have a family of hash functions and assign a different hash function from that family to each hash table instance. That would statistically almost completely eliminate the possibility that the hash table element traversal causes excessive collisions. I should probably @mention extempore here.
* / / Disabled another presentation compiler test.Paul Phillips2011-12-093-0/+0
|/ / | | | | | | | | | | It foiled me right on the cusp of a successful windows nightly. https://scala-webapps.epfl.ch/jenkins/job/scala-nightly-windows/1170/consoleText
* | Merge remote-tracking branches 'VladUreche/issue/5054' and ↵Paul Phillips2011-12-086-13/+5
|\| | | | | | | 'jsuereth/dont_resolve_releases'
| *-. Merge remote-tracking branches 'soc/SI-4990', ↵Paul Phillips2011-12-076-13/+5
| |\ \ | | | | | | | | | | | | 'fedgehog/docs_fix_for_scala.Either.cond___SI-5113' and 'kepler/ticket/5266' into develop
| | | * Fix reflective toolbox producing invalid bytecodeEugene Burmako2011-12-075-10/+3
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wrapper method for AST undergoing a reflective compilation has been incorrectly marked as static. This was off the radars until one day the code being compiled declared a top-level method. During flatten that method got hoisted into the wrapper module, and its invocation got translated into an instance call upon the module. This led to static wrapper method trying to call an instance method, and that blew up the bytecode verifier. More info: https://issues.scala-lang.org/browse/SI-5266. Fixes SI-5266, review by @odersky.
| | * 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.
* / Fixed #5054, #5287Vlad Ureche2011-12-089-14/+173
|/ | | | | | | | | | | | | | | | | | | | | | | | | | The documents with use cases should be restructured like: /** * The full definition, either used with an implicit value or with an explicit one. * * Some more explanation on implicits... * * @param lost a lost parameter * @return some integer * * @usecase def test(): Int * * This takes the implicit value in scope. * * Example: `test()` * * @usecase def test(explicit: Int): Int * * This takes the explicit value passed. * * Example: `test(3)` */ def test(implicit lost: Int): Int
* Merge remote-tracking branch 'soc/scaladoc-spacing' into developPaul Phillips2011-12-061-7/+7
|\
| * Fixes the annoying spaces between name, type params and params in ScalaDoc.Simon Ochsenreither2011-12-061-7/+7
| |
* | Merge remote-tracking branches 'blair/documentation-typo-fix' and ↵Paul Phillips2011-12-064-5/+5
|\ \ | | | | | | | | | 'blair/remove-documentation-stutters' into develop
| * | Fix documentation stutters.Blair Zajac2011-12-064-5/+5
| | |
* | | Fix documentation typo.Blair Zajac2011-12-061-1/+1
|/ /
* | Disabled non-deterministic tests.Paul Phillips2011-12-0561-0/+0
| | | | | | | | | | | | Everyone's favorite "will they or won't they" tests, akka and timeofday. They will be welcomed back into the fold once they can stick to a decision on whether to pass or fail.
* | Another test pack for reflectionEugene Burmako2011-12-0559-0/+1200
| | | | | | | | Also see https://github.com/scala/scala/pull/25.
* | Merge remote-tracking branch 'kepler/topic/reifytests'Paul Phillips2011-12-0428-0/+352
|\ \
| * | Test pack for various flavors of reflection.Eugene Burmako2011-12-0528-0/+352
| | |
| | |
| \ \
*-. \ \ Merge remote-tracking branches 'kepler/topic/reifyclasses' and ↵Paul Phillips2011-12-044-1/+17
|\ \ \ \ | | | | | | | | | | | | | | | 'ijuma/feature/signum' into develop
| | * | | Delegate to Java's implementation of signum for Long and Int.Ismael Juma2011-12-031-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Java implementation is faster as it doesn't have branches. java.lang.Math includes implementations of signum for Double and Float, but I didn't change the ones in scala.math because there is a difference on how negative zero is handled.
| * | | | Reification of classes now produces trees that can be compiled and run.Eugene Burmako2011-12-043-1/+2
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Multiple minor fixes to Martin's implementation of reflection infrastructure. Dominating theme is allowing for the fact that compilation via reflection involves numerous exports/imports between various reflection universes. Fixes SI-5230. Review by @odersky.
* / | | 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.