diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2013-04-10 11:52:01 +0200 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2013-04-21 13:01:03 +0200 |
commit | ec5eaee3ec27b614c3ffe0496a755623c912cfdd (patch) | |
tree | d08a45df201ee77532b0f9b790315c3a114ffc5c /src/compiler/scala/reflect/macros/runtime | |
parent | 190aea9f015280d0f48cc2928515d11eccce4e33 (diff) | |
download | scala-ec5eaee3ec27b614c3ffe0496a755623c912cfdd.tar.gz scala-ec5eaee3ec27b614c3ffe0496a755623c912cfdd.tar.bz2 scala-ec5eaee3ec27b614c3ffe0496a755623c912cfdd.zip |
SI-7345 More refactoring and documentation in Contexts
- Use `firstError match {}` rather than `if (c.hasErrors) c.firstError ..`
- Convert implementation comments to doc comments
- Add new doc comments
- Refactor `Context#make` for better readability.
- Note a few TODOs.
- Roughly delineate the internal structure of Contexts with comments.
- Combine `mode` and `state` methods into `contextMode`.
- Move `isNameInScope` closer to its compadres.
- Improving alignment, tightening access.
Diffstat (limited to 'src/compiler/scala/reflect/macros/runtime')
-rw-r--r-- | src/compiler/scala/reflect/macros/runtime/Typers.scala | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Typers.scala b/src/compiler/scala/reflect/macros/runtime/Typers.scala index 99b934787d..79833d155e 100644 --- a/src/compiler/scala/reflect/macros/runtime/Typers.scala +++ b/src/compiler/scala/reflect/macros/runtime/Typers.scala @@ -54,11 +54,10 @@ trait Typers { wrapper(universe.analyzer.inferImplicit(tree, pt, reportAmbiguous = true, isView = isView, context = context, saveAmbiguousDivergent = !silent, pos = pos)) match { case failure if failure.tree.isEmpty => macroLogVerbose("implicit search has failed. to find out the reason, turn on -Xlog-implicits") - if (context.hasErrors) { - val err = context.firstError - throw new TypecheckException(err.errPos, err.errMsg) + context.firstError match { + case Some(err) => throw new TypecheckException(err.errPos, err.errMsg) + case None => universe.EmptyTree } - universe.EmptyTree case success => success.tree } |