Skip to content

Finish Position-Related Renamings #5697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 77 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
8de8ba6
Rename nextId -> nextSymId in Context
odersky Dec 18, 2018
7081106
Make nextTreeId counter a context field
odersky Dec 19, 2018
a51ec45
Adapt refelect.TreeOps to new scheme
odersky Dec 19, 2018
10fd66f
@transientParam annotation
odersky Dec 19, 2018
0afbd4f
Apply @transientParam to compiler
odersky Dec 19, 2018
3d6665a
Produce tree ids in chunks
odersky Dec 19, 2018
6b68133
Set source field of context directly
odersky Dec 19, 2018
8bd9263
Make TreeCopiers preserve source
odersky Dec 19, 2018
47e3470
Refactor getSource and withSource
odersky Dec 19, 2018
0a689bf
Serialize source file changes
odersky Dec 20, 2018
a69e55e
Better caching of sources
odersky Dec 20, 2018
6f3ba27
Allocate tree ids globally
odersky Dec 20, 2018
c7575bb
Follow source changes when unpickling
odersky Dec 21, 2018
ff2fa5c
Remove unpickleTypeTree
odersky Dec 23, 2018
7850b9e
Keep sourcefile info when pickling
odersky Dec 23, 2018
f510175
Eliminate Decorators.sourcePos
odersky Dec 23, 2018
a10aeab
Fix position of inline bodies in unpickler.
odersky Dec 25, 2018
3c80ab6
Lazy load contents of source position
odersky Dec 31, 2018
8c7ef50
Print full source positions in trees
odersky Dec 31, 2018
1b5a2b9
Fix dropInlined
odersky Dec 31, 2018
a3f074c
Check sources correspond under -Ytest-pickler
odersky Dec 31, 2018
0b7586c
Fix PositionPickler
odersky Dec 31, 2018
d6716c8
Make Inliner source-position aware
odersky Dec 31, 2018
7ec9d60
Fix Symbol#sourceFile
odersky Jan 1, 2019
b1c73e6
Make PositionPickler work for shared trees
odersky Jan 1, 2019
6cd7ca5
Make Modifiers not extend from Positioned
odersky Jan 2, 2019
f453666
Temporary hack to circumvent missing sourcefile info
odersky Jan 2, 2019
207df5f
Add source component to Positioned
odersky Jan 2, 2019
e410a80
Inliner tweaks
odersky Jan 2, 2019
61f4ee7
withPos(Positioned) -> withPosOf
odersky Jan 3, 2019
ac60b60
Unpickler always takes source from context
odersky Jan 3, 2019
19f0e8a
withPos -> withSpan
odersky Jan 3, 2019
97ddf4c
Fix position pickler
odersky Jan 3, 2019
1732416
Harden IDE: Survive duplicate package and object
odersky Jan 3, 2019
e0fc25a
Position -> Span
odersky Jan 3, 2019
c0158d1
Add missing check files
odersky Jan 3, 2019
6ed965d
Fix rebase breakage
odersky Jan 3, 2019
0c9b30c
atPos -> atSpan
odersky Jan 3, 2019
c80b52b
Rename SourcePos#pos -> SourcePos#span
odersky Jan 4, 2019
7f34ac2
Rename Span#pos -> Span#span
odersky Jan 4, 2019
1986cf3
Rename Symbol#pos -> span, Comment#pos -> span
odersky Jan 4, 2019
b90b6b3
Apply renamings to language server
odersky Jan 4, 2019
2d7de55
Rename other uses of `pos` to `span`
odersky Jan 4, 2019
a031d43
Polishings
odersky Jan 4, 2019
5d75560
Convert some checking methods to take Positioned arguments
odersky Jan 4, 2019
ad38ec4
Simplify Parser
odersky Jan 4, 2019
85e3149
Fix rebase breakage
odersky Jan 6, 2019
3a8dbe1
Add missing source to context
nicolasstucki Jan 5, 2019
e4582d6
Add missing contents to vitual files
nicolasstucki Jan 5, 2019
89b617e
Avoid memoization of virtual source files with same path
nicolasstucki Jan 5, 2019
ee09e0e
Use non-virtual files in dottydoc tests
nicolasstucki Jan 6, 2019
95fcf70
Update test to use Spans
nicolasstucki Jan 6, 2019
ab08247
Update missing `pos` to `span`
nicolasstucki Jan 6, 2019
741f644
Update implicit modifier test
nicolasstucki Jan 7, 2019
a22fe17
Add missing spans in closures
nicolasstucki Jan 7, 2019
b0cdd14
Comment debug assertion
nicolasstucki Jan 7, 2019
c94d9b1
Remove unnecessary workaround for repl
nicolasstucki Jan 7, 2019
bfbe23c
Fix rebase breakage
odersky Jan 9, 2019
dcf7b07
Avoid creating source positions in backend interface
odersky Jan 7, 2019
9e8a551
Optimize computation of Sourcefile#content
odersky Jan 7, 2019
d19a85e
Make SourceFile equals depend on file
odersky Jan 9, 2019
211a939
Optimize equals + hashCode on PlainFile
odersky Jan 9, 2019
0a261c6
Reduce concurrent hashmap lookups
odersky Jan 9, 2019
35fbc23
Refactor SourceFile operations
odersky Jan 9, 2019
a8527fb
Optimize PlainFile.equals
odersky Jan 10, 2019
dcf3e3d
Implement -Ydebug-pos
odersky Jan 10, 2019
7330b38
Revise PositionPickler
odersky Jan 10, 2019
637b4eb
Fix rebase breakage
odersky Jan 10, 2019
99c94cf
Optimize initialPos in Positioned
odersky Jan 10, 2019
131d81b
Optimize SourceFile.fromId
odersky Jan 11, 2019
6e04aca
Optimize Symbol#source
odersky Jan 11, 2019
890fba1
Use SourceFile implicits instead of SourceInfo
odersky Jan 11, 2019
dc2c818
Rename SourcePosition -> Position
odersky Jan 11, 2019
8960f44
Rename Symbol#sourcePos -> pos
odersky Jan 11, 2019
4f57780
Rename Tree#sourcePos -> pos
odersky Jan 11, 2019
c6a54fa
Rename withSourcePos -> withPos
odersky Jan 11, 2019
fc4b3c2
Drop one redundant and one unused method
odersky Jan 12, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/backend/jvm/CollectEntryPoints.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SymDenotations._
import Contexts._
import Types._
import Symbols._
import dotty.tools.dotc.util.Positions.Position
import dotty.tools.dotc.util.Position
import Decorators._
import StdNames.nme

