Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcb5f090

Browse files
committed
ApplyToImplicitArgs is Applied attachment
1 parent92bd67a commitcb5f090

File tree

6 files changed

+11
-16
lines changed

6 files changed

+11
-16
lines changed

‎src/compiler/scala/tools/nsc/transform/CleanUp.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ abstract class CleanUp extends Statics with Transform with ast.TreeDSL {
516516
!elemtpt.tpe.typeSymbol.isBottomClass&&!elemtpt.tpe.typeSymbol.isPrimitiveValueClass/* can happen via specialization.*/
517517
=>
518518
classTagEvidence.attachments.get[analyzer.MacroExpansionAttachment]match {
519-
caseSome(att)if att.expandee.symbol.name== nme.materializeClassTag&& tree.isInstanceOf[ApplyToImplicitArgs]=>
519+
caseSome(att)if att.expandee.symbol.name== nme.materializeClassTag&& tree.hasAttachment[AppliedToImplicitArgs.type]=>
520520
super.transform(arg)
521521
case _=>
522522
typedWithPos(tree.pos) {

‎src/compiler/scala/tools/nsc/typechecker/StdAttachments.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ trait StdAttachments {
3535
defmacroExpanderAttachment(tree:Tree):MacroExpanderAttachment=
3636
tree.attachments.get[MacroExpanderAttachment] getOrElse {
3737
treematch {
38-
caseApply(fn, _)if tree.isInstanceOf[ApplyToImplicitArgs]=> macroExpanderAttachment(fn)
38+
caseApply(fn, _)if tree.hasAttachment[AppliedToImplicitArgs.type]=> macroExpanderAttachment(fn)
3939
case _=>MacroExpanderAttachment(tree,EmptyTree)
4040
}
4141
}

‎src/compiler/scala/tools/nsc/typechecker/Typers.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
283283
for (arg<- args) ar.subst traverse arg
284284
}
285285

286-
newApplyToImplicitArgs(fun, args)setPosfun.pos
286+
ApplyToImplicitArgs(fun, args).setPos(fun.pos)
287287
caseErrorType=>
288288
fun
289289
case x=>thrownewMatchError(x)
@@ -5290,7 +5290,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
52905290

52915291
valtree1:Tree= resolveClassTag(tree.pos, tagType)match {
52925292
caseEmptyTree=>MissingClassTagError(tree, tagType)
5293-
case tag=> atPos(tree.pos)(newApplyToImplicitArgs(Select(tag, nme.newArray), arg::Nil))
5293+
case tag=> atPos(tree.pos)(ApplyToImplicitArgs(Select(tag, nme.newArray), arg::Nil))
52945294
}
52955295
if (tree1.isErrorTyped) tree1else typed(tree1, mode, pt)
52965296
caseApply(Select(fun, nme.apply), _)if treeInfo.isSuperConstrCall(fun)=>TooManyArgumentListsForConstructor(tree)//scala/bug#5696
@@ -5347,7 +5347,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
53475347
mkAssign(Select(qq1, qual.symbol) setPos qual.pos)
53485348
}
53495349

5350-
caseApply(fn, extra)if qual.isInstanceOf[ApplyToImplicitArgs]=>
5350+
caseApply(fn, extra)if qual.hasAttachment[AppliedToImplicitArgs.type]=>
53515351
fnmatch {
53525352
case treeInfo.Applied(Select(table, nme.apply), _, indices::Nil)=>
53535353
// table(indices)(implicits)

‎src/reflect/scala/reflect/internal/Importers.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,8 @@ trait Importers { to: SymbolTable =>
379379
newTyped(importTree(expr), importTree(tpt))
380380
case from.TypeApply(fun, args)=>
381381
newTypeApply(importTree(fun), args map importTree)
382-
case from.Apply(fun, args)=> theirmatch {
383-
case_: from.ApplyToImplicitArgs=>
384-
newApplyToImplicitArgs(importTree(fun), args map importTree)
385-
case _=>
386-
newApply(importTree(fun), args map importTree)
387-
}
382+
case from.Apply(fun, args)=>
383+
newApply(importTree(fun), args map importTree)
388384
case from.ApplyDynamic(qual, args)=>
389385
newApplyDynamic(importTree(qual), args map importTree)
390386
case from.Super(qual, mix)=>

‎src/reflect/scala/reflect/internal/StdAttachments.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,6 @@ trait StdAttachments {
191191

192192
/** Application is an implicit view.*/
193193
caseobjectAppliedImplicitViewextendsPlainAttachment
194+
195+
caseobjectAppliedToImplicitArgsextendsPlainAttachment
194196
}

‎src/reflect/scala/reflect/internal/Trees.scala

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,7 @@ trait Trees extends api.Trees {
805805
}
806806
objectApplyextendsApplyExtractor
807807

808-
// TODO remove this class, add a tree attachment to Apply to track whether implicits were involved
809-
// copying trees will all too easily forget to distinguish subclasses
810-
classApplyToImplicitArgs(fun:Tree,args:List[Tree])extendsApply(fun, args)
808+
defApplyToImplicitArgs(fun:Tree,args:List[Tree])=Apply(fun, args).updateAttachment(AppliedToImplicitArgs)
811809

812810
defApplyImplicitView(fun:Tree,args:List[Tree])=Apply(fun, args).updateAttachment(AppliedImplicitView)
813811

@@ -1110,8 +1108,7 @@ trait Trees extends api.Trees {
11101108
defTypeApply(tree:Tree,fun:Tree,args:List[Tree])=
11111109
newTypeApply(fun, args).copyAttrs(tree)
11121110
defApply(tree:Tree,fun:Tree,args:List[Tree])=
1113-
(treematch {// TODO: use a tree attachment to track whether this is an apply to implicit args or a view
1114-
case_:ApplyToImplicitArgs=>newApplyToImplicitArgs(fun, args)
1111+
(treematch {
11151112
// TODO: ApplyConstructor ???
11161113
case self.pendingSuperCall=> self.pendingSuperCall
11171114
case _=>newApply(fun, args)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp