Skip to content

Commit 41718b7

Browse files
committed
attempt to pass Ycheck
1 parent a45708b commit 41718b7

File tree

10 files changed

+218
-211
lines changed

10 files changed

+218
-211
lines changed

compiler/src/dotty/tools/dotc/core/tasty/experimental/CommentPickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package dotty.tools.dotc.core.tasty.experimental
33
import dotty.tools.dotc.ast.tpd
44
import dotty.tools.dotc.core.Contexts.Context
55

6-
import dotty.tools.tasty.experimental.{TastyPickler, CommentPickler => CommentPicklerImpl}
6+
import dotty.tools.tasty.experimental.{CommentPickler => CommentPicklerImpl}
77
import dotty.tools.tasty.TastyBuffer.Addr
88

9-
class CommentPickler(pickler: TastyPickler[DottyTasty.type], addrOfTree: tpd.Tree => Addr)(implicit ctx: Context)
10-
extends CommentPicklerImpl(DottyTasty)(pickler, addrOfTree)
9+
class CommentPickler(pickler: TastyPickler, addrOfTree: tpd.Tree => Addr)(implicit ctx: Context)
10+
extends CommentPicklerImpl(pickler, addrOfTree)

compiler/src/dotty/tools/dotc/core/tasty/experimental/PositionPickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ package dotty.tools.dotc.core.tasty.experimental
22

33
import dotty.tools.dotc.ast.untpd
44

5-
import dotty.tools.tasty.experimental.{TastyPickler, PositionPickler => PositionPicklerImpl}
5+
import dotty.tools.tasty.experimental.{PositionPickler => PositionPicklerImpl}
66
import dotty.tools.tasty.TastyBuffer.Addr
77

8-
class PositionPickler(pickler: TastyPickler[DottyTasty.type], addrOfTree: untpd.Tree => Addr)
9-
extends PositionPicklerImpl(DottyTasty)(pickler, addrOfTree)
8+
class PositionPickler(pickler: TastyPickler, addrOfTree: untpd.Tree => Addr)
9+
extends PositionPicklerImpl(pickler, addrOfTree)

tasty/src/dotty/tools/tasty/experimental/CommentPickler.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import TastyBuffer.{Addr, NoAddr}
55

66
import java.nio.charset.Charset
77

