diff options
author | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-13 16:28:42 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@epfl.ch> | 2012-07-18 09:21:52 +0200 |
commit | 776105a43ef7a7a7c32be8111b496a6762a8ac68 (patch) | |
tree | d37327c251552e61364a2509b9084ac0e30b3ad0 /src | |
parent | 43dc4cc9f623a50f374feff28b67d7865c85d34c (diff) | |
download | scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.tar.gz scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.tar.bz2 scala-776105a43ef7a7a7c32be8111b496a6762a8ac68.zip |
SI-5892 allow implicit views in annotation args
the problem was that lazy annotations got completed in phase pickler.
the `inferView` method in Typers bails out if `isPastTyper`. now the
lazy annotations completes `atPhase(typerPhase)`. test case in `pos`.
the second test case in `neg` is for another bug that is discussed in
a comment of SI-5892. when type checking arguments of type parameter
annotations, the class members should not be in scope. this was alreay
fixed in 9129cfe9.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Contexts.scala | 6 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Namers.scala | 4 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala index bcf529ecd2..805f60ba87 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala @@ -636,6 +636,12 @@ trait Contexts { self: Analyzer => collect(imp.tree.selectors) } + /* SI-5892 / SI-4270: `implicitss` can return results which are not accessible at the + * point where implicit search is triggered. Example: implicits in (annotations of) + * class type parameters (SI-5892). The `context.owner` is the class symbol, therefore + * `implicitss` will return implicit conversions defined inside the class. These are + * filtered out later by `eligibleInfos` (SI-4270 / 9129cfe9), as they don't type-check. + */ def implicitss: List[List[ImplicitInfo]] = { if (implicitsRunId != currentRunId) { implicitsRunId = currentRunId diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala index 9580cd5676..fa34bce82c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala @@ -1212,8 +1212,8 @@ trait Namers extends MethodSynthesis { if (!annotated.isInitialized) tree match { case defn: MemberDef => val ainfos = defn.mods.annotations filterNot (_ eq null) map { ann => - // need to be lazy, #1782 - AnnotationInfo lazily (typer typedAnnotation ann) + // need to be lazy, #1782. beforeTyper to allow inferView in annotation args, SI-5892. + AnnotationInfo lazily beforeTyper(typer typedAnnotation ann) } if (ainfos.nonEmpty) { annotated setAnnotations ainfos |