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

Commit0996ac6

Browse files
committed
Use isScala3Cross and tree.pos per review
1 parent386cde3 commit0996ac6

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
3838
finaldefforArgMode(fun:Tree,mode:Mode)=
3939
if (treeInfo.isSelfOrSuperConstrCall(fun)) mode|SCCmodeelse mode
4040

41-
defisScala3cross= currentRun.isScala3&& settings.source.value> scala.tools.nsc.settings.SpecificScalaVersion(3,0,0, scala.tools.nsc.settings.Final)
42-
4341
finalvalshortenImports=false
4442

4543
// All typechecked RHS of ValDefs for right-associative operator desugaring
@@ -1129,7 +1127,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
11291127
defadaptApplyInsertion():Tree= {
11301128
valmsg=s"The method `apply` is inserted. The auto insertion will be deprecated, please write `${tree.symbol.name}.apply` explicitly."
11311129
context.deprecationWarning(tree.pos, tree.symbol, msg,"2.13.13")
1132-
typed(Select(tree, nme.apply), mode, pt)
1130+
typed(atPos(tree.pos)(Select(tree, nme.apply)), mode, pt)
11331131
}
11341132

11351133
defadaptExprNotFunMode():Tree= {
@@ -1138,7 +1136,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
11381136
if (settings.isDebug&& settings.explaintypes.value) explainTypes(tree.tpe, pt)
11391137
if (err nenull) context.issue(err)
11401138
if (tree.tpe.isErroneous|| pt.isErroneous) setError(tree)
1141-
elseif (isScala3cross&& isFunctionType(pt)&& tree.symbol.isModule&& tree.symbol.companion.isCase)
1139+
elseif (currentRun.isScala3Cross&& isFunctionType(pt)&& tree.symbol.isModule&& tree.symbol.companion.isCase)
11421140
adaptApplyInsertion()
11431141
else adaptMismatchedSkolems()
11441142
}
@@ -5373,12 +5371,14 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
53735371
else context.javaFindMember(cls.typeOfThis, name, s=> s.isStaticMember|| s.isStaticModule)._2
53745372

53755373
// If they try C.tupled, make it (C.apply _).tupled
5376-
deffixUpCaseTupled(qual:Tree,name:Name,mode:Mode):Tree=
5377-
if (qual.symbol!=null&&isScala3cross&& qual.symbol.isModule&& qual.symbol.companion.isCase&&
5374+
deffixUpCaseTupled(tree:Tree,qual:Tree,name:Name,mode:Mode):Tree=
5375+
if (qual.symbol!=null&&currentRun.isScala3Cross&& qual.symbol.isModule&& qual.symbol.companion.isCase&&
53785376
context.undetparams.isEmpty&& fixableFunctionMembers.contains(name)) {
5379-
valt=Select(qual, nme.apply)
5380-
valt1= typedSelect(t, qual, nme.apply)
5381-
valt2= typed(Select(etaExpand(t1, context.owner), name), mode, pt)
5377+
valt2= {
5378+
valt= atPos(tree.pos)(Select(qual, nme.apply))
5379+
valt1= typedSelect(t, qual, nme.apply)
5380+
typed(atPos(tree.pos)(Select(etaExpand(t1, context.owner), name)), mode, pt)
5381+
}
53825382
if (!t2.isErroneous) {
53835383
valmsg=s"The method `apply` is inserted. The auto insertion will be deprecated, please write `${t2}` explicitly."
53845384
context.deprecationWarning(tree.pos, qual.symbol, msg,"2.13.13")
@@ -5424,7 +5424,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
54245424
if ((qual1 ne qual)&&!qual1.isErrorTyped)
54255425
typed(treeCopy.Select(tree, qual1, name), mode, pt).tap(checkDubiousAdaptation)
54265426
else
5427-
fixUpCaseTupled(qual, name, mode)
5427+
fixUpCaseTupled(tree,qual, name, mode)
54285428
if (!fixed.isEmpty)
54295429
return fixed
54305430
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,11 @@ trait Unapplies extends ast.TreeDSL {
109109
elseDefault
110110
}
111111

112-
privatedefisScala3cross=
113-
currentRun.isScala3&& settings.source.value> scala.tools.nsc.settings.SpecificScalaVersion(3,0,0, scala.tools.nsc.settings.Final)
114-
115112
/** The module corresponding to a case class; overrides toString to show the module's name
116113
*/
117114
defcaseModuleDef(cdef:ClassDef):ModuleDef= {
118115
valparams= constrParamss(cdef)
119-
definheritFromFun=!isScala3cross&&!cdef.mods.hasAbstractFlag&& cdef.tparams.isEmpty&& (paramsmatch {
116+
definheritFromFun=!currentRun.isScala3Cross&&!cdef.mods.hasAbstractFlag&& cdef.tparams.isEmpty&& (paramsmatch {
120117
caseList(ps)if ps.length<=MaxFunctionArity=>true
121118
case _=>false
122119
})&& applyAccess(constrMods(cdef))!=Inherit

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp