summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* Platform independence for SI-6240 test caseJason Zaugg2013-10-202-4/+4
| | | | File.pathSeparator, rather than ":"
* hotfix for reflection tests on WindowsEugene Burmako2013-10-202-2/+0
| | | | | | | | | Removes the Unix-specific command-line sanity check put in place in recently committed reflection tests. On Windows, something like `C:\Java\jdk1.6.0_24-x64\jre\bin\java` might be a valid command (pointing to `java.exe` or `java.bat`) even if the eponymous file does not exist.
* Merge pull request #3007 from densh/pull/fresh-name-and-package-supportEugene Burmako2013-10-1912-15/+136
|\ | | | | Add support for packages into quasiquotes and toolbox, improve handling of fresh names, unhardcode quasiquote expansion logic
| * use concurrent hash map with atomic integersDen Shabalin2013-10-181-1/+1
| | | | | | | | | | This should ensure that concurrent access to the fresh name creator is properly synchronized.
| * re-wire fresh name creator to currentUnit.fresh at compile-timeDen Shabalin2013-10-181-0/+2
| |
| * eliminate isCaseDefEnd override by moving the logic into stock parserDen Shabalin2013-10-181-1/+1
| |
| * make q"f(..$xs)" deconstruction symmetrical to q"f[..$xs]"Den Shabalin2013-10-181-3/+2
| |
| * advanced fresh name reificationDen Shabalin2013-10-182-2/+32
| | | | | | | | | | | | | | | | | | | | During parsing some names are generated artificially using freshTermName & freshTypeName (e.g. `x$1`). Such names should be reified in a different way because they are assumed to be always fresh and non-overlapping with the environment. So `x$1` should reify down to equivalent of `freshTermName("x$")` rather than `TermName("x$1")`. But this is not enough. One name can be used more than once in a tree. E.g. `q"_ + 1"` desugars into `q"x$1 => x$1 + 1"`. So we need to ensure that every place where `x$1` is used gets the same fresh name. Hence the need for `withFreshTermName` that lets q"_ + 1" quasiquote desugare into equivalent of `withFreshTermName("x$") { freshx => q"$freshx => $freshx + 1" }`. For pattern quasiquotes it's a bit different. Due to the fact that end-result must be a pattern we need to represent fresh names as patterns too. A natural way to express that something is fresh is to represent it as a free variable (e.g. any name will do in that place). But due to possible use of the same name in multiple places we need to make sure that all such places have the same values by adding a sequence of guards to the pattern. Previously such names were reified naively and it could have caused name collision problems and inability to properly much on trees that contain such names.
| * use regular macro expansion logic for unapply quasiquotesDen Shabalin2013-10-141-4/+1
| | | | | | | | | | | | | | Previously due to limited support for expansion in apply position quasiquotes had to use a compiler hook for deconstruction. Now with recent changes in pattern matcher it's possible to remove that special case.
| * minor changes due to typosDen Shabalin2013-10-141-1/+1
| |
| * SI-6841 SI-6657 add support for packages into quasiquotes and toolboxDen Shabalin2013-10-145-2/+93
| | | | | | | | | | | | In order to implement this a new parser entry point `parseStatsOrPackages` that augments current parseStats with ability to parse "package name { ... }" syntax.
| * harden test case to avoid parsing failure when name is keywordDen Shabalin2013-10-141-1/+3
| |
* | Merge pull request #3051 from retronym/merge/2.10.x-to-master-4Grzegorz Kossakowski2013-10-198-0/+0
|\ \ | | | | | | Merge 2.10.x to master (again)
| * \ Merge remote-tracking branch 'origin/2.10.x' into merge/2.10.x-to-master-4Jason Zaugg2013-10-188-0/+0
| |\ \
| | * | Disable tests for SI-7020Jason Zaugg2013-10-173-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are still impudently being non-deterministic. I've reopened the ticket so we can take another swing at it. A well targetted s/HashMap/LinkedHashMap/ will almost certainly be the salve. fail - neg/t7020.scala [output differs]% scalac t7020.scala t7020.scala:3: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^ t7020.scala:10: warning: match may not be exhaustive. It would fail on the following inputs: List((x: Int forSome x not in (1, 2, 4, 5, 6, 7))), List((x: Int forSome x not in (1, 2, 4, 5, 6, 7)), _), List(1, _), List(2, _), List(4, _), List(5, _), List(6, _), List(7, _), List(??, _), List(_, _) List(5) match { ^
| | * | Disable flaky presentation compiler test.Jason Zaugg2013-10-175-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Francois is investigating the root cause as part of his work on stabilizing Scaladoc preview in the IDE. The test seems to only fail on the windows nightly build. I suspect this is due to a slower or loaded machine.
* | | | pull request feedbackEugene Burmako2013-10-184-2002/+3
| | | | | | | | | | | | | | | | https://github.com/scala/scala/pull/3029
* | | | runtime reflection: death from thousand threadsEugene Burmako2013-10-184-0/+2051
| | | | | | | | | | | | | | | | not anymore
* | | | SI-7045 reflection now auto-initializes selfTypeEugene Burmako2013-10-182-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | selfType joins the happy family of flags, annotations and privateWithin, which automatically trigger initialization, when used within runtime reflection.
* | | | optimizes Scala reflection GILEugene Burmako2013-10-181-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, GIL should only apply to runtime reflection, because noone is going to run toolboxes in multiple threads: a) that's impossible, b/c the compiler isn't thread safe, b) ToolBox api prevents that. Secondly, the only things in symbols which require synchronization are: 1) info/validTo (completers aren't thread-safe), 2) rawInfo and its dependencies (it shares a mutable field with info) 3) non-trivial caches like in typeAsMemberOfLock If you think about it, other things like sourceModule or associatedFile don't need synchronization, because they are either set up when a symbol is created or cloned or when it's completed. The former is obviously safe, while the latter is safe as well, because before acquiring init-dependent state of symbols, the compiler calls `initialize`, which is synchronized. We can say that symbols can be in four possible states: 1) being created, 2) created, but not yet initialized, 3) initializing, 4) initialized. Of those only #3 is dangerous and needs protection, which is what this commit does.
* | | | tests for fancy classloader configurationsEugene Burmako2013-10-189-0/+137
| | | |
* | | | eagerly initializes lazy vals and objects in runtime reflectionJason Zaugg2013-10-181-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code to do so is curated with the help of a generator. Because this needs to inspect code post-typer, the code generator is run during partest as a code-validator. We could concievably do the same with a macro, but this approach might be a better starting point which macros continue to stabilize. Removes Definitions.AnyRefModule and an already deprecated alias, as these have been throwing exceptions for more than a year since 6bb5975289. They used to be used by AnyRef specialization.
* | | | Merge pull request #3030 from xeno-by/topic/fundep-viewsEugene Burmako2013-10-1828-19/+313
|\ \ \ \ | |/ / / |/| | | SI-3346 implicit parameters can now guide implicit view inference
| * | | SI-3346 implicit parameters can now guide implicit view inferenceEugene Burmako2013-10-1128-19/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simple patch makes it possible for implicit views to benefit from fundep-guided type inference, eliminating a nasty special case in implicit inference. Here are the changes that I had to apply to the tests (they exposed quite a number of interesting questions that I was happy to answer): 1) neg/t5845.scala now works, so I moved it to pos. That easily makes sense, because the test was just a canary to track previous state of things. 2) neg/divergent_implicit.scala, neg/t5578.scala and neg/t7519.scala changed their messages to less informative ones, because inapplicable implicit views now get disqualified early and therefore don't display their error messages to the user. This is an unfortunate but necessary byproduct of this change, and one can argue that the behavior is now completely consistent with implicit vals (that also don't explain why this or that implicit val got disqualified, but rather display a generic implicit value not found message). 3) scaladoc/implicits-chaining.scala and scaladoc/implicits-base.scala. Immediate culling of apriori inapplicable implicit views messes things up for Scaladoc, because it's interested in potentially applicable views, having infrastructure to track various constraints (type bounds, requirements for implicit parameters, etc) that guide applicability of views and then present it to the user. Therefore, when scaladoc is detected, implicit search reverts to the old behavior. 4) We still cannot have Jason's workaround to type constructor inference mentioned in comments to SI-3346, because it's not really about implicit parameters of implicit views, but about type inference flowing from the implicit parameter list to a preceding parameter list in order to affect inference of an implicit view. This is something that's still too ambitious.
* | | | Merge pull request #3041 from gkossakowski/merge-2.10.xJason Zaugg2013-10-185-4/+35
|\ \ \ \ | | | | | | | | | | Merge 2.10.x into master
| * \ \ \ Merge remote-tracking branch 'scala/2.10.x' into merge-2.10.xGrzegorz Kossakowski2013-10-165-4/+35
| |\ \ \ \ | | | |/ / | | |/| | | | | | | | | | | | | | | | | Conflicts: build.number test/files/neg/classmanifests_new_deprecations.check
| | * | | Merge pull request #2985 from retronym/ticket/7783Jason Zaugg2013-10-035-10/+33
| | |\ \ \ | | | | | | | | | | | | Don't issue deprecation warnings for inferred TypeTrees
| | | * | | SI-7783 Don't issue deprecation warnings for inferred TypeTreesJason Zaugg2013-09-275-10/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Deprecation checks in RefChecks were looking into all TypeTrees to find references to deprecated type aliases. However, when the compiler infers a type argument or type of a member it creates a TypeTree (with a null original) that was also leading to warnings. I ran into this problem often when upgrading a build from SBT 0.12 to 0.13: a plugin I was using used the deprecated type alias, and I suffered transitively when I used methods from its API. This commit disables the checks for inferred TypeTree-s.
* | | | | | Merge pull request #3048 from adriaanm/sammy_testsJason Zaugg2013-10-183-0/+95
|\ \ \ \ \ \ | | | | | | | | | | | | | | Test cases for SAM restrictions.
| * | | | | | Test cases for SAM restrictions.Jason Zaugg2013-10-173-0/+95
| |/ / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Only one seems to indicate something new: ((x: Int) => 0): NonClassType I believe that we shouldn't pursue SAM translation for that case, and fallthrough to Function1. That would allow for an implicit view to finish the job.
* | | | | | Merge pull request #3045 from retronym/ticket/7688-4Jason Zaugg2013-10-181-0/+7
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Fix AsSeenFrom of ThisType from TypeVar prefix
| * | | | | SI-7688 Fix AsSeenFrom of ThisType from TypeVar prefixJason Zaugg2013-10-171-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restores behaviour for the AsSeenFrom before the refactoring in b457b6c477. This commit uniformly considered that a `TypeVar` prefix should not `matchesPrefixAndClass`; a condition that formerly was only applied if the type being viewed was a `TypeRef`. This condition was originally added in cc9e8eda3364d as a backstop for pos/t2797.scala. This commit leaves that backstop in place where it was, although it expresses it more directly by checking if `pre baseType clazz` is `NoType`, which was the case that cropped up in SI-2797: scala> type T = bc._1.type forSome { val bc: (AnyRef, AnyRef) } warning: there were 1 feature warning(s); re-run with -feature for details defined type alias T scala> val et = typeOf[T].dealias.asInstanceOf[ExistentialType] et: $r.intp.global.ExistentialType = bc._1.type forSome { val bc: (AnyRef, AnyRef) } scala> et.withTypeVars( { x => | println(x.prefix.typeSymbol) | println(x.prefix.typeSymbol.isSubClass(typeOf[Tuple2[_, _]].typeSymbol)) | println(x.prefix.baseType(typeOf[Tuple2[_, _]].typeSymbol)) | true | } , reflect.internal.Depth(0)) type bc.type true <notype> res98: Boolean = true
* | | | | | Merge pull request #3016 from xeno-by/topic/vampiresJason Zaugg2013-10-154-0/+61
|\ \ \ \ \ \ | | | | | | | | | | | | | | [master] assorted fixes for vampire macros
| * | | | | | no longer warns on calls to vampire macrosEugene Burmako2013-10-044-0/+61
| | |_|_|/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As eloquently elaborated and cleverly named by Travis Brown, macros defined in structural types are useful: http://meta.plasm.us/posts/2013/07/12/vampire-methods-for-structural-types/. However, since such macros are on the intersection of a number of language features, as usual, there are bugs. This commit fixes an unwanted interaction of macros defined in structural types with the scala.language.reflectiveCalls guard. Since macro calls aren't going to be carried to runtime, there's no need to warn about them.
* | | | | | Merge pull request #3037 from gkossakowski/fix-merge-3018v2.11.0-M6Grzegorz Kossakowski2013-10-1415-3/+154
|\ \ \ \ \ \ | | | | | | | | | | | | | | [resubmit] Experimental Single Abstract Method support (sammy meets world)
| * \ \ \ \ \ Merge remote-tracking branch 'scala/master' into fix-merge-3018Grzegorz Kossakowski2013-10-1449-83/+292
| |\ \ \ \ \ \ | | | |_|_|_|/ | | |/| | | | | | | | | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/typechecker/Typers.scala
| * | | | | | Single Abstract Method support: java8 testAdriaan Moors2013-10-084-1/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by test/files/run/t7398.scala and sammy_poly. Added some notes to original tests. Elaborating on that note: we don't yet desugar `f(a)` to `f.sam(a)`, like we do for regular functions: `f(a)` becomes `f.apply(a)`. It seems pleasingly symmetrical and is easy to implement, but not sure it's a good idea...
| * | | | | | Extract SerialVersionUIDAnnotation. Make SAM body synthetic.Adriaan Moors2013-10-082-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Addressing review feedback.
| * | | | | | Don't pursue SAM translation after an arity mismatch.Jason Zaugg2013-10-083-0/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change: scala> trait T { def apply(a: Int): Int } defined trait T scala> ((x: Int, y: Int) => 0): T <console>:9: error: object creation impossible, since method apply in trait T of type (a: Int)Int is not defined ((x: Int, y: Int) => 0): T ^ After the change, these cases report the same errors as they do *without* -Xexperimental.
| * | | | | | Single Abstract Method support: synthesize SAMsAdriaan Moors2013-10-047-2/+32
| | |/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Under `-Xexperimental`, `typedFunction` invokes `synthesizeSAMFunction` when the expected type for the function literal (`pt`) is not the built-in `FunctionN` type of the expected arity, but `pt` does have a SAM with the expected number of arguments. PS: We'll require `import language.sam` instead of `-Xexperimental`, as soon as the SIP is ready and there are more tests.
* | | | | | Merge pull request #3038 from retronym/topic/by-name-revertGrzegorz Kossakowski2013-10-143-0/+26
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | SI-7899 Allow by-name inference under -Yinfer-by-name
| * | | | | SI-7899 Allow by-name inference under -Yinfer-by-nameJason Zaugg2013-10-143-0/+26
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As usual, the hole has been exploited in the wild. While you can't abstract over by-name-ness without running into the ClassCastException or an un-applied Function0, there are cases like the enclosed test where you can tiptoe around those cases. I've proposed a small change to Scalaz to avoid tripping over this problem: https://github.com/scalaz/scalaz/pull/562/files But this commit I've also added a transitional flag, -Yinfer-by-name, that they could use to back-publish older versions without code changes. It is also an insurance policy for other projects that might be exploiting the same hole.
* | | | | Merge pull request #3032 from retronym/ticket/7239-testPaul Phillips2013-10-122-0/+16
|\ \ \ \ \ | | | | | | | | | | | | SI-7239 A bonus test case from [scala-user]
| * | | | | SI-7239 A bonus test case from [scala-user]Jason Zaugg2013-10-112-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thanks to Ilya Denisov for another sample [1] that progressed with the fix for SI-7239, 174334b. [1] https://groups.google.com/forum/#!topic/scala-user/8rZeCeiTYDo
* | | | | | Merge pull request #3024 from retronym/ticket/7895Paul Phillips2013-10-1228-45/+171
|\ \ \ \ \ \ | | | | | | | | | | | | | | SI-7895 Error reporting: avoid cascading, truncation
| * | | | | | SI-7985 Typecheck args after failure to typecheck functionJason Zaugg2013-10-0910-7/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `missing1.foo(missing2)` now reports `missing1` and `missing2` as not found. Previously, only the first was reported. The arguments are typed with an expected type ErrorType. We propagate this through as the inferred type of anonymous function parameters to avoid issuing cascading "missing parameter type" errors in code like: scala> Nil.mapp(x => abracadabra) <console>:8: error: value mapp is not a member of object Nil Nil.mapp(x => abracadabra) ^ <console>:8: error: not found: value abracadabra Nil.mapp(x => abracadabra) ^ This was in response to unwanted changes in the output of existing neg tests; no new test is added. Similarly, we refine the errors in neg/t6436b.scala by to avoid cascaded errors after: type mismatch; found: StringContext, required: ?{def q: ?}
| * | | | | | SI-7895 Issue all buffered errors after silent mode.Jason Zaugg2013-10-098-6/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than just the first. For example, `foo(wizzle, wuzzle, woggle)` should report all three not-found symbols.
| * | | | | | SI-7895 Avoid cascade of "symbol not found" in pattern matchesJason Zaugg2013-10-0910-32/+18
| | |_|/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | If we can't type check the `Foo` in `case Foo(a, b) => (a, b)`, we should enter error symbols for `a` and `b` to avoid further errors being reported in the case body.
* | | | | | Merge pull request #3025 from retronym/ticket/7902Paul Phillips2013-10-121-0/+17
|\ \ \ \ \ \ | |_|_|/ / / |/| | | | | SI-7902 Fix spurious kind error due to an unitialized symbol
| * | | | | SI-7902 Fix spurious kind error due to an unitialized symbolJason Zaugg2013-10-091-0/+17
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tracked down this error: <none> is invariant, but type Y2 is declared covariant <none>'s bounds<notype> are stricter than type X2's declared bounds >: Nothing <: Any, <none>'s bounds<notype> are stricter than type Y2's declared bounds >: Nothing <: Any to `Symbol#typeParams` returning `List(NoSymbol)` if the symbol was not initialized. This happends in the enclosed test for: // checkKindBoundsHK() hkArgs = List(type M3) hkParams = List(type M2) This commit forces the symbol of the higher-kinded type argument before checking kind conformance. A little backstory: The `List(NoSymbol)` arises from: class PolyTypeCompleter... { // @M. If `owner` is an abstract type member, `typeParams` are all NoSymbol (see comment in `completerOf`), // otherwise, the non-skolemized (external) type parameter symbols override val typeParams = tparams map (_.symbol) The variation that triggers this problem gets into the kind conformance checks quite early on, during naming of: private[this] val x = ofType[InSeq] The inferred type of which is forced during: def addDerivedTrees(typer: Typer, stat: Tree): List[Tree] = stat match { case vd @ ValDef(mods, name, tpt, rhs) if !noFinishGetterSetter(vd) => // If we don't save the annotations, they seem to wander off. val annotations = stat.symbol.initialize.annotations