summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-9174 test caseLukas Rytz2015-03-262-0/+30
| | | | Test case for SI-9174, SI-9173, SI-7402 and SI-7403.
* Merge pull request #4374 from retronym/ticket/9200Lukas Rytz2015-03-262-0/+18
|\ | | | | SI-9200 Fix Java generic signatures for refined types
| * SI-9200 Fix Java generic signatures for refined typesJason Zaugg2015-03-052-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The erasure of a refined type `T1 with T2 ... Tn` is the erasure of the intersection dominator of the elements. In addition to erased method signatures, the compiler also emits Java generic signatures, included information about generic types, up to the point that it is possible to express in the language of Java 5 generics. Java generic signatures must be consistent with erasued signatures, that is, the Java compiler must erase that generic signature to the same erased signature. If this does not hold, linkage errors will occur. The compiler implements erasure in `ErasureMap` and java generic signatures in `Erasure#javaSig`. Regrettably, these don't share any implementation; e.g `javaSig` only takes the first parent of a refinement type, rather than using `intersectionDominator`. This commit fixes that discrepency.
* | Merge pull request #4396 from retronym/ticket/9074-2.12Lukas Rytz2015-03-242-0/+39
|\ \ | | | | | | SI-9074 Fix generic substitution with package objects, overloading
| * | SI-9074 Fix generic substitution with package objects, overloadingJason Zaugg2015-03-242-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Takes a leaf out of dotty's book [1] and makes `asSeenFrom` transparently change the prefix from the package class to the package object when needed. This fixes generic subsitution during overload resolution, as reported in SI-9074. This subsumes the former fix for SI-6225, which is removed here. [1] https://github.com/lampepfl/dotty/pull/282
* | | Merge pull request #4352 from som-snytt/issue/9167-2.12Jason Zaugg2015-03-243-3/+43
|\ \ \ | |/ / |/| | SI-9167 Clarify ScalaVersion parsing
| * | SI-9167 Clarify ScalaVersion parsingSom Snytt2015-02-203-3/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Probably it was unintended to accept "2.." and "2.-11.7". This commit makes it a bit more regular and also accepts arbitrary text after the dash in the build string, including newlines. Since the number parts must be numbers, accept only digits. That also disallows "2.+11.7", which could be misconstrued as some sort of range. As before, the special build string prefixes "rc" and "m" are case-insensitive, but "FINAL" is not.
* | | Merge pull request #4302 from som-snytt/issue/deprecate-named-paramLukas Rytz2015-03-232-21/+31
|\ \ \ | | | | | | | | SI-9140 Allow deprecating current parameter name
| * | | SI-9140 Allow omitting pleonastic parameter nameSom Snytt2015-02-092-21/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable simply: ``` scala> def f(@deprecatedName foo: String) = foo.reverse f: (foo: String)String scala> f(foo = "bar") <console>:9: warning: naming parameter foo has been deprecated. f(foo = "bar") ^ res0: String = rab ``` `Symbol.deprecatedParamName` conventionally returns `NO_NAME` when the name is omitted.
| * | | SI-9140 Allow deprecating current parameter nameSom Snytt2015-02-082-21/+26
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow deprecatedName to specify the name of the parameter it qualifies. This tells the user, That's my name, don't wear it out. I.e., don't use my name when calling me. Use cases include: the name will change; normally a name should be provided for a boolean, but not in this case (perhaps because there is only one argument). ``` scala> def f(@deprecatedName('foo) bar: String) = bar.reverse f: (bar: String)String scala> f(foo = "hello") <console>:9: warning: the parameter name foo has been deprecated. Use bar instead. f(foo = "hello") ^ res0: String = olleh scala> def g(@deprecatedName('foo) foo: String) = foo.reverse g: (foo: String)String scala> g(foo = "hello") <console>:9: warning: naming parameter foo has been deprecated. g(foo = "hello") ^ res1: String = olleh ```
* | | Merge pull request #4301 from som-snytt/issue/8918-deferredLukas Rytz2015-03-231-0/+49
|\ \ \ | | | | | | | | SI-8918 Unary ids are plain ids
| * | | SI-8918 Unary ids are plain idsSom Snytt2015-02-081-0/+49
| |/ / | | | | | | | | | | | | | | | | | | | | | Allow +,-,!,~ to be used as unprefixed identifiers. As prefix operators, they must be followed by a simple expression, so otherwise, consume the id itself as the start of a simple expression.
* | | Merge pull request #4300 from CodeMettle/FiniteDuration.toCoarsestLukas Rytz2015-03-231-1/+4
|\ \ \ | | | | | | | | Declare FiniteDuration.toCoarsest to return a FiniteDuration
| * | | Declare FiniteDuration.toCoarsest to return a FiniteDurationSteven Scott2015-02-061-1/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | FiniteDuration.toCoarsest is declared with a return type of Duration even though it can only ever return a FiniteDuration. Change the declaration to return a FiniteDuration so that using this method doesn't require a cast or pattern match on the result in cases where a FiniteDuration is required.
* | | Merge pull request #4372 from som-snytt/issue/7775-tweakLukas Rytz2015-03-231-0/+43
|\ \ \ | | | | | | | | SI-7775 Exclude nulls when iterating sys props
| * | | SI-7775 Exclude nulls when iterating sys propsSom Snytt2015-03-021-0/+43
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous fix to deal with concurrent modification of system properties doesn't handle null results introduced when a property is removed. This commit filters nulls for safety, and also adds a `names` method to `sys.SystemProperties`. The test is upgraded.
* | | Merge pull request #4241 from kanielc/SI-6778Lukas Rytz2015-03-232-3/+10
|\ \ \ | | | | | | | | SI-6778 scala.math.random should have parenthesis
| * | | SI-6778 scala.math.random should have parenthesisDenton Cockburn2015-01-102-3/+10
| | | |
* | | | SI-7784 Extend test with enum constantSom Snytt2015-02-281-0/+4
| | | | | | | | | | | | | | | | Because we can.
* | | | SI-7784 Allow a singleton type over a constant value defn.Jason Zaugg2015-02-282-1/+10
| |_|/ |/| | | | | | | | | | | | | | When typechecking a `SingletonTypeTree`, we must `deconst` the type of the typechecked reference tree to avoid collapsing `a.type` into a constant type if `a` is a constant value definition.
* | | Merge pull request #4362 from ms-tg/SI-9134Adriaan Moors2015-02-261-0/+25
|\ \ \ | | | | | | | | SI-9134 Verify Stream#withFilter#map lazy in tail
| * | | SI-9134 Verify Stream#withFilter#map lazy in tailMarc Siegel2015-02-251-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in comments on [the issue](https://issues.scala-lang.org/browse/SI-9134), it appears that the fix for SI-8990 also fixed this issue. These tests demonstrate that it is fixed and will serve as regression tests. Also, if back-ported to 2.11.x, they could drive a potentially different fix there. Squashed: - incorporate review comments from adriaanm
* | | | SI-8575 Avoid use of unitialized field in a test.Jason Zaugg2015-02-261-3/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The checkinit build has been failing in the 2.12.x branch. This commit modifies the errant test case to avoid using an unitialized field. I have verified that the new test still faithfully demonstrates the original bug. ``` % scalac-hash v2.11.0 test/files/run/t8575.scala && scala-hash v2.11.0 Test java.lang.AbstractMethodError: Test$.consume(Ljava/lang/Object;)V ```
* | | Merge pull request #4284 from ms-tg/SI-8990-rebase-on-2.12-squashedAdriaan Moors2015-02-231-0/+65
|\ \ \ | | | | | | | | SI-8990 Fix lazy evaluation of StreamWithFilter#foreach
| * | | SI-8990 Allow GC during lazy evaluation of Stream#withFilterMarc Siegel2015-02-201-0/+65
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - The fact that StreamWithFilter was an inner class prevented collection of the head during processing after #withFilter, due to the reference to the outer class instance held in self. - By implementing StreamWithFilter outside of the Stream class, we gain control of the reference to the original Stream. - We clarify explicit "filter after first use" semantics for the reference to the original stream, which allows it to be GC'd during the processing of foreach, map, and flatMap. - Code is more DRY by implementing in terms of Stream#filter, which is already correctly lazy, and then Stream's #map, #flatMap, and #foreach, which already correctly allow GC. - Unfortunately, the type returned by Stream#withFilter *must* change, as it had previously inherited from the inner class TraversableLike#WithFilter, which is where the problematic reference to the outer class instance was held. Therefore, this change is targetted to 2.12.x. There doesn't appear to be any way to fix this without changing the type, sadly. - Special thanks to @paulp who suggested the likely cause of the issue at nescala 2015, and got me setup to build and run tests. Also thanks to @Ichoran and @retronym, who suggested that filter-after-first-use would preserve the reusable nature of the return value from #withFilter, rather than a single-shot null-after-first-use solution. Review by @Ichoran and @retronym Fixes #8990
* | | Merge pull request #4343 from adriaanm/reword-4267Adriaan Moors2015-02-231-0/+279
|\ \ \ | | | | | | | | SI-9113 Converting `null` collection Java<->Scala yields `null`
| * | | SI-9113 Converting `null` collection Java<->Scala yields `null`Roman Hargrave2015-02-181-0/+279
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `scala.collection.{JavaConversions, JavaConverters}` no longer wrap a `null` collection, but return `null` instead. Before, a wrapper would hold the original `null` collections, delaying the NPE until the first operation on the collection was called, with no way of knowing whether we were holding such a time bomb wrapper until the NPE was thrown. For example, this now holds: `(null : java.util.Iterator[_]).asScala == null`. Before, a wrapper would silently be created that would NPE on any further interaction. An example of this issue in the wild can be seen at https://github.com/scalafx/scalafx/issues/178, and an example of code that generates such a wrapper [before the issue was fixed](https://github.com/scalafx/scalafx/blob/ad60d5faee687b71d3c0474510d 3f3dd081ea351/scalafx/src/main/scala/scalafx/stage/FileChooser.scala#L138).
* | | Merge pull request #4323 from axel22/t-concurrent-map-get-2.12.xAdriaan Moors2015-02-231-0/+76
|\ \ \ | | | | | | | | Fix SI-9147 Override `getOrElseUpdate` in `concurrent.Map`.
| * | | Fix SI-9147 Override `getOrElseUpdate` in `concurrent.Map`.Aleksandar Prokopec2015-02-121-0/+76
| |/ / | | | | | | | | | Also, add a ScalaCheck test.
* / / SI-9131 Fix use of apply syntactic sugar with by-name paramJason Zaugg2015-02-031-0/+12
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After typechecking a tree, the typer adapts it to the current mode and expected type. If we are in FUNmode (typechecking the qualifier of a value- or type-application), and the tree does not already have a MethodType or PolyType, it is reinterepreted as `qual.apply`. In doing so, `insertApply` stabilizes the type of `qual`, e.g. replacing `Ident(foo).setType(typeOf[Int])` with `Ident(foo).setType(typeOf[foo.type])`. However, this does not check for by-name parameters, which cannot form the basis for a singleton type, as we can see by trying that directly: ``` scala> def foo(a: => String) { type T = a.type } <console>:7: error: stable identifier required, but a.type found. def foo(a: => String) { type T = a.type } ^ ``` When I last touched this code in SI-6206 / 267650cf9, I noted: // TODO reconcile the overlap between Typers#stablize and TreeGen.stabilize I didn't get around to that, but Adriaan gave that code a thorough cleanup in fada1ef6b. It appears that on the back of his work, we can now remove the local stabilization logic in `insertApply` in favour of `TreeGen.stabilize`. We then avoid the ill-formed singleton type, and the spurious "apply is not a member" type error. I did have to modify `isStableIdent` to check the symbol's info in addition to the tree's type for by-name-ness.
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-01-2955-59/+1539
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150129 Conflicts: build.number src/library/scala/concurrent/Future.scala versions.properties
| * \ Merge pull request #4214 from som-snytt/issue/5154Jason Zaugg2015-01-221-0/+9
| |\ \ | | | | | | | | SI-5154 Parse leading literal brace in XML pattern
| | * | SI-5154 Parse leading literal brace in XML patternSom Snytt2014-12-161-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't consume literal brace as Scala pattern. Previously, leading space would let the text parser `xText` handle it correctly instead.
| * | | Merge pull request #4253 from retronym/ticket/9087Grzegorz Kossakowski2015-01-202-8/+69
| |\ \ \ | | | | | | | | | | SI-9087 Fix min/max of reversed Double/Float orderings
| | * | | SI-9087 Fix min/max of reversed Double/Float orderingsJason Zaugg2015-01-202-8/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As diagnosed by the reporter, we needed additional overrides due to the way these orderings are implemented. I've added tests to show other methods and other orderings are working correctly. After writing that, I found a scalacheck test related to NaN handling that also covers `Ordering`. I had to correct the assertion in the tests of `reverse.{min,max}`.
| * | | | Construct ClassBTypes from parsed classfilesLukas Rytz2015-01-165-21/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This infrastructure is required for the inliner: when inlining code from a classfile, the corresponding ClassBType is needed for various things (eg access checks, InnerClass attribute). The test creates two ClassBTypes for the same class: once using the (unpickled) Symbol, once using the parsed ASM ClassNode, and verifies that the two are the same. There's a cleanup to the InnerClass attribute: object T { class Member; def foo = { class Local } } class T For Java compatibility the InnerClass entry for Member says the class is nested in T (not in the module class T$). We now make sure to add that entry only to T, not to T$ (unless Member is actually referenced in the classfile T$, in that case it will be added, as required).
| * | | | Cleanup asm-to-string debug helpersLukas Rytz2015-01-161-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Introduces methods for textifying classes, methods, InsnLists and individual AbstractInsnNodes.
| * | | | Merge pull request #4249 from retronym/ticket/9089Vlad Ureche2015-01-163-0/+7
| |\ \ \ \ | | |/ / / | |/| | | SI-9089 Another REPL/FSC + specialization bug fix
| | * | | SI-9089 Another REPL/FSC + specialization bug fixJason Zaugg2015-01-153-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The enclosed test case stopped working in 2.11.5 on the back of https://github.com/scala/scala/pull/4040. The key change was that we ran all post-typer info transformers on each run of the compiler, rather than trying to reuse the results of the previous run. In that patch, I noticed one place [1] in specialization that aggressively entered specialized members into the owning scope, rather than relying on `transformInfo` to place the new members in the scope of the newly created element of the info history. I made that change after noticing that this code could actually mutated scopes of specializaed types at the parser phase, which led to fairly obscure failures. This bug is another one of these obscure failures, and has the same root cause. We effectively "double specialiaze" Function0, which trips an assertion when `method apply$mcI$sp` is found twice in a scope. I have found another spot that was directly manipulating the scope, and removed the offending code. [1] https://github.com/scala/scala/pull/4040#commitcomment-8531516
| * | | | Merge pull request #4201 from mpociecha/fix-typos-in-docs-and-commentsGrzegorz Kossakowski2015-01-1422-30/+30
| |\ \ \ \ | | | | | | | | | | | | Fix many typos in docs and comments
| | * | | | Fix many typos in docs and commentsmpociecha2014-12-1422-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
| * | | | | SI-9057 - fix `showCode` to put backticks around names including dotsJan Bessai2015-01-071-0/+2
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | Missing backticks cause the parser to treat names as paths, which is obviously invalid. A unit test is included.
| * | | | Add unit tests for Tseitin CNF conversion.Gerard Basler2014-12-291-0/+555
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We compare the results using the Tseitin transformation with the results of a conversion via expansion of the formula (using distributive laws), e.g., ``` +-------+ |Formula| +---+---+ | +-----------+-----------+ | | v v +---------+ +-------+ |Expansion| |Tseitin| +----+----+ +---+---+ | +-----+ | +------->| =?= |<-------+ +-----+ ``` both methods should deliver the same results (i.e., models).
| * | | | Merge pull request #4139 from retronym/ticket/7965Adriaan Moors2014-12-231-0/+54
| |\ \ \ \ | | | | | | | | | | | | SI-7965 Support calls to MethodHandle.{invoke,invokeExact}
| | * | | | SI-7965 Support calls to MethodHandle.{invoke,invokeExact}Jason Zaugg2014-12-031-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods are "signature polymorphic", which means that compiler should not: 1. adapt the arguments to `Object` 2. wrap the repeated parameters in an array 3. adapt the result type to `Object`, but instead treat it as it it already conforms to the expected type. Dispiritingly, my initial attempt to implement this touched the type checker, uncurry, erasure, and the backend. However, I realized we could centralize handling of this in the typer if at each application we substituted the signature polymorphic symbol with a clone that carried its implied signature, which is derived from the types of the arguments (typechecked without an expected type) and position within and enclosing cast or block. The test case requires Java 7+ to compile so is currently embedded in a conditionally compiled block of code in a run test. We ought to create a partest category for modern JVMs so we can write such tests in a more natural style. Here's how this looks in bytecode. Note the `bipush` / `istore` before/after the invocation of `invokeExact`, and the descriptor `(LO$;I)I`. ``` % cat sandbox/poly-sig.scala && qscala Test && echo ':javap Test$#main' | qscala import java.lang.invoke._ object O { def bar(x: Int): Int = -x } object Test { def main(args: Array[String]): Unit = { def lookup(name: String, params: Array[Class[_]], ret: Class[_]) = { val lookup = java.lang.invoke.MethodHandles.lookup val mt = MethodType.methodType(ret, params) lookup.findVirtual(O.getClass, name, mt) } def lookupBar = lookup("bar", Array(classOf[Int]), classOf[Int]) val barResult: Int = lookupBar.invokeExact(O, 42) () } } scala> :javap Test$#main public void main(java.lang.String[]); descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC Code: stack=3, locals=3, args_size=2 0: aload_0 1: invokespecial #18 // Method lookupBar$1:()Ljava/lang/invoke/MethodHandle; 4: getstatic #23 // Field O$.MODULE$:LO$; 7: bipush 42 9: invokevirtual #29 // Method java/lang/invoke/MethodHandle.invokeExact:(LO$;I)I 12: istore_2 13: return LocalVariableTable: Start Length Slot Name Signature 0 14 0 this LTest$; 0 14 1 args [Ljava/lang/String; 13 0 2 barResult I LineNumberTable: line 16: 0 } ``` I've run this test across our active JVMs: ``` % for v in 1.6 1.7 1.8; do java_use $v; pt --terse test/files/run/t7965.scala || break; done java version "1.6.0_65" Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716) Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode) Selected 1 tests drawn from specified tests . 1/1 passed (elapsed time: 00:00:02) Test Run PASSED java version "1.7.0_71" Java(TM) SE Runtime Environment (build 1.7.0_71-b14) Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode) Selected 1 tests drawn from specified tests . 1/1 passed (elapsed time: 00:00:07) Test Run PASSED java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) Selected 1 tests drawn from specified tests . 1/1 passed (elapsed time: 00:00:05) Test Run PASSED ```
| * | | | | Merge pull request #4208 from lrytz/t9044Adriaan Moors2014-12-231-0/+6
| |\ \ \ \ \ | | | | | | | | | | | | | | SI-9044 Fix order of interfaces in classfiles
| | * | | | | SI-9044 Fix order of interfaces in classfilesLukas Rytz2014-12-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was reversed since ced3ca8ae1. The reason is that the backend used `mixinClasses` to obtain the parents of a class, which returns them in linearization order. `mixinClasses` als returns all ancestors (not only direct parents), which means more work for `minimizeInterfaces`. This was introduced in cd62f52 for unclear reasons. So we switch back to using `parents`.
| * | | | | | Merge pull request #4199 from adriaanm/rebase-4193Adriaan Moors2014-12-182-0/+272
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-8999 Reduce memory usage in exhaustivity check
| | * | | | | | SI-8999 Reduce memory usage in exhaustivity checkGerard Basler2014-12-122-0/+272
| | | |_|/ / / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The OOM could occur when all models are forcibly expanded in the DPLL solver. The simplest solution would be to limit the number of returned models but then we are back in non-determinism land (since the subset we get back depends on which models were found first). A better alternative is to create only the models that have corresponding counter examples. If this does not ring a bell, here's a longer explanation: TThe models we get from the DPLL solver need to be mapped back to counter examples. However there's no precalculated mapping model -> counter example. Even worse, not every valid model corresponds to a valid counter example. The reason is that restricting the valid models further would for example require a quadratic number of additional clauses. So to keep the optimistic case fast (i.e., all cases are covered in a pattern match), the infeasible counter examples are filtered later. The DPLL procedure keeps the literals that do not contribute to the solution unassigned, e.g., for `(a \/ b)` only {a = true} or {b = true} is required and the other variable can have any value. This function does a smart expansion of the model and avoids models that have conflicting mappings. For example for in case of the given set of symbols (taken from `t7020.scala`): "V2=2#16" "V2=6#19" "V2=5#18" "V2=4#17" "V2=7#20" One possibility would be to group the symbols by domain but this would only work for equality tests and would not be compatible with type tests. Another observation leads to a much simpler algorithm: Only one of these symbols can be set to true, since `V2` can at most be equal to one of {2,6,5,4,7}. TODO: How does this fare with mixed TypeConst/ValueConst assignments? When the assignments are e.g., V2=Int | V2=2 | V2=4, only the assignments to value constants are mutually exclusive.
| * | | | | | Merge pull request #4122 from retronym/ticket/7459-2Adriaan Moors2014-12-1812-0/+166
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-7459 Handle pattern binders used as prefixes in TypeTrees.