summaryrefslogtreecommitdiff
path: root/test/files
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #2746 from soc/topic/paulp-typer-debug-outputAdriaan Moors2013-07-2919-40/+47
|\ | | | | Improve type printing (toString/debugging)
| * Make -Ytyper-debug output readable.Paul Phillips2013-07-1717-34/+36
| |
| * Cleanups in type printing.Paul Phillips2013-07-174-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More consistency as to how to understand aliases, singletons, specialized symbols, subclasses. Fewer weird special casings, like normalizing tuples and functions during type printing, but nothing else. I avoid "normalize" entirely now, and do not make special cases for dealiasing, which is already well handled when printing error messages. Look at the change to test/files/neg/t2641.check to get a sense of why we should resist calling normalize during the early days of a compilation run. Anonymous and refinement classes can be printed far more usefully by revealing their parents, and that too is here. Hardened toString against undesirable side effects. Make toString final to discourage any further rogue toString overriders. Make safeToString a little safer.
* | Merge pull request #2739 from retronym/ticket/7668Adriaan Moors2013-07-291-0/+12
|\ \ | | | | | | SI-7668 Better return type inheritance for dep. method types
| * | SI-7668 Better return type inheritance for dep. method typesJason Zaugg2013-07-161-0/+12
| |/ | | | | | | | | | | | | | | Return type inheritance already handles substitution of type parameters of the overriding method for those of the overriding. This commit extends this to do the same for parameter symbols.
* | Merge pull request #2737 from retronym/ticket/7669Adriaan Moors2013-07-296-2/+24
|\ \ | | | | | | SI-7669 Fix exhaustivity warnings for recursive ADTs.
| * | SI-7669 Fix exhaustivity warnings for recursive ADTs.Jason Zaugg2013-07-176-2/+24
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pattern matcher's analysis was correctly finding models under which the match in the enclosed test could fail. But, when trying to render that model as a counter example, it ran into an internal inconsistency and gave up. That inconsistency arose from VariableAssignment, which: > turn the variable assignments into a tree > the root is the scrutinee (x1), edges are labelled > by the fields that are assigned a node is a variable > example (which is later turned into a counter example) In the process, it notes the unreachable case `V2 = NotHandled`, which can only arise if `V1 = Op`, ie the scrutinee is `Op(NotHandled())`. V2 is assosicated with the path `x1.arg`. The code then looked for any variable assosicated with the prefix `x1` and registered that its field `arg` was assosicated with this variable assignment. However, the assignment for `V1 = NotHandled` (another missing case) is also associated with the path `x1`. Registering this field makes no sense here; we should only do that for `Op`. This commit conditionally registers the fields based on the class of `VariableAssignment#cls`. We no longer hit the inconsistency in `VariableAssignment#allFieldAssignmentsLegal`. This favourably changes the results of two existing tests. I had to tweak the counter example pruning to avoid relying on CounterExample.==, which is flaky in the light of Nil and List(). It is possible to have: A, B where A != B && A.coveredBy(B) && B.coveredBy(A) Luckily it is straightforward to implement pruning entirely with coveredBy.
* | Merge pull request #2690 from soc/SI-7620Adriaan Moors2013-07-297-50/+3
|\ \ | | | | | | SI-7620 Remove floating-point-literals-without-digit-after-dot
| * | SI-7620 Remove floating-point-literals-without-digit-after-dotSimon Ochsenreither2013-06-287-50/+3
| | |
* | | Merge pull request #2765 from retronym/ticket/7689Grzegorz Kossakowski2013-07-271-0/+7
|\ \ \ | | | | | | | | SI-7689 Fix typing regression with default arguments
| * | | SI-7689 Fix typing regression with default argumentsJason Zaugg2013-07-241-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regressed in e28c3edda4. That commit encoded upper/lower bounds of Any/Nothing as EmptyTree, which were triggering the .isEmpty check in Namers#TypeTreeSubstitutor and resulting in the default getter having TypeTree() as the return type. This resulted in a "missing parmameter type" error. This commit tightens up that condition to only consider empty TypeTrees (those wrapping null or NoType.)
* | | | Merge pull request #2772 from som-snytt/issue/6123-fix-testGrzegorz Kossakowski2013-07-275-0/+21
|\ \ \ \ | | | | | | | | | | SI-7695 Macro debug output on -explaintypes
| * | | | SI-7695 Macro debug output on -explaintypesSom Snytt2013-07-275-0/+21
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It looks like checkConforms should wait for error before using explainTypes, rather than turning on macro debug trace if explaintypes is set. In particular, macro debug output is Console.println instead of reporter.echo or similar, so partest can't test it.
* | | | Merge pull request #2736 from som-snytt/issue/7488-chase-delayed-initAdriaan Moors2013-07-252-0/+49
|\ \ \ \ | |/ / / |/| | | SI-7488 REPL javap finds new style delayedEndpoint
| * | | SI-7488 REPL javap finds new style delayedEndpointSom Snytt2013-07-152-0/+49
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The REPL :java -app command is a convenience to locate the body of DelayedInit code. Now it will look for new style delayedEndpoints on the class before it falls back to showing the apply method of the delayedInit$body closure. ``` apm@mara:~/tmp$ skala Welcome to Scala version 2.11.0-20130711-153246-eb1c3137f5 (OpenJDK 64-Bit Server VM, Java 1.7.0_21). Type in expressions to have them evaluated. Type :help for more information. scala> :javap -pv -app delayed.C public final void delayedEndpoint$delayed$C$1(); flags: ACC_PUBLIC, ACC_FINAL Code: stack=2, locals=1, args_size=1 0: getstatic #29 // Field scala/Predef$.MODULE$:Lscala/Predef$; 3: ldc #31 // String this is the initialization code of C 5: invokevirtual #35 // Method scala/Predef$.println:(Ljava/lang/Object;)V 8: return LocalVariableTable: Start Length Slot Name Signature 0 9 0 this Ldelayed/C; LineNumberTable: line 11: 0 scala> :q apm@mara:~/tmp$ rm delayed/*.class apm@mara:~/tmp$ scalac delayed.scala apm@mara:~/tmp$ skala Welcome to Scala version 2.11.0-20130711-153246-eb1c3137f5 (OpenJDK 64-Bit Server VM, Java 1.7.0_21). Type in expressions to have them evaluated. Type :help for more information. scala> :javap -pv -app delayed.C public final java.lang.Object apply(); flags: ACC_PUBLIC, ACC_FINAL Code: stack=2, locals=1, args_size=1 0: getstatic #13 // Field scala/Predef$.MODULE$:Lscala/Predef$; 3: ldc #15 // String this is the initialization code of C 5: invokevirtual #19 // Method scala/Predef$.println:(Ljava/lang/Object;)V 8: getstatic #25 // Field scala/runtime/BoxedUnit.UNIT:Lscala/runtime/BoxedUnit; 11: areturn LocalVariableTable: Start Length Slot Name Signature 0 12 0 this Ldelayed/C$delayedInit$body; LineNumberTable: line 11: 0 line 10: 8 ```
* / | Commit .gitignore directlyJason Zaugg2013-07-174-10/+0
|/ / | | | | | | | | | | | | | | | | | | | | | | Rather than relying on the cloner to copy the provided gitignore.SAMPLE files. This finishes the job started in c48509598, mostly by reverting that commit and moving the two existing SAMPLE files to the final destinations. Use `.git/info/exclude` to augment the list of patterns with entries specific to your workflow.
* | Merge pull request #2725 from som-snytt/topic/repl-paste-fileAdriaan Moors2013-07-124-0/+52
|\ \ | | | | | | SI-4684 Repl supports whole-file paste (rebased)
| * | SI-4684 Repl supports raw pasteSom Snytt2013-07-112-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | By special request, :paste -raw simply compiles the pasted code to the repl output dir. The -raw flag means no wrapping; the pasted code must be ordinary top level Scala code, not script.
| * | SI-4684 Repl supports whole-file pasteSom Snytt2013-07-112-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a file argument to the :paste command which loads the file's contents as though entered in :paste mode. The :paste command is replayable. Samples, including companions defined together: ``` scala> :paste junk.scala File contains no code: junk.scala scala> :paste no-file.scala That file does not exist scala> :paste obj-repl.scala Pasting file obj-repl.scala... <console>:2: error: expected start of definition private foo = 7 ^ scala> :paste hw-repl.scala Pasting file hw-repl.scala... The pasted code is incomplete! <pastie>:5: error: illegal start of simple expression } ^ scala> :replay Replaying: :paste junk.scala File contains no code: junk.scala Replaying: :paste obj-repl.scala Pasting file obj-repl.scala... defined trait Foo defined object Foo Replaying: Foo(new Foo{}) res0: Int = 7 ```
* | | Fix repl-save testSom Snytt2013-07-112-24/+18
|/ / | | | | | | | | | | | | | | Make the test a SessionTest, where the file name appears just once, in the transcript, and is trivially compared against itself. The contents of the saved file are still output and compared with the check file.
* | Merge pull request #2697 from som-snytt/issue/6419-repl-saveAdriaan Moors2013-07-102-0/+34
|\ \ | | | | | | SI-6419 Repl save session command
| * | SI-6419 Repl save session commandSom Snytt2013-07-012-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A simple save command to write out the current replay stack. ``` scala> val i = 7 i: Int = 7 scala> val j= 8 j: Int = 8 scala> i * j res0: Int = 56 scala> :save multy.script scala> :q apm@mara:~/tmp$ cat multy.script val i = 7 val j= 8 i * j apm@mara:~/tmp$ skala Welcome to Scala version 2.11.0-20130626-204845-a83ca5bdf7 (OpenJDK 64-Bit Server VM, Java 1.7.0_21). Type in expressions to have them evaluated. Type :help for more information. scala> :load multy.script Loading multy.script... i: Int = 7 j: Int = 8 res0: Int = 56 scala> :load multy.script Loading multy.script... i: Int = 7 j: Int = 8 res1: Int = 56 ```
* | | Merge pull request #2701 from som-snytt/issue/4594-repl-settingsAdriaan Moors2013-07-101-0/+26
|\ \ \ | | | | | | | | SI-4594 Repl settings command
| * | | SI-4594 Repl settings commandSom Snytt2013-07-041-0/+26
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A settings command for the rest of us. The usual command line options are used, except that boolean flags are enabled with +flag and disabled with -flag. ``` scala> :settings +deprecation scala> new BigInt(java.math.BigInteger.TEN) { } <console>:8: warning: inheritance from class BigInt in package math is deprecated: This class will me made final. new BigInt(java.math.BigInteger.TEN) { } ^ res0: BigInt = 10 scala> :settings -deprecation scala> new BigInt(java.math.BigInteger.TEN) { } res1: BigInt = 10 ``` Multivalue "colon" options can be reset by supplying no values after the colon. This behavior is different from the command line. ``` scala> 1 toString warning: there were 1 feature warning(s); re-run with -feature for details res0: String = 1 scala> :settings -language:postfixOps scala> 1 toString res1: String = 1 scala> :settings -d = . -encoding = UTF-8 -explaintypes = false -language = List(postfixOps) -nowarn = false scala> :settings -language: scala> :settings -d = . -encoding = UTF-8 -explaintypes = false -language = List() -nowarn = false ```
* | | Merge pull request #2714 from scalamacros/topic/quasiquotesAdriaan Moors2013-07-1017-0/+1331
|\ \ \ | | | | | | | | Quasiquotes
| * | | macro impls can now return subtypes of c.TreeEugene Burmako2013-07-106-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 10229316db allowed macro impls to take and return values of type c.Tree in addition to the usual c.Expr. However it didn't take into account that it is often useful to return subtypes of trees (e.g. with quasiquotes that expand into expressions typed as precisely as possible). This patch fixes that oversight.
| * | | tests for quasiquotesDen Shabalin2013-07-0811-0/+1280
| | | | | | | | | | | | | | | | | | | | | | | | Introduces an extensive ScalaCheck-based test suite for recently implemented quasiquotes. Provides tools for syntactic tree comparison and verifying compilation error messages.
* | | | Merge pull request #2717 from retronym/ticket/6574Adriaan Moors2013-07-105-0/+44
|\ \ \ \ | | | | | | | | | | SI-6574 Support @tailrec for extension methods.
| * | | | SI-6574 Support @tailrec for extension methods.Jason Zaugg2013-07-105-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, when the body of an extension method is transplanted to the companion object, recursive calls point back to the original instance method. That changes during erasure, but this is too late for tail call analysis/elimination. This commit eagerly updates the recursive calls to point to the extension method in the companion. It also removes the @tailrec annotation from the original method.
* | | | | Merge pull request #2713 from VladUreche/issue/7638-masterAdriaan Moors2013-07-101-0/+51
|\ \ \ \ \ | | | | | | | | | | | | SI-7638 Superaccessor lookup after specialization
| * | | | | SI-7638 Superaccessor lookup after specializationVlad Ureche2013-07-081-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The crash was caused by a symbol lookup to rewire the super calls, done after pickler, but specialization added new traits and new members, thus making the super rewiring impossible. To avoid such problems, this patch moves symbol lookup after specialization, so the changes done by specialization (and miniboxing) become visible to mixin. Review by @adriaanm or @retronym.
* | | | | | Merge pull request #2650 from paulp/issue/6221Adriaan Moors2013-07-087-7/+74
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-6221 inference with Function1 subtypes.
| * | | | | SI-6221 inference with Function1 subtypes.Paul Phillips2013-06-137-7/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There appears to be no upper bound on the number of places we have to remove calls to typeSymbol and introduce calls to baseType. This one was type inference for function parameter types: worked when expected type was A => B, but not if there was an implicit conversion from A => B to the expected type.
* | | | | | Merge pull request #2660 from retronym/ticket/7582Adriaan Moors2013-07-0311-0/+92
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7582 Only inline accessible calls to package-private Java code
| * | | | | | SI-7582 Only inline accessible calls to package-private Java codeJason Zaugg2013-06-198-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two problems here. The inliner was using `isPrivate` / `isProtected` to determine access. The fallthrough considered things to be (bytecode) public. This is okay in practice for Scala code, which never emits package private code. Secondly, we must check accessibility of the called symbol *and* its owner. This case is tested in `run/t7582b`. This commit tightens the check for Java defined symbols: a) check the owner, and b) don't assume that `! isPrivate` is accessible.
| * | | | | | SI-7582 ClassfileParser: populate privateWithin of Java module classJason Zaugg2013-06-163-0/+42
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `privateWithin` attribute of Java companion module classes was correctly set under joint compilation (ie, when using JavaParser), but not under separate compilation. This commit remedies this. The test covers variety of Java symbols.
* | | | | | Merge pull request #2699 from adriaanm/fix-2637-windowsJason Zaugg2013-07-021-1/+2
|\ \ \ \ \ \ | | | | | | | | | | | | | | Use forward slash in #2637's test on windows
| * | | | | | Use forward slash in #2637's test on windowsAdriaan Moors2013-07-011-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't use toString to output file names in tests, its output is platform dependent -- use `testIdent` instead.
* | | | | | | Merge pull request #2693 from lexspoon/semmle-lintAdriaan Moors2013-07-013-0/+10
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Lint-like fixes found by Semmle
| * | | | | | | Updates .gitignore files.Lex Spoon2013-06-263-0/+10
| | | | | | | |
* | | | | | | | Merge pull request #2694 from adriaanm/masterGrzegorz Kossakowski2013-07-018-420/+229
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Merge 2.10.x into master
| * \ \ \ \ \ \ \ Merge 2.10.x into masterAdriaan Moors2013-06-288-420/+229
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Duplicators.scala src/library/scala/concurrent/Future.scala test/files/jvm/scala-concurrent-tck.scala
| | * \ \ \ \ \ \ \ Merge pull request #2648 from retronym/ticket/7571Grzegorz Kossakowski2013-06-253-7/+17
| | |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | SI-7571 Allow nesting of anonymous classes in value classes
| | | * | | | | | | | SI-7571 Allow nesting of anonymous classes in value classesJason Zaugg2013-06-193-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 5d9cde105e added deep prohibition of nested classes within a value class. This has the undesirable side effect of prohibiting partial functions literals in method bodies of a value class. The intention of that prohibition was to avoid problems in code using Type Tests, such as: class C(val inner: A) extends AnyVal { class D } def foo(a: Any, other: C) = a match { case _ : other.D } Here, the pattern usually checks that `a.$outer == other`. But that is incongruent with the way that `other` is erased to `A`. However, not all nested classes could lead us into this trap. This commit slightly relaxes the restriction to allow anonymous classes, which can't appear in a type test. The test shows that the translation generates working code.
| | * | | | | | | | | 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
| | * | | | | | | | | | Merge pull request #2651 from VladUreche/issue/7343-2Adriaan Moors2013-06-183-1/+59
| | |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | SI-7343 Fixed phase ordering in specialization
| | | * | | | | | | | | | SI-7343 Fixed phase ordering in specializationVlad Ureche2013-06-123-1/+59
| | | | |/ / / / / / / / | | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specialization rewires class parents during info transformation, and the new info then guides the tree changes. But if a symbol is created during duplication, which runs after specialization, its info is not visited and thus the corresponding tree is not specialized. One manifestation is the following: ``` object Test { class Parent[@specialized(Int) T] def spec_method[@specialized(Int) T](t: T, expectedXSuper: String) = { class X extends Parent[T]() // even in the specialized variant, the local X class // doesn't extend Parent$mcI$sp, since its symbol has // been created after specialization and was not seen // by specialzation's info transformer. ... } } ``` We can fix this by forcing duplication to take place before specialization. Review by @dragos, @paulp or @axel22.
| | * | | | | | | | | | Merge pull request #2646 from retronym/topic/duration-relax-2.10.xGrzegorz Kossakowski2013-06-181-2/+3
| | |\ \ \ \ \ \ \ \ \ \ | | | |/ / / / / / / / / | | |/| | | | | | | | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)
| | | * | | | | | | | | [backport] relax time constraint in duration-tck.scala (for Windows VMs)Roland2013-06-101-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry picked from commit 3e0fbc0193f0b6f58dc16dae3824677e9902dc7b)