diff options
author | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2012-05-10 14:14:39 +0200 |
---|---|---|
committer | Hubert Plociniczak <hubert.plociniczak@gmail.com> | 2012-05-10 14:14:39 +0200 |
commit | 8f294c4fefde35d47240c36511ce2cff3a927048 (patch) | |
tree | a04ece46e0fe1628a438315ff614b1fd8cd5e83a /src | |
parent | 97046e6cbe8dfc5d5b672d1a490071b68cbdad9a (diff) | |
download | scala-8f294c4fefde35d47240c36511ce2cff3a927048.tar.gz scala-8f294c4fefde35d47240c36511ce2cff3a927048.tar.bz2 scala-8f294c4fefde35d47240c36511ce2cff3a927048.zip |
A bunch of fixes for positions when dealing with partial functions
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 8c2eae1c86..1c39e99a4d 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2297,7 +2297,7 @@ trait Typers extends Modes with Adaptations with Taggings { import CODE._ // need to duplicate the cases before typing them to generate the apply method, or the symbols will be all messed up - val casesTrue = if (isPartial) cases map (c => deriveCaseDef(c)(x => TRUE_typed).duplicate) else Nil + val casesTrue = if (isPartial) cases map (c => deriveCaseDef(c)(x => atPos(x.pos.focus)(TRUE_typed)).duplicate) else Nil // println("casesTrue "+ casesTrue) def parentsPartial(targs: List[Type]) = addSerializable(appliedType(AbstractPartialFunctionClass.typeConstructor, targs)) @@ -2372,7 +2372,7 @@ trait Typers extends Modes with Adaptations with Taggings { } def isDefinedAtMethod = { - val methodSym = anonClass.newMethod(nme.isDefinedAt, tree.pos, FINAL) + val methodSym = anonClass.newMethod(nme.isDefinedAt, tree.pos.makeTransparent, FINAL) val paramSyms = mkParams(methodSym) val selector = mkSel(paramSyms) @@ -2398,7 +2398,7 @@ trait Typers extends Modes with Adaptations with Taggings { def translated = if (members.head eq EmptyTree) setError(tree) - else typed(Block(List(ClassDef(anonClass, NoMods, List(List()), List(List()), members, tree.pos)), New(anonClass.tpe)), mode, pt) + else typed(atPos(tree.pos)(Block(List(ClassDef(anonClass, NoMods, List(List()), List(List()), members, tree.pos.focus)), atPos(tree.pos.focus)(New(anonClass.tpe)))), mode, pt) } // Function(params, Match(sel, cases)) ==> new <Partial>Function { def apply<OrElse>(params) = `translateMatch('sel match { cases }')` } |