summaryrefslogtreecommitdiff
path: root/test/files/jvm
Commit message (Collapse)AuthorAgeFilesLines
* [backport] SI-8689 Make a Future test case determisticJason Zaugg2015-03-311-2/+7
| | | | | | | | | As discussed: https://groups.google.com/forum/#!topic/scala-internals/m8I_3GQR4vQ We need to ensure a happens-before relationship between the callback that prints "success" and the end of the main method.
* Merge pull request #4307 from som-snytt/issue/4339-2.10-bGrzegorz Kossakowski2015-02-231-1/+3
|\ | | | | SI-4339 Backpatch event errors and attr fix
| * [backport] SI-9060 Backpatch fifth-edition namesSom Snytt2015-02-151-1/+3
| | | | | | | | | | | | | | | | | | Because the compiler and library share some code in this version, compiler must exclude xml tags that look like Scala operators, such as `<:`. This is an upstream port of: scala-xml/commit/968f7bd94e934c781c19e25847ab09ac98cfbaf6
* | SI-8689 Avoid internal error in Promise after sequence of completionsViktor Klang2015-02-043-9/+82
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | Calling `completeWith` when the `DefaultPromise` is already completed, leads to callbacks not being properly executed. This happened because `Future.InternalCallbackExecutor` extends `BatchingExecutor`[1] which assumes `unbatchedExecute` to be async, when in this case it is sync, and if there is an exception thrown by executing the batch, it creates a new batch with the remaining items from the current batch and submits that to `unbatchedExecute` and then rethrows, but if you have a sync `unbatchedExecute`, it will fail since it is not reentrant, as witnessed by the failed `require` as reported in this issue. This commit avoids problem by delegating `completeWith` to `tryComplete`, which has the effect of using `onComplete` + `tryComplete` i.s.o. `complete`, which means that when it fails (because of a benign race condition between completers) it won't throw an exception. It has been tested by the minimized reproducer. [1] Actually, in the 2.10.x branch where this patch is starting out, "The BatchingExecutor trait had to be inlined into InternalCallbackExecutor for binary compatibility.". This comment will be more literally correct in the context of 2.11.x and beyond
* SI-6913 Fixing semantics of Future fallbackTo to be according to docsHeather Miller2013-12-052-4/+4
| | | | Origin: viktorklang@1bbe854
* Merge pull request #2511 from ↵Adriaan Moors2013-06-241-409/+153
|\ | | | | | | | | viktorklang/wip-cleaner-Future-method-implementations-2.10-√ General SIP-14 Future method implementation cleanup
| * Refactoring to the scala-concurrent-tck.scalaViktor Klang2013-06-191-409/+153
| | | | | | | | | | | | - there were numerous logical issues with the former implementation - failed assertions may not fail the build - there was a lot of ceremony and noise
* | [backport] relax time constraint in duration-tck.scala (for Windows VMs)Roland2013-06-101-2/+3
|/ | | | (cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)
* SI-7383 - Call ExecutionContext.prepare in Future.apply to allow for ↵Viktor Klang2013-05-101-0/+19
| | | | capturing local context like ThreadLocals and then re-establishing them prior to execution, as per intention of EC.prepare
* SI-7253: respect binary compatibility constraintsPaolo G. Giarrusso2013-03-165-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From the JLS one can prove that moving a method to a superclass is a binary compatible change, both forward and backward. That's because when compiling a method call `c.foo()`, where c: C, the output descriptor *must* refer to `C` and not to the class where `foo()` is actually defined. This patch just ensures that, and adds a test comparing generated descriptors against the Javac output. The sample code is from Paul Philipps, the fix and the bytecode comparison code from me. From 2006 (9954eafffd5e60676238369ab0ed5797c92b4a7b, a fix for bug 455 in the old bug tracker http://www.scala-lang.org/sites/default/files/aladdin/displayItem.do%3Fid=455.html) until 2.9, Scalac has followed this rule "often" (that is, when C is *not* an interface). This behavior was wrong, but the bug was hard to trigger. AFAICS, this can create problems only when moving a method to a super interface in a library and expecting forward binary compatibility - that is, compiling some Scala client code against the new version of the library, and trying to run this code against the old version of the library. This change grows an interface, so it is valid only if clients are supposed to *not* implement the library. Apparently, this is so rare that nobody noticed. Since 2.10 (0bea2ab5f6b211a83bbf14ea46fe57b8163c6334), Scalac follows this rule *only* when C is an interface (I assume by oversight, since the main change was an accessibility check), so the bug was finally triggered. The new code will have to emit INVOKEINTERFACE instead of INVOKEVIRTUAL a bit more often, compared to 2.9 (but not to 2.10). I don't know whether INVOKEINTERFACE is noticeably slower (it shouldn't be); but this is the safest fix since this behavior is mandated by the JLS. If somebody disagrees and believes the 2.9 is significantly faster, IMHO he should send a separate pull request (although ProGuard is probably a better place for the change).
* SI-7146 - Fixing checkinit bug in ExecutionContextImpl and adding testViktor Klang2013-02-192-0/+28
|
* [nomaster] Revert "SI-4664 Make scala.util.Random Serializable"Adriaan Moors2013-02-091-15/+0
| | | | | | | | | Also revert "SI-4664 [Make scala.util.Random Serializable] Add test case" This reverts commit 0b92073a38f9d1823f051ac18173078bfcfafc8a. This reverts commit 2aa66bec86fd464712b0d15251cc400ff9d52821. This is necessary to maintain binary compatibility with 2.10.0.
* SI-5675 Discard duplicate feature warnings at a positionJason Zaugg2013-02-081-2/+2
| | | | | | | | | | When -feature has not been enabled, we were double counting identical feature warnings that were emitted at the same position. Normal error reporting only reports the first time a warning appears at a position; feature warning counter incrementing should behave the same way. @hubertp: Fixed .check files that were broken in the original commit.
* Merge pull request #2033 from adriaanm/patmat-optAdriaan Moors2013-02-0316-0/+142
|\ | | | | pattern matching efficiency: addresses SI-6686 and SI-6941, affects SI-5739
| * SI-6941 testsAdriaan Moors2013-01-314-0/+28
| | | | | | | | | | | | | | | | tests that the methods' bytecodes are similar as variable load/stores are reordered, it ignores which variables are modified when checking for bytecode equality the assert is: `similarBytecode(methNodeA, methNodeB, equalsModuloVar)`
| * SI-6686 drop valdef unused in flatMapCond's blockAdriaan Moors2013-01-313-3/+0
| |
| * no type test if static type <:< primitive value classAdriaan Moors2013-01-314-0/+35
| |
| * don't store subpats bound to underscoreAdriaan Moors2013-01-314-0/+47
| | | | | | | | | | | | | | also, tweak fix in place for SI-5158 to appease SI-6941 don't store mutable fields from scala.* as we can assume these classes are well-behaved and do not mutate their case class fields
| * no null check for type-tested unapply argAdriaan Moors2013-01-314-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pattern matching on case classes where pattern is not known to be a subclass of the unapply's argument type used to result in code like: ``` if (x1.isInstanceOf[Foo]) { val x2 = x1.asInstanceOf[Foo] if (x2 != null) { // redundant ... } } ``` this wastes byte code on the redundant null check with this patch, when previous type tests imply the variable cannot be null, there's no null check
* | Merge pull request #2044 from phaller/issue/7029Adriaan Moors2013-02-021-1/+13
|\ \ | | | | | | SI-7029 - Makes sure that uncaught exceptions are propagated to the UEH ...
| * | SI-7029 - Make test more robustPhilipp Haller2013-02-011-24/+12
| | |
| * | SI-7029 - Makes sure that uncaught exceptions are propagated to the UEH for ↵Viktor Klang2013-01-311-0/+24
| |/ | | | | | | the global ExecutionContext
* | Merge pull request #2021 from gkossakowski/issue/SI-7009Grzegorz Kossakowski2013-01-314-0/+85
|\ \ | |/ |/| SI-7009: `@throws` annotation synthesized incorrectly
| * SI-7009: `@throws` annotation synthesized incorrectlyGrzegorz Kossakowski2013-01-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 990b3c7 made `scala.throws` annotation polymorphic but forgot to adapt compiler code that synthesizes it, e.g. when parsing class files. The consequence was that we would get non-deterministically either `scala.throws` or `scala.throws[T]` as a type for synthesized annotation. The reason is that `Symbol.addAnnotation` would call `tpe` method which does not initialization of symbol so type parameters list would not be determined correctly. Only if info of that symbol was forced for other reason we would get `scala.throws[T]`. That non-deterministic behavior was observed in sbt's incremental compiler. Another problem we have is that Scala allows polymorphic exceptions so in ClassfileParser we could synthesize `@throws` annotation with wrong (polymorphic) type applied. In such case the best we can do is to convert such type to monomorphic one by introducing existentials. Here's list of changes this commit introduces: * The `Symbol.addAnnotation` that takes symbol as argument asserts that the type represented by that symbol is monomorphic (disabled due to cycles; see comments in the code) * Introduce `Symbol.addAnnotation` overload that allows us to pass an applied type * Change all places where polymorphic annotations are synthesized to pass an applied type * Handle polymorphic exception types in `ClassfileParser.parseExceptions` Fixes SI-7009.
| * Test case for SI-7009.Grzegorz Kossakowski2013-01-294-0/+85
| | | | | | | | | | The next commit fixes the problem itself and it's easier to see in diff what's being fixed exactly.
* | Add Bytecode test (ASM-based) to partest.Grzegorz Kossakowski2013-01-293-0/+42
|/ | | | | | | | | | | | | | | | | | | This commit introduces a new kind of test `Bytecode` that allows one to inspect bytecode generated for given piece of Scala code. The bytecode inspection is achieved by inspection of ASM trees. See the included example for details. NOTE: This commit does not introduce a new category of pratest tests. Bytecode tests should be run in `jvm` category of partest tests. Specific list of changes: * Add BytecodeTest that contains common utilities to partest * Add asm to classpath when compiling partest. That's not a new dependency as it's being already done for javac task we were running while compiling partest. * Add an example test that shows how to count null checks in given method.
* Fix SI-6932 by enabling linearization of callback execution for the ↵Viktor Klang2013-01-211-0/+7
| | | | internal execution context of Future
* Backport of SI-6846.Jason Zaugg2013-01-082-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit 55806cc0e6177820c12a35a18b4f2a12dc07bb39 Author: Paul Phillips <paulp@improving.org> Date: Wed Dec 19 07:32:19 2012 -0800 SI-6846, regression in type constructor inference. In 658ba1b4e6 some inference was gained and some was lost. In this commit we regain what was lost and gain even more. Dealiasing and widening should be fully handled now, as illustrated by the test case. (cherry picked from commit dbebcd509e4013ce02655a2687b27d0967b3650e) commit e6ef58447d0f4ef6de956fcc03ee283bb9028c02 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:11:29 2012 -0800 Cleaning up type alias usage. I determined that many if not most of the calls to .normalize have no intent beyond dealiasing the type. In light of this I went call site to call site knocking on doors and asking why exactly they were calling any of .normalize .widen.normalize .normalize.widen and if I didn't like their answers they found themselves introduced to 'dropAliasesAndSingleTypes', the recursive widener and dealiaser which I concluded is necessary after all. Discovered that the object called 'deAlias' actually depends upon calling 'normalize', not 'dealias'. Decided this was sufficient cause to rename it to 'normalizeAliases'. Created dealiasWiden and dealiasWidenChain. Dropped dropAliasesAndSingleTypes in favor of methods on Type alongside dealias and widen (Type#dealiasWiden). These should reduce the number of "hey, the type alias doesn't work" bugs. (cherry picked from commit 3bf51189f979eb0dd41744ca844fd12dfdaa0dee) Conflicts: src/compiler/scala/tools/nsc/interpreter/CompletionOutput.scala commit c1d8803cea1523f458730103386d8e14324a9446 Author: Paul Phillips <paulp@improving.org> Date: Sat Dec 22 08:13:48 2012 -0800 Shored up a hidden dealiasing dependency. Like the comment says: // This way typedNew always returns a dealiased type. This // used to happen by accident for instantiations without type // arguments due to ad hoc code in typedTypeConstructor, and // annotations depended on it (to the extent that they worked, // which they did not when given a parameterized type alias // which dealiased to an annotation.) typedTypeConstructor // dealiases nothing now, but it makes sense for a "new" to // always be given a dealiased type. PS: Simply running the test suite is becoming more difficult all the time. Running "ant test" includes time consuming activities of niche interest such as all the osgi tests, but test.suite manages to miss the continuations tests. (cherry picked from commit 422f461578ae0547181afe6d2c0c52ea1071d37b) commit da4748502792b260161baa10939554564c488051 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 12:39:02 2012 -0800 Fix and simplify typedTypeConstructor. Investigating the useful output of devWarning (-Xdev people, it's good for you) led back to this comment: "normalize to get rid of type aliases" You may know that this is not all the normalizing does. Normalizing also turns TypeRefs with unapplied arguments (type constructors) into PolyTypes. That means that when typedParentType would call typedTypeConstructor it would find its parent had morphed into a PolyType. Not that it noticed; it would blithely continue and unwittingly discard the type arguments by way of appliedType (which smoothly logged the incident, thank you appliedType.) The simplification of typedTypeConstructor: There was a whole complicated special treatment of AnyRef here which appears to have become unnecessary. Removed special treatment and lit a candle for regularity. Updated lots of tests regarding newly not-so-special AnyRef. (cherry picked from commit 394cc426c1ff1da53146679b4e2995ece52a133e) commit 1f3c77bacb2fbb3ba9e4ad0a8a733e0f9263b234 Author: Paul Phillips <paulp@improving.org> Date: Fri Dec 21 15:06:10 2012 -0800 Removed dead implementation. Another "attractive nuisance" burning off time until I realized it was commented out. (cherry picked from commit ed40f5cbdf35d09b02898e9c0950b9bd34c1f858)
* SI-4664 [Make scala.util.Random Serializable] Add test caseJean-Remi Desjardins2012-12-041-0/+15
|
* Removing actors-migration from main repository so it can live on elsewhere.Josh Suereth2012-11-012-35/+0
| | | | | | | * Removes actors-migration hooks from partest * Removes actors-migration code * removes actors-migration tests * removes actors-migration distribution packaging.
* Merge branch '2.10.0-wip' of github.com:scala/scala into 2.10.0-wipJosh Suereth2012-11-012-0/+35
|\
| * SI-6581 fixed by inlining `Actor.self`.Vojin Jovanovic2012-10-302-0/+35
| | | | | | | | | | | | This avoids the necessary type cast that was preventing leakage of internal migration classes. Review by @phaller
* | Removing actors-migration from main repository so it can live on elsewhere.Josh Suereth2012-10-3026-1579/+0
|/ | | | | | | * Removes actors-migration hooks from partest * Removes actors-migration code * removes actors-migration tests * removes actors-migration distribution packaging.
* avoid single-art assert where harmful in duration-tckRoland2012-10-181-4/+7
|
* SI-6442 - Add ActorDSL object for actor migration kitphaller2012-09-2911-78/+68
| | | | Removes MigrationSystem, since ActorDSL replaces it.
* Additional Actor Migration Tests.Vojin Jovanovic2012-09-2510-0/+656
| | | | Review by @phaller.
* Support for scala.concurrent for the ActorRef.Vojin Jovanovic2012-09-258-39/+74
| | | | Review by @phaller
* SI-6305 fix.Vojin Jovanovic2012-09-255-7/+12
|
* Merge remote-tracking branch 'paulp/topic/gitattributes' into 2.10.xPaul Phillips2012-09-202-128/+128
|\
| * Normalized line endings.Paul Phillips2012-09-202-128/+128
| | | | | | | | | | | | This brings all the files into line with the .gitattributes settings, which should henceforth be automatically maintained by git.
* | Merge pull request #1339 from rkuhn/wip-6389-finite-duration-multJosh Suereth2012-09-2012-26/+34
|\ \ | |/ |/| enable integer multiplication/divison on FiniteDuration, see SI-6389
| * some small remaining fixesRoland2012-09-201-1/+4
| | | | | | | | | | | | | | | | - added test for “span” and “fromNow” qualifiers - make those actually work even when there is an expected type - add ScalaDoc to them - verify (and fix) conversion Deadline -> FiniteDuration - also make Int * Duration => FiniteDuration work (and test it)
| * Adjustments to scala.concurrent.duration.Paul Phillips2012-09-191-10/+9
| | | | | | | | | | | | | | | | More use of implicit classes and value classes; aliased units to make importing TimeUnit and TimeUnit._ unnecessary; placed some classes in their own files because "the unit of compilation is the file" and we shouldn't bundle more than necessary; fixed some examples.
| * move Duration (incl. DSL) into scala.concurrent.duration packageRoland2012-09-1912-15/+14
| | | | | | | | | | | | | | | | | | so that the full package can be imported naturally: import scala.concurrent.duration._ will give you all the types (Duration, FiniteDuration, Deadline) and the DSL for constructing these.
| * enable integer multiplication/divison on FiniteDuration, see SI-6389Roland2012-09-181-1/+8
| | | | | | | | | | | | | | | | | | - without this "2.seconds * 2" will not return FiniteDuration but Duration - added test case verifying this behavior - matches normal arithmetics: integers throw on div-by-zero while doubles yield infinity; extended here to include overflow protection on integer multiplication
* | Merge pull request #1298 from pavelpavlov/SI-5767Josh Suereth2012-09-184-4/+92
|\ \ | |/ |/| SI-5767 fix + protecting public FlatHashMap API
| * pull request feedbackPavel Pavlov2012-09-184-4/+92
| |
* | Merge remote-tracking branch 'origin/2.10.x' into fix-duration-issues-RKRoland2012-09-121-1/+28
|\ \
| * | improve docs and Promise implRoland2012-09-111-8/+1
| | | | | | | | | | | | | | | | | | | | | - scaladoc the exceptions thrown by Await.* and Awaitable.* - move intercept[Exception] into partest’s TestUtil object - improve Promise.tryAwait implementation following Viktor’s comments and make use of Deadline to avoid calling System.nanoTime too often
| * | fix usage of Duration in Promise implRoland2012-09-101-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | - correctly treat MinusInf and Undefined - don't toMillis in the timeout message (could be MinusInf) - also notice that Inf did not actually wait unbounded - and further notice that tryAwait swallows InterruptedException instead of bailing out early => changed to do so and added throws annotation - also removed some unused imports of Duration