Expand Down Expand Up @@ -48,9 +48,9 @@ object CollectEntryPoints{
(toDenot(sym).info member nme.main).alternatives exists(x => isJavaMainMethod(x.symbol))

def fail(msg: String, pos: Position = sym.pos) = {
ctx.warning( sym.name +
s" has a main method with parameter type Array[String], but ${toDenot(sym).fullName} will not be a runnable program.\n Reason: $msg",
sourcePos(sym.pos)
ctx.warning(
i"""${sym.name} has a main method with parameter type Array[String], but ${sym.fullName} will not be a runnable program.
|Reason: $msg""", sym.pos
// TODO: make this next claim true, if possible
// by generating valid main methods as static in module classes
// not sure what the jvm allows here
Expand Down
20 changes: 11 additions & 9 deletions compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import Types._
import Symbols._
import Phases._

import dotty.tools.dotc.util.Positions
import dotty.tools.dotc.util
import dotty.tools.dotc.util.Spans
import Decorators._
import tpd._

Expand All @@ -41,7 +42,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
type CompilationUnit = dotc.CompilationUnit
type Constant = Constants.Constant
type Literal = tpd.Literal
type Position = Positions.Position
type Position = Spans.Span
type Name = Names.Name
type ClassDef = tpd.TypeDef
type TypeDef = tpd.TypeDef
Expand Down Expand Up @@ -77,7 +78,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
type Closure = tpd.Closure

val NoSymbol: Symbol = Symbols.NoSymbol
val NoPosition: Position = Positions.NoPosition
val NoPosition: Position = Spans.NoSpan
val EmptyTree: Tree = tpd.EmptyTree


Expand Down Expand Up @@ -380,16 +381,17 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
ctx.requiredModule(className)
}


def debuglog(msg: => String): Unit = ctx.debuglog(msg)
def informProgress(msg: String): Unit = ctx.informProgress(msg)
def log(msg: => String): Unit = ctx.log(msg)
def error(pos: Position, msg: String): Unit = ctx.error(msg, pos)
def warning(pos: Position, msg: String): Unit = ctx.warning(msg, pos)
def error(pos: Position, msg: String): Unit = ctx.error(msg, sourcePos(pos))
def warning(pos: Position, msg: String): Unit = ctx.warning(msg, sourcePos(pos))
def abort(msg: String): Nothing = {
ctx.error(msg)
throw new RuntimeException(msg)
}
def sourcePos(pos: Position)(implicit ctx: Context): util.Position =
ctx.source.atSpan(pos)

def emitAsmp: Option[String] = None

Expand Down Expand Up @@ -587,7 +589,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
implicit def treeHelper(a: Tree): TreeHelper = new TreeHelper {
def symbol: Symbol = a.symbol

def pos: Position = a.pos
def pos: Position = a.span

def isEmpty: Boolean = a.isEmpty

Expand Down Expand Up @@ -809,7 +811,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma

def moduleSuffix: String = "" // todo: validate that names already have $ suffix
def outputDirectory: AbstractFile = DottyBackendInterface.this.outputDirectory
def pos: Position = sym.pos
def pos: Position = sym.span

def throwsAnnotations: List[Symbol] = Nil

Expand Down Expand Up @@ -1105,7 +1107,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
def _1: Type = field.tpe match {
case JavaArrayType(elem) => elem
case _ =>
ctx.error(s"JavaSeqArray with type ${field.tpe} reached backend: $field", field.pos)
error(field.span, s"JavaSeqArray with type ${field.tpe} reached backend: $field")
UnspecifiedErrorType
}
def _2: List[Tree] = field.elems
Expand Down
Loading