Skip to content

Commit d9a4545

Browse files
committed
Rename impliedOnly in Import,ImortInfo to importImplied
An import implied will also import old-style implicits, so the name is not correct anymore.
1 parent 6787ba4 commit d9a4545

File tree

21 files changed

+67
-67
lines changed

21 files changed

+67
-67
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ object desugar {
396396
if (enumCases.isEmpty)
397397
ctx.error("Enumerations must constain at least one case", namePos)
398398
val enumCompanionRef = new TermRefTree()
399-
val enumImport = Import(impliedOnly = false, enumCompanionRef, enumCases.flatMap(caseIds))
399+
val enumImport = Import(importImplied = false, enumCompanionRef, enumCases.flatMap(caseIds))
400400
(enumImport :: enumStats, enumCases, enumCompanionRef)
401401
}
402402
else (stats, Nil, EmptyTree)

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ object Trees {
751751
* where a selector is either an untyped `Ident`, `name` or
752752
* an untyped thicket consisting of `name` and `rename`.
753753
*/
754-
case class Import[-T >: Untyped] private[ast] (impliedOnly: Boolean, expr: Tree[T], selectors: List[Tree[Untyped]])(implicit @constructorOnly src: SourceFile)
754+
case class Import[-T >: Untyped] private[ast] (importImplied: Boolean, expr: Tree[T], selectors: List[Tree[Untyped]])(implicit @constructorOnly src: SourceFile)
755755
extends DenotingTree[T] {
756756
type ThisTree[-T >: Untyped] = Import[T]
757757
}
@@ -1140,9 +1140,9 @@ object Trees {
11401140
case tree: Template if (constr eq tree.constr) && (parents eq tree.parents) && (derived eq tree.derived) && (self eq tree.self) && (body eq tree.unforcedBody) => tree
11411141
case tree => finalize(tree, untpd.Template(constr, parents, derived, self, body)(sourceFile(tree)))
11421142
}
1143-
def Import(tree: Tree)(impliedOnly: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import = tree match {
1144-
case tree: Import if (impliedOnly == tree.impliedOnly) && (expr eq tree.expr) && (selectors eq tree.selectors) => tree
1145-
case _ => finalize(tree, untpd.Import(impliedOnly, expr, selectors)(sourceFile(tree)))
1143+
def Import(tree: Tree)(importImplied: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import = tree match {
1144+
case tree: Import if (importImplied == tree.importImplied) && (expr eq tree.expr) && (selectors eq tree.selectors) => tree
1145+
case _ => finalize(tree, untpd.Import(importImplied, expr, selectors)(sourceFile(tree)))
11461146
}
11471147
def PackageDef(tree: Tree)(pid: RefTree, stats: List[Tree])(implicit ctx: Context): PackageDef = tree match {
11481148
case tree: PackageDef if (pid eq tree.pid) && (stats eq tree.stats) => tree
@@ -1283,8 +1283,8 @@ object Trees {
12831283
cpy.TypeDef(tree)(name, transform(rhs))
12841284
case tree @ Template(constr, parents, self, _) if tree.derived.isEmpty =>
12851285
cpy.Template(tree)(transformSub(constr), transform(tree.parents), Nil, transformSub(self), transformStats(tree.body))
1286-
case Import(impliedOnly, expr, selectors) =>
1287-
cpy.Import(tree)(impliedOnly, transform(expr), selectors)
1286+
case Import(importImplied, expr, selectors) =>
1287+
cpy.Import(tree)(importImplied, transform(expr), selectors)
12881288
case PackageDef(pid, stats) =>
12891289
cpy.PackageDef(tree)(transformSub(pid), transformStats(stats)(localCtx))
12901290
case Annotated(arg, annot) =>
@@ -1403,7 +1403,7 @@ object Trees {
14031403
this(x, rhs)
14041404
case tree @ Template(constr, parents, self, _) if tree.derived.isEmpty =>
14051405
this(this(this(this(x, constr), parents), self), tree.body)
1406-
case Import(impliedOnly, expr, selectors) =>
1406+
case Import(importImplied, expr, selectors) =>
14071407
this(x, expr)
14081408
case PackageDef(pid, stats) =>
14091409
this(this(x, pid), stats)(localCtx)

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
326326
Block(cdef :: Nil, New(cls.typeRef, Nil))
327327
}
328328

329-
def Import(impliedOnly: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
330-
ta.assignType(untpd.Import(impliedOnly, expr, selectors), ctx.newImportSymbol(ctx.owner, expr))
329+
def Import(importImplied: Boolean, expr: Tree, selectors: List[untpd.Tree])(implicit ctx: Context): Import =
330+
ta.assignType(untpd.Import(importImplied, expr, selectors), ctx.newImportSymbol(ctx.owner, expr))
331331

332332
def PackageDef(pid: RefTree, stats: List[Tree])(implicit ctx: Context): PackageDef =
333333
ta.assignType(untpd.PackageDef(pid, stats), pid)

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
323323
def Template(constr: DefDef, parents: List[Tree], derived: List[Tree], self: ValDef, body: LazyTreeList)(implicit src: SourceFile): Template =
324324
if (derived.isEmpty) new Template(constr, parents, self, body)
325325
else new DerivingTemplate(constr, parents ++ derived, self, body, derived.length)
326-
def Import(impliedOnly: Boolean, expr: Tree, selectors: List[Tree])(implicit src: SourceFile): Import = new Import(impliedOnly, expr, selectors)
326+
def Import(importImplied: Boolean, expr: Tree, selectors: List[Tree])(implicit src: SourceFile): Import = new Import(importImplied, expr, selectors)
327327
def PackageDef(pid: RefTree, stats: List[Tree])(implicit src: SourceFile): PackageDef = new PackageDef(pid, stats)
328328
def Annotated(arg: Tree, annot: Tree)(implicit src: SourceFile): Annotated = new Annotated(arg, annot)
329329

compiler/src/dotty/tools/dotc/core/Contexts.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ object Contexts {
406406
case _ => None
407407
}
408408
ctx.fresh.setImportInfo(
409-
new ImportInfo(implicit ctx => sym, imp.selectors, impNameOpt, imp.impliedOnly))
409+
new ImportInfo(implicit ctx => sym, imp.selectors, impNameOpt, imp.importImplied))
410410
}
411411

412412
/** Does current phase use an erased types interpretation? */

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,10 +532,10 @@ class TreePickler(pickler: TastyPickler) {
532532
}
533533
pickleStats(tree.constr :: rest)
534534
}
535-
case Import(impliedOnly, expr, selectors) =>
535+
case Import(importImplied, expr, selectors) =>
536536
writeByte(IMPORT)
537537
withLength {
538-
if (impliedOnly) writeByte(IMPLIED)
538+
if (importImplied) writeByte(IMPLIED)
539539
pickleTree(expr)
540540
pickleSelectors(selectors)
541541
}

compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -954,10 +954,10 @@ class TreeUnpickler(reader: TastyReader,
954954
assert(sourcePathAt(start).isEmpty)
955955
readByte()
956956
readEnd()
957-
val impliedOnly = nextByte == IMPLIED
958-
if (impliedOnly) readByte()
957+
val importImplied = nextByte == IMPLIED
958+
if (importImplied) readByte()
959959
val expr = readTerm()
960-
setSpan(start, Import(impliedOnly, expr, readSelectors()))
960+
setSpan(start, Import(importImplied, expr, readSelectors()))
961961
}
962962

963963
def readSelectors()(implicit ctx: Context): List[untpd.Tree] = nextByte match {

compiler/src/dotty/tools/dotc/core/unpickleScala2/Scala2Unpickler.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ class Scala2Unpickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClas
10491049
val to = untpd.Ident(toName)
10501050
if (toName.isEmpty) from else untpd.Thicket(from, untpd.Ident(toName))
10511051
})
1052-
Import(impliedOnly = false, expr, selectors)
1052+
Import(importImplied = false, expr, selectors)
10531053

10541054
case TEMPLATEtree =>
10551055
setSym()

compiler/src/dotty/tools/dotc/parsing/JavaParsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ object JavaParsers {
600600
}
601601

602602
def importCompanionObject(cdef: TypeDef): Tree =
603-
Import(impliedOnly = false, Ident(cdef.name.toTermName).withSpan(NoSpan), Ident(nme.WILDCARD) :: Nil)
603+
Import(importImplied = false, Ident(cdef.name.toTermName).withSpan(NoSpan), Ident(nme.WILDCARD) :: Nil)
604604

605605
// Importing the companion object members cannot be done uncritically: see
606606
// ticket #2377 wherein a class contains two static inner classes, each of which
@@ -662,7 +662,7 @@ object JavaParsers {
662662
// case nme.WILDCARD => Pair(ident, Ident(null) withPos Span(-1))
663663
// case _ => Pair(ident, ident)
664664
// }
665-
val imp = atSpan(start) { Import(impliedOnly = false, qual, List(ident)) }
665+
val imp = atSpan(start) { Import(importImplied = false, qual, List(ident)) }
666666
imp :: Nil
667667
}
668668
}

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,9 +2222,9 @@ object Parsers {
22222222
*/
22232223
def importClause(): List[Tree] = {
22242224
val offset = accept(IMPORT)
2225-
val impliedOnly = in.token == IMPLIED
2226-
if (impliedOnly) in.nextToken()
2227-
commaSeparated(importExpr(impliedOnly)) match {
2225+
val importImplied = in.token == IMPLIED
2226+
if (importImplied) in.nextToken()
2227+
commaSeparated(importExpr(importImplied)) match {
22282228
case t :: rest =>
22292229
// The first import should start at the start offset of the keyword.
22302230
val firstPos =
@@ -2237,11 +2237,11 @@ object Parsers {
22372237

22382238
/** ImportExpr ::= StableId `.' (id | `_' | ImportSelectors)
22392239
*/
2240-
def importExpr(impliedOnly: Boolean): () => Import = {
2240+
def importExpr(importImplied: Boolean): () => Import = {
22412241

22422242
val handleImport: Tree => Tree = { tree: Tree =>
2243-
if (in.token == USCORE) Import(impliedOnly, tree, importSelector() :: Nil)
2244-
else if (in.token == LBRACE) Import(impliedOnly, tree, inBraces(importSelectors()))
2243+
if (in.token == USCORE) Import(importImplied, tree, importSelector() :: Nil)
2244+
else if (in.token == LBRACE) Import(importImplied, tree, inBraces(importSelectors()))
22452245
else tree
22462246
}
22472247

@@ -2250,10 +2250,10 @@ object Parsers {
22502250
imp
22512251
case sel @ Select(qual, name) =>
22522252
val selector = atSpan(pointOffset(sel)) { Ident(name) }
2253-
cpy.Import(sel)(impliedOnly, qual, selector :: Nil)
2253+
cpy.Import(sel)(importImplied, qual, selector :: Nil)
22542254
case t =>
22552255
accept(DOT)
2256-
Import(impliedOnly, t, Ident(nme.WILDCARD) :: Nil)
2256+
Import(importImplied, t, Ident(nme.WILDCARD) :: Nil)
22572257
}
22582258
}
22592259

0 commit comments

Comments
 (0)