summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-2458 Make spec example live testSom Snytt2017-04-095-33/+58
| | | | | | | | | Synchronize the live test with the spec update, which is trivial. Also add a neg test showing that an imported name remains ambiguous even if it resolves to the definition in scope with which it is ambiguous.
* Revert "Optimised implementation of List.filter/filterNot"Adriaan Moors2017-04-071-4/+4
| | | | This reverts commit eb5c51383a63c5c3420e53ef021607ff5fd20296.
* Merge 2.11.x into 2.12.xAdriaan Moors2017-04-073-2/+21
|\ | | | | | | Include 99f41a1 Merge pull request #5736
| * Merge pull request #5736 from adriaanm/t10206Adriaan Moors2017-03-213-2/+21
| |\ | | | | | | SI-10206 tighten fix for SI-6889
| | * Test case for SI-10206Jason Zaugg2017-03-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implicit search implements a restriction that the target type for an implicit view should be more specific that AnyRef or AnyVal. scala> def foo(s: String): AnyVal = s <console>:12: error: the result type of an implicit conversion must be more specific than AnyVal def foo(s: String): AnyVal = s ^ Without this, an implicit value classes over `String` would be applied, which is unlikely to be what was intended. Implicit views are implemented as an implicit search for a function type with a structural type as its result. This structural type is created with: scala> val schema = analyzer.HasMethodMatching.apply(TermName("clone"), Nil, WildcardType) schema: $r.intp.global.analyzer.global.Type = ?{def clone(): ?} The quirk arises when, as above, we're seeking a member with the same name as a member of AnyRef. AnyRef is seen to be a subtype of the result type: scala> AnyRefClass.tpe <:< schema res23: Boolean = true Which leads to the implicit in the test case being disqualified. The typer opts to report the error about the inapplicability of the inherited clone method, so we don't even know why the implicit was discarded.
| | * SI-10206 tighten fix for SI-6889Adriaan Moors2017-02-232-2/+6
| | | | | | | | | | | | | | | There are more supertypes of `AnyRef` than you might think: `?{def clone: ?}` is one example...
| * | Improvements based on reviews by Lukas & JasonAdriaan Moors2017-03-023-4/+60
| | |
| * | Allow user-defined `[un]apply` in case companionAdriaan Moors2017-02-273-0/+80
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Don't emit a synthetic `apply` (or `unapply`) when it would clash with an existing one. This allows e.g., a `private apply`, along with a `case class` with a `private` constructor. We have to retract the synthetic method in a pretty roundabout way, as we need the other methods and the owner to be completed already. Unless we have to complete the synthetic `apply` while completing the user-defined one, this should not be a problem. If this does happen, this implies there's a cycle in computing the user-defined signature and the synthetic one, which is not allowed.
* | t5717: test message, not just absence of compiler crashLukas Rytz2017-04-072-1/+2
| |
* | Make ImplicitInfo hashCode consistent with equals.Miles Sabin2017-04-031-0/+39
| |
* | Merge pull request #5724 from jvican/stub-errors-2.12.xAdriaan Moors2017-03-2723-23/+363
|\ \ | | | | | | SCP-009: Improve direct dependency experience
| * | Improve stub error messages (SCP-009 proposal)jvican2017-03-2423-23/+363
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Merge pull request #5783 from lrytz/t10231Adriaan Moors2017-03-222-0/+16
|\ \ \ | | | | | | | | SI-10231 Skip outer parameter when classfile parsing java param names
| * | | SI-10231 Skip outer parameter when classfile parsing java param namesLukas Rytz2017-03-172-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Nested java classes have a synthetic outer parameter, which the classfile parser skips for the constructor symbol. When assigning parameter names from the MethodParameters classfile attribute, we also need to skip the first name in this case.
* | | | Merge pull request #5643 from som-snytt/issue/8417Adriaan Moors2017-03-223-0/+22
|\ \ \ \ | | | | | | | | | | SI-8417 Check adapts of each param section
| * | | | SI-8417 Check adapts of each param sectionSom Snytt2017-02-203-0/+22
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | Previously, adaptations like auto-tupling were checked only on the last param section of an application. This commit runs the sanity check always.
* | | | Merge pull request #5741 from monkey-mas/bump-up-sbt-jmh-to-0.2.21Seth Tisue2017-03-211-1/+1
|\ \ \ \ | | | | | | | | | | Bump up sbt-jmh to 0.2.21
| * | | | Bump up sbt-jmh to 0.2.21Masaru Nomura2017-02-251-1/+1
| | | | | | | | | | | | | | | | | | | | With this change, we'll use JMH 1.17.4.
* | | | | remove test/pending directory tooSeth Tisue2017-03-21357-9792/+0
| | | | | | | | | | | | | | | | | | | | | | | | | it will all stay right there in the Git history to be consulted anytime we want...
* | | | | rm -r test/{flaky,disabled*,checker-tests,support,debug}Seth Tisue2017-03-20188-74446/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | keeping this stuff, somewhere, forever and ever and ever is what version control is for. who dares disturb the ancient and accursed tomb of all this code...?
* | | | | remove orphaned checkfilesSeth Tisue2017-03-203-8/+0
| | | | | | | | | | | | | | | | | | | | thank you tools/rm-orphan-checkfiles script
* | | | | unset a stray execute bitSeth Tisue2017-03-201-0/+0
| |_|/ / |/| | |
* | | | Merge pull request #5755 from rorygraves/2.12.x_map4Jason Zaugg2017-03-143-6/+62
|\ \ \ \ | | | | | | | | | | Improve the performance of Map4 to HashMap and Set4 to HashSet transitions
| * | | | Add benchmarks for Map4 to HashMap and Set4 to HashSet transitionsRory Graves2017-03-042-0/+58
| | | | |
| * | | | Fix compile error on existing ListBenchmarkRory Graves2017-03-041-6/+4
| | | | |
* | | | | Merge pull request #5675 from piyush-jaiswal/issue/9729som-snytt2017-03-101-0/+173
|\ \ \ \ \ | | | | | | | | | | | | Add tests for ConsoleReporter.
| * | | | | Add tests for ConsoleReporter.piyush-jaiswal2017-03-111-0/+173
| | | | | |
* | | | | | Merge pull request #5761 from lrytz/sd329Adriaan Moors2017-03-102-2/+78
|\ \ \ \ \ \ | | | | | | | | | | | | | | Don't use `equals` for comparing java.lang.Double/Float
| * | | | | | Don't use `equals` for comparing java.lang.Double/FloatLukas Rytz2017-03-092-2/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes https://github.com/scala/scala-dev/issues/329 The `equals` method for java.lang.Double/Float behaves differently than comparing the `doubleValue`s / `floatValues` for `-0.0`/`0.0`/`NaN`.
* | | | | | | Merge pull request #5719 from retronym/ticket/10187Adriaan Moors2017-03-101-0/+38
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | SI-10187 Support mutation of mutable.HashMap in getOrElseUpdate
| * | | | | | | SI-10187 Support mutation of mutable.HashMap in getOrElseUpdateJason Zaugg2017-03-031-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scala 2.12.1 included optimizations to `HashMape.getOrElseUpdate` to avoid recomputing the index in the hash table when adding an the element. However, this index could be stale if the callback added elements to the map and triggered a resize. This commit checks that the table is unchanged before reusing the index, restoring the 2.12.0 behaviour.
* | | | | | | | SI-8969 Accept poly+implicit for assignment syntaxSom Snytt2017-03-091-2/+13
| |_|/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to fb061f22d4c35df626d9651e017820a11f8fe56e which allowed the type param only. Reported: ``` scala> object Test { | def a[R](implicit s: List[R]):Int = 0 | def a_=[R](v: Int)(implicit s: List[R]) = () | } ```
* | | | | | | Merge pull request #5754 from Philippus/issue/html-tag-in-hoverLukas Rytz2017-03-042-29/+24
|\ \ \ \ \ \ \ | |_|_|/ / / / |/| | | | | | fix regression in scaladoc
| * | | | | | pattern for entitylink was too narrow, cleaned up the testsPhilippus Baalman2017-03-032-29/+24
| | | | | | |
* | | | | | | Merge pull request #5671 from retronym/topic/stubby-2Lukas Rytz2017-03-031-0/+59
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Avoid compiler crash with missing transitive dependencies
| * | | | | | | Avoid stub symbol related crash in backendJason Zaugg2017-02-191-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this test case, the backend forces the specialization info transform of `Sub` during computation of its inner class metadata. This in turn runs the info transforms of the `Base`. This leads to the uncurry info tranform transforming a signature that has a type alias as a method parameter type. Subsequent substution of the new method symbol into the result type, which includes a stub symbol for an absent class, tripped an assertion: ``` requirement failed: package b java.lang.IllegalArgumentException: requirement failed: package b at scala.Predef$.require(Predef.scala:277) at scala.reflect.internal.Types$ModuleTypeRef.<init>(Types.scala:1879) at scala.reflect.internal.Types$PackageTypeRef.<init>(Types.scala:1897) at scala.reflect.internal.Types$TypeRef$.apply(Types.scala:2401) at scala.reflect.internal.Types.typeRef(Types.scala:3553) at scala.reflect.internal.Types.typeRef$(Types.scala:3536) at scala.reflect.internal.SymbolTable.typeRef(SymbolTable.scala:16) at scala.reflect.internal.Symbols$TypeSymbol.newTypeRef(Symbols.scala:3026) at scala.reflect.internal.Symbols$TypeSymbol.updateTypeCache(Symbols.scala:3079) at scala.reflect.internal.Symbols$TypeSymbol.maybeUpdateTypeCache(Symbols.scala:3065) at scala.reflect.internal.Symbols$TypeSymbol.tpe_$times(Symbols.scala:3043) at scala.reflect.internal.Symbols$Symbol.typeOfThis(Symbols.scala:2020) at scala.reflect.internal.Types$ThisType.underlying(Types.scala:1184) at scala.reflect.internal.Types$SimpleTypeProxy.boundSyms(Types.scala:150) at scala.reflect.internal.Types$SimpleTypeProxy.boundSyms$(Types.scala:150) at scala.reflect.internal.Types$SingletonType.boundSyms(Types.scala:1088) at scala.reflect.internal.tpe.TypeMaps$SubstMap.apply(TypeMaps.scala:726) at scala.reflect.internal.tpe.TypeMaps$SubstSymMap.apply(TypeMaps.scala:789) at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:102) at scala.reflect.internal.tpe.TypeMaps$SubstSymMap.apply(TypeMaps.scala:783) at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:102) at scala.reflect.internal.tpe.TypeMaps$SubstSymMap.apply(TypeMaps.scala:783) at scala.reflect.internal.Types$Type.substSym(Types.scala:727) at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:123) at scala.reflect.internal.transform.UnCurry$$anon$1.apply(UnCurry.scala:53) at scala.reflect.internal.transform.UnCurry.transformInfo(UnCurry.scala:154) ``` This commit address the direct failure above by setting coherent flags on the stub package class symbol (it also needs the MODULE flag).
* | | | | | | | Merge pull request #5622 from edmundnoble/extra-errsAdriaan Moors2017-03-023-8/+8
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Improved error messages for identically named, differently prefixed types
| * | | | | | | | Match error lengthsEdmund Noble2017-02-071-1/+1
| | | | | | | | |
| * | | | | | | | Improved error messages for identically named, differently prefixed typesEdmund Noble2016-12-313-8/+8
| | | | | | | | |
* | | | | | | | | Merge pull request #5728 from Philippus/issue/html-tag-in-hoverLukas Rytz2017-03-023-15/+68
|\ \ \ \ \ \ \ \ \ | | |_|/ / / / / / | |/| | | / / / / | |_|_|_|/ / / / |/| | | | | | | inlineToStr is not exhaustive and does not remove html tags inside HtmlTag [ci: last-only]
| * | | | | | | added missing Inline matches to inlineToStr so it is now exhaustivePhilippus Baalman2017-02-253-15/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scala.xml.XML.loadString(tag).text will remove all html tags inside the HtmlTag use a regex to remove html tags inside the tag added some tests for the inlineToStr-method moved inlineToStr to companion object of Page added test for nested html tags
* | | | | | | | SI-10207 Error before update conversionSom Snytt2017-02-262-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Gaze deeper for errors before committing to conversion of assignment to update. The error buried in the transformed tree escapes notice of retypechecking and leaks to backend.
* | | | | | | | increase timeouts on some sys.process testsSeth Tisue2017-02-231-12/+18
| |_|_|_|/ / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | these were occasionally timing out on our Windows CI reference: https://github.com/scala/scala-dev/issues/313
* | | | | | | Revert "Fix erasure of the qualifier of ##"Adriaan Moors2017-02-222-17/+0
|/ / / / / /
* | | | | | Merge pull request #5681 from Philippus/issue/9704Lukas Rytz2017-02-222-0/+26
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-9704 don't add a closing HtmlTag if it is already closed
| * | | | | | SI-9704 don't add a closed HtmlTag if it is already closedPhilippus Baalman2017-02-082-0/+26
| | | | | | |
* | | | | | | Revert "SI-10133 Require escaped single quote char lit"Adriaan Moors2017-02-2112-44/+17
| | | | | | |
* | | | | | | Merge pull request #5658 from retronym/topic/hashhashLukas Rytz2017-02-212-0/+17
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Fix erasure of the qualifier of ##
| * | | | | | | Fix erasure of the qualifier of ##Jason Zaugg2017-01-242-0/+17
| | | | | | | |
* | | | | | | | Merge pull request #5708 from szeiger/issue/si10194Lukas Rytz2017-02-211-0/+15
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | SI-10194: Fix abstract type resolution for overloaded HOFs