summaryrefslogtreecommitdiff
path: root/src/partest-extras
Commit message (Collapse)AuthorAgeFilesLines
* Improve stub error messages (SCP-009 proposal)jvican2017-03-241-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following commit message is a squash of several commit messages. - This is the 1st commit message: Add position to stub error messages Stub errors happen when we've started the initialization of a symbol but key information of this symbol is missing (the information cannot be found in any entry of the classpath not sources). When this error happens, we better have a good error message with a position to the place where the stub error came from. This commit goes into this direction by adding a `pos` value to `StubSymbol` and filling it in in all the use sites (especifically `UnPickler`). This commit also changes some tests that test stub errors-related issues. Concretely, `t6440` is using special Partest infrastructure and doens't pretty print the position, while `t5148` which uses the conventional infrastructure does. Hence the difference in the changes for both tests. - This is the commit message #2: Add partest infrastructure to test stub errors `StubErrorMessageTest` is the friend I introduce in this commit to help state stub errors. The strategy to test them is easy and builds upon previous concepts: we reuse `StoreReporterDirectTest` and add some methods that will compile the code and simulate a missing classpath entry by removing the class files from the class directory (the folder where Scalac compiles to). This first iteration allow us to programmatically check that stub errors are emitted under certain conditions. - This is the commit message #3: Improve contents of stub error message This commit does three things: * Keep track of completing symbol while unpickling First, it removes the previous `symbolOnCompletion` definition to be more restrictive/clear and use only positions, since only positions are used to report the error (the rest of the information comes from the context of the `UnPickler`). Second, it adds a new variable called `lazyCompletingSymbol` that is responsible for keeping a reference to the symbol that produces the stub error. This symbol will usually (always?) come from the classpath entries and therefore we don't have its position (that's why we keep track of `symbolOnCompletion` as well). This is the one that we have to explicitly use in the stub error message, the culprit so to speak. Aside from these two changes, this commit modifies the existing tests that are affected by the change in the error message, which is more precise now, and adds new tests for stub errors that happen in complex inner cases and in return type of `MethodType`. * Check that order of initialization is correct With the changes introduced previously to keep track of position of symbols coming from source files, we may ask ourselves: is this going to work always? What happens if two symbols the initialization of two symbols is intermingled and the stub error message gets the wrong position? This commit adds a test case and modifications to the test infrastructure to double check empirically that this does not happen. Usually, this interaction in symbol initialization won't happen because the `UnPickler` will lazily load all the buckets necessary for a symbol to be truly initialized, with the pertinent addresses from which this information has to be deserialized. This ensures that this operation is atomic and no other symbol initialization can happen in the meantime. Even though the previous paragraph is the feeling I got from reading the sources, this commit creates a test to double-check it. My attempt to be better safe than sorry. * Improve contents of the stub error message This commit modifies the format of the previous stub error message by being more precise in its formulation. It follows the structured format: ``` s"""|Symbol '${name.nameKind} ${owner.fullName}.$name' is missing from the classpath. |This symbol is required by '${lazyCompletingSymbol.kindString} ${lazyCompletingSymbol.fullName}'. ``` This format has the advantage that is more readable and explicit on what's happening. First, we report what is missing. Then, why it was required. Hopefully, people working on direct dependencies will find the new message friendlier. Having a good test suite to check the previously added code is important. This commit checks that stub errors happen in presence of well-known and widely used Scala features. These include: * Higher kinded types. * Type definitions. * Inheritance and subclasses. * Typeclasses and implicits. - This is the commit message #4: Use `lastTreeToTyper` to get better positions The previous strategy to get the last user-defined position for knowing what was the root cause (the trigger) of stub errors relied on instrumenting `def info`. This instrumentation, while easy to implement, is inefficient since we register the positions for symbols that are already completed. However, we cannot do it only for uncompleted symbols (!hasCompleteInfo) because the positions won't be correct anymore -- definitions using stub symbols (val b = new B) are for the compiler completed, but their use throws stub errors. This means that if we initialize symbols between a definition and its use, we'll use their positions instead of the position of `b`. To work around this we use `lastTreeToTyper`. We assume that stub errors will be thrown by Typer at soonest. The benefit of this approach is better error messages. The positions used in them are now as concrete as possible since they point to the exact tree that **uses** a symbol, instead of the one that **defines** it. Have a look at `StubErrorComplexInnerClass` for an example. This commit removes the previous infrastructure and replaces it by the new one. It also removes the fields positions from the subclasses of `StubSymbol`s. - This is the commit message #5: Keep track of completing symbols Make sure that cycles don't happen by keeping track of all the symbols that are being completed by `completeInternal`. Stub errors only need the last completing symbols, but the whole stack of symbols may be useful to reporting other error like cyclic initialization issues. I've added this per Jason's suggestion. I've implemented with a list because `remove` in an array buffer is linear. Array was not an option because I would need to resize it myself. I think that even though list is not as efficient memory-wise, it probably doesn't matter since the stack will usually be small. - This is the commit message #6: Remove `isPackage` from `newStubSymbol` Remove `isPackage` since in 2.12.x its value is not used.
* Move Scaladoc's Partest base classes to partest-extrasJason Zaugg2017-01-272-0/+219
| | | | | | They exist in the current location for historical reasons. partest-extras is a cleaner home for them, as we can avoid the dependency of the scaladoc project on partest.
* Typo and spelling correctionsJanek Bogucki2016-11-112-2/+2
|
* Revert "Temporarily insource Scalacheck 1.11.6"Adriaan Moors2016-11-0114-3613/+0
| | | | This reverts commit 22dac3118e97b2a4707d42ef1f47ac292a8ed385.
* Upgrade asm to 5.1Lukas Rytz2016-07-201-3/+3
| | | | | The constructor of scala.tools.asm.Handle now takes an additional boolean parameter to denote whether the owner is an interface.
* Temporarily insource Scalacheck 1.11.6Jason Zaugg2016-06-2714-0/+3613
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a temporary measure until we release Scala 2.12.0. It means we are able to release milestones, and RCs of Scala without needing a public release of Scalacheck. While we've never had to wait very long for these in the past (Thanks, Rickard!) we'd like to spare the maintainer some work betwen now and 2.12.0. After we release Scala 2.12.0, we'll revert to a binary dependency on the standard Scalacheck. I have replaced the scala-parser-combinator based command line option parsing with a quick and dirty version. I've had to remove scalacheck as a SBT test framework in our build. We don't use it directly as such (instead, it is used indirectly through `partest --scalacheck`), and it's test discovery (which we expect to return nothing) fails after re-STARR-ing due to an unsolved problem with SBT's testLoader including either STARR or sbt-launch.jar on the classpath used to discover and spawn tests. For the record, I tried the following to no avail: ``` // Two modifications are needed from the stock SBT configuration in order to exclude STARR // from the classloader that performs test discovery. // - We make `isManagedVersion` hold by providing an explicit Scala version, in order to go into the desired // branch in `createTestLoader` // - We remove STARR from the classloader of the scala instance def fixTestLoader = testLoader := { val s = scalaInstance.value val scalaInstance1 = new ScalaInstance(s.version, appConfiguration.value.provider.scalaProvider.loader(), s.libraryJar, s.compilerJar, s.extraJars, Some(s.actualVersion)) assert(scalaInstance1.isManagedVersion) TestFramework.createTestLoader(Attributed.data(fullClasspath.value), scalaInstance1, IO.createUniqueDirectory(taskTemporaryDirectory.value)) } ``` f
* Remove abstraction layer in classpath implementationLukas Rytz2016-05-021-5/+5
|
* remove recursive classpath implementationLukas Rytz2016-04-231-7/+11
|
* Fix one warning in Util.scalaKota Mizushima2016-03-171-1/+1
| | | | Explicitly annotate return type of trace macro to avoid type inference
* Tests for optimizing val patternsLukas Rytz2016-02-161-4/+18
| | | | Fixes https://github.com/scala/scala-dev/issues/28
* Merge remote-tracking branch 'upstream/2.12.x' into opt/elimBoxesLukas Rytz2016-01-244-6/+1
|\
| * Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-184-6/+1
| | | | | | | | | | | | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
* | Eliminate non-escaping boxes, tuples and refsLukas Rytz2015-12-151-0/+5
|/ | | | | | | | | Eliminate boxes, tuples and refs that are created and used within a single method without escaping. For details on the implementation see the doc comment in class BoxUnbox. This commit also cleans up the logic of inter-dependent method-level optimizations that run until reaching a fixpoint.
* fix bug in partest-extras causing test failures on WindowsSeth Tisue2015-09-251-2/+7
| | | | includes comment with full details
* [backport] Accessibility checks for methods with an InvokeDynamic instructionLukas Rytz2015-07-231-30/+48
| | | | | | | | | | | | | | Implements the necessary tests to check if a method with an InvokeDynamic instruction can be inlined into a destination class. Only InvokeDynamic instructions with LambdaMetaFactory as bootstrap methods can be inlined. The accessibility checks cannot be implemented generically, because it depends on what the bootstrap method is doing. In particular, the bootstrap method receives a Lookup object as argument which can be used to access private methods of the class where the InvokeDynamic method is located. A comment in the inliner explains the details.
* Merge pull request #4576 from som-snytt/issue/9206-moreSeth Tisue2015-07-011-15/+19
|\ | | | | SI-9206 REPL custom bits
| * SI-9206 De-perk the welcome messageSom Snytt2015-06-251-6/+8
| | | | | | | | | | The welcome message defaults to a sober header followed by one line of instructions.
| * SI-9206 Update REPL welcome messageSom Snytt2015-06-241-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Everyone knows that a `help` command will result in `more information`. This commit moves the version string to the second line and adds some verve to the welcome. If anyone can't live without the old banner, they are now able to configure it explicitly, so there is still no blood on our hands. ``` $ scala Welcome to Scala version 2.11.6 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions to have them evaluated. Type :help for more information. scala> :quit $ skala Welcome to Scala! version 2.11.7-20150623-155244-eab44dd092 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_40). Type in expressions for evaluation. Or try :help. scala> :quit ``` REPL tests now lop off the actual length of the welcome header; or, if necessary, remove the version number from a header embedded in output.
* | Fix 23 typos (m-o)Janek Bogucki2015-06-281-1/+1
|/
* SI-9206 Accept paste with custom promptSom Snytt2015-06-211-5/+7
| | | | But sans test.
* Fix many typosMichaƂ Pociecha2015-04-211-1/+1
| | | | | This commit corrects many typos found in scaladocs and comments. There's also fixed the name of a private method in ICodeCheckers.
* SI-3368 CDATA gets a NodeSom Snytt2015-04-081-0/+21
| | | | | | | | | | | | | | | | | | | | | | XML Parser uses `scala.xml.PCData`. A compiler flag `-Yxml:coalescing`, analogous to `DocumentBuilderFactory.setCoalescing`, turns `PCData` nodes into `Text` nodes and coalesces sibling text nodes. This change also fixes parse errors such as rejecting a sequence of CDATA sections. A sequence of "top level" nodes are not coalesced. ``` scala> <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a> res0: scala.xml.Elem = <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a> scala> :replay -Yxml:coalescing Replaying: <a><b/>start<![CDATA[hi & bye]]><c/>world<d/>stuff<![CDATA[red & black]]></a> res0: scala.xml.Elem = <a><b/>starthi &amp; bye<c/>world<d/>stuffred &amp; black</a> ```
* SI-9170 More flexible SessionTestSom Snytt2015-03-031-5/+32
| | | | | | | | SessionTest session text can include line continuations and pasted text. Pasted script (which looks like a double prompt) probably doesn't work. This commit includes @retronym's SI-9170 one-liner.
* Fix many typos in docs and commentsmpociecha2014-12-142-2/+2
| | | | | | | | | | | | | 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.
* Cleanup and refactoring - semicolons, unused or commented out codempociecha2014-12-051-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains some minor changes made by the way when implementing flat classpath. Sample JUnit test that shows that all pieces of JUnit infrastructure work correctly now uses assert method form JUnit as it should do from the beginning. I removed commented out lines which were obvious to me. In the case of less obvious commented out lines I added TODOs as someone should look at such places some day and clean them up. I removed also some unnecessary semicolons and unused imports. Many string concatenations using + have been changed to string interpolation. There's removed unused, private walkIterator method from ZipArchive. It seems that it was unused since this commit: https://github.com/scala/scala/commit/9d4994b96c77d914687433586eb6d1f9e49c520f However, I had to add an exception for the compatibility checker because it was complaining about this change. I made some trivial corrections/optimisations like use 'findClassFile' method instead of 'findClass' in combination with 'binary' to find the class file.
* Address review feedback.Lukas Rytz2014-09-112-3/+3
|
* Remove stale local variables and exception handlers after DCELukas Rytz2014-09-101-19/+35
| | | | | | This is required for correctness of the generated bytecode. Exception handlers and local variable descriptors specify code offset ranges. These offsets have to exist, not be eliminated.
* Tools to run the compiler in JUnit testsLukas Rytz2014-09-101-2/+21
|
* JUnit tests for dead code elimination.Lukas Rytz2014-09-102-65/+174
| | | | JUnit tests may use tools from partest-extras (ASMConverters)
* Respect -Dpartest.scalac_opts when running the test suite through ANTLukas Rytz2014-05-071-1/+1
| | | | | | | | | | | | | | Used to enable `-Xcheckinit` (now also `-Ybackend:GenBCode`) when compiling tests in the respective jenkins builds. This is currently broken, as you can see in [recent build logs] [1], `-Xcheckinit` is missing: [partest] Scalac options are: -optimise Adds `.flags` files for macro tests (correct range positions not enforced) and for tests failing due to SI-8560 or SI-8562. [1]: https://scala-webapps.epfl.ch/jenkins/view/nightlies/job/scala-nightly-checkinit/2058/consoleFull
* SI-7711 Test for args in scriptSom Snytt2014-02-141-1/+2
| | | | | | | | | Compiles with -Xlint to ensure there are no lurkers. Updates `ScriptTest` to pass args to the script. It's called `argv` partly as homage, partly because `args` is an `Array`.
* *boxContext => *box.Context , *boxMacro => *box.MacroEugene Burmako2014-01-121-2/+2
| | | | | | | | | | Performs the following renamings: * scala.reflect.macros.BlackboxContext to scala.reflect.macros.blackbox.Context * scala.reflect.macros.BlackboxMacro to scala.reflect.macros.blackbox.Macro * scala.reflect.macros.WhiteboxContext to scala.reflect.macros.whitebox.Context * scala.reflect.macros.WhiteboxMacro to scala.reflect.macros.whitebox.Macro https://groups.google.com/forum/#!topic/scala-internals/MX40-dM28rk
* blackbox and whitebox macrosEugene Burmako2013-11-121-2/+2
| | | | | | | | | | | | | | | | | | This is the first commit in the series. This commit only: 1) Splits Context into BlackboxContext and WhiteboxContext 2) Splits Macro into BlackboxMacro and WhiteboxMacro 3) Introduces the isBundle property in the macro impl binding Here we just teach the compiler that macros can now be blackbox and whitebox, without actually imposing any restrictions on blackbox macros. These restrictions will come in subsequent commits. For description and documentation of the blackbox/whitebox separation see the official macro guide at the scaladoc website: http://docs.scala-lang.org/overviews/macros/blackbox-whitebox.html Some infrastructure work to make evolving macros easier: compile partest-extras with quick so they can use latest library/reflect/...
* Cull extraneous whitespace.Paul Phillips2013-09-181-2/+1
| | | | | | | | | | | | | | | | | | | | | One last flurry with the broom before I leave you slobs to code in your own filth. Eliminated all the trailing whitespace I could manage, with special prejudice reserved for the test cases which depended on the preservation of trailing whitespace. Was reminded I cannot figure out how to eliminate the trailing space on the "scala> " prompt in repl transcripts. At least reduced the number of such empty prompts by trimming transcript code on the way in. Routed ConsoleReporter's "printMessage" through a trailing whitespace stripping method which might help futureproof against the future of whitespace diseases. Deleted the up-to-40 lines of trailing whitespace found in various library files. It seems like only yesterday we performed whitespace surgery on the whole repo. Clearly it doesn't stick very well. I suggest it would work better to enforce a few requirements on the way in.
* Merge pull request #2859 from som-snytt/issue/7622-phaserGrzegorz Kossakowski2013-09-121-0/+74
|\ | | | | SI-7622 Clean Up Phase Assembly
| * Todo promote to partestSom Snytt2013-09-111-0/+1
| |
| * SI-7622 Clean Up Phase AssemblySom Snytt2013-08-211-0/+73
| | | | | | | | | | | | | | | | Let optimiser components and continuations plugin opt-out when required flags are not set. Wasted time on a whitespace error in check file, so let --debug dump the processed check file and its diff.
* | Merge pull request #2885 from som-snytt/issue/7791-script-linenumsJason Zaugg2013-09-081-0/+21
|\ \ | | | | | | SI-7791 Line number table reflects underlying file
| * | SI-7791 Line number table reflects underlying fileSom Snytt2013-09-051-0/+21
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since positions ultimately know their ultimate positions in their ultimate source, use that line number, ultimately, when emitting line number table entries. It is possible, but possibly not useful, to emit both the actual (ultimate) line number and the nominal one. The `int`-valued line number of the `StackTraceElement` is "derived" from the attribute. In global, wrapping a `BatchSourceFile` as a `ScriptSource` happens in `compileSources` to facilitate testing. A `ScriptTest` facility is provided to facilitate testing the script facility. It is rather facile.
* | SI-7805 REPL -i startupSom Snytt2013-09-061-3/+21
| | | | | | | | | | | | | | | | | | Tested with a ReplTest that loads an include script. ReplTests can choose to be `Welcoming` and keep a normalized welcome message in their check transcript. One recent SessionTest is updated to use the normalizing API.
* | SI-7781 Comments to SessionTestSom Snytt2013-09-021-5/+16
| | | | | | | | | | | | Also, it would be nice if code and expected results were calculated lazily. That would allow tests with infinite code but which terminate on various conditions.
* | SI-7781 Improve test and add commentSom Snytt2013-09-021-0/+5
|/ | | | | | | The test should normalize the elided message, not strip it. (Thanks qerub; I was frustrated with kitteh's turnaround that night, hence unwilling to improve once it passed.)
* Move partest to https://github.com/scala/scala-partestAdriaan Moors2013-08-209-0/+647
As partest is now resolved from maven, `test/partest` uses `ant test.suite.init` to determine the classpath (serialized to build/pack/partest.properties) that's necessary to run `scala.tools.partest.nest.ConsoleRunner`. Thus, partest gets exactly the same classpath, whether run from the command line through `test/partest` or via `ant test`. The version of partest we're using is specified by properties defined in versions.properties (formerly `starr.number`). Currently, we're using: ``` scala.binary.version=2.11.0-M4 partest.version.number=1.0-RC3 ``` NOTES: - The version of Scala being tested must be backwards binary compatible with the version of Scala that was used to compile partest. - Once 2.11 goes final, `scala.binary.version=2.11`, and `starr.version=2.11.0`. - Need scalacheck on classpath for test/partest scalacheck tests. - Removed atrophied ant tests (haven't been run/changed for at least two years I checked 81d659141a as a "random" sample). - Removed scalacheck. It's resolved as a partest dependency. - For now, use a locally built scalap - Kept the trace macro in the main repo (partest-extras) - New targets for faster pr validation: test-core-opt, test-stab-opt - Reused partest eclipse/intellij project to partest-extras (note: the partest dependency is hard-coded)