-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add explicit return types to public members #5203
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
Conversation
| type Closure = tpd.Closure | ||
|
|
||
| val NoSymbol = Symbols.NoSymbol | ||
| val NoSymbol: Symbols.NoSymbol.type = Symbols.NoSymbol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do val NoSymbol: Symbol to match the way it's done just below
allanrenucci
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass up to Definitions.scala
| def phaseName: String = GenBCode.name | ||
| private val entryPoints = new mutable.HashSet[Symbol]() | ||
| def registerEntryPoint(sym: Symbol) = entryPoints += sym | ||
| def registerEntryPoint(sym: Symbol): mutable.HashSet[Symbol] = entryPoints += sym |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be Unit?
| var tree: Tree = _ | ||
|
|
||
| val sourceFile = ctx.compilationUnit.source | ||
| val sourceFile: SourceFile = ctx.compilationUnit.source |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can sourceFile and tree above be private[this]?
| } | ||
|
|
||
| val cdef1 = addEnumFlags { | ||
| val cdef1: DefTree = addEnumFlags { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
|
|
||
| /** Attachment containing the number of enum cases and the smallest kind that was seen so far. */ | ||
| val EnumCaseCount = new Property.Key[(Int, CaseKind.Value)] | ||
| val EnumCaseCount: Property.Key[(Int, DesugarEnums.CaseKind.Value)] = new Property.Key[(Int, CaseKind.Value)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrite RHS to new Property.Key?
|
|
||
| /** Add implied flags to an enum class or an enum case */ | ||
| def addEnumFlags(cdef: TypeDef)(implicit ctx: Context) = | ||
| def addEnumFlags(cdef: TypeDef)(implicit ctx: Context): cdef.ThisTree[Untyped] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeDef ?
|
|
||
| /** All outer contexts, ending in `base.initialCtx` and then `NoContext` */ | ||
| def outersIterator = new Iterator[Context] { | ||
| def outersIterator: AnyRef with Iterator[Context] { var current: Context; } = new Iterator[Context] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Iterator[Context]?
|
|
||
| /** A new context that summarizes an import statement */ | ||
| def importContext(imp: Import[_], sym: Symbol) = { | ||
| def importContext(imp: Import[_], sym: Symbol): FreshContext = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure it is meant to be a FreshContext. I would try Context and see if it still compile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, has to be fresh:
[error] /home/olivier/workspace/dotty/compiler/src/dotty/tools/repl/ReplCompiler.scala:58:24: type mismatch;
[error] found : dotty.tools.dotc.core.Contexts.Context
[error] required: dotty.tools.dotc.core.Contexts.FreshContext
[error] importContext(imp)(ctx))
[error] ^
[error] one error found| setSettings(setting.updateIn(settingsState, value)) | ||
|
|
||
| def setDebug = setSetting(base.settings.Ydebug, true) | ||
| def setDebug: FreshContext = setSetting(base.settings.Ydebug, true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.type?
| * to avoid space leaks - the message computation usually captures a context. | ||
| */ | ||
| private[core] val errorTypeMsg = mutable.Map[ErrorType, () => Message]() | ||
| private[core] val errorTypeMsg: mutable.Map[Types.ErrorType, () => Message] = mutable.Map[ErrorType, () => Message]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove type annotation on RHS
|
|
||
| @sharable object EmptyGADTMap extends GADTMap(SimpleIdentityMap.Empty) { | ||
| override def setBounds(sym: Symbol, b: TypeBounds) = unsupported("EmptyGADTMap.setBounds") | ||
| override def setBounds(sym: Symbol, b: TypeBounds): Nothing = unsupported("EmptyGADTMap.setBounds") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit I beleive
allanrenucci
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second pass up to Types.scala
| NoSymbol, nme.ROOTPKG, PackageCreationFlags, TypeRef(NoPrefix, RootClass)) | ||
|
|
||
| lazy val EmptyPackageVal = ctx.newPackageSymbol( | ||
| lazy val EmptyPackageVal: Symbol { type ThisName = Names.TermName } = ctx.newPackageSymbol( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TermSymbol?
| /** A package in which we can place all methods that are interpreted specially by the compiler */ | ||
| lazy val OpsPackageVal = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered | ||
| lazy val OpsPackageClass = OpsPackageVal.moduleClass.asClass | ||
| lazy val OpsPackageVal: Symbol { type ThisName = Names.TermName } = ctx.newCompletePackageSymbol(RootClass, nme.OPS_PACKAGE).entered |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TermSymbol?
| lazy val Object_waitL: TermSymbol = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: Nil, UnitType), Final) | ||
| lazy val Object_waitLI: TermSymbol = enterMethod(ObjectClass, nme.wait_, MethodType(LongType :: IntType :: Nil, UnitType), Final) | ||
|
|
||
| def ObjectMethods: List[Symbols.TermSymbol] = List(Object_eq, Object_ne, Object_synchronized, Object_clone, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove prefix Symbols.?
|
|
||
| // The set of all wrap{X, Ref}Array methods, where X is a value type | ||
| val WrapArrayMethods = new PerRun[collection.Set[Symbol]]({ implicit ctx => | ||
| val WrapArrayMethods: PerRun[collection.Set[Symbol]] = new PerRun[collection.Set[Symbol]]({ implicit ctx => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove type annotation from RHS?
| def staticsMethodRef(name: PreName) = ScalaStaticsModule.requiredMethodRef(name) | ||
| def staticsMethod(name: PreName) = ScalaStaticsModule.requiredMethod(name) | ||
| def NullType: TypeRef = NullClass.typeRef | ||
| lazy val RuntimeNullModuleRef: Types.TermRef = ctx.requiredModuleRef("scala.runtime.Null") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import TermRef for all the definitions below?
|
|
||
| /** Create a synthetic lazy implicit value */ | ||
| def newLazyImplicit(info: Type) = | ||
| def newLazyImplicit(info: Type): Symbol { type ThisName = Names.TermName } = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TermSymbol?
| * motivation (create a singleton referencing to a type) is similar. | ||
| */ | ||
| def newSkolem(tp: Type) = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | NonMember | Permanent, tp) | ||
| def newSkolem(tp: Type): Symbol { type ThisName = Names.TermName } = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | NonMember | Permanent, tp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TermSymbol?
| def newSkolem(tp: Type): Symbol { type ThisName = Names.TermName } = newSymbol(defn.RootClass, nme.SKOLEM, SyntheticArtifact | NonMember | Permanent, tp) | ||
|
|
||
| def newErrorSymbol(owner: Symbol, name: Name, msg: => Message) = { | ||
| def newErrorSymbol(owner: Symbol, name: Name, msg: => Message): Symbol { type ThisName = Names.Name } = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symbol?
|
|
||
| /** Tree attachment containing the identifiers in a tree as a sorted array */ | ||
| val Ids = new Property.Key[Array[String]] | ||
| val Ids: Property.Key[Array[String]] = new Property.Key[Array[String]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RHS: new Property.Key?
|
|
||
| object ErasedValueType { | ||
| def apply(tycon: TypeRef, erasedUnderlying: Type)(implicit ctx: Context) = { | ||
| def apply(tycon: TypeRef, erasedUnderlying: Type)(implicit ctx: Context): CachedErasedValueType = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ErasedValueType?
|
|
||
| /** The uninstantiated variables */ | ||
| def uninstVars = constraint.uninstVars | ||
| def uninstVars: Seq[Types.TypeVar] = constraint.uninstVars |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seq[TypeVar]
| def kindString = "Term" | ||
| def copyBoundType(bt: BT) = bt.paramRefs(paramNum) | ||
| def kindString: String = "Term" | ||
| def copyBoundType(bt: BT): bt.ParamRefType = bt.paramRefs(paramNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type?
| def kindString = "Type" | ||
| def copyBoundType(bt: BT) = bt.paramRefs(paramNum) | ||
| def kindString: String = "Type" | ||
| def copyBoundType(bt: BT): bt.ParamRefType = bt.paramRefs(paramNum) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type?
| @sharable var debugTrace: Boolean = false | ||
|
|
||
| val watchList = List[String]( | ||
| val watchList: List[Names.TypeName] = List[String]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove prefix Names.
|
|
||
| protected var currentClassName: SimpleName = _ // JVM name of the current class | ||
| protected var classTParams = Map[Name,Symbol]() | ||
| protected var classTParams: Map[Name, Symbol] = Map[Name, Symbol]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove RHS type annotation
| val matchMarker = marker("Match") | ||
| val orMarker: xsbti.api.Annotation = marker("Or") | ||
| val byNameMarker: xsbti.api.Annotation = marker("ByName") | ||
| val matchMarker: xsbti.api.Annotation = marker("Match") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
privates
| } | ||
|
|
||
| override def prepareForUnit(tree: Tree)(implicit ctx: Context) = { | ||
| override def prepareForUnit(tree: Tree)(implicit ctx: Context): FreshContext = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Context
| } | ||
|
|
||
| val eraser = new Erasure.Typer(this) | ||
| val eraser: Erasure.Typer = new Erasure.Typer(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private
| val functionName = "JFunction".toTermName | ||
| val functionPackage = "scala.compat.java8.".toTermName | ||
| val functionName: TermName = "JFunction".toTermName | ||
| val functionPackage: TermName = "scala.compat.java8.".toTermName |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
privates
| */ | ||
| class Hoister(cls: Symbol)(implicit ctx: Context) { | ||
| val superArgDefs = new mutable.ListBuffer[DefDef] | ||
| val superArgDefs: mutable.ListBuffer[DefDef] = new mutable.ListBuffer[DefDef] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove RHS type annotation
|
|
||
| /** A map storing free variables of functions and classes */ | ||
| val free = new LinkedHashMap[Symbol, SymSet] | ||
| val free: mutable.LinkedHashMap[Symbol, SymSet] = new LinkedHashMap[Symbol, SymSet] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove RHS type annotation
|
|
||
| /** Buffers for lifted out classes and methods, indexed by owner */ | ||
| val liftedDefs = new HashMap[Symbol, mutable.ListBuffer[Tree]] | ||
| val liftedDefs: mutable.HashMap[Symbol, mutable.ListBuffer[Tree]] = new HashMap[Symbol, mutable.ListBuffer[Tree]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove RHS type annotation
| * and number of bits currently used */ | ||
| class OffsetInfo(var defs: List[Tree], var ord:Int) | ||
| val appendOffsetDefs = mutable.Map.empty[Symbol, OffsetInfo] | ||
| val appendOffsetDefs: mutable.Map[Symbol, OffsetInfo] = mutable.Map.empty[Symbol, OffsetInfo] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private?
| val initFlags: Flags.FlagSet = Flags.Synthetic | Flags.Method | ||
|
|
||
| val containerFlagsMask = Flags.Method | Flags.Lazy | Flags.Accessor | Flags.Module | ||
| val containerFlagsMask: Flags.FlagSet = Flags.Method | Flags.Lazy | Flags.Accessor | Flags.Module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import FlagSet
| def forwarder(target: Symbol) = (targs: List[Type]) => (vrefss: List[List[Tree]]) => | ||
| superRef(target).appliedToTypes(targs).appliedToArgss(vrefss) | ||
| def forwarder(target: Symbol): List[Type] => List[List[Tree]] => Tree = | ||
| (targs: List[Type]) => (vrefss: List[List[Tree]]) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
targs => vrefss =>
|
|
||
| /** Does this abstract file denote an existing file? */ | ||
| def create() = { unsupported() } | ||
| def create(): Nothing = { unsupported() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit
|
|
||
| /** Delete the underlying file or directory (recursively). */ | ||
| def delete() = { unsupported() } | ||
| def delete(): Nothing = { unsupported() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit
| * check that it exists. | ||
| */ | ||
| def lookupNameUnchecked(name: String, directory: Boolean) = unsupported() | ||
| def lookupNameUnchecked(name: String, directory: Boolean): Nothing = unsupported() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractFile
| private[this] var content = Array.emptyByteArray | ||
|
|
||
| def absolute = this | ||
| def absolute: VirtualFile = this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractFile
| } | ||
|
|
||
| def absolute = this | ||
| def absolute: VirtualDirectory = this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractFile
allanrenucci
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
| def output = unsupported() | ||
| def container = unsupported() | ||
| def absolute = unsupported() | ||
| override def underlyingSource: Some[ZipArchive] = Some(this) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option[AbstractFile]
| def absolute = unsupported() | ||
| override def underlyingSource: Some[ZipArchive] = Some(this) | ||
| def isDirectory: Boolean = true | ||
| def lookupName(name: String, directory: Boolean): Nothing = unsupported() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractFile
| override def underlyingSource: Some[ZipArchive] = Some(this) | ||
| def isDirectory: Boolean = true | ||
| def lookupName(name: String, directory: Boolean): Nothing = unsupported() | ||
| def lookupNameUnchecked(name: String, directory: Boolean): Nothing = unsupported() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AbstractFile
| def isDirectory: Boolean = true | ||
| def lookupName(name: String, directory: Boolean): Nothing = unsupported() | ||
| def lookupNameUnchecked(name: String, directory: Boolean): Nothing = unsupported() | ||
| def create(): Nothing = unsupported() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit
| def lookupName(name: String, directory: Boolean): Nothing = unsupported() | ||
| def lookupNameUnchecked(name: String, directory: Boolean): Nothing = unsupported() | ||
| def create(): Nothing = unsupported() | ||
| def delete(): Nothing = unsupported() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit
| def getArchive: ZipFile = null | ||
| override def underlyingSource = Some(self) | ||
| override def toString = self.path + "(" + path + ")" | ||
| override def underlyingSource: Some[ZipArchive] = Some(self) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option[AbstractFile]
| /** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */ | ||
| class DirEntry(path: String) extends Entry(path) { | ||
| val entries = mutable.HashMap[String, Entry]() | ||
| val entries: mutable.HashMap[String, Entry] = mutable.HashMap[String, Entry]() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove RHS type annotation
| } | ||
|
|
||
| @volatile lazy val (root, allDirs) = { | ||
| @volatile lazy val ((root: DirEntry), (allDirs: mutable.HashMap[String, DirEntry])) = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lazy val (root , allDirs): (DirEntry, Map[String, DirEntry]))
| override def canEqual(other: Any) = other.isInstanceOf[FileZipArchive] | ||
| override def hashCode() = jpath.hashCode | ||
| override def equals(that: Any) = that match { | ||
| override def sizeOption: Some[Int] = Some(Files.size(jpath).toInt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option[Int]
| def lastModified = Files.getLastModifiedTime(jpath).toMillis | ||
| def name: String = jpath.getFileName.toString | ||
| def path: String = jpath.toString | ||
| def input: java.io.InputStream = Files.newInputStream(jpath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove prefix java.io.
6480c9e to
55c2a1c
Compare
Using dotty-compiler/scalafix RemoveUnused
Using a published local version of RscCompat
This reverts commit 8861d18.
55c2a1c to
9751e7c
Compare
|
|
No description provided.