Tweak internals
This commit is contained in:
parent
2aaf097229
commit
22531888cc
|
@ -77,7 +77,7 @@ class PipelineMainClass(argFiles: Seq[Path], pipelineSettings: PipelineMain.Pipe
|
|||
}
|
||||
}
|
||||
|
||||
implicit val executor = ExecutionContext.fromExecutor(new java.util.concurrent.ForkJoinPool(parallelism), t => handler.uncaughtException(Thread.currentThread(), t))
|
||||
implicit val executor: ExecutionContext = ExecutionContext.fromExecutor(new java.util.concurrent.ForkJoinPool(parallelism), t => handler.uncaughtException(Thread.currentThread(), t))
|
||||
def changeExtension(p: Path, newExtension: String): Path = {
|
||||
val fileName = p.getFileName.toString
|
||||
val changedFileName = fileName.lastIndexOf('.') match {
|
||||
|
|
|
@ -54,7 +54,8 @@ trait AnalyzerPlugins { self: Analyzer with splain.SplainData =>
|
|||
/**
|
||||
* Let analyzer plugins change the types assigned to definitions. For definitions that have
|
||||
* an annotated type, the assigned type is obtained by typing that type tree. Otherwise, the
|
||||
* type is inferred by typing the definition's righthand side.
|
||||
* type is inferred by typing the definition's righthand side, or from the overridden
|
||||
* member under `-Xsource:3`.
|
||||
*
|
||||
* In order to know if the type was inferred, you can query the `wasEmpty` field in the `tpt`
|
||||
* TypeTree of the definition (for DefDef and ValDef).
|
||||
|
|
|
@ -24,7 +24,7 @@ object ManPage {
|
|||
case class Emph(contents: AbstractText) extends AbstractText
|
||||
case class Mono(contents: AbstractText) extends AbstractText
|
||||
case class Quote(contents: AbstractText) extends AbstractText
|
||||
implicit def str2text(str: String) = Text(str)
|
||||
implicit def str2text(str: String): Text = Text(str)
|
||||
|
||||
case class Definition(term: AbstractText, description: AbstractText)
|
||||
case class DefinitionList(definitions: Definition*) extends AbstractText
|
||||
|
@ -37,14 +37,14 @@ object ManPage {
|
|||
case class CodeSample(text: String) extends Paragraph
|
||||
case class BlockQuote(text: AbstractText) extends Paragraph
|
||||
implicit def text2para(text: AbstractText): Paragraph = TextParagraph(text)
|
||||
implicit def str2para(str: String) = text2para(str2text(str))
|
||||
implicit def str2para(str: String): Paragraph = text2para(str2text(str))
|
||||
|
||||
case class BulletList(items: AbstractText*) extends Paragraph
|
||||
case class NumberedList(items: AbstractText*) extends Paragraph
|
||||
case class TitledPara(title: String, text: AbstractText) extends Paragraph
|
||||
|
||||
case class EmbeddedSection(section: Section) extends Paragraph
|
||||
implicit def section2Para(section: Section) = EmbeddedSection(section)
|
||||
implicit def section2Para(section: Section): EmbeddedSection = EmbeddedSection(section)
|
||||
|
||||
case class Section(title: String, paragraphs: Paragraph*)
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
package scala.tools.partest
|
||||
|
||||
import scala.language.implicitConversions
|
||||
import scala.reflect.runtime.{universe => ru}
|
||||
import scala.tools.nsc._
|
||||
|
||||
|
@ -46,7 +47,7 @@ abstract class CompilerTest extends DirectTest {
|
|||
if (sym eq NoSymbol) NoType
|
||||
else appliedType(sym, compilerTypeFromTag(t))
|
||||
}
|
||||
implicit def mkMkType(sym: Symbol) = new MkType(sym)
|
||||
implicit def mkMkType(sym: Symbol): MkType = new MkType(sym)
|
||||
|
||||
def allMembers(root: Symbol): List[Symbol] = {
|
||||
def loop(seen: Set[Symbol], roots: List[Symbol]): List[Symbol] = {
|
||||
|
|
|
@ -28,5 +28,5 @@ trait Instance extends Spec {
|
|||
def residualArgs = parsed.residualArgs // only args which were not options or args to options
|
||||
|
||||
type OptionMagic = Opt.Instance
|
||||
protected implicit def optionMagicAdditions(name: String) = new Opt.Instance(programInfo, parsed, name)
|
||||
protected implicit def optionMagicAdditions(name: String): Opt.Instance = new Opt.Instance(programInfo, parsed, name)
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ trait Reference extends Spec {
|
|||
final def apply(args: String*): ThisCommandLine = creator(propertyArgs ++ args flatMap expandArg)
|
||||
|
||||
type OptionMagic = Opt.Reference
|
||||
protected implicit def optionMagicAdditions(name: String) = new Opt.Reference(programInfo, options, name)
|
||||
protected implicit def optionMagicAdditions(name: String): Opt.Reference = new Opt.Reference(programInfo, options, name)
|
||||
}
|
||||
|
||||
object Reference {
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.concurrent.{Callable, ExecutorService}
|
|||
import scala.concurrent.duration.Duration
|
||||
import scala.io.Codec
|
||||
import scala.jdk.CollectionConverters._
|
||||
import scala.language.implicitConversions
|
||||
import scala.tools.nsc.util.Exceptional
|
||||
|
||||
package object partest {
|
||||
|
@ -123,8 +124,6 @@ package object partest {
|
|||
implicit def temporaryPath2File(x: Path): File = x.jfile
|
||||
implicit def stringPathToJavaFile(path: String): File = new File(path)
|
||||
|
||||
implicit lazy val implicitConversions = scala.language.implicitConversions
|
||||
|
||||
def fileSeparator = java.io.File.separator
|
||||
def pathSeparator = java.io.File.pathSeparator
|
||||
|
||||
|
|
|
@ -1098,7 +1098,7 @@ trait Internals { self: Universe =>
|
|||
trait CompatApi {
|
||||
/** @see [[CompatToken]] */
|
||||
@deprecated("compatibility with Scala 2.10 EOL", "2.13.0")
|
||||
implicit val token = new CompatToken
|
||||
implicit val token: CompatToken = new CompatToken
|
||||
|
||||
/** Scala 2.10 compatibility enrichments for BuildApi. */
|
||||
@deprecated("compatibility with Scala 2.10 EOL", "2.13.0")
|
||||
|
|
|
@ -1464,15 +1464,13 @@ trait Trees extends api.Trees {
|
|||
override def removeAttachment[T: ClassTag]: this.type = attachmentWarning()
|
||||
private def attachmentWarning(): this.type = {devWarning(s"Attempt to mutate attachments on $self ignored"); this}
|
||||
|
||||
private def requireLegal(value: Any, allowed: Any, what: String) = (
|
||||
if (value != allowed) {
|
||||
private def requireLegal(value: Any, allowed: Any, what: String): Unit =
|
||||
if (value != allowed && this != pendingSuperCall) {
|
||||
log(s"can't set $what for $self to value other than $allowed")
|
||||
if (settings.isDebug && settings.isDeveloper)
|
||||
(new Throwable).printStackTrace
|
||||
new Throwable(s"can't set $what for $self to value other than $allowed").printStackTrace
|
||||
}
|
||||
)
|
||||
override def traverse(traverser: Traverser): Unit =
|
||||
()
|
||||
override def traverse(traverser: Traverser): Unit = ()
|
||||
}
|
||||
|
||||
case object EmptyTree extends TermTree with CannotHaveAttrs {
|
||||
|
|
|
@ -34,7 +34,7 @@ trait MemberHandlers {
|
|||
val front = if (leadingPlus) "+ " else ""
|
||||
front + (xs map string2codeQuoted mkString " + ")
|
||||
}
|
||||
private implicit def name2string(name: Name) = name.toString
|
||||
private implicit def name2string(name: Name): String = name.toString
|
||||
|
||||
/** A traverser that finds all mentioned identifiers, i.e. things
|
||||
* that need to be imported. It might return extra names.
|
||||
|
|
|
@ -264,7 +264,7 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re
|
|||
|
||||
trait Implicits1 {
|
||||
// fallback
|
||||
implicit def replPrinting[T](x: T)(implicit pretty: Prettifier[T] = Prettifier.default[T]) =
|
||||
implicit def replPrinting[T](x: T)(implicit pretty: Prettifier[T] = Prettifier.default[T]): PrettifierClass[T] =
|
||||
new SinglePrettifierClass[T](x)
|
||||
}
|
||||
trait Implicits2 extends Implicits1 {
|
||||
|
@ -288,7 +288,7 @@ class Power[ReplValsImpl <: ReplVals : ru.TypeTag: ClassTag](val intp: IMain, re
|
|||
implicit def replPrettifier[T] : Prettifier[T] = Prettifier.default[T]
|
||||
implicit def replTypeApplication(sym: Symbol): RichSymbol = new RichSymbol(sym)
|
||||
|
||||
implicit def replInputStream(in: InputStream)(implicit codec: Codec) = new RichInputStream(in)
|
||||
implicit def replInputStream(in: InputStream)(implicit codec: Codec): RichInputStream = new RichInputStream(in)
|
||||
implicit def replEnhancedURLs(url: URL)(implicit codec: Codec): RichReplURL = new RichReplURL(url)(codec)
|
||||
}
|
||||
|
||||
|
|
|
@ -47,13 +47,17 @@ class StdReplVals(final val intp: IMain) extends ReplVals {
|
|||
import intp.global.Symbol
|
||||
|
||||
private val tagFn = ReplVals.mkCompilerTypeFromTag[intp.global.type](global)
|
||||
implicit def mkCompilerTypeFromTag(sym: Symbol) = tagFn(sym)
|
||||
implicit def mkCompilerTypeFromTag(sym: Symbol): ATFT[global.type] = tagFn(sym)
|
||||
}
|
||||
|
||||
final lazy val replImplicits = new ReplImplicits
|
||||
|
||||
def typed[T <: analyzer.global.Tree](tree: T): T = typer.typed(tree).asInstanceOf[T]
|
||||
}
|
||||
trait ATFT[G <: Global] {
|
||||
def apply[M](implicit m1: ru.TypeTag[M]): G#Type
|
||||
def apply[M1, M2](implicit m1: ru.TypeTag[M1], m2: ru.TypeTag[M2]): G#Type
|
||||
}
|
||||
|
||||
object ReplVals {
|
||||
/** Latest attempt to work around the challenge of foo.global.Type
|
||||
|
@ -72,7 +76,7 @@ object ReplVals {
|
|||
def compilerTypeFromTag(t: ApiUniverse # WeakTypeTag[_]): Global#Type =
|
||||
definitions.compilerTypeFromTag(t)
|
||||
|
||||
class AppliedTypeFromTags(sym: Symbol) {
|
||||
class AppliedTypeFromTags(sym: Symbol) extends ATFT[T] {
|
||||
def apply[M](implicit m1: ru.TypeTag[M]): Type =
|
||||
if (sym eq NoSymbol) NoType
|
||||
else appliedType(sym, compilerTypeFromTag(m1).asInstanceOf[Type])
|
||||
|
|
|
@ -29,7 +29,7 @@ trait Uncompilable {
|
|||
import global.definitions.{ AnyRefClass, AnyRefTpe }
|
||||
import global.rootMirror.RootClass
|
||||
|
||||
private implicit def translateName(name: Global#Name) =
|
||||
private implicit def translateName(name: Global#Name): global.Name =
|
||||
if (name.isTypeName) newTypeName("" + name) else newTermName("" + name)
|
||||
|
||||
val WaitNames = List("scala", "AnyRef", "wait")
|
||||
|
|
|
@ -114,7 +114,7 @@ case class ScalaSig(majorVersion: Int, minorVersion: Int, table: Seq[Int ~ ByteC
|
|||
|
||||
def parseEntry(index: Int) = applyRule(ScalaSigParsers.parseEntry(ScalaSigEntryParsers.entry)(index))
|
||||
|
||||
implicit def applyRule[A](parser: ScalaSigParsers.Parser[A]) = ScalaSigParsers.expect(parser)(this)
|
||||
implicit def applyRule[A](parser: ScalaSigParsers.Parser[A]): A = ScalaSigParsers.expect(parser)(this)
|
||||
|
||||
override def toString = "ScalaSig version " + majorVersion + "." + minorVersion + {
|
||||
for (i <- 0 until table.size) yield "" + i + ":\t" + parseEntry(i) // + "\n\t" + getEntry(i)
|
||||
|
@ -165,7 +165,8 @@ object ScalaSigEntryParsers extends RulesWithState with MemoisableRules {
|
|||
|
||||
def parseEntry[A](parser: EntryParser[A])(index: Int) = (toEntry(index) -~ parser)
|
||||
|
||||
implicit def entryType(code: Int) = key filter (_ == code)
|
||||
type R = scala.tools.scalap.scalax.rules.Rule[ScalaSigEntryParsers.S, ScalaSigEntryParsers.S, Int, Nothing]
|
||||
implicit def entryType(code: Int): R = key.filter(_ == code)
|
||||
|
||||
val index = read(_.index)
|
||||
val key = read(_.entryType)
|
||||
|
|
Loading…
Reference in New Issue