8-
class CommentPickler[T <: Tasty](val tasty: T)(pickler: TastyPickler[tasty.type], addrOfTree: tasty.Tree => Addr)(implicit ctx: tasty.Context) {
9-
import tasty.{_, given}
8+
class CommentPickler[T <: Tasty](val pickler: TastyPickler[T], addrOfTree: pickler.tasty.tpd.Tree => Addr)(implicit ctx: pickler.tasty.Context) {
9+
import pickler.tasty.{_, given}
1010
private val buf = new TastyBuffer(5000)
1111
pickler.newSection("Comments", buf)
1212

13-
def pickleComment(root: Tree): Unit = {
13+
def pickleComment(root: tpd.Tree): Unit = {
1414
val docCtx = ctx.docCtx
1515
assert(docCtx.isDefined, "Trying to pickle comments, but there's no `docCtx`.")
1616
new Traverser(docCtx.get).traverse(root)
@@ -29,9 +29,9 @@ class CommentPickler[T <: Tasty](val tasty: T)(pickler: TastyPickler[tasty.type]
2929
}
3030

3131
private class Traverser(docCtx: ContextDocstrings) extends TreeTraverser {
32-
override def traverse(tree: Tree)(implicit ctx: Context): Unit =
32+
override def traverse(tree: tpd.Tree)(implicit ctx: Context): Unit =
3333
tree match {
34-
case md: MemberDef =>
34+
case md: tpd.MemberDef =>
3535
val comment = docCtx.docstring(md.symbol)
3636
pickleComment(addrOfTree(md), comment)
3737
traverseChildren(md)

tasty/src/dotty/tools/tasty/experimental/PositionPickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import TastyBuffer._
66

77
import collection.mutable
88

9-
class PositionPickler[T <: Tasty](val tasty: T)(val pickler: TastyPickler[tasty.type], addrOfTree: tasty.untpd.Tree => Addr) {
10-
import tasty.{_,given}
9+
class PositionPickler[T <: Tasty](val pickler: TastyPickler[T], addrOfTree: pickler.tasty.untpd.Tree => Addr) {
10+
import pickler.tasty.{_,given}
1111
val buf: TastyBuffer = new TastyBuffer(5000)
1212
pickler.newSection("Positions", buf)
1313

@@ -18,7 +18,7 @@ class PositionPickler[T <: Tasty](val tasty: T)(val pickler: TastyPickler[tasty.
1818
(addrDelta << 3) | (toInt(hasStartDelta) << 2) | (toInt(hasEndDelta) << 1) | toInt(hasPoint)
1919
}
2020

21-
def picklePositions(roots: List[Tree])(implicit ctx: Context): Unit = {
21+
def picklePositions(roots: List[tpd.Tree])(implicit ctx: Context): Unit = {
2222
var lastIndex = 0
2323
var lastSpan = Span.empty
2424
def pickleDeltas(index: Int, span: Span) = {

tasty/src/dotty/tools/tasty/experimental/TastyPickler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class TastyPickler[T <: Tasty](val tasty: T)(val rootCls: tasty.ClassSymbol) { s
6464
* Note that trees are looked up by reference equality,
6565
* so one can reliably use this function only directly after `pickler`.
6666
*/
67-
var addrOfTree: Tree => Addr = (_ => NoAddr)
67+
var addrOfTree: tpd.Tree => Addr = (_ => NoAddr)
6868

6969
/**
7070
* Addresses in TASTY file of symbols, stored by pickling.
@@ -73,5 +73,5 @@ class TastyPickler[T <: Tasty](val tasty: T)(val rootCls: tasty.ClassSymbol) { s
7373
*/
7474
var addrOfSym: Symbol => Option[Addr] = (_ => None)
7575

76-
val treePkl = new TreePickler(tasty)(self.asInstanceOf[TastyPickler[tasty.type]])
76+
val treePkl = new TreePickler(self)
7777
}

tasty/src/dotty/tools/tasty/experimental/TreeBuffer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import TastyBuffer.{Addr, NoAddr, AddrWidth}
66

77
import util.Util.bestFit
88

9-
class TreeBuffer[T <: Tasty](given val tasty: T) extends TastyBuffer(50000) {
9+
class TreeBuffer[T <: Tasty](val tasty: T) extends TastyBuffer(50000) {
1010
import tasty.{_, given}
1111
import Printers.pickling
1212

tasty/src/dotty/tools/tasty/experimental/TreePickler.scala

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ object TreePickler {
99
val sectionName = "ASTs"
1010
}
1111

12-
class TreePickler[T <: Tasty](val tasty: T)(val pickler: TastyPickler[tasty.type]) {
13-
import tasty.{_, given}
14-
val buf = TreeBuffer[tasty.type](given tasty)
12+
class TreePickler[T <: Tasty](val pickler: TastyPickler[T]) {
13+
import pickler.tasty.{_, given}
14+
val buf = TreeBuffer[pickler.tasty.type](pickler.tasty)
1515
pickler.newSection(TreePickler.sectionName, buf)
1616
import TreePickler._
1717
import buf._
1818
import pickler.nameBuffer.nameIndex
1919
import Constants._
2020
import Symbols.{_,given}
21+
import tpd._
2122

2223
private val symRefs = Symbols.newMutableSymbolMap[Addr]
2324
private val forwardSymRefs = Symbols.newMutableSymbolMap[List[Addr]]

tasty/src/dotty/tools/tasty/experimental/bridge/AnnotationOps.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dotty.tools.tasty.experimental.bridge
33
import reflect.ClassTag
44

55
trait AnnotationOps extends Core with
6+
self: TreeOps with PositionOps with ContextOps with SourceFileOps with SymbolOps =>
67

78
given ClassTag[Annotation] = internal.Annotation_CT
89

@@ -13,5 +14,5 @@ trait AnnotationOps extends Core with
1314
def unapply(annot: Annotation)(given Context): Option[Symbol] = internal.Annotation_Child_unapply(annot)
1415

1516
given AnnotationOps: (annot: Annotation) with
16-
def tree(given Context): Tree = internal.Annotation_tree(annot)
17+
def tree(given Context): tpd.Tree = internal.Annotation_tree(annot)
1718
def symbol(given Context): Symbol = internal.Annotation_symbol(annot)

tasty/src/dotty/tools/tasty/experimental/bridge/Core.scala

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -22,53 +22,6 @@ trait Core with
2222

2323
type Positioned = internal.Positioned
2424

25-
type Tree = internal.Tree
26-
type MemberDef = internal.MemberDef
27-
type Hole = internal.Hole
28-
type Template = internal.Template
29-
type ValOrDefDef = internal.ValOrDefDef
30-
type TypeDef = internal.TypeDef
31-
type ValDef = internal.ValDef
32-
type DefDef = internal.DefDef
33-
type RefTree = internal.RefTree
34-
type Ident = internal.Ident
35-
type Select = internal.Select
36-
type This = internal.This
37-
type Apply = internal.Apply
38-
type TypeApply = internal.TypeApply
39-
type Literal = internal.Literal
40-
type Super = internal.Super
41-
type New = internal.New
42-
type Typed = internal.Typed
43-
type NamedArg = internal.NamedArg
44-
type Assign = internal.Assign
45-
type Block = internal.Block
46-
type If = internal.If
47-
type Closure = internal.Closure
48-
type Match = internal.Match
49-
type CaseDef = internal.CaseDef
50-
type Labeled = internal.Labeled
51-
type Return = internal.Return
52-
type WhileDo = internal.WhileDo
53-
type Try = internal.Try
54-
type SeqLiteral = internal.SeqLiteral
55-
type Inlined = internal.Inlined
56-
type Bind = internal.Bind
57-
type Alternative = internal.Alternative
58-
type UnApply = internal.UnApply
59-
type Import = internal.Import
60-
type PackageDef = internal.PackageDef
61-
type TypeTree = internal.TypeTree
62-
type SingletonTypeTree = internal.SingletonTypeTree
63-
type RefinedTypeTree = internal.RefinedTypeTree
64-
type AppliedTypeTree = internal.AppliedTypeTree
65-
type MatchTypeTree = internal.MatchTypeTree
66-
type ByNameTypeTree = internal.ByNameTypeTree
67-
type Annotated = internal.Annotated
68-
type LambdaTypeTree = internal.LambdaTypeTree
69-
type TypeBoundsTree = internal.TypeBoundsTree
70-
type Thicket = internal.Thicket
71-
7225
type Type = internal.Type
7326
type AppliedType = internal.AppliedType
7427
type ConstantType = internal.ConstantType

0 commit comments

Comments
 (0)