From 75b627bb16cb9ae0e557f12b01c6fb08da1f412b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 10 Mar 2023 14:12:01 +0800 Subject: [PATCH 001/202] WIP: Add driver --- .gitignore | 3 + build.sbt | 30 +++ driver/js/src/main/scala/Driver.scala | 186 ++++++++++++++++++ driver/js/src/main/scala/DriverOptions.scala | 19 ++ driver/js/src/main/scala/Main.scala | 10 + driver/js/src/test/js/.temp/Simple.mlsi | 2 + driver/js/src/test/js/Simple.js | 19 ++ driver/js/src/test/mlscript/Simple.mls | 2 + .../src/main/scala/mlscript/JSBackend.scala | 63 ++++++ 9 files changed, 334 insertions(+) create mode 100644 driver/js/src/main/scala/Driver.scala create mode 100644 driver/js/src/main/scala/DriverOptions.scala create mode 100644 driver/js/src/main/scala/Main.scala create mode 100644 driver/js/src/test/js/.temp/Simple.mlsi create mode 100644 driver/js/src/test/js/Simple.js create mode 100644 driver/js/src/test/mlscript/Simple.mls diff --git a/.gitignore b/.gitignore index 1e05d21e3..959526e08 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,6 @@ metals.sbt project/Dependencies.scala project/metals.sbt **.worksheet.sc +.tsc.temp +mlsc.js +mlsc.js.map diff --git a/build.sbt b/build.sbt index 66cf66845..138177714 100644 --- a/build.sbt +++ b/build.sbt @@ -93,3 +93,33 @@ lazy val compiler = crossProject(JSPlatform, JVMPlatform).in(file("compiler")) lazy val compilerJVM = compiler.jvm lazy val compilerJS = compiler.js +lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) + .settings( + name := "mlscript-driver", + scalaVersion := "2.13.8", + scalacOptions ++= Seq( + "-deprecation" + ) + ) + .jvmSettings() + .jsSettings( + scalaJSUseMainModuleInitializer := true, + libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", + Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js" + ) + .dependsOn(mlscript % "compile->compile;test->test") + +lazy val driverJS = driver.js + +import complete.DefaultParsers._ +import scala.sys.process._ + +lazy val mlsc = inputKey[Unit]("mlsc") +mlsc := { + (driverJS / Compile / fastOptJS).value + val args: Seq[String] = spaceDelimited("").parsed + if (args.length > 0) + s"node bin/mlsc.js ${args.reduceLeft((r, s) => s"$r $s")}" ! + else "node bin/mlsc.js" ! +} diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala new file mode 100644 index 000000000..c83d58558 --- /dev/null +++ b/driver/js/src/main/scala/Driver.scala @@ -0,0 +1,186 @@ +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import js.JSConverters._ +import mlscript.utils._ +import mlscript._ +import mlscript.utils.shorthands._ +import scala.collection.mutable.{Map => MutMap} + +class Driver(options: DriverOptions) { + import Driver._ + + lazy val timeStampCache = + readFile(s"${options.outputDir}/.temp/.tsc.temp") match { + case Some(content) => content.split("\n").foldLeft(MutMap[String, String]())((mp, rc) => { + val data = rc.split(",") + if (data.length < 2) mp + else mp += (data(0) -> data(1)) + }) + case _ => MutMap[String, String]() + } + + def flush(): Unit = { + val res = timeStampCache.foldLeft("")((s, r) => s"$s${r._1},${r._2}\n") + writeFile(s"${options.outputDir}/.temp", ".tsc.temp", res) + } + + def execute: Unit = + try { + compile(options.filename) + } + catch { + case err: Diagnostic => + report(err) + } + + private def compile(filename: String): Unit = { + val mtime = getModificationTime(filename) + if (timeStampCache.getOrElse(filename, () => "") =/= mtime) { + readFile(filename) match { + case Some(content) => { + import fastparse._ + import fastparse.Parsed.{Success, Failure} + import mlscript.{NewLexer, NewParser, ErrorReport, Origin} + + val lines = content.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(content, lines) + val origin = Origin("", 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + + parser.parseAll(parser.typingUnit) match { + case tu => { + val beginIndex = filename.lastIndexOf("/") + 1 + val endIndex = filename.lastIndexOf(".") + val prefixName = filename.substring(beginIndex, endIndex) + typeCheck(tu, prefixName) + generate(Pgrm(tu.entities), prefixName) + } + } + } + case _ => report(s"can not open file $filename") + } + + timeStampCache += (filename -> mtime) + } + } + + private def typeCheck(tu: TypingUnit, filename: String): Unit = { + val typer = new mlscript.Typer( + dbg = false, + verbose = false, + explainErrors = false + ) { + newDefs = true + } + + import typer._ + + implicit val raise: Raise = throw _ + implicit var ctx: Ctx = Ctx.init + implicit val extrCtx: Opt[typer.ExtrCtx] = N + + val vars: Map[Str, typer.SimpleType] = Map.empty + val tpd = typer.typeTypingUnit(tu, allowPure = true)(ctx.nest, raise, vars) + val comp = tpd.force()(raise) + + object SimplifyPipeline extends typer.SimplifyPipeline { + def debugOutput(msg: => Str): Unit = + // if (mode.dbgSimplif) output(msg) + println(msg) + } + val sim = SimplifyPipeline(comp, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) + val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) + writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) + } + + private def generate(program: Pgrm, filename: String): Unit = { + val backend = new JSCompilerBackend() + val lines = backend(program) + val code = lines.mkString("\n") + writeFile(options.outputDir, s"$filename.js", code) + } +} + +object Driver { + def apply(options: DriverOptions) = new Driver(options) + + private val fs = g.require("fs") // must use fs module to manipulate files in JS + + private def readFile(filename: String) = + if (!fs.existsSync(filename)) None + else Some(fs.readFileSync(filename).toString) + + private def writeFile(dir: String, filename: String, content: String) = { + if (!fs.existsSync(dir)) fs.mkdirSync(dir, js.Dictionary("recursive" -> true)) + fs.writeFileSync(s"$dir/$filename", content) + } + + private def getModificationTime(filename: String): String = + if (!fs.existsSync(filename)) "" + else { + val state = fs.statSync(filename) + state.mtime.toString + } + + private def report(msg: String): Unit = + System.err.println(msg) + + private def report(diag: Diagnostic): Unit = { + val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") + val headStr = diag match { + case ErrorReport(msg, loco, src) => + src match { + case Diagnostic.Lexing => + s"╔══[LEXICAL ERROR] " + case Diagnostic.Parsing => + s"╔══[PARSE ERROR] " + case _ => // TODO customize too + s"╔══[ERROR] " + } + case WarningReport(msg, loco, src) => + s"╔══[WARNING] " + } + val lastMsgNum = diag.allMsgs.size - 1 + diag.allMsgs.zipWithIndex.foreach { case ((msg, loco), msgNum) => + val isLast = msgNum =:= lastMsgNum + val msgStr = msg.showIn(sctx) + if (msgNum =:= 0) report(headStr + msgStr) + else report(s"${if (isLast && loco.isEmpty) "╙──" else "╟──"} ${msgStr}") + if (loco.isEmpty && diag.allMsgs.size =:= 1) report("╙──") + loco.foreach { loc => + val (startLineNum, startLineStr, startLineCol) = + loc.origin.fph.getLineColAt(loc.spanStart) + val (endLineNum, endLineStr, endLineCol) = + loc.origin.fph.getLineColAt(loc.spanEnd) + var l = startLineNum + var c = startLineCol + while (l <= endLineNum) { + val globalLineNum = loc.origin.startLineNum + l - 1 + val shownLineNum = "l." + globalLineNum + val prepre = "║ " + val pre = s"$shownLineNum: " + val curLine = loc.origin.fph.lines(l - 1) + report(prepre + pre + "\t" + curLine) + val tickBuilder = new StringBuilder() + tickBuilder ++= ( + (if (isLast && l =:= endLineNum) "╙──" else prepre) + + " " * pre.length + "\t" + " " * (c - 1)) + val lastCol = if (l =:= endLineNum) endLineCol else curLine.length + 1 + while (c < lastCol) { tickBuilder += ('^'); c += 1 } + if (c =:= startLineCol) tickBuilder += ('^') + report(tickBuilder.toString) + c = 1 + l += 1 + } + } + } + if (diag.allMsgs.isEmpty) report("╙──") + () + } +} diff --git a/driver/js/src/main/scala/DriverOptions.scala b/driver/js/src/main/scala/DriverOptions.scala new file mode 100644 index 000000000..953b4b9d7 --- /dev/null +++ b/driver/js/src/main/scala/DriverOptions.scala @@ -0,0 +1,19 @@ +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import js.JSConverters._ + +final case class DriverOptions( + val filename: String, + val outputDir: String = "." +) // TODO: add more options + +object DriverOptions { + def parse: Option[DriverOptions] = { + val process = g.require("process") + val args = process.argv + if (args.length > 3) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString)) + else if (args.length > 2) Some(DriverOptions(args.selectDynamic("2").toString)) + else None + } +} diff --git a/driver/js/src/main/scala/Main.scala b/driver/js/src/main/scala/Main.scala new file mode 100644 index 000000000..3ecc1d35d --- /dev/null +++ b/driver/js/src/main/scala/Main.scala @@ -0,0 +1,10 @@ +object Main { + def main(args: Array[String]): Unit = DriverOptions.parse match { + case Some(options) => { + val driver = Driver(options) + driver.execute + driver.flush() + } + case _ => System.out.println("Usage: mlsc filename.mls [outputDir]") + } +} diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi new file mode 100644 index 000000000..f89d2b332 --- /dev/null +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -0,0 +1,2 @@ +class A(n: int) +let a: A diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js new file mode 100644 index 000000000..54fec1d4f --- /dev/null +++ b/driver/js/src/test/js/Simple.js @@ -0,0 +1,19 @@ +let typing_unit = { + cache: {}, + get A() { + if (this.cache.A === undefined) { + class A { + #n; + get n() { return this.#n; } + constructor(n) { + this.#n = n; + } + }; + this.cache.A = ((n) => new A(n)); + this.cache.A["class"] = A; + } + return this.cache.A; + } +}; +globalThis.A = typing_unit.A; +const a = A(42); \ No newline at end of file diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls new file mode 100644 index 000000000..e4d63a794 --- /dev/null +++ b/driver/js/src/test/mlscript/Simple.mls @@ -0,0 +1,2 @@ +class A(n: int) +let a = A(42) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 86168b33f..8f55afdad 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -849,6 +849,69 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } +class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { + private def generateNewDef(pgrm: Pgrm): Ls[Str] = { + val mlsModule = topLevelScope.declareValue("typing_unit", Some(false), false) + val (diags, (typeDefs, otherStmts)) = pgrm.newDesugared + + val (traitSymbols, classSymbols, mixinSymbols, moduleSymbols, superParameters) = declareNewTypeDefs(typeDefs) + def include(typeName: Str, moduleName: Str) = + JSExprStmt(JSAssignExpr(JSField(JSIdent("globalThis"), typeName), JSField(JSIdent(moduleName), typeName))) + val includes = + traitSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ + mixinSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ + moduleSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ + classSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)).toList + + val defs = + traitSymbols.map { translateTraitDeclaration(_)(topLevelScope) } ++ + mixinSymbols.map { translateMixinDeclaration(_)(topLevelScope) } ++ + moduleSymbols.map((m) => + translateModuleDeclaration(m, superParameters.get(m.runtimeName) match { + case Some(lst) => lst + case _ => Nil + })(topLevelScope) + ) ++ + classSymbols.map { sym => + superParameters.get(sym.runtimeName) match { + case Some(sp) => translateNewClassDeclaration(sym, sp)(topLevelScope) + case _ => translateNewClassDeclaration(sym)(topLevelScope) + } + }.toList + + val defStmts = + JSLetDecl(Ls(mlsModule.runtimeName -> S(JSRecord(Ls("cache" -> JSRecord(Ls())), defs)))) :: includes + + val stmts: Ls[JSStmt] = + defStmts + .concat(otherStmts.flatMap { + case Def(recursive, Var(name), L(body), isByname) => + val (originalExpr, sym) = if (recursive) { + val isByvalueRecIn = if (isByname) None else Some(true) + val sym = topLevelScope.declareValue(name, isByvalueRecIn, body.isInstanceOf[Lam]) + val translated = translateTerm(body)(topLevelScope) + topLevelScope.unregisterSymbol(sym) + val isByvalueRecOut = if (isByname) None else Some(false) + (translated, topLevelScope.declareValue(name, isByvalueRecOut, body.isInstanceOf[Lam])) + } else { + val translatedBody = translateTerm(body)(topLevelScope) + val isByvalueRec = if (isByname) None else Some(false) + (translatedBody, topLevelScope.declareValue(name, isByvalueRec, body.isInstanceOf[Lam])) + } + val translatedBody = if (sym.isByvalueRec.isEmpty && !sym.isLam) JSArrowFn(Nil, L(originalExpr)) else originalExpr + topLevelScope.tempVars `with` JSConstDecl(sym.runtimeName, translatedBody) :: Nil + // Ignore type declarations. + case Def(_, _, R(_), isByname) => Nil + // `exprs.push()`. + case term: Term => + translateTerm(term)(topLevelScope).stmt :: Nil + }) + SourceCode.fromStmts(polyfill.emit() ::: stmts).toLines + } + + def apply(pgrm: Pgrm): Ls[Str] = generateNewDef(pgrm) +} + class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { // Name of the array that contains execution results val resultsName: Str = topLevelScope declareRuntimeSymbol "results" From a6488213cfb7d15c697c267c4312c2f14c3310a8 Mon Sep 17 00:00:00 2001 From: Lionel Parreaux Date: Fri, 10 Mar 2023 21:25:03 +0800 Subject: [PATCH 002/202] Minor changes --- driver/js/src/main/scala/Driver.scala | 11 +++++++++-- driver/js/src/test/js/.temp/Simple.mlsi | 10 +++++++++- driver/js/src/test/js/Simple.js | 18 ++++++++++++++++-- driver/js/src/test/mlscript/Simple.mls | 10 +++++++++- 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index c83d58558..3e4ffda6c 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -28,10 +28,13 @@ class Driver(options: DriverOptions) { def execute: Unit = try { compile(options.filename) + if (Driver.totalErrors > 0) + js.Dynamic.global.process.exit(-1) } catch { case err: Diagnostic => report(err) + js.Dynamic.global.process.exit(-1) } private def compile(filename: String): Unit = { @@ -80,7 +83,7 @@ class Driver(options: DriverOptions) { import typer._ - implicit val raise: Raise = throw _ + implicit val raise: Raise = report implicit var ctx: Ctx = Ctx.init implicit val extrCtx: Opt[typer.ExtrCtx] = N @@ -102,7 +105,7 @@ class Driver(options: DriverOptions) { private def generate(program: Pgrm, filename: String): Unit = { val backend = new JSCompilerBackend() val lines = backend(program) - val code = lines.mkString("\n") + val code = lines.mkString("", "\n", "\n") writeFile(options.outputDir, s"$filename.js", code) } } @@ -131,6 +134,9 @@ object Driver { private def report(msg: String): Unit = System.err.println(msg) + private var totalErrors = 0 + + // TODO factor with duplicated logic in DiffTests private def report(diag: Diagnostic): Unit = { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") val headStr = diag match { @@ -141,6 +147,7 @@ object Driver { case Diagnostic.Parsing => s"╔══[PARSE ERROR] " case _ => // TODO customize too + totalErrors += 1 s"╔══[ERROR] " } case WarningReport(msg, loco, src) => diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index f89d2b332..ed5f07d4d 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,2 +1,10 @@ -class A(n: int) +mixin B() { + this: {n: 'n} + fun foo: 'n +} +class A(n: int) { + fun foo: int +} let a: A +let console: nothing +nothing diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index 54fec1d4f..d77010169 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,11 +1,23 @@ let typing_unit = { cache: {}, + B(base) { + return (class B extends base { + constructor(...rest) { + super(...rest); + } + get foo() { + const self = this; + return self.n; + } + }); + }, get A() { if (this.cache.A === undefined) { - class A { + class A extends B(Object) { #n; get n() { return this.#n; } constructor(n) { + super(); this.#n = n; } }; @@ -15,5 +27,7 @@ let typing_unit = { return this.cache.A; } }; +globalThis.B = typing_unit.B; globalThis.A = typing_unit.A; -const a = A(42); \ No newline at end of file +const a = A(42); +console.log(a.foo + 1); diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index e4d63a794..c05872725 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -1,2 +1,10 @@ -class A(n: int) + +mixin B { fun foo = this.n } + +class A(n: int) extends B let a = A(42) + +let console: nothing + +console.log(a.foo + 1) + From 1cc3c1440ec19ac439223d35d2a9c3e55e16038b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 16 Mar 2023 14:25:41 +0800 Subject: [PATCH 003/202] Remove timestamp file --- .gitignore | 1 - driver/js/src/main/scala/Driver.scala | 29 +++++++------------------- driver/js/src/main/scala/Main.scala | 6 +----- driver/js/src/test/mlscript/Simple.mls | 1 - 4 files changed, 8 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 959526e08..34fdf0efe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,5 @@ metals.sbt project/Dependencies.scala project/metals.sbt **.worksheet.sc -.tsc.temp mlsc.js mlsc.js.map diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 3e4ffda6c..4da89827a 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -10,21 +10,6 @@ import scala.collection.mutable.{Map => MutMap} class Driver(options: DriverOptions) { import Driver._ - lazy val timeStampCache = - readFile(s"${options.outputDir}/.temp/.tsc.temp") match { - case Some(content) => content.split("\n").foldLeft(MutMap[String, String]())((mp, rc) => { - val data = rc.split(",") - if (data.length < 2) mp - else mp += (data(0) -> data(1)) - }) - case _ => MutMap[String, String]() - } - - def flush(): Unit = { - val res = timeStampCache.foldLeft("")((s, r) => s"$s${r._1},${r._2}\n") - writeFile(s"${options.outputDir}/.temp", ".tsc.temp", res) - } - def execute: Unit = try { compile(options.filename) @@ -38,8 +23,13 @@ class Driver(options: DriverOptions) { } private def compile(filename: String): Unit = { + val beginIndex = filename.lastIndexOf("/") + 1 + val endIndex = filename.lastIndexOf(".") + val prefixName = filename.substring(beginIndex, endIndex) + val mtime = getModificationTime(filename) - if (timeStampCache.getOrElse(filename, () => "") =/= mtime) { + val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") + if (imtime.isEmpty || mtime.compareTo(imtime) >= 0) { readFile(filename) match { case Some(content) => { import fastparse._ @@ -57,9 +47,6 @@ class Driver(options: DriverOptions) { parser.parseAll(parser.typingUnit) match { case tu => { - val beginIndex = filename.lastIndexOf("/") + 1 - val endIndex = filename.lastIndexOf(".") - val prefixName = filename.substring(beginIndex, endIndex) typeCheck(tu, prefixName) generate(Pgrm(tu.entities), prefixName) } @@ -67,8 +54,6 @@ class Driver(options: DriverOptions) { } case _ => report(s"can not open file $filename") } - - timeStampCache += (filename -> mtime) } } @@ -128,7 +113,7 @@ object Driver { if (!fs.existsSync(filename)) "" else { val state = fs.statSync(filename) - state.mtime.toString + state.mtimeMs.toString } private def report(msg: String): Unit = diff --git a/driver/js/src/main/scala/Main.scala b/driver/js/src/main/scala/Main.scala index 3ecc1d35d..ede846d3b 100644 --- a/driver/js/src/main/scala/Main.scala +++ b/driver/js/src/main/scala/Main.scala @@ -1,10 +1,6 @@ object Main { def main(args: Array[String]): Unit = DriverOptions.parse match { - case Some(options) => { - val driver = Driver(options) - driver.execute - driver.flush() - } + case Some(options) => Driver(options).execute case _ => System.out.println("Usage: mlsc filename.mls [outputDir]") } } diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index c05872725..4b0e139af 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -7,4 +7,3 @@ let a = A(42) let console: nothing console.log(a.foo + 1) - From c301a8ef6c6ff421b363138c1f41b35a7b639d88 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 17 Mar 2023 10:58:34 +0800 Subject: [PATCH 004/202] Remove typing unit when using comiler --- driver/js/src/main/scala/Driver.scala | 2 +- driver/js/src/main/scala/DriverOptions.scala | 8 +- driver/js/src/test/js/.temp/Simple.mlsi | 2 +- driver/js/src/test/js/Simple.js | 61 +++++----- driver/js/src/test/mlscript/Simple.mls | 3 + .../src/main/scala/mlscript/JSBackend.scala | 111 +++++++++++------- 6 files changed, 111 insertions(+), 76 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 4da89827a..2477701bd 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -29,7 +29,7 @@ class Driver(options: DriverOptions) { val mtime = getModificationTime(filename) val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") - if (imtime.isEmpty || mtime.compareTo(imtime) >= 0) { + if (options.force || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { readFile(filename) match { case Some(content) => { import fastparse._ diff --git a/driver/js/src/main/scala/DriverOptions.scala b/driver/js/src/main/scala/DriverOptions.scala index 953b4b9d7..efbd6e647 100644 --- a/driver/js/src/main/scala/DriverOptions.scala +++ b/driver/js/src/main/scala/DriverOptions.scala @@ -5,14 +5,16 @@ import js.JSConverters._ final case class DriverOptions( val filename: String, - val outputDir: String = "." + val outputDir: String = ".", + val force: Boolean = false // force to recompile if it is true ) // TODO: add more options object DriverOptions { def parse: Option[DriverOptions] = { - val process = g.require("process") + val process = g.require("process") // TODO: better parse val args = process.argv - if (args.length > 3) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString)) + if (args.length > 4) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString, true)) + else if (args.length > 3) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString)) else if (args.length > 2) Some(DriverOptions(args.selectDynamic("2").toString)) else None } diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index ed5f07d4d..585b2eb33 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -7,4 +7,4 @@ class A(n: int) { } let a: A let console: nothing -nothing +module C() diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index d77010169..281504cc8 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,33 +1,36 @@ -let typing_unit = { - cache: {}, - B(base) { - return (class B extends base { - constructor(...rest) { - super(...rest); - } - get foo() { - const self = this; - return self.n; - } - }); - }, - get A() { - if (this.cache.A === undefined) { - class A extends B(Object) { - #n; - get n() { return this.#n; } - constructor(n) { - super(); - this.#n = n; - } - }; - this.cache.A = ((n) => new A(n)); - this.cache.A["class"] = A; +function B(base) { + return (class B extends base { + constructor(...rest) { + super(...rest); + } + get foo() { + const self = this; + return self.n; } - return this.cache.A; + }); +} +(() => { + if (globalThis.C === undefined) { + class C {} + globalThis.C = new C(); + globalThis.C["class"] = C; + } + return globalThis.C; +})(); +(() => { + if (globalThis.A === undefined) { + class A extends B(Object) { + #n; + get n() { return this.#n; } + constructor(n) { + super(); + this.#n = n; + } + }; + globalThis.A = ((n) => new A(n)); + globalThis.A["class"] = A; } -}; -globalThis.B = typing_unit.B; -globalThis.A = typing_unit.A; + return globalThis.A; +})(); const a = A(42); console.log(a.foo + 1); diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 4b0e139af..5d0cd77e8 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -7,3 +7,6 @@ let a = A(42) let console: nothing console.log(a.foo + 1) + +module C { +} diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 8f55afdad..7f0ff223a 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -442,8 +442,9 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } protected def translateMixinDeclaration( - mixinSymbol: MixinSymbol - )(implicit scope: Scope): JSClassMethod = { + mixinSymbol: MixinSymbol, + typingUnit: Boolean = true + )(implicit scope: Scope): JSStmt = { val getterScope = scope.derive(s"getter ${mixinSymbol.lexicalName}") val mixinScope = getterScope.derive(s"mixin ${mixinSymbol.lexicalName}") // Collect class fields. @@ -469,9 +470,13 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val classBody = JSClassNewDecl(mixinSymbol.runtimeName, fields, S(JSIdent(base.runtimeName)), Ls(JSIdent(s"...${rest.runtimeName}")), S(rest.runtimeName), members, traits) - JSClassMethod(mixinSymbol.lexicalName, Ls(JSNamePattern(base.runtimeName)), R(Ls( - JSReturnStmt(S(JSClassExpr(classBody))) - ))) + if (typingUnit) + JSClassMethod(mixinSymbol.lexicalName, Ls(JSNamePattern(base.runtimeName)), R(Ls( + JSReturnStmt(S(JSClassExpr(classBody))) + ))) + else + JSFuncDecl(mixinSymbol.lexicalName, Ls(JSNamePattern(base.runtimeName)), + Ls(JSReturnStmt(S(JSClassExpr(classBody))))) } private def translateParents(superFields: Ls[Term], constructorScope: Scope)(implicit scope: Scope): Opt[JSExpr] = { @@ -514,8 +519,9 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { protected def translateModuleDeclaration( moduleSymbol: ModuleSymbol, - superFields: Ls[Term] = Nil - )(implicit scope: Scope): JSClassGetter = { + superFields: Ls[Term] = Nil, + typingUnit: Boolean = true + )(implicit scope: Scope): JSStmt = { val getterScope = scope.derive(s"getter ${moduleSymbol.lexicalName}") val moduleScope = scope.derive(s"module ${moduleSymbol.lexicalName}") val constructorScope = moduleScope.derive(s"${moduleSymbol.lexicalName} constructor") @@ -550,22 +556,38 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { members, traits) - JSClassGetter(moduleSymbol.runtimeName, R(Ls( - JSIfStmt(JSBinary("===", JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), JSIdent("undefined")), Ls( - decl, - JSExprStmt(JSAssignExpr(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), - JSNew(JSInvoke(JSIdent(moduleSymbol.runtimeName), Nil)))), - JSExprStmt(JSAssignExpr(JSMember(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(moduleSymbol.runtimeName))), - )), - JSReturnStmt(S(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName))) - ))) + if (typingUnit) + JSClassGetter(moduleSymbol.runtimeName, R(Ls( + JSIfStmt(JSBinary("===", JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), JSIdent("undefined")), Ls( + decl, + JSExprStmt(JSAssignExpr(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), + JSNew(JSInvoke(JSIdent(moduleSymbol.runtimeName), Nil)))), + JSExprStmt(JSAssignExpr(JSMember(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(moduleSymbol.runtimeName))), + )), + JSReturnStmt(S(JSField(JSField(JSIdent("this"), "cache"), moduleSymbol.runtimeName))) + ))) + else + JSExprStmt( + JSImmEvalFn(N, Nil, R( + Ls( + JSIfStmt(JSBinary("===", JSField(JSIdent("globalThis"), moduleSymbol.runtimeName), JSIdent("undefined")), Ls( + decl, + JSExprStmt(JSAssignExpr(JSField(JSIdent("globalThis"), moduleSymbol.runtimeName), + JSNew(JSInvoke(JSIdent(moduleSymbol.runtimeName), Nil)))), + JSExprStmt(JSAssignExpr(JSMember(JSField(JSIdent("globalThis"), moduleSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(moduleSymbol.runtimeName))), + )), + JSReturnStmt(S(JSField(JSIdent("globalThis"), moduleSymbol.runtimeName))) + ) + ), Nil) + ) } protected def translateNewClassDeclaration( classSymbol: NewClassSymbol, superFields: Ls[Term] = Nil, - rest: Opt[Str] = N - )(implicit scope: Scope): JSClassGetter = { + rest: Opt[Str] = N, + typingUnit: Boolean = true + )(implicit scope: Scope): JSStmt = { val getterScope = scope.derive(s"${classSymbol.lexicalName} getter") val classBody = translateNewClassExpression(classSymbol, superFields, rest)(getterScope) val constructor = classBody match { @@ -575,15 +597,30 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { case JSClassNewDecl(_, fields, _, _, _, _, _) => fields.map(JSIdent(_)) } - JSClassGetter(classSymbol.runtimeName, R(Ls( - JSIfStmt(JSBinary("===", JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), JSIdent("undefined")), Ls( - JSExprStmt(JSClassExpr(classBody)), - JSExprStmt(JSAssignExpr(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), - JSArrowFn(constructor, L(JSInvoke(JSNew(JSIdent(classSymbol.runtimeName)), params))))), - JSExprStmt(JSAssignExpr(JSMember(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(classSymbol.runtimeName))) - )), - JSReturnStmt(S(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName))) - ))) + if (typingUnit) + JSClassGetter(classSymbol.runtimeName, R(Ls( + JSIfStmt(JSBinary("===", JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), JSIdent("undefined")), Ls( + JSExprStmt(JSClassExpr(classBody)), + JSExprStmt(JSAssignExpr(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), + JSArrowFn(constructor, L(JSInvoke(JSNew(JSIdent(classSymbol.runtimeName)), params))))), + JSExprStmt(JSAssignExpr(JSMember(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(classSymbol.runtimeName))) + )), + JSReturnStmt(S(JSField(JSField(JSIdent("this"), "cache"), classSymbol.runtimeName))) + ))) + else + JSExprStmt( + JSImmEvalFn(N, Nil, R( + Ls( + JSIfStmt(JSBinary("===", JSField(JSIdent("globalThis"), classSymbol.runtimeName), JSIdent("undefined")), Ls( + JSExprStmt(JSClassExpr(classBody)), + JSExprStmt(JSAssignExpr(JSField(JSIdent("globalThis"), classSymbol.runtimeName), + JSArrowFn(constructor, L(JSInvoke(JSNew(JSIdent(classSymbol.runtimeName)), params))))), + JSExprStmt(JSAssignExpr(JSMember(JSField(JSIdent("globalThis"), classSymbol.runtimeName), JSLit(JSLit.makeStringLiteral("class"))), JSIdent(classSymbol.runtimeName))) + )), + JSReturnStmt(S(JSField(JSIdent("globalThis"), classSymbol.runtimeName))) + ) + ), Nil) + ) } protected def translateNewClassExpression( @@ -855,35 +892,25 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { val (diags, (typeDefs, otherStmts)) = pgrm.newDesugared val (traitSymbols, classSymbols, mixinSymbols, moduleSymbols, superParameters) = declareNewTypeDefs(typeDefs) - def include(typeName: Str, moduleName: Str) = - JSExprStmt(JSAssignExpr(JSField(JSIdent("globalThis"), typeName), JSField(JSIdent(moduleName), typeName))) - val includes = - traitSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ - mixinSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ - moduleSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)) ++ - classSymbols.map((sym) => include(sym.runtimeName, mlsModule.runtimeName)).toList val defs = traitSymbols.map { translateTraitDeclaration(_)(topLevelScope) } ++ - mixinSymbols.map { translateMixinDeclaration(_)(topLevelScope) } ++ + mixinSymbols.map { translateMixinDeclaration(_, false)(topLevelScope) } ++ moduleSymbols.map((m) => translateModuleDeclaration(m, superParameters.get(m.runtimeName) match { case Some(lst) => lst case _ => Nil - })(topLevelScope) + }, false)(topLevelScope) ) ++ classSymbols.map { sym => superParameters.get(sym.runtimeName) match { - case Some(sp) => translateNewClassDeclaration(sym, sp)(topLevelScope) - case _ => translateNewClassDeclaration(sym)(topLevelScope) + case Some(sp) => translateNewClassDeclaration(sym, sp, N, false)(topLevelScope) + case _ => translateNewClassDeclaration(sym, Nil, N, false)(topLevelScope) } }.toList - val defStmts = - JSLetDecl(Ls(mlsModule.runtimeName -> S(JSRecord(Ls("cache" -> JSRecord(Ls())), defs)))) :: includes - val stmts: Ls[JSStmt] = - defStmts + defs .concat(otherStmts.flatMap { case Def(recursive, Var(name), L(body), isByname) => val (originalExpr, sym) = if (recursive) { From 4a5f7dbb3233c836b2eb68673db13ac4e4ee8592 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 17 Mar 2023 13:41:56 +0800 Subject: [PATCH 005/202] Add import and export --- driver/js/src/main/scala/Driver.scala | 86 ++++++++++++------- driver/js/src/test/js/.temp/Opened.mlsi | 4 + driver/js/src/test/js/Opened.js | 17 ++++ driver/js/src/test/js/Simple.js | 1 + driver/js/src/test/mlscript/Opened.mls | 5 ++ driver/js/src/test/mlscript/Simple.mls | 3 + .../src/main/scala/mlscript/JSBackend.scala | 14 ++- .../main/scala/mlscript/codegen/Codegen.scala | 10 +++ 8 files changed, 105 insertions(+), 35 deletions(-) create mode 100644 driver/js/src/test/js/.temp/Opened.mlsi create mode 100644 driver/js/src/test/js/Opened.js create mode 100644 driver/js/src/test/mlscript/Opened.mls diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 2477701bd..ab596c073 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -5,7 +5,8 @@ import js.JSConverters._ import mlscript.utils._ import mlscript._ import mlscript.utils.shorthands._ -import scala.collection.mutable.{Map => MutMap} +import scala.collection.mutable.{ListBuffer,Map => MutMap} +import mlscript.codegen._ class Driver(options: DriverOptions) { import Driver._ @@ -22,41 +23,58 @@ class Driver(options: DriverOptions) { js.Dynamic.global.process.exit(-1) } - private def compile(filename: String): Unit = { - val beginIndex = filename.lastIndexOf("/") + 1 + private def compile(filename: String): Boolean = { + val beginIndex = filename.lastIndexOf("/") val endIndex = filename.lastIndexOf(".") - val prefixName = filename.substring(beginIndex, endIndex) - - val mtime = getModificationTime(filename) - val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") - if (options.force || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { - readFile(filename) match { - case Some(content) => { - import fastparse._ - import fastparse.Parsed.{Success, Failure} - import mlscript.{NewLexer, NewParser, ErrorReport, Origin} - - val lines = content.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(content, lines) - val origin = Origin("", 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } - - parser.parseAll(parser.typingUnit) match { - case tu => { - typeCheck(tu, prefixName) - generate(Pgrm(tu.entities), prefixName) - } + val prefixName = filename.substring(beginIndex + 1, endIndex) + val path = filename.substring(0, beginIndex + 1) + + System.out.println(s"compiling $filename...") + readFile(filename) match { + case Some(content) => { + import fastparse._ + import fastparse.Parsed.{Success, Failure} + import mlscript.{NewLexer, NewParser, ErrorReport, Origin} + + val dependencies = ListBuffer[String]() + val lines = content.splitSane('\n').toIndexedSeq.filter((line) => + if (line.startsWith("open ")) { dependencies += line.substring(5); false } + else true + ) + + val depList = dependencies.toList + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls")) + val imports = depList.map(JSImport(_)) + // val moduleTypes = depList.map(dp => importModule(s"${options.outputDir}/.temp/$dp.mlsi")) + + val mtime = getModificationTime(filename) + val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") + if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { + val fph = new mlscript.FastParseHelpers(lines.reduceLeft((r, s) => s"$r\n$s"), lines) + val origin = Origin("", 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens + + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + parser.parseAll(parser.typingUnit) match { + case tu => { + typeCheck(tu, prefixName) + generate(Pgrm(tu.entities), prefixName, false, imports) + true } + } } - case _ => report(s"can not open file $filename") + else false } + case _ => report(s"can not open file $filename"); true } } + private def importModule(filename: String): Unit = { + } // TODO: + private def typeCheck(tu: TypingUnit, filename: String): Unit = { val typer = new mlscript.Typer( dbg = false, @@ -87,10 +105,14 @@ class Driver(options: DriverOptions) { writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) } - private def generate(program: Pgrm, filename: String): Unit = { + private def generate(program: Pgrm, filename: String, exported: Boolean, imports: Ls[JSImport]): Unit = { val backend = new JSCompilerBackend() - val lines = backend(program) - val code = lines.mkString("", "\n", "\n") + val lines = backend(program, exported) + val code = + if (imports.isEmpty) + lines.mkString("", "\n", "\n") + else + imports.map(_.toSourceCode).reduceLeft(_ + _).lines.map(_.toString).reduceLeft(_ + _) + lines.mkString("", "\n", "\n") writeFile(options.outputDir, s"$filename.js", code) } } diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi new file mode 100644 index 000000000..f431827be --- /dev/null +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -0,0 +1,4 @@ +let console: nothing +module SubModule() { + fun hello: (x: int,) -> nothing +} diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js new file mode 100644 index 000000000..20f2240d9 --- /dev/null +++ b/driver/js/src/test/js/Opened.js @@ -0,0 +1,17 @@ +(() => { + if (globalThis.SubModule === undefined) { + class SubModule { + constructor() { + } + hello(x) { + return (console.log([ + "hello!", + x + ])); + } + } + globalThis.SubModule = new SubModule(); + globalThis.SubModule["class"] = SubModule; + } + return globalThis.SubModule; +})(); diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index 281504cc8..711fffbe8 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,3 +1,4 @@ +import * as Opened from "./Opened.js" function B(base) { return (class B extends base { constructor(...rest) { diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/mlscript/Opened.mls new file mode 100644 index 000000000..946724be6 --- /dev/null +++ b/driver/js/src/test/mlscript/Opened.mls @@ -0,0 +1,5 @@ +let console: nothing + +module SubModule { + fun hello(x: int) = console.log(("hello!", x)) +} diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 5d0cd77e8..10d833ba8 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -1,3 +1,4 @@ +open Opened mixin B { fun foo = this.n } @@ -10,3 +11,5 @@ console.log(a.foo + 1) module C { } + +// Opened.SubModule.hello(a.n) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 7f0ff223a..9f55129ad 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -887,7 +887,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { - private def generateNewDef(pgrm: Pgrm): Ls[Str] = { + private def generateNewDef(pgrm: Pgrm, exported: Bool): Ls[Str] = { val mlsModule = topLevelScope.declareValue("typing_unit", Some(false), false) val (diags, (typeDefs, otherStmts)) = pgrm.newDesugared @@ -909,6 +909,14 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } }.toList + val exports = + if (exported) + JSExport(traitSymbols.map { _.runtimeName } ++ + mixinSymbols.map { _.runtimeName } ++ + moduleSymbols.map{_.runtimeName} ++ + classSymbols.map { _.runtimeName }.toList) :: Nil + else Nil + val stmts: Ls[JSStmt] = defs .concat(otherStmts.flatMap { @@ -932,11 +940,11 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { // `exprs.push()`. case term: Term => translateTerm(term)(topLevelScope).stmt :: Nil - }) + }) ::: exports SourceCode.fromStmts(polyfill.emit() ::: stmts).toLines } - def apply(pgrm: Pgrm): Ls[Str] = generateNewDef(pgrm) + def apply(pgrm: Pgrm, exported: Bool): Ls[Str] = generateNewDef(pgrm, exported) } class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index 37e216454..50353de43 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -889,6 +889,16 @@ final case class JSClassNewDecl( private val fieldsSet = collection.immutable.HashSet.from(fields) } +final case class JSExport(items: Ls[Str]) extends JSStmt { + def toSourceCode: SourceCode = + SourceCode(s"export {${items.reduceLeft((r, s) => r + ", " + s)}}") +} + +final case class JSImport(name: Str) extends JSStmt { + def toSourceCode: SourceCode = + SourceCode(s"import * as $name from \"./$name.js\"\n") // TODO: submodule? +} + final case class JSComment(text: Str) extends JSStmt { def toSourceCode: SourceCode = SourceCode(s"// $text") } From 16dcbc462fc93175332f5a02f4474cd6808540bd Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 17 Mar 2023 22:03:42 +0800 Subject: [PATCH 006/202] First version of driver --- driver/js/src/main/scala/Driver.scala | 54 ++++++++++++++----- driver/js/src/main/scala/Main.scala | 6 ++- driver/js/src/test/js/.temp/Opened.mlsi | 4 +- driver/js/src/test/js/.temp/Simple.mlsi | 9 +++- driver/js/src/test/js/Opened.js | 22 ++------ driver/js/src/test/js/Simple.js | 13 ++++- driver/js/src/test/js/package.json | 1 + driver/js/src/test/mlscript/Opened.mls | 5 +- driver/js/src/test/mlscript/Simple.mls | 5 +- .../src/main/scala/mlscript/JSBackend.scala | 32 ++++++----- shared/src/main/scala/mlscript/Typer.scala | 3 +- 11 files changed, 99 insertions(+), 55 deletions(-) create mode 100644 driver/js/src/test/js/package.json diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index ab596c073..ae681d2f5 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -21,9 +21,14 @@ class Driver(options: DriverOptions) { case err: Diagnostic => report(err) js.Dynamic.global.process.exit(-1) - } + } - private def compile(filename: String): Boolean = { + def genPackageJson(): Unit = { + val content = """{ "type": "module" }""" // TODO: more settings? + writeFile(options.outputDir, "package.json", content) + } + + private def compile(filename: String, exported: Boolean = false): Boolean = { val beginIndex = filename.lastIndexOf("/") val endIndex = filename.lastIndexOf(".") val prefixName = filename.substring(beginIndex + 1, endIndex) @@ -43,9 +48,8 @@ class Driver(options: DriverOptions) { ) val depList = dependencies.toList - val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls")) + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls", true)) val imports = depList.map(JSImport(_)) - // val moduleTypes = depList.map(dp => importModule(s"${options.outputDir}/.temp/$dp.mlsi")) val mtime = getModificationTime(filename) val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") @@ -60,8 +64,8 @@ class Driver(options: DriverOptions) { } parser.parseAll(parser.typingUnit) match { case tu => { - typeCheck(tu, prefixName) - generate(Pgrm(tu.entities), prefixName, false, imports) + typeCheck(tu, prefixName, depList) + generate(Pgrm(tu.entities), prefixName, exported, imports) true } } @@ -72,10 +76,7 @@ class Driver(options: DriverOptions) { } } - private def importModule(filename: String): Unit = { - } // TODO: - - private def typeCheck(tu: TypingUnit, filename: String): Unit = { + private def typeCheck(tu: TypingUnit, filename: String, depList: List[String]): Unit = { val typer = new mlscript.Typer( dbg = false, verbose = false, @@ -86,12 +87,41 @@ class Driver(options: DriverOptions) { import typer._ - implicit val raise: Raise = report + def importModule(moduleName: String, pgm: TypingUnit): TypingUnit = { + val filename = s"${options.outputDir}/.temp/$moduleName.mlsi" + readFile(filename) match { + case Some(content) => { + val wrapped = s"module $moduleName() {\n" + + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" + val lines = wrapped.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(wrapped, lines) + val origin = Origin("", 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens + + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + + parser.parseAll(parser.typingUnit) match { + case TypingUnit(entities1) => { + pgm match { + case TypingUnit(entities2) => TypingUnit(entities1 ::: entities2) + } + } + } + } + case _ => report(s"can not open file $filename"); pgm + } + } + + val packedTU = depList.foldRight(tu)((p, u) => importModule(p, u)) implicit var ctx: Ctx = Ctx.init + implicit val raise: Raise = report implicit val extrCtx: Opt[typer.ExtrCtx] = N val vars: Map[Str, typer.SimpleType] = Map.empty - val tpd = typer.typeTypingUnit(tu, allowPure = true)(ctx.nest, raise, vars) + val tpd = typer.typeTypingUnit(packedTU, allowPure = true)(ctx.nest, raise, vars) val comp = tpd.force()(raise) object SimplifyPipeline extends typer.SimplifyPipeline { diff --git a/driver/js/src/main/scala/Main.scala b/driver/js/src/main/scala/Main.scala index ede846d3b..5db57d096 100644 --- a/driver/js/src/main/scala/Main.scala +++ b/driver/js/src/main/scala/Main.scala @@ -1,6 +1,10 @@ object Main { def main(args: Array[String]): Unit = DriverOptions.parse match { - case Some(options) => Driver(options).execute + case Some(options) => { + val driver = Driver(options) + driver.execute + driver.genPackageJson() + } case _ => System.out.println("Usage: mlsc filename.mls [outputDir]") } } diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index f431827be..167f85d83 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1,4 +1,2 @@ let console: nothing -module SubModule() { - fun hello: (x: int,) -> nothing -} +fun hello: (x: int,) -> nothing diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index 585b2eb33..332ba9056 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,3 +1,7 @@ +module Opened() { + let console: nothing + fun hello: (x: int,) -> nothing +} mixin B() { this: {n: 'n} fun foo: 'n @@ -7,4 +11,7 @@ class A(n: int) { } let a: A let console: nothing -module C() +module C() { + let b: 1 +} +nothing diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index 20f2240d9..3e843e9a2 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -1,17 +1,5 @@ -(() => { - if (globalThis.SubModule === undefined) { - class SubModule { - constructor() { - } - hello(x) { - return (console.log([ - "hello!", - x - ])); - } - } - globalThis.SubModule = new SubModule(); - globalThis.SubModule["class"] = SubModule; - } - return globalThis.SubModule; -})(); +const hello = (x) => console.log([ + "hello!", + x +]); +export {hello} diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index 711fffbe8..2715fc85e 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -12,7 +12,13 @@ function B(base) { } (() => { if (globalThis.C === undefined) { - class C {} + class C { + constructor() { + } + get b() { + return 1; + } + } globalThis.C = new C(); globalThis.C["class"] = C; } @@ -33,5 +39,8 @@ function B(base) { } return globalThis.A; })(); +const C = globalThis.C; +const A = globalThis.A; const a = A(42); -console.log(a.foo + 1); +console.log(a.foo); +Opened.hello(a.n); diff --git a/driver/js/src/test/js/package.json b/driver/js/src/test/js/package.json new file mode 100644 index 000000000..bb34440a3 --- /dev/null +++ b/driver/js/src/test/js/package.json @@ -0,0 +1 @@ +{ "type": "module" } \ No newline at end of file diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/mlscript/Opened.mls index 946724be6..1caea1762 100644 --- a/driver/js/src/test/mlscript/Opened.mls +++ b/driver/js/src/test/mlscript/Opened.mls @@ -1,5 +1,2 @@ let console: nothing - -module SubModule { - fun hello(x: int) = console.log(("hello!", x)) -} +fun hello(x: int) = console.log(("hello!", x)) diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 10d833ba8..9b8932fe6 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -7,9 +7,10 @@ let a = A(42) let console: nothing -console.log(a.foo + 1) +console.log(a.foo) module C { + let b = 1 } -// Opened.SubModule.hello(a.n) +Opened.hello(a.n) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 9f55129ad..783a54b46 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -888,9 +888,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { private def generateNewDef(pgrm: Pgrm, exported: Bool): Ls[Str] = { - val mlsModule = topLevelScope.declareValue("typing_unit", Some(false), false) val (diags, (typeDefs, otherStmts)) = pgrm.newDesugared - val (traitSymbols, classSymbols, mixinSymbols, moduleSymbols, superParameters) = declareNewTypeDefs(typeDefs) val defs = @@ -909,18 +907,18 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } }.toList - val exports = - if (exported) - JSExport(traitSymbols.map { _.runtimeName } ++ - mixinSymbols.map { _.runtimeName } ++ - moduleSymbols.map{_.runtimeName} ++ - classSymbols.map { _.runtimeName }.toList) :: Nil - else Nil + def include(typeName: Str) = + JSConstDecl(typeName, JSField(JSIdent("globalThis"), typeName)) + val includes = + moduleSymbols.map((sym) => include(sym.runtimeName)) ++ + classSymbols.map((sym) => include(sym.runtimeName)).toList + val otherDecs = ListBuffer[Str]() val stmts: Ls[JSStmt] = - defs + defs ::: includes .concat(otherStmts.flatMap { case Def(recursive, Var(name), L(body), isByname) => + otherDecs += name val (originalExpr, sym) = if (recursive) { val isByvalueRecIn = if (isByname) None else Some(true) val sym = topLevelScope.declareValue(name, isByvalueRecIn, body.isInstanceOf[Lam]) @@ -940,8 +938,18 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { // `exprs.push()`. case term: Term => translateTerm(term)(topLevelScope).stmt :: Nil - }) ::: exports - SourceCode.fromStmts(polyfill.emit() ::: stmts).toLines + }) + + val exportedNuTypes = + if (exported) + JSExport(traitSymbols.map { _.runtimeName } ++ + mixinSymbols.map { _.runtimeName } ++ + moduleSymbols.map{_.runtimeName} ++ + classSymbols.map { _.runtimeName } ++ + otherDecs.toList) :: Nil + else Nil + + SourceCode.fromStmts(polyfill.emit() ::: stmts ::: exportedNuTypes).toLines } def apply(pgrm: Pgrm, exported: Bool): Ls[Str] = generateNewDef(pgrm, exported) diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 2b2c4ebd1..f0de826a0 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -66,12 +66,13 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) inPattern: Bool, tyDefs: Map[Str, TypeDef], // tyDefs2: MutMap[Str, NuTypeDef], - tyDefs2: MutMap[Str, LazyTypeInfo], + val tyDefs2: MutMap[Str, LazyTypeInfo], inRecursiveDef: Opt[Var], // TODO rm extrCtx: ExtrCtx, ) { def +=(b: Str -> TypeInfo): Unit = env += b def ++=(bs: IterableOnce[Str -> TypeInfo]): Unit = bs.iterator.foreach(+=) + def /=(dep: Str -> LazyTypeInfo): Unit = tyDefs2 += dep def get(name: Str): Opt[TypeInfo] = env.get(name) orElse parent.dlof(_.get(name))(N) def contains(name: Str): Bool = env.contains(name) || parent.exists(_.contains(name)) def addMth(parent: Opt[Str], nme: Str, ty: MethodType): Unit = mthEnv += R(parent, nme) -> ty From 14ee3ad38c6dcc3c289b54a90878f5872a1f7598 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 24 Mar 2023 10:41:24 +0800 Subject: [PATCH 007/202] WIP: Fix module parameter --- driver/js/src/test/js/Simple.js | 7 ++++--- shared/src/main/scala/mlscript/JSBackend.scala | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index 2715fc85e..023abaafa 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -13,10 +13,11 @@ function B(base) { (() => { if (globalThis.C === undefined) { class C { + #b; + get b() { return this.#b; } constructor() { - } - get b() { - return 1; + this.#b = 1; + const b = this.#b; } } globalThis.C = new C(); diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 588a0c44e..9fd7d1737 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -963,7 +963,7 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { val defs = traitSymbols.map { translateTraitDeclaration(_)(topLevelScope) } ++ mixinSymbols.map { translateMixinDeclaration(_, false)(topLevelScope) } ++ - moduleSymbols.map{ translateModuleDeclaration(_)(topLevelScope) } ++ + moduleSymbols.map{ translateModuleDeclaration(_, false)(topLevelScope) } ++ classSymbols.map { translateNewClassDeclaration(_, false)(topLevelScope) }.toList def include(typeName: Str) = From ff6e2949c515cf9dd67fce2fc6c8cc1ef8652076 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 24 Mar 2023 11:04:07 +0800 Subject: [PATCH 008/202] WIP: Add import parse --- driver/js/src/main/scala/Driver.scala | 5 +---- driver/js/src/test/mlscript/Simple.mls | 2 +- shared/src/main/scala/mlscript/NewLexer.scala | 1 + shared/src/main/scala/mlscript/NewParser.scala | 14 ++++++++++++++ shared/src/main/scala/mlscript/syntax.scala | 1 + 5 files changed, 18 insertions(+), 5 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index eb03cc2ce..06bee8a16 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -42,10 +42,7 @@ class Driver(options: DriverOptions) { import mlscript.{NewLexer, NewParser, ErrorReport, Origin} val dependencies = ListBuffer[String]() - val lines = content.splitSane('\n').toIndexedSeq.filter((line) => - if (line.startsWith("open ")) { dependencies += line.substring(5); false } - else true - ) + val lines = content.splitSane('\n').toIndexedSeq val depList = dependencies.toList val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls", true)) diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 9b8932fe6..8b67eb081 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -1,4 +1,4 @@ -open Opened +import "Opened.mls" mixin B { fun foo = this.n } diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 57c2f88b4..be0bf48a0 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -277,6 +277,7 @@ object NewLexer { "exists", "in", "out", + "import" ) def printToken(tl: TokLoc): Str = tl match { diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index cc1c150ab..04b20cc21 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -258,6 +258,20 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case (SPACE, _) :: _ => consume; block case c => val t = c match { + case (KEYWORD("import"), l0) :: c => + consume + val path = yeetSpaces match { + case (LITVAL(StrLit(path)), _) :: _ => + consume + path + case c => + val (tkstr, loc) = c.headOption.fold(("end of input", lastLoc))(_.mapFirst(_.describe).mapSecond(some)) + err(( + msg"Expected a module path; found ${tkstr} instead" -> loc :: Nil)) + "" + } + val res = Import(path) + R(res.withLoc(S(l0 ++ res.getLoc))) case (KEYWORD(k @ ("class" | "infce" | "trait" | "mixin" | "type" | "namespace" | "module")), l0) :: c => consume val kind = k match { diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index 1e91511d2..a555e975a 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -112,6 +112,7 @@ sealed trait Statement extends StatementImpl final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement final case class DataDefn(body: Term) extends Statement final case class DatatypeDefn(head: Term, body: Term) extends Statement +final case class Import(path: Str) extends Statement sealed trait DesugaredStatement extends Statement with DesugaredStatementImpl From 7b11950f39e5d328cf5e5d3eadbaf75010e8a14c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 24 Mar 2023 11:51:12 +0800 Subject: [PATCH 009/202] WIP: Add import translates --- driver/js/src/main/scala/Driver.scala | 17 +++++-------- .../src/main/scala/mlscript/JSBackend.scala | 14 +++++++---- .../src/main/scala/mlscript/NewParser.scala | 24 ++++++++++++------- shared/src/main/scala/mlscript/Typer.scala | 2 +- shared/src/main/scala/mlscript/helpers.scala | 2 ++ shared/src/main/scala/mlscript/syntax.scala | 2 +- 6 files changed, 36 insertions(+), 25 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 06bee8a16..7d5ad88c4 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -46,7 +46,6 @@ class Driver(options: DriverOptions) { val depList = dependencies.toList val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls", true)) - val imports = depList.map(JSImport(_)) val mtime = getModificationTime(filename) val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") @@ -62,7 +61,7 @@ class Driver(options: DriverOptions) { parser.parseAll(parser.typingUnit) match { case tu => { typeCheck(tu, prefixName, depList) - generate(Pgrm(tu.entities), prefixName, exported, imports) + generate(Pgrm(tu.entities), tu.depList, prefixName, exported) true } } @@ -101,9 +100,9 @@ class Driver(options: DriverOptions) { } parser.parseAll(parser.typingUnit) match { - case TypingUnit(entities1) => { + case TypingUnit(entities1, _) => { pgm match { - case TypingUnit(entities2) => TypingUnit(entities1 ::: entities2) + case TypingUnit(entities2, _) => TypingUnit(entities1 ::: entities2) } } } @@ -131,14 +130,10 @@ class Driver(options: DriverOptions) { writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) } - private def generate(program: Pgrm, filename: String, exported: Boolean, imports: Ls[JSImport]): Unit = { + private def generate(program: Pgrm, imports: Ls[Import], filename: String, exported: Boolean): Unit = { val backend = new JSCompilerBackend() - val lines = backend(program, exported) - val code = - if (imports.isEmpty) - lines.mkString("", "\n", "\n") - else - imports.map(_.toSourceCode).reduceLeft(_ + _).lines.map(_.toString).reduceLeft(_ + _) + lines.mkString("", "\n", "\n") + val lines = backend(program, imports, exported) + val code = lines.mkString("", "\n", "\n") writeFile(options.outputDir, s"$filename.js", code) } } diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 9fd7d1737..82f7a3022 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -267,11 +267,11 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { case Inst(bod) => translateTerm(bod) case iff: If => throw CodeGenError(s"if expression was not desugared") - case New(N, TypingUnit(Nil)) => JSRecord(Nil) - case New(S(TypeName(className) -> Tup(args)), TypingUnit(Nil)) => + case New(N, TypingUnit(Nil, _)) => JSRecord(Nil) + case New(S(TypeName(className) -> Tup(args)), TypingUnit(Nil, _)) => val callee = translateVar(className, true) callee(args.map { case (_, Fld(_, _, arg)) => translateTerm(arg) }: _*) - case New(_, TypingUnit(_)) => + case New(_, TypingUnit(_, _)) => throw CodeGenError("custom class body is not supported yet") case Forall(_, bod) => translateTerm(bod) case TyApp(base, _) => translateTerm(base) @@ -1011,7 +1011,13 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { SourceCode.fromStmts(polyfill.emit() ::: stmts ::: exportedNuTypes).toLines } - def apply(pgrm: Pgrm, exported: Bool): Ls[Str] = generateNewDef(pgrm, exported) + private def translateImport(imp: Import) = imp match { + case Import(path) => JSImport(path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."))) + } + + def apply(pgrm: Pgrm, imports: Ls[Import], exported: Bool): Ls[Str] = { + imports.flatMap(translateImport(_).toSourceCode.toLines) ::: generateNewDef(pgrm, exported) + } } class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 04b20cc21..dac6ba558 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -212,15 +212,23 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D final def typingUnit: TypingUnit = { val ts = block(false, false) - val es = ts.map { - case L(t) => - err(msg"Unexpected 'then'/'else' clause" -> t.toLoc :: Nil) - errExpr - case R(d: NuDecl) => d - case R(e: Term) => e - case _ => ??? + val (es, dp) = ts.partition{ + case R(imp: Import) => false + case _ => true + } match { + case (es, dp) => + (es.map { + case L(t) => + err(msg"Unexpected 'then'/'else' clause" -> t.toLoc :: Nil) + errExpr + case R(d: NuDecl) => d + case R(e: Term) => e + case _ => ??? + }, dp.map { + case R(imp: Import) => imp + }) } - TypingUnit(es) + TypingUnit(es, dp) } final def typingUnitMaybeIndented(implicit fe: FoundErr): TypingUnit = yeetSpaces match { case (br @ BRACKETS(Indent, toks), _) :: _ => diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 6c5f4916b..6aa1503c7 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -1054,7 +1054,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) } catch { case e: DesugaringException => err(e.messages) } - case New(S((nmedTy, trm)), TypingUnit(Nil)) => + case New(S((nmedTy, trm)), TypingUnit(Nil, _)) => typeMonomorphicTerm(App(Var(nmedTy.base.name).withLocOf(nmedTy), trm)) case New(base, args) => ??? case TyApp(_, _) => diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index f19182001..24102c9b9 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -947,6 +947,7 @@ trait StatementImpl extends Located { self: Statement => case Super() => Nil case NuTypeDef(k, nme, tps, ps, sig, pars, sup, ths, bod) => nme :: tps.map(_._2) ::: ps :: pars ::: ths.toList ::: bod :: Nil + case _: Import => Nil } @@ -957,6 +958,7 @@ trait StatementImpl extends Located { self: Statement => case _: Term => super.toString case d: Decl => d.showDbg case d: NuDecl => d.showDbg + case Import(path) => s"""import "$path"""" } } diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index a555e975a..55f40fb24 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -169,7 +169,7 @@ final case class PolyType(targs: Ls[TypeName \/ TypeVar], body: Type) extends Ty // New Definitions AST -final case class TypingUnit(entities: Ls[Statement]) extends TypingUnitImpl +final case class TypingUnit(entities: Ls[Statement], depList: Ls[Import] = Nil) extends TypingUnitImpl // final case class TypingUnit(entities: Ls[Statement]) extends TypeLike with PgrmOrTypingUnit with TypingUnitImpl final case class Signature(members: Ls[NuDecl], result: Opt[Type]) extends TypeLike with SignatureImpl From ea80f78c808763b26d86306bbeb0d74115ec2a1e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 24 Mar 2023 20:55:47 +0800 Subject: [PATCH 010/202] WIP: Store work --- driver/js/src/main/scala/Driver.scala | 71 ++++++++++++---------- driver/js/src/test/js/.temp/Opened.mlsi | 3 +- driver/js/src/test/js/.temp/Simple.mlsi | 7 +-- driver/js/src/test/js/Opened.js | 5 +- driver/js/src/test/js/Simple.js | 6 +- driver/js/src/test/mlscript/Opened.mls | 3 +- driver/js/src/test/mlscript/Simple.mls | 4 +- shared/src/main/scala/mlscript/Typer.scala | 3 +- 8 files changed, 54 insertions(+), 48 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 7d5ad88c4..6f7f810d2 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -41,32 +41,32 @@ class Driver(options: DriverOptions) { import fastparse.Parsed.{Success, Failure} import mlscript.{NewLexer, NewParser, ErrorReport, Origin} - val dependencies = ListBuffer[String]() val lines = content.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(content, lines) + val origin = Origin("", 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens - val depList = dependencies.toList - val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp.mls", true)) - - val mtime = getModificationTime(filename) - val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") - if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { - val fph = new mlscript.FastParseHelpers(lines.reduceLeft((r, s) => s"$r\n$s"), lines) - val origin = Origin("", 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + parser.parseAll(parser.typingUnit) match { + case tu => { + val depList = tu.depList.map { + case Import(path) => path + } + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp", true)) + val mtime = getModificationTime(filename) + val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } - parser.parseAll(parser.typingUnit) match { - case tu => { + if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { typeCheck(tu, prefixName, depList) generate(Pgrm(tu.entities), tu.depList, prefixName, exported) true } + else false } } - else false } case _ => report(s"can not open file $filename"); true } @@ -82,11 +82,16 @@ class Driver(options: DriverOptions) { } import typer._ + type ModuleType = DelayedTypeInfo + + var ctx: Ctx = Ctx.init + implicit val raise: Raise = report - def importModule(moduleName: String, pgm: TypingUnit): TypingUnit = { - val filename = s"${options.outputDir}/.temp/$moduleName.mlsi" + def importModule(modulePath: String): Unit = { + val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" readFile(filename) match { case Some(content) => { + val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) val wrapped = s"module $moduleName() {\n" + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" val lines = wrapped.splitSane('\n').toIndexedSeq @@ -100,32 +105,36 @@ class Driver(options: DriverOptions) { } parser.parseAll(parser.typingUnit) match { - case TypingUnit(entities1, _) => { - pgm match { - case TypingUnit(entities2, _) => TypingUnit(entities1 ::: entities2) + case tu: TypingUnit => { + val vars: Map[Str, typer.SimpleType] = Map.empty + val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx.nest, raise, vars) + object SimplifyPipeline extends typer.SimplifyPipeline { + def debugOutput(msg: => Str): Unit = + // if (mode.dbgSimplif) output(msg) + println(msg) } + val sim = SimplifyPipeline(tpd, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) } } } - case _ => report(s"can not open file $filename"); pgm + case _ => report(s"can not open file $filename") } } - val packedTU = depList.foldRight(tu)((p, u) => importModule(p, u)) - implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = report + depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + + implicit var nestedCtx: Ctx = ctx.nest implicit val extrCtx: Opt[typer.ExtrCtx] = N - val vars: Map[Str, typer.SimpleType] = Map.empty - val tpd = typer.typeTypingUnit(packedTU, topLevel = true)(ctx.nest, raise, vars) - + val tpd = typer.typeTypingUnit(tu, topLevel = true)(nestedCtx.nest, raise, vars) object SimplifyPipeline extends typer.SimplifyPipeline { def debugOutput(msg: => Str): Unit = // if (mode.dbgSimplif) output(msg) println(msg) } - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) + val sim = SimplifyPipeline(tpd, all = false)(nestedCtx) + val exp = typer.expandType(sim)(nestedCtx) val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) } diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index 167f85d83..36027486a 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1,2 +1 @@ -let console: nothing -fun hello: (x: int,) -> nothing +fun hello: (x: int,) -> unit diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index 332ba9056..58d5aa477 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,7 +1,3 @@ -module Opened() { - let console: nothing - fun hello: (x: int,) -> nothing -} mixin B() { this: {n: 'n} fun foo: 'n @@ -10,8 +6,7 @@ class A(n: int) { fun foo: int } let a: A -let console: nothing module C() { let b: 1 } -nothing +error diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index 3e843e9a2..a67a410b5 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -1,4 +1,7 @@ -const hello = (x) => console.log([ +function log(x) { + return console.info(x); +} +const hello = (x) => log([ "hello!", x ]); diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index 023abaafa..f6f5dc5a3 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,4 +1,8 @@ import * as Opened from "./Opened.js" + +function log(x) { + return console.info(x); +} function B(base) { return (class B extends base { constructor(...rest) { @@ -43,5 +47,5 @@ function B(base) { const C = globalThis.C; const A = globalThis.A; const a = A(42); -console.log(a.foo); +log(a.foo); Opened.hello(a.n); diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/mlscript/Opened.mls index 1caea1762..8c1b7c7e4 100644 --- a/driver/js/src/test/mlscript/Opened.mls +++ b/driver/js/src/test/mlscript/Opened.mls @@ -1,2 +1 @@ -let console: nothing -fun hello(x: int) = console.log(("hello!", x)) +fun hello(x: int) = log(("hello!", x)) diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 8b67eb081..7f3819ff0 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -5,9 +5,7 @@ mixin B { fun foo = this.n } class A(n: int) extends B let a = A(42) -let console: nothing - -console.log(a.foo) +log(a.foo) module C { let b = 1 diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 6aa1503c7..2f6e98934 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -67,13 +67,12 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) inPattern: Bool, tyDefs: Map[Str, TypeDef], // tyDefs2: MutMap[Str, NuTypeDef], - val tyDefs2: MutMap[Str, DelayedTypeInfo], + tyDefs2: MutMap[Str, DelayedTypeInfo], inRecursiveDef: Opt[Var], // TODO rm extrCtx: ExtrCtx, ) { def +=(b: Str -> TypeInfo): Unit = env += b def ++=(bs: IterableOnce[Str -> TypeInfo]): Unit = bs.iterator.foreach(+=) - def /=(dep: Str -> DelayedTypeInfo): Unit = tyDefs2 += dep def get(name: Str): Opt[TypeInfo] = env.get(name) orElse parent.dlof(_.get(name))(N) def contains(name: Str): Bool = env.contains(name) || parent.exists(_.contains(name)) def addMth(parent: Opt[Str], nme: Str, ty: MethodType): Unit = mthEnv += R(parent, nme) -> ty From 7a6ab8c561a57a570ccf6af7ca545b6ffdd6bc64 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 24 Mar 2023 21:48:02 +0800 Subject: [PATCH 011/202] WIP: Fix something... --- driver/js/src/main/scala/Driver.scala | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 6f7f810d2..53b98abaa 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -84,8 +84,9 @@ class Driver(options: DriverOptions) { import typer._ type ModuleType = DelayedTypeInfo - var ctx: Ctx = Ctx.init + implicit var ctx: Ctx = Ctx.init implicit val raise: Raise = report + implicit val extrCtx: Opt[typer.ExtrCtx] = N def importModule(modulePath: String): Unit = { val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" @@ -96,7 +97,7 @@ class Driver(options: DriverOptions) { content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" val lines = wrapped.splitSane('\n').toIndexedSeq val fph = new mlscript.FastParseHelpers(wrapped, lines) - val origin = Origin("", 1, fph) + val origin = Origin(modulePath, 1, fph) val lexer = new NewLexer(origin, throw _, dbg = false) val tokens = lexer.bracketedTokens @@ -109,9 +110,7 @@ class Driver(options: DriverOptions) { val vars: Map[Str, typer.SimpleType] = Map.empty val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx.nest, raise, vars) object SimplifyPipeline extends typer.SimplifyPipeline { - def debugOutput(msg: => Str): Unit = - // if (mode.dbgSimplif) output(msg) - println(msg) + def debugOutput(msg: => Str): Unit = println(msg) } val sim = SimplifyPipeline(tpd, all = false)(ctx) val exp = typer.expandType(sim)(ctx) @@ -123,18 +122,15 @@ class Driver(options: DriverOptions) { } depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) - - implicit var nestedCtx: Ctx = ctx.nest - implicit val extrCtx: Opt[typer.ExtrCtx] = N val vars: Map[Str, typer.SimpleType] = Map.empty - val tpd = typer.typeTypingUnit(tu, topLevel = true)(nestedCtx.nest, raise, vars) + val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx.nest, raise, vars) object SimplifyPipeline extends typer.SimplifyPipeline { def debugOutput(msg: => Str): Unit = // if (mode.dbgSimplif) output(msg) println(msg) } - val sim = SimplifyPipeline(tpd, all = false)(nestedCtx) - val exp = typer.expandType(sim)(nestedCtx) + val sim = SimplifyPipeline(tpd, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) } From 09c65f5e784ae8ca229312819b15dad6338f41f5 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 25 Mar 2023 14:10:36 +0800 Subject: [PATCH 012/202] Fix typing logic --- driver/js/src/main/scala/Driver.scala | 141 +++++++++++++----------- driver/js/src/test/js/.temp/Simple.mlsi | 2 +- 2 files changed, 76 insertions(+), 67 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 53b98abaa..cff69088d 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -11,8 +11,28 @@ import mlscript.codegen._ class Driver(options: DriverOptions) { import Driver._ + private val typer = + new mlscript.Typer( + dbg = false, + verbose = false, + explainErrors = false + ) { + newDefs = true + } + + import typer._ + + private object SimplifyPipeline extends typer.SimplifyPipeline { + def debugOutput(msg: => Str): Unit = + println(msg) + } + def execute: Unit = try { + implicit var ctx: Ctx = Ctx.init + implicit val raise: Raise = report + implicit val extrCtx: Opt[typer.ExtrCtx] = N + implicit val vars: Map[Str, typer.SimpleType] = Map.empty compile(options.filename) if (Driver.totalErrors > 0) js.Dynamic.global.process.exit(-1) @@ -28,7 +48,15 @@ class Driver(options: DriverOptions) { writeFile(options.outputDir, "package.json", content) } - private def compile(filename: String, exported: Boolean = false): Boolean = { + private def compile( + filename: String, + exported: Boolean = false + )( + implicit ctx: Ctx, + raise: Raise, + extrCtx: Opt[typer.ExtrCtx], + vars: Map[Str, typer.SimpleType] + ): Boolean = { val beginIndex = filename.lastIndexOf("/") val endIndex = filename.lastIndexOf(".") val prefixName = filename.substring(beginIndex + 1, endIndex) @@ -55,12 +83,56 @@ class Driver(options: DriverOptions) { val depList = tu.depList.map { case Import(path) => path } - val needRecomp = depList.foldLeft(false)((nr, dp) => nr || compile(s"$path$dp", true)) + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || { + // We need to create another new context when compiling other files + // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" + // If we forget to add `import "D.mls"` in C, we need to raise an error + // Keeping using the same environment would not. + var newCtx: Ctx = Ctx.init + val newExtrCtx: Opt[typer.ExtrCtx] = N + val newVars: Map[Str, typer.SimpleType] = Map.empty + compile(s"$path$dp", true)(newCtx, raise, newExtrCtx, newVars) + }) val mtime = getModificationTime(filename) val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { - typeCheck(tu, prefixName, depList) + def importModule(modulePath: String): Unit = { + val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" + readFile(filename) match { + case Some(content) => { + val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) + val wrapped = s"module $moduleName() {\n" + + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" + val lines = wrapped.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(wrapped, lines) + val origin = Origin(modulePath, 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens + + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + + parser.parseAll(parser.typingUnit) match { + case tu: TypingUnit => { + val tpd = typer.typeTypingUnit(tu, topLevel = true) + val sim = SimplifyPipeline(tpd, all = false) + val exp = typer.expandType(sim) + } + } + } + case _ => report(s"can not open file $filename") + } + } + + depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + val tpd = typer.typeTypingUnit(tu, topLevel = true) + val sim = SimplifyPipeline(tpd, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) + val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) + writeFile(s"${options.outputDir}/.temp", s"$prefixName.mlsi", expStr) + generate(Pgrm(tu.entities), tu.depList, prefixName, exported) true } @@ -72,69 +144,6 @@ class Driver(options: DriverOptions) { } } - private def typeCheck(tu: TypingUnit, filename: String, depList: List[String]): Unit = { - val typer = new mlscript.Typer( - dbg = false, - verbose = false, - explainErrors = false - ) { - newDefs = true - } - - import typer._ - type ModuleType = DelayedTypeInfo - - implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = report - implicit val extrCtx: Opt[typer.ExtrCtx] = N - - def importModule(modulePath: String): Unit = { - val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" - readFile(filename) match { - case Some(content) => { - val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) - val wrapped = s"module $moduleName() {\n" + - content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" - val lines = wrapped.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(wrapped, lines) - val origin = Origin(modulePath, 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens - - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } - - parser.parseAll(parser.typingUnit) match { - case tu: TypingUnit => { - val vars: Map[Str, typer.SimpleType] = Map.empty - val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx.nest, raise, vars) - object SimplifyPipeline extends typer.SimplifyPipeline { - def debugOutput(msg: => Str): Unit = println(msg) - } - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) - } - } - } - case _ => report(s"can not open file $filename") - } - } - - depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) - val vars: Map[Str, typer.SimpleType] = Map.empty - val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx.nest, raise, vars) - object SimplifyPipeline extends typer.SimplifyPipeline { - def debugOutput(msg: => Str): Unit = - // if (mode.dbgSimplif) output(msg) - println(msg) - } - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) - val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) - writeFile(s"${options.outputDir}/.temp", s"$filename.mlsi", expStr) - } - private def generate(program: Pgrm, imports: Ls[Import], filename: String, exported: Boolean): Unit = { val backend = new JSCompilerBackend() val lines = backend(program, imports, exported) diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index 58d5aa477..e3746012c 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -9,4 +9,4 @@ let a: A module C() { let b: 1 } -error +unit From 659f5a39e1943a71a1ad6c7cf83b8b80ea3e4fe0 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 25 Mar 2023 14:31:25 +0800 Subject: [PATCH 013/202] Wrap module before compiling and fix import path --- driver/js/src/main/scala/Driver.scala | 18 ++++++++------ driver/js/src/test/js/.temp/Opened.mlsi | 4 +++- driver/js/src/test/js/Opened.js | 24 +++++++++++++++---- driver/js/src/test/js/Simple.js | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 6 ++++- .../main/scala/mlscript/codegen/Codegen.scala | 4 ++-- 6 files changed, 41 insertions(+), 17 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index cff69088d..6611274d8 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -69,8 +69,15 @@ class Driver(options: DriverOptions) { import fastparse.Parsed.{Success, Failure} import mlscript.{NewLexer, NewParser, ErrorReport, Origin} - val lines = content.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(content, lines) + val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) + val wrapped = + if (!exported) content + else s"module $moduleName() {\n" + + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + + "\n}" + + val lines = wrapped.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(wrapped, lines) val origin = Origin("", 1, fph) val lexer = new NewLexer(origin, throw _, dbg = false) val tokens = lexer.bracketedTokens @@ -101,11 +108,8 @@ class Driver(options: DriverOptions) { val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" readFile(filename) match { case Some(content) => { - val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) - val wrapped = s"module $moduleName() {\n" + - content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" - val lines = wrapped.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(wrapped, lines) + val lines = content.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(content, lines) val origin = Origin(modulePath, 1, fph) val lexer = new NewLexer(origin, throw _, dbg = false) val tokens = lexer.bracketedTokens diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index 36027486a..8e2993d98 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1 +1,3 @@ -fun hello: (x: int,) -> unit +module Opened() { + fun hello: (x: int,) -> unit +} diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index a67a410b5..a8c069bdb 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -1,8 +1,22 @@ function log(x) { return console.info(x); } -const hello = (x) => log([ - "hello!", - x -]); -export {hello} +(() => { + if (globalThis.Opened === undefined) { + class Opened { + constructor() { + } + hello(x) { + return (log([ + "hello!", + x + ])); + } + } + globalThis.Opened = new Opened(); + globalThis.Opened["class"] = Opened; + } + return globalThis.Opened; +})(); +const Opened = globalThis.Opened; +export {Opened} diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index f6f5dc5a3..76855f322 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,4 +1,4 @@ -import * as Opened from "./Opened.js" +import { Opened } from "./Opened.js" function log(x) { return console.info(x); diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 82f7a3022..19d843f28 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1012,7 +1012,11 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } private def translateImport(imp: Import) = imp match { - case Import(path) => JSImport(path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf("."))) + case Import(path) => + JSImport( + path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")), + "./" + path.substring(0, path.lastIndexOf(".")) + ".js" + ) } def apply(pgrm: Pgrm, imports: Ls[Import], exported: Bool): Ls[Str] = { diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index be877f6ba..f600d5046 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -901,9 +901,9 @@ final case class JSExport(items: Ls[Str]) extends JSStmt { SourceCode(s"export {${items.reduceLeft((r, s) => r + ", " + s)}}") } -final case class JSImport(name: Str) extends JSStmt { +final case class JSImport(name: Str, path: Str) extends JSStmt { def toSourceCode: SourceCode = - SourceCode(s"import * as $name from \"./$name.js\"\n") // TODO: submodule? + SourceCode(s"import { $name } from \"$path\"\n") } final case class JSComment(text: Str) extends JSStmt { From 86e5315b9b17115d0c24c2b8eee616ff4eb44f80 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 25 Mar 2023 17:03:49 +0800 Subject: [PATCH 014/202] Fix subdirectory bugs and add options for ignoring definitions --- driver/js/src/main/scala/Driver.scala | 34 +++++++++++++++---- driver/js/src/main/scala/DriverOptions.scala | 16 +++++++-- driver/js/src/test/js/.temp/Opened.mlsi | 1 + driver/js/src/test/js/.temp/Simple.mlsi | 1 + driver/js/src/test/js/.temp/tools/Inc.mlsi | 3 ++ driver/js/src/test/js/Opened.js | 4 ++- driver/js/src/test/js/tools/Inc.js | 16 +++++++++ driver/js/src/test/mlscript/Opened.mls | 4 ++- driver/js/src/test/mlscript/tools/Inc.mls | 1 + .../src/main/scala/mlscript/NuTypeDefs.scala | 3 +- shared/src/main/scala/mlscript/Typer.scala | 1 + 11 files changed, 71 insertions(+), 13 deletions(-) create mode 100644 driver/js/src/test/js/.temp/tools/Inc.mlsi create mode 100644 driver/js/src/test/js/tools/Inc.js create mode 100644 driver/js/src/test/mlscript/tools/Inc.mls diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 6611274d8..22f74151b 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -18,6 +18,7 @@ class Driver(options: DriverOptions) { explainErrors = false ) { newDefs = true + noDefinitionCheck = true } import typer._ @@ -75,21 +76,28 @@ class Driver(options: DriverOptions) { else s"module $moduleName() {\n" + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" - val lines = wrapped.splitSane('\n').toIndexedSeq val fph = new mlscript.FastParseHelpers(wrapped, lines) - val origin = Origin("", 1, fph) + val origin = Origin(filename, 1, fph) val lexer = new NewLexer(origin, throw _, dbg = false) val tokens = lexer.bracketedTokens val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) } + parser.parseAll(parser.typingUnit) match { case tu => { - val depList = tu.depList.map { + def getAllImport(top: Ls[Import], tu: TypingUnit): Ls[Import] = + tu.entities.foldLeft(top)((res, ett) => ett match { + case nudef: NuTypeDef => res ::: nudef.body.depList + case _ => res + }) + val importsList = getAllImport(tu.depList, tu) + val depList = importsList.map { case Import(path) => path } + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || { // We need to create another new context when compiling other files // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" @@ -120,6 +128,10 @@ class Driver(options: DriverOptions) { parser.parseAll(parser.typingUnit) match { case tu: TypingUnit => { + val depList = tu.depList.map { + case Import(path) => path + } + depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) val tpd = typer.typeTypingUnit(tu, topLevel = true) val sim = SimplifyPipeline(tpd, all = false) val exp = typer.expandType(sim) @@ -135,9 +147,11 @@ class Driver(options: DriverOptions) { val sim = SimplifyPipeline(tpd, all = false)(ctx) val exp = typer.expandType(sim)(ctx) val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) - writeFile(s"${options.outputDir}/.temp", s"$prefixName.mlsi", expStr) + val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - generate(Pgrm(tu.entities), tu.depList, prefixName, exported) + val relatedPath = path.substring(options.path.length) + writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) + generate(Pgrm(tu.entities), importsList, prefixName, s"${options.outputDir}/$relatedPath", exported) true } else false @@ -148,11 +162,17 @@ class Driver(options: DriverOptions) { } } - private def generate(program: Pgrm, imports: Ls[Import], filename: String, exported: Boolean): Unit = { + private def generate( + program: Pgrm, + imports: Ls[Import], + filename: String, + outputDir: String, + exported: Boolean + ): Unit = { val backend = new JSCompilerBackend() val lines = backend(program, imports, exported) val code = lines.mkString("", "\n", "\n") - writeFile(options.outputDir, s"$filename.js", code) + writeFile(outputDir, s"$filename.js", code) } } diff --git a/driver/js/src/main/scala/DriverOptions.scala b/driver/js/src/main/scala/DriverOptions.scala index efbd6e647..3d6b5f1b4 100644 --- a/driver/js/src/main/scala/DriverOptions.scala +++ b/driver/js/src/main/scala/DriverOptions.scala @@ -5,6 +5,7 @@ import js.JSConverters._ final case class DriverOptions( val filename: String, + val path: String, val outputDir: String = ".", val force: Boolean = false // force to recompile if it is true ) // TODO: add more options @@ -13,9 +14,18 @@ object DriverOptions { def parse: Option[DriverOptions] = { val process = g.require("process") // TODO: better parse val args = process.argv - if (args.length > 4) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString, true)) - else if (args.length > 3) Some(DriverOptions(args.selectDynamic("2").toString, args.selectDynamic("3").toString)) - else if (args.length > 2) Some(DriverOptions(args.selectDynamic("2").toString)) + if (args.length > 4) { + val filename = args.selectDynamic("2").toString + Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1), args.selectDynamic("3").toString, true)) + } + else if (args.length > 3) { + val filename = args.selectDynamic("2").toString + Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1), args.selectDynamic("3").toString)) + } + else if (args.length > 2) { + val filename = args.selectDynamic("2").toString + Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1))) + } else None } } diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index 8e2993d98..49f2d036f 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1,3 +1,4 @@ +import "tools/Inc.mls" module Opened() { fun hello: (x: int,) -> unit } diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index e3746012c..9f68cdafb 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,3 +1,4 @@ +import "Opened.mls" mixin B() { this: {n: 'n} fun foo: 'n diff --git a/driver/js/src/test/js/.temp/tools/Inc.mlsi b/driver/js/src/test/js/.temp/tools/Inc.mlsi new file mode 100644 index 000000000..04eec6e93 --- /dev/null +++ b/driver/js/src/test/js/.temp/tools/Inc.mlsi @@ -0,0 +1,3 @@ +module Inc() { + fun inc: (x: int,) -> int +} diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index a8c069bdb..fd2441621 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -1,3 +1,5 @@ +import { Inc } from "./tools/Inc.js" + function log(x) { return console.info(x); } @@ -9,7 +11,7 @@ function log(x) { hello(x) { return (log([ "hello!", - x + Inc.inc(x) ])); } } diff --git a/driver/js/src/test/js/tools/Inc.js b/driver/js/src/test/js/tools/Inc.js new file mode 100644 index 000000000..9b30c8163 --- /dev/null +++ b/driver/js/src/test/js/tools/Inc.js @@ -0,0 +1,16 @@ +(() => { + if (globalThis.Inc === undefined) { + class Inc { + constructor() { + } + inc(x) { + return x + 1; + } + } + globalThis.Inc = new Inc(); + globalThis.Inc["class"] = Inc; + } + return globalThis.Inc; +})(); +const Inc = globalThis.Inc; +export {Inc} diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/mlscript/Opened.mls index 8c1b7c7e4..d43018470 100644 --- a/driver/js/src/test/mlscript/Opened.mls +++ b/driver/js/src/test/mlscript/Opened.mls @@ -1 +1,3 @@ -fun hello(x: int) = log(("hello!", x)) +import "tools/Inc.mls" + +fun hello(x: int) = log(("hello!", Inc.inc(x))) diff --git a/driver/js/src/test/mlscript/tools/Inc.mls b/driver/js/src/test/mlscript/tools/Inc.mls new file mode 100644 index 000000000..4fa6f734b --- /dev/null +++ b/driver/js/src/test/mlscript/tools/Inc.mls @@ -0,0 +1 @@ +fun inc(x: int) = x + 1 diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index a6257dc74..8db19898c 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -805,8 +805,9 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => constrain(memSign, sign) case S(mem: NuParam) => case S(_) => ??? // TODO - case N => + case N if (!self.noDefinitionCheck) => err(msg"Member ${fd.nme.name} is declared but not defined", fd.nme.toLoc) + case _ => () } } } diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 2f6e98934..56f0a07b5 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -34,6 +34,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) var constrainedTypes: Boolean = false var newDefs: Bool = false + var noDefinitionCheck: Bool = false var recordProvenances: Boolean = true From b77a362df93c9775a6f7b719a1781efea5a70dc3 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 27 Mar 2023 08:07:40 +0800 Subject: [PATCH 015/202] Add cycle dependence check --- driver/js/src/main/scala/Driver.scala | 136 +++++++++++++----------- driver/js/src/test/js/.temp/Cycle1.mlsi | 4 + driver/js/src/test/js/.temp/Cycle2.mlsi | 3 + driver/js/src/test/js/.temp/Self.mlsi | 2 + driver/js/src/test/js/Cycle1.js | 18 ++++ driver/js/src/test/js/Cycle2.js | 18 ++++ driver/js/src/test/js/Self.js | 11 ++ driver/js/src/test/mlscript/Cycle1.mls | 3 + driver/js/src/test/mlscript/Cycle2.mls | 5 + driver/js/src/test/mlscript/Self.mls | 3 + 10 files changed, 138 insertions(+), 65 deletions(-) create mode 100644 driver/js/src/test/js/.temp/Cycle1.mlsi create mode 100644 driver/js/src/test/js/.temp/Cycle2.mlsi create mode 100644 driver/js/src/test/js/.temp/Self.mlsi create mode 100644 driver/js/src/test/js/Cycle1.js create mode 100644 driver/js/src/test/js/Cycle2.js create mode 100644 driver/js/src/test/js/Self.js create mode 100644 driver/js/src/test/mlscript/Cycle1.mls create mode 100644 driver/js/src/test/mlscript/Cycle2.mls create mode 100644 driver/js/src/test/mlscript/Self.mls diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 22f74151b..d62cbd01c 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -34,6 +34,7 @@ class Driver(options: DriverOptions) { implicit val raise: Raise = report implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty + implicit val stack = List[String]() compile(options.filename) if (Driver.totalErrors > 0) js.Dynamic.global.process.exit(-1) @@ -56,63 +57,68 @@ class Driver(options: DriverOptions) { implicit ctx: Ctx, raise: Raise, extrCtx: Opt[typer.ExtrCtx], - vars: Map[Str, typer.SimpleType] - ): Boolean = { - val beginIndex = filename.lastIndexOf("/") - val endIndex = filename.lastIndexOf(".") - val prefixName = filename.substring(beginIndex + 1, endIndex) - val path = filename.substring(0, beginIndex + 1) + vars: Map[Str, typer.SimpleType], + stack: List[String] + ): Boolean = + if (stack.contains(filename)) { + report(s"cycle dependence on $filename"); true + } + else { + val beginIndex = filename.lastIndexOf("/") + val endIndex = filename.lastIndexOf(".") + val prefixName = filename.substring(beginIndex + 1, endIndex) + val path = filename.substring(0, beginIndex + 1) - System.out.println(s"compiling $filename...") - readFile(filename) match { - case Some(content) => { - import fastparse._ - import fastparse.Parsed.{Success, Failure} - import mlscript.{NewLexer, NewParser, ErrorReport, Origin} + System.out.println(s"compiling $filename...") + readFile(filename) match { + case Some(content) => { + import fastparse._ + import fastparse.Parsed.{Success, Failure} + import mlscript.{NewLexer, NewParser, ErrorReport, Origin} - val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) - val wrapped = - if (!exported) content - else s"module $moduleName() {\n" + - content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + - "\n}" - val lines = wrapped.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(wrapped, lines) - val origin = Origin(filename, 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens + val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) + val wrapped = + if (!exported) content + else s"module $moduleName() {\n" + + content.splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + + "\n}" + val lines = wrapped.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(wrapped, lines) + val origin = Origin(filename, 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } - parser.parseAll(parser.typingUnit) match { - case tu => { - def getAllImport(top: Ls[Import], tu: TypingUnit): Ls[Import] = - tu.entities.foldLeft(top)((res, ett) => ett match { - case nudef: NuTypeDef => res ::: nudef.body.depList - case _ => res - }) - val importsList = getAllImport(tu.depList, tu) - val depList = importsList.map { - case Import(path) => path - } + parser.parseAll(parser.typingUnit) match { + case tu => { + def getAllImport(top: Ls[Import], tu: TypingUnit): Ls[Import] = + tu.entities.foldLeft(top)((res, ett) => ett match { + case nudef: NuTypeDef => res ::: nudef.body.depList + case _ => res + }) + val importsList = getAllImport(tu.depList, tu) + val depList = importsList.map { + case Import(path) => path + } - val needRecomp = depList.foldLeft(false)((nr, dp) => nr || { - // We need to create another new context when compiling other files - // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" - // If we forget to add `import "D.mls"` in C, we need to raise an error - // Keeping using the same environment would not. - var newCtx: Ctx = Ctx.init - val newExtrCtx: Opt[typer.ExtrCtx] = N - val newVars: Map[Str, typer.SimpleType] = Map.empty - compile(s"$path$dp", true)(newCtx, raise, newExtrCtx, newVars) - }) - val mtime = getModificationTime(filename) - val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") + val needRecomp = depList.foldLeft(false)((nr, dp) => nr || { + // We need to create another new context when compiling other files + // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" + // If we forget to add `import "D.mls"` in C, we need to raise an error + // Keeping using the same environment would not. + var newCtx: Ctx = Ctx.init + val newExtrCtx: Opt[typer.ExtrCtx] = N + val newVars: Map[Str, typer.SimpleType] = Map.empty + compile(s"$path$dp", true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) + }) + val mtime = getModificationTime(filename) + val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") - if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { - def importModule(modulePath: String): Unit = { + if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { + def importModule(modulePath: String): Unit = { val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" readFile(filename) match { case Some(content) => { @@ -140,27 +146,27 @@ class Driver(options: DriverOptions) { } case _ => report(s"can not open file $filename") } - } + } - depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) - val tpd = typer.typeTypingUnit(tu, topLevel = true) - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) - val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) - val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + val tpd = typer.typeTypingUnit(tu, topLevel = true) + val sim = SimplifyPipeline(tpd, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) + val expStr = exp.showIn(ShowCtx.mk(exp :: Nil), 0) + val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - val relatedPath = path.substring(options.path.length) - writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) - generate(Pgrm(tu.entities), importsList, prefixName, s"${options.outputDir}/$relatedPath", exported) - true + val relatedPath = path.substring(options.path.length) + writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) + generate(Pgrm(tu.entities), importsList, prefixName, s"${options.outputDir}/$relatedPath", exported) + true + } + else false } - else false } } + case _ => report(s"can not open file $filename"); true } - case _ => report(s"can not open file $filename"); true } - } private def generate( program: Pgrm, diff --git a/driver/js/src/test/js/.temp/Cycle1.mlsi b/driver/js/src/test/js/.temp/Cycle1.mlsi new file mode 100644 index 000000000..f06df5e1c --- /dev/null +++ b/driver/js/src/test/js/.temp/Cycle1.mlsi @@ -0,0 +1,4 @@ +import "Cycle2.mls" +module Cycle1() { + fun f: (x: int,) -> error +} diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/js/.temp/Cycle2.mlsi new file mode 100644 index 000000000..b094a4ac4 --- /dev/null +++ b/driver/js/src/test/js/.temp/Cycle2.mlsi @@ -0,0 +1,3 @@ +import "Cycle1.mls" +class A(x: int) +let a: error diff --git a/driver/js/src/test/js/.temp/Self.mlsi b/driver/js/src/test/js/.temp/Self.mlsi new file mode 100644 index 000000000..d23b39e57 --- /dev/null +++ b/driver/js/src/test/js/.temp/Self.mlsi @@ -0,0 +1,2 @@ +import "Self.mls" +class Foo() diff --git a/driver/js/src/test/js/Cycle1.js b/driver/js/src/test/js/Cycle1.js new file mode 100644 index 000000000..c8615b732 --- /dev/null +++ b/driver/js/src/test/js/Cycle1.js @@ -0,0 +1,18 @@ +import { Cycle2 } from "./Cycle2.js" + +(() => { + if (globalThis.Cycle1 === undefined) { + class Cycle1 { + constructor() { + } + f(x) { + return Cycle2.A(x + 1); + } + } + globalThis.Cycle1 = new Cycle1(); + globalThis.Cycle1["class"] = Cycle1; + } + return globalThis.Cycle1; +})(); +const Cycle1 = globalThis.Cycle1; +export {Cycle1} diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/js/Cycle2.js new file mode 100644 index 000000000..252f87437 --- /dev/null +++ b/driver/js/src/test/js/Cycle2.js @@ -0,0 +1,18 @@ +import { Cycle1 } from "./Cycle1.js" + +(() => { + if (globalThis.A === undefined) { + class A { + #x; + get x() { return this.#x; } + constructor(x) { + this.#x = x; + } + }; + globalThis.A = ((x) => new A(x)); + globalThis.A["class"] = A; + } + return globalThis.A; +})(); +const A = globalThis.A; +const a = Cycle1.f(42); diff --git a/driver/js/src/test/js/Self.js b/driver/js/src/test/js/Self.js new file mode 100644 index 000000000..72c75f9f8 --- /dev/null +++ b/driver/js/src/test/js/Self.js @@ -0,0 +1,11 @@ +import { Self } from "./Self.js" + +(() => { + if (globalThis.Foo === undefined) { + class Foo {}; + globalThis.Foo = (() => new Foo()); + globalThis.Foo["class"] = Foo; + } + return globalThis.Foo; +})(); +const Foo = globalThis.Foo; diff --git a/driver/js/src/test/mlscript/Cycle1.mls b/driver/js/src/test/mlscript/Cycle1.mls new file mode 100644 index 000000000..9b2379d6f --- /dev/null +++ b/driver/js/src/test/mlscript/Cycle1.mls @@ -0,0 +1,3 @@ +import "Cycle2.mls" + +fun f(x: int) = Cycle2.A(x + 1) diff --git a/driver/js/src/test/mlscript/Cycle2.mls b/driver/js/src/test/mlscript/Cycle2.mls new file mode 100644 index 000000000..8646f348e --- /dev/null +++ b/driver/js/src/test/mlscript/Cycle2.mls @@ -0,0 +1,5 @@ +import "Cycle1.mls" + +class A(x: int) {} + +let a = Cycle1.f(42) diff --git a/driver/js/src/test/mlscript/Self.mls b/driver/js/src/test/mlscript/Self.mls new file mode 100644 index 000000000..4887945a8 --- /dev/null +++ b/driver/js/src/test/mlscript/Self.mls @@ -0,0 +1,3 @@ +import "Self.mls" + +class Foo() {} From e88fa9c38cd4cb13d2533d95f92b51f7635c5729 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 27 Mar 2023 09:16:23 +0800 Subject: [PATCH 016/202] Fix error report --- driver/js/src/main/scala/Driver.scala | 16 ++++++++++------ driver/js/src/test/js/.temp/Cycle1.mlsi | 4 ---- driver/js/src/test/js/.temp/Cycle2.mlsi | 3 --- driver/js/src/test/js/.temp/Self.mlsi | 2 -- driver/js/src/test/js/Cycle1.js | 18 ------------------ driver/js/src/test/js/Cycle2.js | 18 ------------------ driver/js/src/test/js/Self.js | 11 ----------- 7 files changed, 10 insertions(+), 62 deletions(-) delete mode 100644 driver/js/src/test/js/.temp/Cycle1.mlsi delete mode 100644 driver/js/src/test/js/.temp/Cycle2.mlsi delete mode 100644 driver/js/src/test/js/.temp/Self.mlsi delete mode 100644 driver/js/src/test/js/Cycle1.js delete mode 100644 driver/js/src/test/js/Cycle2.js delete mode 100644 driver/js/src/test/js/Self.js diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index d62cbd01c..52a431852 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -7,6 +7,7 @@ import mlscript._ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap} import mlscript.codegen._ +import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} class Driver(options: DriverOptions) { import Driver._ @@ -60,9 +61,9 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = - if (stack.contains(filename)) { - report(s"cycle dependence on $filename"); true - } + if (stack.contains(filename)) + throw + ErrorReport(Ls((s"cycle dependence on $filename", None)), Diagnostic.Compilation) else { val beginIndex = filename.lastIndexOf("/") val endIndex = filename.lastIndexOf(".") @@ -74,7 +75,6 @@ class Driver(options: DriverOptions) { case Some(content) => { import fastparse._ import fastparse.Parsed.{Success, Failure} - import mlscript.{NewLexer, NewParser, ErrorReport, Origin} val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) val wrapped = @@ -144,7 +144,9 @@ class Driver(options: DriverOptions) { } } } - case _ => report(s"can not open file $filename") + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } } @@ -164,7 +166,9 @@ class Driver(options: DriverOptions) { } } } - case _ => report(s"can not open file $filename"); true + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } } diff --git a/driver/js/src/test/js/.temp/Cycle1.mlsi b/driver/js/src/test/js/.temp/Cycle1.mlsi deleted file mode 100644 index f06df5e1c..000000000 --- a/driver/js/src/test/js/.temp/Cycle1.mlsi +++ /dev/null @@ -1,4 +0,0 @@ -import "Cycle2.mls" -module Cycle1() { - fun f: (x: int,) -> error -} diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/js/.temp/Cycle2.mlsi deleted file mode 100644 index b094a4ac4..000000000 --- a/driver/js/src/test/js/.temp/Cycle2.mlsi +++ /dev/null @@ -1,3 +0,0 @@ -import "Cycle1.mls" -class A(x: int) -let a: error diff --git a/driver/js/src/test/js/.temp/Self.mlsi b/driver/js/src/test/js/.temp/Self.mlsi deleted file mode 100644 index d23b39e57..000000000 --- a/driver/js/src/test/js/.temp/Self.mlsi +++ /dev/null @@ -1,2 +0,0 @@ -import "Self.mls" -class Foo() diff --git a/driver/js/src/test/js/Cycle1.js b/driver/js/src/test/js/Cycle1.js deleted file mode 100644 index c8615b732..000000000 --- a/driver/js/src/test/js/Cycle1.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Cycle2 } from "./Cycle2.js" - -(() => { - if (globalThis.Cycle1 === undefined) { - class Cycle1 { - constructor() { - } - f(x) { - return Cycle2.A(x + 1); - } - } - globalThis.Cycle1 = new Cycle1(); - globalThis.Cycle1["class"] = Cycle1; - } - return globalThis.Cycle1; -})(); -const Cycle1 = globalThis.Cycle1; -export {Cycle1} diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/js/Cycle2.js deleted file mode 100644 index 252f87437..000000000 --- a/driver/js/src/test/js/Cycle2.js +++ /dev/null @@ -1,18 +0,0 @@ -import { Cycle1 } from "./Cycle1.js" - -(() => { - if (globalThis.A === undefined) { - class A { - #x; - get x() { return this.#x; } - constructor(x) { - this.#x = x; - } - }; - globalThis.A = ((x) => new A(x)); - globalThis.A["class"] = A; - } - return globalThis.A; -})(); -const A = globalThis.A; -const a = Cycle1.f(42); diff --git a/driver/js/src/test/js/Self.js b/driver/js/src/test/js/Self.js deleted file mode 100644 index 72c75f9f8..000000000 --- a/driver/js/src/test/js/Self.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Self } from "./Self.js" - -(() => { - if (globalThis.Foo === undefined) { - class Foo {}; - globalThis.Foo = (() => new Foo()); - globalThis.Foo["class"] = Foo; - } - return globalThis.Foo; -})(); -const Foo = globalThis.Foo; From 76885b9bead9746bd9e63169c1936b5df6702daf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 11 Apr 2023 16:28:33 +0800 Subject: [PATCH 017/202] Remove export renaming --- driver/js/src/test/js/Opened.js | 7 +++---- driver/js/src/test/js/Simple.js | 4 ++-- driver/js/src/test/js/tools/Inc.js | 5 ++--- shared/src/main/scala/mlscript/JSBackend.scala | 10 +++++----- shared/src/main/scala/mlscript/codegen/Codegen.scala | 2 +- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index 08bfdd144..c8640ecd7 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -1,9 +1,9 @@ -import { _Inc as Inc } from "./tools/Inc.js" +import { Inc } from "./tools/Inc.js" function log(x) { return console.info(x); } -class Opened { +export const Opened = (() => new class Opened { constructor() { const self = this; self.hello(114513); @@ -14,5 +14,4 @@ class Opened { Inc.inc(x) ])); } -} -export const _Opened = new Opened; +})(); diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index cf6efb093..feb2d1ba0 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -1,4 +1,4 @@ -import { _Opened as Opened } from "./Opened.js" +import { Opened } from "./Opened.js" function log(x) { return console.info(x); @@ -60,4 +60,4 @@ class Simple { return this.#A; } } -const _Simple = new Simple; +new Simple; diff --git a/driver/js/src/test/js/tools/Inc.js b/driver/js/src/test/js/tools/Inc.js index 84e9739d3..aff08310b 100644 --- a/driver/js/src/test/js/tools/Inc.js +++ b/driver/js/src/test/js/tools/Inc.js @@ -1,8 +1,7 @@ -class Inc { +export const Inc = (() => new class Inc { constructor() { } inc(x) { return x + 1; } -} -export const _Inc = new Inc; +})(); diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index b968fce1f..a30b6af75 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1008,13 +1008,13 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } val topModule = topLevelScope.declareTopModule(topModuleName, otherStmts, typeDefs, false) - val insName = s"_$topModuleName" val moduleDecl = translateTopModuleDeclaration(topModule, false)(topLevelScope) - val insDecl = - if (exported) JSExport(JSConstDecl(insName, JSNew(JSIdent(topModuleName)))) - else JSConstDecl(insName, JSNew(JSIdent(topModuleName))) + val ins = + if (exported) + JSExport(JSConstDecl(topModuleName, JSImmEvalFn(N, Nil, L(JSNew(JSClassExpr(moduleDecl))), Nil))) :: Nil + else moduleDecl :: JSNew(JSIdent(topModuleName)).stmt :: Nil - SourceCode.fromStmts(polyfill.emit() ::: (moduleDecl :: insDecl :: Nil)).toLines + SourceCode.fromStmts(polyfill.emit() ++ ins).toLines } private def translateImport(imp: Import) = imp match { diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index 9bc234f84..54b1fedae 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -912,7 +912,7 @@ final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { final case class JSImport(name: Str, path: Str) extends JSStmt { def toSourceCode: SourceCode = - SourceCode(s"import { _$name as $name } from \"$path\"\n") + SourceCode(s"import { $name } from \"$path\"\n") } final case class JSComment(text: Str) extends JSStmt { From 0a919ed7e4709ed108e491dca8e9d67bdb18d5dd Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 11 Apr 2023 16:30:57 +0800 Subject: [PATCH 018/202] Remove IIFE --- driver/js/src/test/js/Opened.js | 4 ++-- driver/js/src/test/js/tools/Inc.js | 4 ++-- shared/src/main/scala/mlscript/JSBackend.scala | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index c8640ecd7..d991142d8 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -3,7 +3,7 @@ import { Inc } from "./tools/Inc.js" function log(x) { return console.info(x); } -export const Opened = (() => new class Opened { +export const Opened = new class Opened { constructor() { const self = this; self.hello(114513); @@ -14,4 +14,4 @@ export const Opened = (() => new class Opened { Inc.inc(x) ])); } -})(); +}; diff --git a/driver/js/src/test/js/tools/Inc.js b/driver/js/src/test/js/tools/Inc.js index aff08310b..53bce9074 100644 --- a/driver/js/src/test/js/tools/Inc.js +++ b/driver/js/src/test/js/tools/Inc.js @@ -1,7 +1,7 @@ -export const Inc = (() => new class Inc { +export const Inc = new class Inc { constructor() { } inc(x) { return x + 1; } -})(); +}; diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index a30b6af75..20d304fc3 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1011,7 +1011,7 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { val moduleDecl = translateTopModuleDeclaration(topModule, false)(topLevelScope) val ins = if (exported) - JSExport(JSConstDecl(topModuleName, JSImmEvalFn(N, Nil, L(JSNew(JSClassExpr(moduleDecl))), Nil))) :: Nil + JSExport(JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl)))) :: Nil else moduleDecl :: JSNew(JSIdent(topModuleName)).stmt :: Nil SourceCode.fromStmts(polyfill.emit() ++ ins).toLines From 76f325806fbc51e75db22e7a12187776f05676f0 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 11 Apr 2023 17:17:54 +0800 Subject: [PATCH 019/202] Fix missing declare keyword and refactor code --- driver/js/src/main/scala/Driver.scala | 95 +++++++++++++++---------- driver/js/src/test/js/.temp/Simple.mlsi | 2 +- 2 files changed, 57 insertions(+), 40 deletions(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index e60ef0f13..e133c992a 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -50,6 +50,23 @@ class Driver(options: DriverOptions) { writeFile(options.outputDir, "package.json", content) } + private def parse(filename: String, content: String) = { + import fastparse._ + import fastparse.Parsed.{Success, Failure} + + val lines = content.splitSane('\n').toIndexedSeq + val fph = new mlscript.FastParseHelpers(content, lines) + val origin = Origin(filename, 1, fph) + val lexer = new NewLexer(origin, throw _, dbg = false) + val tokens = lexer.bracketedTokens + + val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { + def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) + } + + parser.parseAll(parser.typingUnit) + } + private def compile( filename: String, exported: Boolean = false @@ -59,34 +76,46 @@ class Driver(options: DriverOptions) { extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType], stack: List[String] - ): Boolean = - if (stack.contains(filename)) - throw + ): Boolean = { + val beginIndex = filename.lastIndexOf("/") + val endIndex = filename.lastIndexOf(".") + val prefixName = filename.substring(beginIndex + 1, endIndex) + val path = filename.substring(0, beginIndex + 1) + val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) + + if (stack.contains(filename)) { + throw // TODO: how to handle it? ErrorReport(Ls((s"cycle dependence on $filename", None)), Diagnostic.Compilation) - else { - val beginIndex = filename.lastIndexOf("/") - val endIndex = filename.lastIndexOf(".") - val prefixName = filename.substring(beginIndex + 1, endIndex) - val path = filename.substring(0, beginIndex + 1) + // if (stack.last === filename) // it means a file is trying to import itself! + // throw + // ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) + // else readFile(filename) match { + // case Some(content) => + // parse(filename, content) match { + // case tu => { + // val tpd = typer.typeTypingUnit(tu, topLevel = true) + // val sim = SimplifyPipeline(tpd, all = false)(ctx) + // val exp = typer.expandType(sim)(ctx) + // val expStr = + // s"declare module $moduleName() {\n" + + // exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + + // "\n}" + // val relatedPath = path.substring(options.path.length) + // writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", expStr) + // true + // } + // } + // case _ => + // throw + // ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + // } + } + else { System.out.println(s"compiling $filename...") readFile(filename) match { case Some(content) => { - import fastparse._ - import fastparse.Parsed.{Success, Failure} - - val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) - val lines = content.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(content, lines) - val origin = Origin(filename, 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens - - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } - - parser.parseAll(parser.typingUnit) match { + parse(filename, content) match { case tu => { def getAllImport(top: Ls[Import], tu: TypingUnit): Ls[Import] = tu.entities.foldLeft(top)((res, ett) => ett match { @@ -117,17 +146,7 @@ class Driver(options: DriverOptions) { val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) readFile(filename) match { case Some(content) => { - val lines = content.splitSane('\n').toIndexedSeq - val fph = new mlscript.FastParseHelpers(content, lines) - val origin = Origin(modulePath, 1, fph) - val lexer = new NewLexer(origin, throw _, dbg = false) - val tokens = lexer.bracketedTokens - - val parser = new NewParser(origin, tokens, throw _, dbg = false, None) { - def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) - } - - parser.parseAll(parser.typingUnit) match { + parse(filename, content) match { case tu: TypingUnit => { val depList = tu.depList.map { case Import(path) => path @@ -149,13 +168,10 @@ class Driver(options: DriverOptions) { val tpd = typer.typeTypingUnit(tu, topLevel = true) val sim = SimplifyPipeline(tpd, all = false)(ctx) val exp = typer.expandType(sim)(ctx) - val wrapped = - s"module $moduleName() {\n" + + val expStr = + s"declare module $moduleName() {\n" + exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}" - val expStr = - if (exported) "declare " + wrapped - else wrapped val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") val relatedPath = path.substring(options.path.length) @@ -172,6 +188,7 @@ class Driver(options: DriverOptions) { ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } } + } private def generate( program: Pgrm, diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index a2c6e36a3..8a3a3ee21 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,5 +1,5 @@ import "Opened.mls" -module Simple() { +declare module Simple() { mixin B() { this: {n: 'n} fun foo: 'n From 5185f2ba3f5f23c0ea318f3715f4e9bbf5e30f71 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 11 Apr 2023 18:28:02 +0800 Subject: [PATCH 020/202] WIP: Allow cycle dependencies --- driver/js/src/main/scala/Driver.scala | 58 ++++++++++--------- driver/js/src/test/js/.temp/Cycle1.mlsi | 5 ++ driver/js/src/test/js/.temp/Cycle2.mlsi | 6 ++ driver/js/src/test/js/Cycle1.js | 11 ++++ driver/js/src/test/js/Cycle2.js | 17 ++++++ driver/js/src/test/js/Opened.js | 7 ++- driver/js/src/test/js/Simple.js | 18 +++--- driver/js/src/test/js/tools/Inc.js | 2 + driver/js/src/test/mlscript/Cycle1.mls | 4 +- driver/js/src/test/mlscript/Cycle2.mls | 4 +- .../src/main/scala/mlscript/JSBackend.scala | 53 +++++++++++------ 11 files changed, 126 insertions(+), 59 deletions(-) create mode 100644 driver/js/src/test/js/.temp/Cycle1.mlsi create mode 100644 driver/js/src/test/js/.temp/Cycle2.mlsi create mode 100644 driver/js/src/test/js/Cycle1.js create mode 100644 driver/js/src/test/js/Cycle2.js diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index e133c992a..57cdbf855 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -5,7 +5,7 @@ import js.JSConverters._ import mlscript.utils._ import mlscript._ import mlscript.utils.shorthands._ -import scala.collection.mutable.{ListBuffer,Map => MutMap} +import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} @@ -28,6 +28,8 @@ class Driver(options: DriverOptions) { println(msg) } + private val importedModule = MutSet[String]() + def execute: Unit = try { implicit var ctx: Ctx = Ctx.init @@ -84,32 +86,30 @@ class Driver(options: DriverOptions) { val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) if (stack.contains(filename)) { - throw // TODO: how to handle it? - ErrorReport(Ls((s"cycle dependence on $filename", None)), Diagnostic.Compilation) - // if (stack.last === filename) // it means a file is trying to import itself! - // throw - // ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) - // else readFile(filename) match { - // case Some(content) => - // parse(filename, content) match { - // case tu => { - // val tpd = typer.typeTypingUnit(tu, topLevel = true) - // val sim = SimplifyPipeline(tpd, all = false)(ctx) - // val exp = typer.expandType(sim)(ctx) - // val expStr = - // s"declare module $moduleName() {\n" + - // exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + - // "\n}" + if (stack.last === filename) // it means a file is trying to import itself! + throw + ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) + else readFile(filename) match { + case Some(content) => + parse(filename, content) match { + case tu => { + val tpd = typer.typeTypingUnit(tu, topLevel = true) + val sim = SimplifyPipeline(tpd, all = false)(ctx) + val exp = typer.expandType(sim)(ctx) + val expStr = + s"declare module $moduleName() {\n" + + exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + + "\n}" - // val relatedPath = path.substring(options.path.length) - // writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", expStr) - // true - // } - // } - // case _ => - // throw - // ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) - // } + val relatedPath = path.substring(options.path.length) + writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", expStr) + true + } + } + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + } } else { System.out.println(s"compiling $filename...") @@ -135,7 +135,9 @@ class Driver(options: DriverOptions) { var newCtx: Ctx = Ctx.init val newExtrCtx: Opt[typer.ExtrCtx] = N val newVars: Map[Str, typer.SimpleType] = Map.empty - compile(s"$path$dp", true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) + val newFilename = s"$path$dp" + importedModule += newFilename + compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) }) val mtime = getModificationTime(filename) val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") @@ -176,7 +178,7 @@ class Driver(options: DriverOptions) { val relatedPath = path.substring(options.path.length) writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) - generate(Pgrm(tu.entities), moduleName, importsList, prefixName, s"${options.outputDir}/$relatedPath", exported) + generate(Pgrm(tu.entities), moduleName, importsList, prefixName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) true } else false diff --git a/driver/js/src/test/js/.temp/Cycle1.mlsi b/driver/js/src/test/js/.temp/Cycle1.mlsi new file mode 100644 index 000000000..887651b2a --- /dev/null +++ b/driver/js/src/test/js/.temp/Cycle1.mlsi @@ -0,0 +1,5 @@ +import "Cycle2.mls" +declare module Cycle1() { + fun f: (x: int,) -> int + +} \ No newline at end of file diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/js/.temp/Cycle2.mlsi new file mode 100644 index 000000000..f12a73f22 --- /dev/null +++ b/driver/js/src/test/js/.temp/Cycle2.mlsi @@ -0,0 +1,6 @@ +import "Cycle1.mls" +declare module Cycle2() { + fun g: (x: int,) -> int + unit + +} \ No newline at end of file diff --git a/driver/js/src/test/js/Cycle1.js b/driver/js/src/test/js/Cycle1.js new file mode 100644 index 000000000..3bf27b797 --- /dev/null +++ b/driver/js/src/test/js/Cycle1.js @@ -0,0 +1,11 @@ +import { Cycle2 } from "./Cycle2.js" + +export const Cycle1 = new class Cycle1 { + constructor() { + } + f(x) { + return x == 0 === true ? 114 : Cycle2.g(x - 1); + } + $init() {} +}; +Cycle1.$init(); diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/js/Cycle2.js new file mode 100644 index 000000000..dfed8717a --- /dev/null +++ b/driver/js/src/test/js/Cycle2.js @@ -0,0 +1,17 @@ +import { Cycle1 } from "./Cycle1.js" + +function log(x) { + return console.info(x); +} +export const Cycle2 = new class Cycle2 { + constructor() { + } + g(x) { + return Cycle1.f(x); + } + $init() { + const self = this; + log(self.g(42)); + } +}; +Cycle2.$init(); diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/js/Opened.js index d991142d8..e1d57115b 100644 --- a/driver/js/src/test/js/Opened.js +++ b/driver/js/src/test/js/Opened.js @@ -5,8 +5,6 @@ function log(x) { } export const Opened = new class Opened { constructor() { - const self = this; - self.hello(114513); } hello(x) { return (log([ @@ -14,4 +12,9 @@ export const Opened = new class Opened { Inc.inc(x) ])); } + $init() { + const self = this; + self.hello(114513); + } }; +Opened.$init(); diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/js/Simple.js index feb2d1ba0..075df41d7 100644 --- a/driver/js/src/test/js/Simple.js +++ b/driver/js/src/test/js/Simple.js @@ -3,17 +3,12 @@ import { Opened } from "./Opened.js" function log(x) { return console.info(x); } -class Simple { +const Simple = new class Simple { #A; #C; #a; get a() { return this.#a; } constructor() { - const self = this; - this.#a = self.A(42); - const a = this.#a; - log(a.foo); - Opened.hello(a.n); } B(base) { const outer = this; @@ -59,5 +54,12 @@ class Simple { } return this.#A; } -} -new Simple; + $init() { + const self = this; + this.#a = self.A(42); + const a = this.#a; + log(a.foo); + Opened.hello(a.n); + } +}; +Simple.$init(); diff --git a/driver/js/src/test/js/tools/Inc.js b/driver/js/src/test/js/tools/Inc.js index 53bce9074..02fd1ff82 100644 --- a/driver/js/src/test/js/tools/Inc.js +++ b/driver/js/src/test/js/tools/Inc.js @@ -4,4 +4,6 @@ export const Inc = new class Inc { inc(x) { return x + 1; } + $init() {} }; +Inc.$init(); diff --git a/driver/js/src/test/mlscript/Cycle1.mls b/driver/js/src/test/mlscript/Cycle1.mls index 9b2379d6f..9efcfa8f7 100644 --- a/driver/js/src/test/mlscript/Cycle1.mls +++ b/driver/js/src/test/mlscript/Cycle1.mls @@ -1,3 +1,5 @@ import "Cycle2.mls" -fun f(x: int) = Cycle2.A(x + 1) +fun f(x: int): int = if x is + 0 then 114 + _ then Cycle2.g(x - 1) diff --git a/driver/js/src/test/mlscript/Cycle2.mls b/driver/js/src/test/mlscript/Cycle2.mls index 8646f348e..7852d137a 100644 --- a/driver/js/src/test/mlscript/Cycle2.mls +++ b/driver/js/src/test/mlscript/Cycle2.mls @@ -1,5 +1,5 @@ import "Cycle1.mls" -class A(x: int) {} +fun g(x: int): int = Cycle1.f(x) -let a = Cycle1.f(42) +log(g(42)) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 20d304fc3..589c2ea35 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -504,7 +504,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { sym match { case S(sym: NewClassSymbol) => val localScope = scope.derive(s"local ${sym.lexicalName}") - val nd = translateNewTypeDefinition(sym, N, false)(localScope) + val nd = translateNewTypeDefinition(sym, N, false, false)(localScope) val ctorMth = localScope.declareValue("ctor", Some(false), false).runtimeName val (constructor, params) = translateNewClassParameters(nd) JSConstDecl(sym.lexicalName, JSImmEvalFn( @@ -518,7 +518,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { case S(sym: MixinSymbol) => val localScope = scope.derive(s"local ${sym.lexicalName}") val base = localScope.declareValue("base", Some(false), false) - val nd = translateNewTypeDefinition(sym, S(base), false)(localScope) + val nd = translateNewTypeDefinition(sym, S(base), false, false)(localScope) JSConstDecl(sym.lexicalName, JSArrowFn( Ls(JSNamePattern(base.runtimeName)), R(Ls( JSReturnStmt(S(JSClassExpr(nd))) @@ -526,7 +526,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { )) case S(sym: ModuleSymbol) => val localScope = scope.derive(s"local ${sym.lexicalName}") - val nd = translateNewTypeDefinition(sym, N, false)(localScope) + val nd = translateNewTypeDefinition(sym, N, false, false)(localScope) val ins = localScope.declareValue("ins", Some(false), false).runtimeName JSConstDecl(sym.lexicalName, JSImmEvalFn( N, Nil, R(Ls( @@ -549,7 +549,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val outerSymbol = getterScope.declareOuterSymbol() siblingsMembers.foreach(getterScope.captureSymbol(outerSymbol, _)) - val classBody = translateNewTypeDefinition(mixinSymbol, S(base), false)(getterScope) + val classBody = translateNewTypeDefinition(mixinSymbol, S(base), false, false)(getterScope) JSClassMethod(mixinSymbol.lexicalName, Ls(JSNamePattern(base.runtimeName)), R((JSConstDecl(outerSymbol.runtimeName, JSIdent("this")) :: Nil) ::: Ls( JSReturnStmt(S(JSClassExpr(classBody))) @@ -597,9 +597,10 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { protected def translateTopModuleDeclaration( moduleSymbol: ModuleSymbol, - keepTopLevelScope: Bool + keepTopLevelScope: Bool, + needSeparateCtor: Bool )(implicit scope: Scope): JSClassNewDecl = - translateNewTypeDefinition(moduleSymbol, N, keepTopLevelScope) + translateNewTypeDefinition(moduleSymbol, N, keepTopLevelScope, needSeparateCtor) protected def translateModuleDeclaration( moduleSymbol: ModuleSymbol, @@ -609,7 +610,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val outerSymbol = getterScope.declareOuterSymbol() siblingsMembers.foreach(getterScope.captureSymbol(outerSymbol, _)) - val decl = translateNewTypeDefinition(moduleSymbol, N, false)(getterScope) + val decl = translateNewTypeDefinition(moduleSymbol, N, false, false)(getterScope) val privateIdent = JSIdent(s"this.#${moduleSymbol.lexicalName}") JSClassGetter(moduleSymbol.lexicalName, R((JSConstDecl(outerSymbol.runtimeName, JSIdent("this")) :: Nil) ::: Ls( @@ -643,7 +644,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { siblingsMembers.foreach(getterScope.captureSymbol(outerSymbol, _)) val classBody = - translateNewTypeDefinition(classSymbol, N, false)(getterScope) + translateNewTypeDefinition(classSymbol, N, false, false)(getterScope) val (constructor, params) = translateNewClassParameters(classBody) val privateIdent = JSIdent(s"this.#${classSymbol.lexicalName}") @@ -662,10 +663,13 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { protected def translateNewTypeDefinition( sym: TypeSymbol with RuntimeSymbol with NuTypeSymbol, baseSym: Opt[ValueSymbol], - keepTopLevelScope: Bool + keepTopLevelScope: Bool, + needSeparateCtor: Bool )(implicit scope: Scope): JSClassNewDecl = { val nuTypeScope = scope.derive(sym.toString) - val constructorScope = nuTypeScope.derive(s"${sym.lexicalName} constructor") + val constructorScope = + if (!needSeparateCtor) nuTypeScope.derive(s"${sym.lexicalName} constructor") + else nuTypeScope.derive(s"${sym.lexicalName} $$init") val selfSymbol = constructorScope.declareThisAlias() val memberList = ListBuffer[RuntimeSymbol]() // pass to the getter of nested types @@ -747,6 +751,13 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { case _ => Nil } + val (initStmts, initMths) = + if (!needSeparateCtor) (translateSelfDeclaration(selfSymbol) ::: tempDecs ::: stmts, Nil) + else { + val initSymbol = nuTypeScope.declareValue("$init", Some(false), true) + (Nil, JSClassMethod(initSymbol.runtimeName, Nil, R(translateSelfDeclaration(selfSymbol) ::: tempDecs ::: stmts)) :: Nil) + } + JSClassNewDecl( sym.lexicalName, fields, @@ -755,9 +766,9 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { superParameters, ctorParams, rest, - members, + members ::: initMths, traits, - translateSelfDeclaration(selfSymbol) ::: tempDecs ::: stmts, + initStmts, typeList.toList ) } @@ -1008,11 +1019,17 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } val topModule = topLevelScope.declareTopModule(topModuleName, otherStmts, typeDefs, false) - val moduleDecl = translateTopModuleDeclaration(topModule, false)(topLevelScope) + val moduleDecl = translateTopModuleDeclaration(topModule, false, true)(topLevelScope) + val initMethod = moduleDecl.methods.lastOption match { + case Some(JSClassMethod(name, _, _)) => name + case _ => throw new CodeGenError(s"can not get $$init method of module $topModuleName.") + } + val invoke = JSInvoke(JSIdent(topModuleName).member(initMethod), Nil).stmt + val insDecl = JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl))) + val ins = - if (exported) - JSExport(JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl)))) :: Nil - else moduleDecl :: JSNew(JSIdent(topModuleName)).stmt :: Nil + if (exported) JSExport(insDecl) :: invoke :: Nil + else insDecl :: invoke :: Nil SourceCode.fromStmts(polyfill.emit() ++ ins).toLines } @@ -1098,7 +1115,7 @@ class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { // don't pass `otherStmts` to the top-level module, because we need to execute them one by one later val topModule = topLevelScope.declareTopModule("TypingUnit", Nil, typeDefs, true) val moduleIns = topLevelScope.declareValue("typing_unit", Some(false), false) - val moduleDecl = translateTopModuleDeclaration(topModule, true)(topLevelScope) + val moduleDecl = translateTopModuleDeclaration(topModule, true, false)(topLevelScope) val insDecl = JSConstDecl(moduleIns.runtimeName, JSNew(JSIdent(topModule.runtimeName))) @@ -1295,7 +1312,7 @@ class JSTestBackend extends JSBackend(allowUnresolvedSymbols = false) { // don't pass `otherStmts` to the top-level module, because we need to execute them one by one later val topModule = topLevelScope.declareTopModule("TypingUnit", Nil, typeDefs, true) val moduleIns = topLevelScope.declareValue("typing_unit", Some(false), false) - val moduleDecl = translateTopModuleDeclaration(topModule, true) + val moduleDecl = translateTopModuleDeclaration(topModule, true, false) val insDecl = JSConstDecl(moduleIns.runtimeName, JSNew(JSIdent(topModule.runtimeName))) From e540500851c2f28dab1a3ce9d45d056067965ceb Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Apr 2023 09:12:56 +0800 Subject: [PATCH 021/202] Silence error messages when generating mlsi to break cycle dependencies --- driver/js/src/main/scala/Driver.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/Driver.scala index 57cdbf855..e591ab7e1 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/Driver.scala @@ -93,7 +93,10 @@ class Driver(options: DriverOptions) { case Some(content) => parse(filename, content) match { case tu => { - val tpd = typer.typeTypingUnit(tu, topLevel = true) + // To break the cycle dependencies, we need to generate one mlsi file in the cycle + // and it will lead to some errors. We silence error messages in this case + val silentRaise = (diag: Diagnostic) => () + val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx, silentRaise, vars) val sim = SimplifyPipeline(tpd, all = false)(ctx) val exp = typer.expandType(sim)(ctx) val expStr = From ff0be49c68319cf485e8c92d561ac8883cea75ef Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Apr 2023 11:16:56 +0800 Subject: [PATCH 022/202] Adjust package --- driver/js/src/main/scala/{ => driver}/Driver.scala | 2 ++ driver/js/src/main/scala/{ => driver}/DriverOptions.scala | 2 ++ driver/js/src/main/scala/{ => driver}/Main.scala | 2 ++ 3 files changed, 6 insertions(+) rename driver/js/src/main/scala/{ => driver}/Driver.scala (99%) rename driver/js/src/main/scala/{ => driver}/DriverOptions.scala (98%) rename driver/js/src/main/scala/{ => driver}/Main.scala (94%) diff --git a/driver/js/src/main/scala/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala similarity index 99% rename from driver/js/src/main/scala/Driver.scala rename to driver/js/src/main/scala/driver/Driver.scala index e591ab7e1..0710e2998 100644 --- a/driver/js/src/main/scala/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -1,3 +1,5 @@ +package driver + import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ diff --git a/driver/js/src/main/scala/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala similarity index 98% rename from driver/js/src/main/scala/DriverOptions.scala rename to driver/js/src/main/scala/driver/DriverOptions.scala index 3d6b5f1b4..d3deb3105 100644 --- a/driver/js/src/main/scala/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -1,3 +1,5 @@ +package driver + import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ diff --git a/driver/js/src/main/scala/Main.scala b/driver/js/src/main/scala/driver/Main.scala similarity index 94% rename from driver/js/src/main/scala/Main.scala rename to driver/js/src/main/scala/driver/Main.scala index 5db57d096..60ba79c98 100644 --- a/driver/js/src/main/scala/Main.scala +++ b/driver/js/src/main/scala/driver/Main.scala @@ -1,3 +1,5 @@ +package driver + object Main { def main(args: Array[String]): Unit = DriverOptions.parse match { case Some(options) => { From 3f4ae5601ab6f477b652ff6cf8cd85f3a9378bbf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Apr 2023 13:29:16 +0800 Subject: [PATCH 023/202] WIP: Add difftests for driver --- build.sbt | 13 ------ driver/js/src/main/scala/driver/Driver.scala | 27 ++++++------ .../src/main/scala/driver/DriverOptions.scala | 26 ++---------- driver/js/src/main/scala/driver/Main.scala | 12 ------ .../test/scala/driver/DriverDiffTests.scala | 42 +++++++++++++++++++ 5 files changed, 59 insertions(+), 61 deletions(-) delete mode 100644 driver/js/src/main/scala/driver/Main.scala create mode 100644 driver/js/src/test/scala/driver/DriverDiffTests.scala diff --git a/build.sbt b/build.sbt index 138177714..3a4d28c10 100644 --- a/build.sbt +++ b/build.sbt @@ -103,7 +103,6 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) ) .jvmSettings() .jsSettings( - scalaJSUseMainModuleInitializer := true, libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js" @@ -111,15 +110,3 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) .dependsOn(mlscript % "compile->compile;test->test") lazy val driverJS = driver.js - -import complete.DefaultParsers._ -import scala.sys.process._ - -lazy val mlsc = inputKey[Unit]("mlsc") -mlsc := { - (driverJS / Compile / fastOptJS).value - val args: Seq[String] = spaceDelimited("").parsed - if (args.length > 0) - s"node bin/mlsc.js ${args.reduceLeft((r, s) => s"$r $s")}" ! - else "node bin/mlsc.js" ! -} diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 0710e2998..59128af26 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -32,27 +32,28 @@ class Driver(options: DriverOptions) { private val importedModule = MutSet[String]() - def execute: Unit = + // Return true if success + def execute: Boolean = try { implicit var ctx: Ctx = Ctx.init implicit val raise: Raise = report implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() - compile(options.filename) - if (Driver.totalErrors > 0) - js.Dynamic.global.process.exit(-1) + compile(options.filename, false) + Driver.totalErrors == 0 } catch { case err: Diagnostic => report(err) - js.Dynamic.global.process.exit(-1) + false } - def genPackageJson(): Unit = { - val content = """{ "type": "module" }""" // TODO: more settings? - writeFile(options.outputDir, "package.json", content) - } + def genPackageJson(): Unit = + if (!fs.existsSync(s"${options.outputDir}/package.json")) { + val content = """{ "type": "module" }""" // TODO: more settings? + writeFile(options.outputDir, "package.json", content) + } private def parse(filename: String, content: String) = { import fastparse._ @@ -73,7 +74,7 @@ class Driver(options: DriverOptions) { private def compile( filename: String, - exported: Boolean = false + exported: Boolean )( implicit ctx: Ctx, raise: Raise, @@ -86,6 +87,7 @@ class Driver(options: DriverOptions) { val prefixName = filename.substring(beginIndex + 1, endIndex) val path = filename.substring(0, beginIndex + 1) val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) + val relatedPath = path.substring(options.path.length) if (stack.contains(filename)) { if (stack.last === filename) // it means a file is trying to import itself! @@ -117,7 +119,6 @@ class Driver(options: DriverOptions) { } } else { - System.out.println(s"compiling $filename...") readFile(filename) match { case Some(content) => { parse(filename, content) match { @@ -145,9 +146,10 @@ class Driver(options: DriverOptions) { compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) }) val mtime = getModificationTime(filename) - val imtime = getModificationTime(s"${options.outputDir}/.temp/$prefixName.mlsi") + val imtime = getModificationTime(s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi") if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { + System.out.println(s"compiling $filename...") def importModule(modulePath: String): Unit = { val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) @@ -181,7 +183,6 @@ class Driver(options: DriverOptions) { "\n}" val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - val relatedPath = path.substring(options.path.length) writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) generate(Pgrm(tu.entities), moduleName, importsList, prefixName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) true diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index d3deb3105..f1d739f86 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -8,26 +8,6 @@ import js.JSConverters._ final case class DriverOptions( val filename: String, val path: String, - val outputDir: String = ".", - val force: Boolean = false // force to recompile if it is true -) // TODO: add more options - -object DriverOptions { - def parse: Option[DriverOptions] = { - val process = g.require("process") // TODO: better parse - val args = process.argv - if (args.length > 4) { - val filename = args.selectDynamic("2").toString - Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1), args.selectDynamic("3").toString, true)) - } - else if (args.length > 3) { - val filename = args.selectDynamic("2").toString - Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1), args.selectDynamic("3").toString)) - } - else if (args.length > 2) { - val filename = args.selectDynamic("2").toString - Some(DriverOptions(filename, filename.substring(0, filename.lastIndexOf("/") + 1))) - } - else None - } -} + val outputDir: String, + val force: Boolean // force to recompile if it is true +) diff --git a/driver/js/src/main/scala/driver/Main.scala b/driver/js/src/main/scala/driver/Main.scala deleted file mode 100644 index 60ba79c98..000000000 --- a/driver/js/src/main/scala/driver/Main.scala +++ /dev/null @@ -1,12 +0,0 @@ -package driver - -object Main { - def main(args: Array[String]): Unit = DriverOptions.parse match { - case Some(options) => { - val driver = Driver(options) - driver.execute - driver.genPackageJson() - } - case _ => System.out.println("Usage: mlsc filename.mls [outputDir]") - } -} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala new file mode 100644 index 000000000..582eb02ba --- /dev/null +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -0,0 +1,42 @@ +package driver + +import org.scalatest.funsuite.AnyFunSuite + +class DriverDiffTests extends AnyFunSuite { + import DriverDiffTests._ + + testCases.foreach { + case TestOption(filename, expectError) => test(filename) { + val options = DriverOptions(filename, mlscriptPath, jsPath, forceCompiling) + val driver = Driver(options) + driver.genPackageJson() + val success = driver.execute + + assert(success != expectError, s"failed when compiling $filename.") + } + } +} + +object DriverDiffTests { + // For local environment, we may change the driver so forcing compiling is necessary + // but we can ban it during CI + private val forceCompiling = sys.env.get("CI").isEmpty + + private val diffPath = "driver/js/src/test/" + private val mlscriptPath = s"${diffPath}mlscript/" + private val jsPath = s"${diffPath}js/" + + private case class TestOption( + filename: String, + expectError: Boolean + ) + + private def entry(filename: String, expectError: Boolean = false) = + TestOption(s"${mlscriptPath}${filename}", expectError) + + private val testCases = List( + entry("Simple.mls"), + entry("Cycle2.mls"), + entry("Self.mls", true) + ) +} From f4c90988bc172ef9c756d4c249591226160a07bd Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 13 Apr 2023 14:44:17 +0800 Subject: [PATCH 024/202] WIP: Fix cycle dependencies --- driver/js/src/main/scala/driver/Driver.scala | 192 ++++++++++-------- driver/js/src/test/js/.temp/A.mlsi | 3 + driver/js/src/test/js/.temp/B.mlsi | 4 + driver/js/src/test/js/.temp/C.mlsi | 5 + driver/js/src/test/js/.temp/Cycle1.mlsi | 7 +- driver/js/src/test/js/.temp/Cycle2.mlsi | 5 +- driver/js/src/test/js/.temp/Opened.mlsi | 5 +- driver/js/src/test/js/.temp/Simple.mlsi | 5 +- driver/js/src/test/js/.temp/tools/Inc.mlsi | 3 +- driver/js/src/test/js/A.js | 22 ++ driver/js/src/test/js/B.js | 11 + driver/js/src/test/js/C.js | 17 ++ driver/js/src/test/js/Cycle2.js | 2 +- driver/js/src/test/mlscript/A.mls | 1 + driver/js/src/test/mlscript/B.mls | 3 + driver/js/src/test/mlscript/C.mls | 4 + driver/js/src/test/mlscript/Cycle2.mls | 1 + .../test/scala/driver/DriverDiffTests.scala | 3 +- 18 files changed, 187 insertions(+), 106 deletions(-) create mode 100644 driver/js/src/test/js/.temp/A.mlsi create mode 100644 driver/js/src/test/js/.temp/B.mlsi create mode 100644 driver/js/src/test/js/.temp/C.mlsi create mode 100644 driver/js/src/test/js/A.js create mode 100644 driver/js/src/test/js/B.js create mode 100644 driver/js/src/test/js/C.js create mode 100644 driver/js/src/test/mlscript/A.mls create mode 100644 driver/js/src/test/mlscript/B.mls create mode 100644 driver/js/src/test/mlscript/C.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 59128af26..eeb3f0d44 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -69,9 +69,42 @@ class Driver(options: DriverOptions) { def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) } - parser.parseAll(parser.typingUnit) + val tu = parser.parseAll(parser.typingUnit) + val (definitions, declarations) = tu.entities.partitionMap { + case nt: NuTypeDef if (nt.isDecl) => Right(nt) + case nf @ NuFunDef(_, _, _, Right(_)) => Right(nf) + case t => Left(t) + } + + (definitions, declarations, tu.depList, origin) + } + + private def isInterfaceOutdate(origin: String, inter: String): Boolean = { + val mtime = getModificationTime(origin) + val imtime = getModificationTime(inter) + imtime.isEmpty || mtime.compareTo(imtime) >= 0 } + private def packTopModule(moduleName: Option[String], content: String) = + moduleName match { + case Some(moduleName) => + s"declare module $moduleName() {\n" + + content.splitSane('\n').toIndexedSeq.filter(!_.isEmpty()).map(line => s" $line").reduceLeft(_ + "\n" + _) + + "\n}\n" + case _ => s"declare $content" + } + + private def extractSig(filename: String, moduleName: String): TypingUnit = + readFile(filename) match { + case Some(content) => + parse(filename, content) match { + case (_, declarations, _, origin) => TypingUnit( + NuTypeDef(Nms, TypeName(moduleName), Nil, Tup(Nil), N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin))) :: Nil, Nil) + } + case None => + throw ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + } + private def compile( filename: String, exported: Boolean @@ -89,112 +122,91 @@ class Driver(options: DriverOptions) { val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) val relatedPath = path.substring(options.path.length) - if (stack.contains(filename)) { - if (stack.last === filename) // it means a file is trying to import itself! - throw - ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) - else readFile(filename) match { - case Some(content) => - parse(filename, content) match { - case tu => { - // To break the cycle dependencies, we need to generate one mlsi file in the cycle - // and it will lead to some errors. We silence error messages in this case - val silentRaise = (diag: Diagnostic) => () - val tpd = typer.typeTypingUnit(tu, topLevel = true)(ctx, silentRaise, vars) - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) - val expStr = - s"declare module $moduleName() {\n" + - exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + - "\n}" - - val relatedPath = path.substring(options.path.length) - writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", expStr) - true + readFile(filename) match { + case Some(content) => { + parse(filename, content) match { + case (definitions, _, imports, _) => { + val depList = imports.map { + case Import(path) => path } - } - case _ => - throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) - } - } - else { - readFile(filename) match { - case Some(content) => { - parse(filename, content) match { - case tu => { - def getAllImport(top: Ls[Import], tu: TypingUnit): Ls[Import] = - tu.entities.foldLeft(top)((res, ett) => ett match { - case nudef: NuTypeDef => res ::: nudef.body.depList - case _ => res - }) - val importsList = getAllImport(tu.depList, tu) - val depList = importsList.map { - case Import(path) => path - } - val needRecomp = depList.foldLeft(false)((nr, dp) => nr || { - // We need to create another new context when compiling other files - // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" - // If we forget to add `import "D.mls"` in C, we need to raise an error - // Keeping using the same environment would not. - var newCtx: Ctx = Ctx.init - val newExtrCtx: Opt[typer.ExtrCtx] = N - val newVars: Map[Str, typer.SimpleType] = Map.empty - val newFilename = s"$path$dp" - importedModule += newFilename - compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) - }) - val mtime = getModificationTime(filename) - val imtime = getModificationTime(s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi") + val (cycleList, otherList) = depList.partitionMap { dep => { + val depFile = s"$path$dep" + if (depFile === filename) + throw ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) + else if (stack.contains(depFile)) L(dep) + else R(dep) + } } + + val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, dep) => r match { + case (sigs, recomp) => { + val filename = s"$path$dep" + val prefixName = dep.substring(0, dep.lastIndexOf(".")) + (sigs :+ extractSig(filename, prefixName), + isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi")) + } + }) + val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { + // We need to create another new context when compiling other files + // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" + // If we forget to add `import "D.mls"` in C, we need to raise an error + // Keeping using the same environment would not. + var newCtx: Ctx = Ctx.init + val newExtrCtx: Opt[typer.ExtrCtx] = N + val newVars: Map[Str, typer.SimpleType] = Map.empty + val newFilename = s"$path$dp" + importedModule += newFilename + compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) + }) - if (options.force || needRecomp || imtime.isEmpty || mtime.compareTo(imtime) >= 0) { - System.out.println(s"compiling $filename...") - def importModule(modulePath: String): Unit = { - val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" - val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) - readFile(filename) match { - case Some(content) => { - parse(filename, content) match { - case tu: TypingUnit => { - val depList = tu.depList.map { - case Import(path) => path - } - depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) - val tpd = typer.typeTypingUnit(tu, topLevel = true) - val sim = SimplifyPipeline(tpd, all = false) - val exp = typer.expandType(sim) + if (options.force || needRecomp || isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi")) { + System.out.println(s"compiling $filename...") + def importModule(modulePath: String): Unit = { + val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" + val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) + readFile(filename) match { + case Some(content) => { + parse(filename, content) match { + case (_, declarations, imports, _) => { + val depList = imports.map { + case Import(path) => path } + depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + val tpd = typer.typeTypingUnit(TypingUnit(declarations, Nil), topLevel = true) + val sim = SimplifyPipeline(tpd, all = false) + val exp = typer.expandType(sim) } } - case _ => - throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } + } - depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + otherList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + def generateInterface(moduleName: Option[String], tu: TypingUnit) = { val tpd = typer.typeTypingUnit(tu, topLevel = true) val sim = SimplifyPipeline(tpd, all = false)(ctx) val exp = typer.expandType(sim)(ctx) - val expStr = - s"declare module $moduleName() {\n" + - exp.showIn(ShowCtx.mk(exp :: Nil), 0).splitSane('\n').toIndexedSeq.map(line => s" $line").reduceLeft(_ + "\n" + _) + - "\n}" - val interfaces = importsList.map(_.toString).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - - writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) - generate(Pgrm(tu.entities), moduleName, importsList, prefixName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) - true + packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) } - else false + + val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + + generateInterface(Some(moduleName), TypingUnit(definitions, Nil)) + val interfaces = otherList.map(s => Import(s"${s}i")).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + + writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) + generate(Pgrm(definitions), moduleName, imports, prefixName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) + true } + else false } } - case _ => - throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) } } diff --git a/driver/js/src/test/js/.temp/A.mlsi b/driver/js/src/test/js/.temp/A.mlsi new file mode 100644 index 000000000..694da8438 --- /dev/null +++ b/driver/js/src/test/js/.temp/A.mlsi @@ -0,0 +1,3 @@ +declare module A() { + class Foo(x: int) +} diff --git a/driver/js/src/test/js/.temp/B.mlsi b/driver/js/src/test/js/.temp/B.mlsi new file mode 100644 index 000000000..95464dfee --- /dev/null +++ b/driver/js/src/test/js/.temp/B.mlsi @@ -0,0 +1,4 @@ +import "A.mlsi" +declare module B() { + fun foo: error +} diff --git a/driver/js/src/test/js/.temp/C.mlsi b/driver/js/src/test/js/.temp/C.mlsi new file mode 100644 index 000000000..9c62bc96c --- /dev/null +++ b/driver/js/src/test/js/.temp/C.mlsi @@ -0,0 +1,5 @@ +import "B.mlsi" +declare module C() { + let a: error + unit +} diff --git a/driver/js/src/test/js/.temp/Cycle1.mlsi b/driver/js/src/test/js/.temp/Cycle1.mlsi index 887651b2a..797aae729 100644 --- a/driver/js/src/test/js/.temp/Cycle1.mlsi +++ b/driver/js/src/test/js/.temp/Cycle1.mlsi @@ -1,5 +1,6 @@ -import "Cycle2.mls" +declare module Cycle2() { + fun g: (x: int,) -> int +} declare module Cycle1() { fun f: (x: int,) -> int - -} \ No newline at end of file +} diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/js/.temp/Cycle2.mlsi index f12a73f22..4fc2562d7 100644 --- a/driver/js/src/test/js/.temp/Cycle2.mlsi +++ b/driver/js/src/test/js/.temp/Cycle2.mlsi @@ -1,6 +1,5 @@ -import "Cycle1.mls" +import "Cycle1.mlsi" declare module Cycle2() { fun g: (x: int,) -> int unit - -} \ No newline at end of file +} diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index 58465f3d1..eb0b9848e 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1,6 +1,5 @@ -import "tools/Inc.mls" +import "tools/Inc.mlsi" declare module Opened() { fun hello: (x: int,) -> unit unit - -} \ No newline at end of file +} diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index 8a3a3ee21..b92276be3 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,4 +1,4 @@ -import "Opened.mls" +import "Opened.mlsi" declare module Simple() { mixin B() { this: {n: 'n} @@ -12,5 +12,4 @@ declare module Simple() { let b: 1 } unit - -} \ No newline at end of file +} diff --git a/driver/js/src/test/js/.temp/tools/Inc.mlsi b/driver/js/src/test/js/.temp/tools/Inc.mlsi index e5308f17c..d08ad5c53 100644 --- a/driver/js/src/test/js/.temp/tools/Inc.mlsi +++ b/driver/js/src/test/js/.temp/tools/Inc.mlsi @@ -1,4 +1,3 @@ declare module Inc() { fun inc: (x: int,) -> int - -} \ No newline at end of file +} diff --git a/driver/js/src/test/js/A.js b/driver/js/src/test/js/A.js new file mode 100644 index 000000000..7e34c5ffa --- /dev/null +++ b/driver/js/src/test/js/A.js @@ -0,0 +1,22 @@ +export const A = new class A { + #Foo; + constructor() { + } + get Foo() { + const outer = this; + if (this.#Foo === undefined) { + class Foo { + #x; + get x() { return this.#x; } + constructor(x) { + this.#x = x; + } + }; + this.#Foo = ((x) => new Foo(x)); + this.#Foo.class = Foo; + } + return this.#Foo; + } + $init() {} +}; +A.$init(); diff --git a/driver/js/src/test/js/B.js b/driver/js/src/test/js/B.js new file mode 100644 index 000000000..187ec80d9 --- /dev/null +++ b/driver/js/src/test/js/B.js @@ -0,0 +1,11 @@ +import { A } from "./A.js" + +export const B = new class B { + constructor() { + } + get foo() { + return A.Foo(12); + } + $init() {} +}; +B.$init(); diff --git a/driver/js/src/test/js/C.js b/driver/js/src/test/js/C.js new file mode 100644 index 000000000..4b1d19fa3 --- /dev/null +++ b/driver/js/src/test/js/C.js @@ -0,0 +1,17 @@ +import { B } from "./B.js" + +function log(x) { + return console.info(x); +} +const C = new class C { + #a; + get a() { return this.#a; } + constructor() { + } + $init() { + this.#a = B.foo; + const a = this.#a; + log(a.x); + } +}; +C.$init(); diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/js/Cycle2.js index dfed8717a..b0d73cc58 100644 --- a/driver/js/src/test/js/Cycle2.js +++ b/driver/js/src/test/js/Cycle2.js @@ -3,7 +3,7 @@ import { Cycle1 } from "./Cycle1.js" function log(x) { return console.info(x); } -export const Cycle2 = new class Cycle2 { +const Cycle2 = new class Cycle2 { constructor() { } g(x) { diff --git a/driver/js/src/test/mlscript/A.mls b/driver/js/src/test/mlscript/A.mls new file mode 100644 index 000000000..536791507 --- /dev/null +++ b/driver/js/src/test/mlscript/A.mls @@ -0,0 +1 @@ +class Foo(x: int) {} diff --git a/driver/js/src/test/mlscript/B.mls b/driver/js/src/test/mlscript/B.mls new file mode 100644 index 000000000..8203f18d3 --- /dev/null +++ b/driver/js/src/test/mlscript/B.mls @@ -0,0 +1,3 @@ +import "A.mls" + +fun foo = A.Foo(12) diff --git a/driver/js/src/test/mlscript/C.mls b/driver/js/src/test/mlscript/C.mls new file mode 100644 index 000000000..c83656655 --- /dev/null +++ b/driver/js/src/test/mlscript/C.mls @@ -0,0 +1,4 @@ +import "B.mls" + +let a = B.foo +log(a.x) diff --git a/driver/js/src/test/mlscript/Cycle2.mls b/driver/js/src/test/mlscript/Cycle2.mls index 7852d137a..a757dc943 100644 --- a/driver/js/src/test/mlscript/Cycle2.mls +++ b/driver/js/src/test/mlscript/Cycle2.mls @@ -1,5 +1,6 @@ import "Cycle1.mls" +fun g(x: int): int fun g(x: int): int = Cycle1.f(x) log(g(42)) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 582eb02ba..dab9003d4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -37,6 +37,7 @@ object DriverDiffTests { private val testCases = List( entry("Simple.mls"), entry("Cycle2.mls"), - entry("Self.mls", true) + entry("Self.mls", true), + entry("C.mls", true) // FIXME: access to class member not yet supported ) } From 048cf0274dc00186a67ffc15478deafb909cf714 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 13 Apr 2023 15:06:24 +0800 Subject: [PATCH 025/202] WIP: ban unresolved symbols --- driver/js/src/main/scala/driver/Driver.scala | 6 ++++-- driver/js/src/test/js/.temp/C.mlsi | 1 + driver/js/src/test/js/C.js | 4 ++++ driver/js/src/test/mlscript/B.mls | 1 + driver/js/src/test/mlscript/C.mls | 1 + driver/js/src/test/scala/driver/DriverDiffTests.scala | 2 +- shared/src/main/scala/mlscript/JSBackend.scala | 9 +++++++-- 7 files changed, 19 insertions(+), 5 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index eeb3f0d44..6a47e567e 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -217,12 +217,14 @@ class Driver(options: DriverOptions) { filename: String, outputDir: String, exported: Boolean - ): Unit = { + ): Unit = try { val backend = new JSCompilerBackend() val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") writeFile(outputDir, s"$filename.js", code) - } + } catch { + case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation)) + } } object Driver { diff --git a/driver/js/src/test/js/.temp/C.mlsi b/driver/js/src/test/js/.temp/C.mlsi index 9c62bc96c..5adae64d9 100644 --- a/driver/js/src/test/js/.temp/C.mlsi +++ b/driver/js/src/test/js/.temp/C.mlsi @@ -1,5 +1,6 @@ import "B.mlsi" declare module C() { let a: error + let b: error unit } diff --git a/driver/js/src/test/js/C.js b/driver/js/src/test/js/C.js index 4b1d19fa3..e548f473d 100644 --- a/driver/js/src/test/js/C.js +++ b/driver/js/src/test/js/C.js @@ -5,12 +5,16 @@ function log(x) { } const C = new class C { #a; + #b; get a() { return this.#a; } + get b() { return this.#b; } constructor() { } $init() { this.#a = B.foo; const a = this.#a; + this.#b = A.Foo(0); + const b = this.#b; log(a.x); } }; diff --git a/driver/js/src/test/mlscript/B.mls b/driver/js/src/test/mlscript/B.mls index 8203f18d3..4dd737d60 100644 --- a/driver/js/src/test/mlscript/B.mls +++ b/driver/js/src/test/mlscript/B.mls @@ -1,3 +1,4 @@ import "A.mls" +// FIXME: access to class member not yet supported fun foo = A.Foo(12) diff --git a/driver/js/src/test/mlscript/C.mls b/driver/js/src/test/mlscript/C.mls index c83656655..5a9b7a882 100644 --- a/driver/js/src/test/mlscript/C.mls +++ b/driver/js/src/test/mlscript/C.mls @@ -1,4 +1,5 @@ import "B.mls" let a = B.foo +let b = A.Foo(0) // not allowed, unless we import "A.mls" log(a.x) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index dab9003d4..fa8c9d660 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -38,6 +38,6 @@ object DriverDiffTests { entry("Simple.mls"), entry("Cycle2.mls"), entry("Self.mls", true), - entry("C.mls", true) // FIXME: access to class member not yet supported + entry("C.mls", true) ) } diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 589c2ea35..fbf96f082 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1009,7 +1009,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } -class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { +class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool): Ls[Str] = { val (typeDefs, otherStmts) = pgrm.tops.partitionMap { case ot: Terms => R(ot) @@ -1043,7 +1043,12 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = true) { } def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import], exported: Bool): Ls[Str] = { - imports.flatMap(translateImport(_).toSourceCode.toLines) ::: generateNewDef(pgrm, topModuleName, exported) + imports.flatMap { + case imp @ Import(path) => + val moduleName = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")) + topLevelScope.declareValue(moduleName, Some(false), false) + translateImport(imp).toSourceCode.toLines + } ::: generateNewDef(pgrm, topModuleName, exported) } } From 298e7a0ea628e4bd6f0b5668193151a67dabd1c1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 13 Apr 2023 15:27:06 +0800 Subject: [PATCH 026/202] Fix export set and add output dir for difftests --- driver/js/src/main/scala/driver/Driver.scala | 3 +- driver/js/src/test/js/Cycle2.js | 2 +- driver/js/src/test/output/Cycle2.txt | 1 + driver/js/src/test/output/Simple.txt | 3 ++ .../test/scala/driver/DriverDiffTests.scala | 35 +++++++++++++++---- 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 driver/js/src/test/output/Cycle2.txt create mode 100644 driver/js/src/test/output/Simple.txt diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 6a47e567e..213a47d02 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -141,6 +141,7 @@ class Driver(options: DriverOptions) { val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, dep) => r match { case (sigs, recomp) => { val filename = s"$path$dep" + importedModule += filename val prefixName = dep.substring(0, dep.lastIndexOf(".")) (sigs :+ extractSig(filename, prefixName), isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi")) @@ -232,7 +233,7 @@ object Driver { private val fs = g.require("fs") // must use fs module to manipulate files in JS - private def readFile(filename: String) = + def readFile(filename: String) = if (!fs.existsSync(filename)) None else Some(fs.readFileSync(filename).toString) diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/js/Cycle2.js index b0d73cc58..dfed8717a 100644 --- a/driver/js/src/test/js/Cycle2.js +++ b/driver/js/src/test/js/Cycle2.js @@ -3,7 +3,7 @@ import { Cycle1 } from "./Cycle1.js" function log(x) { return console.info(x); } -const Cycle2 = new class Cycle2 { +export const Cycle2 = new class Cycle2 { constructor() { } g(x) { diff --git a/driver/js/src/test/output/Cycle2.txt b/driver/js/src/test/output/Cycle2.txt new file mode 100644 index 000000000..dee79f109 --- /dev/null +++ b/driver/js/src/test/output/Cycle2.txt @@ -0,0 +1 @@ +114 diff --git a/driver/js/src/test/output/Simple.txt b/driver/js/src/test/output/Simple.txt new file mode 100644 index 000000000..54f544546 --- /dev/null +++ b/driver/js/src/test/output/Simple.txt @@ -0,0 +1,3 @@ +[ 'hello!', 114514 ] +42 +[ 'hello!', 43 ] diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index fa8c9d660..37a673f27 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -1,18 +1,28 @@ package driver import org.scalatest.funsuite.AnyFunSuite +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import mlscript.utils._, shorthands._ class DriverDiffTests extends AnyFunSuite { import DriverDiffTests._ testCases.foreach { - case TestOption(filename, expectError) => test(filename) { + case TestOption(filename, executionFile, outputFile, expectError) => test(filename) { val options = DriverOptions(filename, mlscriptPath, jsPath, forceCompiling) val driver = Driver(options) driver.genPackageJson() val success = driver.execute assert(success != expectError, s"failed when compiling $filename.") + + if (!expectError) { + val output = cp.execSync(s"node $executionFile").toString() + val original = Driver.readFile(outputFile).getOrElse("") + if (original =/= output) fs.writeFileSync(outputFile, output) + } } } } @@ -25,19 +35,30 @@ object DriverDiffTests { private val diffPath = "driver/js/src/test/" private val mlscriptPath = s"${diffPath}mlscript/" private val jsPath = s"${diffPath}js/" + private val outputPath = s"${diffPath}output/" private case class TestOption( filename: String, + executionFile: String, + outputFile: String, expectError: Boolean ) - private def entry(filename: String, expectError: Boolean = false) = - TestOption(s"${mlscriptPath}${filename}", expectError) + private def entry(entryModule: String, expectError: Boolean = false) = + TestOption( + s"${mlscriptPath}${entryModule}.mls", + s"${jsPath}${entryModule}.js", + s"${outputPath}${entryModule}.txt", + expectError + ) private val testCases = List( - entry("Simple.mls"), - entry("Cycle2.mls"), - entry("Self.mls", true), - entry("C.mls", true) + entry("Simple"), + entry("Cycle2"), + entry("Self", true), + entry("C", true) ) + + private val cp = g.require("child_process") + private val fs = g.require("fs") } From 6595ebc669bcb031ddbb054925bfc28c040a9d2c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 13 Apr 2023 15:33:39 +0800 Subject: [PATCH 027/202] Update output suffix name --- driver/js/src/test/output/{Cycle2.txt => Cycle2.check} | 0 driver/js/src/test/output/{Simple.txt => Simple.check} | 0 driver/js/src/test/scala/driver/DriverDiffTests.scala | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename driver/js/src/test/output/{Cycle2.txt => Cycle2.check} (100%) rename driver/js/src/test/output/{Simple.txt => Simple.check} (100%) diff --git a/driver/js/src/test/output/Cycle2.txt b/driver/js/src/test/output/Cycle2.check similarity index 100% rename from driver/js/src/test/output/Cycle2.txt rename to driver/js/src/test/output/Cycle2.check diff --git a/driver/js/src/test/output/Simple.txt b/driver/js/src/test/output/Simple.check similarity index 100% rename from driver/js/src/test/output/Simple.txt rename to driver/js/src/test/output/Simple.check diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 37a673f27..81bb1832b 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -48,7 +48,7 @@ object DriverDiffTests { TestOption( s"${mlscriptPath}${entryModule}.mls", s"${jsPath}${entryModule}.js", - s"${outputPath}${entryModule}.txt", + s"${outputPath}${entryModule}.check", expectError ) From ff84ee225c40253af6c2ea0cbcf8e5dbb62ec57b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 14 Apr 2023 18:08:22 +0800 Subject: [PATCH 028/202] Update ts2mls --- .vscode/settings.json | 3 +- .../src/test/diff/{Array.d.mls => Array.mlsi} | 2 +- ...sicFunctions.d.mls => BasicFunctions.mlsi} | 6 +-- .../{ClassMember.d.mls => ClassMember.mlsi} | 2 +- .../js/src/test/diff/{Dec.d.mls => Dec.mlsi} | 2 +- .../src/test/diff/{Enum.d.mls => Enum.mlsi} | 2 +- .../diff/{Heritage.d.mls => Heritage.mlsi} | 2 +- ...HighOrderFunc.d.mls => HighOrderFunc.mlsi} | 0 ...rfaceMember.d.mls => InterfaceMember.mlsi} | 2 +- .../{Intersection.d.mls => Intersection.mlsi} | 2 +- .../test/diff/{Literal.d.mls => Literal.mlsi} | 0 .../{MultiFiles.d.mls => MultiFiles.mlsi} | 2 +- .../diff/{Namespace.d.mls => Namespace.mlsi} | 2 +- .../diff/{Optional.d.mls => Optional.mlsi} | 2 +- .../diff/{Overload.d.mls => Overload.mlsi} | 2 +- .../src/test/diff/{Tuple.d.mls => Tuple.mlsi} | 2 +- .../src/test/diff/{Type.d.mls => Type.mlsi} | 2 +- ...TypeParameter.d.mls => TypeParameter.mlsi} | 0 .../src/test/diff/{Union.d.mls => Union.mlsi} | 2 +- .../diff/{Variables.d.mls => Variables.mlsi} | 2 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 38 +++++++++---------- .../js/src/test/typescript/BasicFunctions.ts | 2 +- 22 files changed, 40 insertions(+), 39 deletions(-) rename ts2mls/js/src/test/diff/{Array.d.mls => Array.mlsi} (84%) rename ts2mls/js/src/test/diff/{BasicFunctions.d.mls => BasicFunctions.mlsi} (68%) rename ts2mls/js/src/test/diff/{ClassMember.d.mls => ClassMember.mlsi} (76%) rename ts2mls/js/src/test/diff/{Dec.d.mls => Dec.mlsi} (70%) rename ts2mls/js/src/test/diff/{Enum.d.mls => Enum.mlsi} (67%) rename ts2mls/js/src/test/diff/{Heritage.d.mls => Heritage.mlsi} (79%) rename ts2mls/js/src/test/diff/{HighOrderFunc.d.mls => HighOrderFunc.mlsi} (100%) rename ts2mls/js/src/test/diff/{InterfaceMember.d.mls => InterfaceMember.mlsi} (74%) rename ts2mls/js/src/test/diff/{Intersection.d.mls => Intersection.mlsi} (72%) rename ts2mls/js/src/test/diff/{Literal.d.mls => Literal.mlsi} (100%) rename ts2mls/js/src/test/diff/{MultiFiles.d.mls => MultiFiles.mlsi} (81%) rename ts2mls/js/src/test/diff/{Namespace.d.mls => Namespace.mlsi} (72%) rename ts2mls/js/src/test/diff/{Optional.d.mls => Optional.mlsi} (69%) rename ts2mls/js/src/test/diff/{Overload.d.mls => Overload.mlsi} (75%) rename ts2mls/js/src/test/diff/{Tuple.d.mls => Tuple.mlsi} (71%) rename ts2mls/js/src/test/diff/{Type.d.mls => Type.mlsi} (73%) rename ts2mls/js/src/test/diff/{TypeParameter.d.mls => TypeParameter.mlsi} (100%) rename ts2mls/js/src/test/diff/{Union.d.mls => Union.mlsi} (69%) rename ts2mls/js/src/test/diff/{Variables.d.mls => Variables.mlsi} (80%) diff --git a/.vscode/settings.json b/.vscode/settings.json index 23778bfa8..b025897bc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,8 @@ { "files.associations": { "*.fun": "typescript", - "*.mls": "scala" + "*.mls": "scala", + "*.mlsi": "scala" }, "typescript.validate.enable": false, "files.watcherExclude": { diff --git a/ts2mls/js/src/test/diff/Array.d.mls b/ts2mls/js/src/test/diff/Array.mlsi similarity index 84% rename from ts2mls/js/src/test/diff/Array.d.mls rename to ts2mls/js/src/test/diff/Array.mlsi index 5fd86917f..63668598c 100644 --- a/ts2mls/js/src/test/diff/Array.d.mls +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -20,4 +20,4 @@ class Temp() { fun ta(ts: MutArray>): MutArray> fun tat(ts: MutArray>): MutArray> //│ |#fun| |first|(|x|#:| |MutArray|‹|string|›|)|#:| |string|↵|#fun| |getZero3|(||)|#:| |MutArray|‹|number|›|↵|#fun| |first2|(|fs|#:| |MutArray|‹|(|number|)| |=>| |number|›|)|#:| |(|number|)| |=>| |number|↵|#fun| |doEs|(|e|#:| |MutArray|‹|int|›|)|#:| |MutArray|‹|int|›|↵|#class| |C|(||)| |{||}|↵|#trait| |I|(||)| |{|→|#let| |i|#:| |number|←|↵|}|↵|#fun| |doCs|(|c|#:| |MutArray|‹|C|›|)|#:| |MutArray|‹|C|›|↵|#fun| |doIs|(|i|#:| |MutArray|‹|I|›|)|#:| |MutArray|‹|I|›|↵|#fun| |inter|‹|U|,| |T|›|(|x|#:| |MutArray|‹|(|U|)| |&| |(|T|)|›|)|#:| |MutArray|‹|(|U|)| |&| |(|T|)|›|↵|#fun| |clean|(|x|#:| |MutArray|‹|(|string|,| |number|,| |)|›|)|#:| |MutArray|‹|(|string|,| |number|,| |)|›|↵|#fun| |translate|‹|T|,| |U|›|(|x|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|U|›|↵|#fun| |uu|(|x|#:| |MutArray|‹|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|›|)|#:| |MutArray|‹|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|›|↵|#class| |Temp|‹|T|›|(||)| |{|→|#let| |x|#:| |T|←|↵|}|↵|#fun| |ta|(|ts|#:| |MutArray|‹|Temp|‹|(|false|)| ||| |(|true|)|›|›|)|#:| |MutArray|‹|Temp|‹|(|false|)| ||| |(|true|)|›|›|↵|#fun| |tat|‹|T|›|(|ts|#:| |MutArray|‹|Temp|‹|T|›|›|)|#:| |MutArray|‹|Temp|‹|T|›|›| -//│ Parsed: {fun first: (x: MutArray[string],) -> string; fun getZero3: () -> MutArray[number]; fun first2: (fs: MutArray[number -> number],) -> number -> number; fun doEs: (e: MutArray[int],) -> MutArray[int]; class C() {}; trait I() {let i: number}; fun doCs: (c: MutArray[C],) -> MutArray[C]; fun doIs: (i: MutArray[I],) -> MutArray[I]; fun inter: (x: MutArray[(U,) & (T,)],) -> MutArray[(U,) & (T,)]; fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)]; fun translate: (x: MutArray[T],) -> MutArray[U]; fun uu: (x: MutArray[((number,) | (false,),) | (true,)],) -> MutArray[((number,) | (false,),) | (true,)]; class Temp‹T›() {let x: T}; fun ta: (ts: MutArray[Temp[(false,) | (true,)]],) -> MutArray[Temp[(false,) | (true,)]]; fun tat: (ts: MutArray[Temp[T]],) -> MutArray[Temp[T]]} +//│ Parsed: {fun first: (x: MutArray[string],) -> string; fun getZero3: () -> MutArray[number]; fun first2: (fs: MutArray[number -> number],) -> number -> number; fun doEs: (e: MutArray[int],) -> MutArray[int]; class C() {}; trait I() {let i: number}; fun doCs: (c: MutArray[C],) -> MutArray[C]; fun doIs: (i: MutArray[I],) -> MutArray[I]; fun inter: (x: MutArray[U & T],) -> MutArray[U & T]; fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)]; fun translate: (x: MutArray[T],) -> MutArray[U]; fun uu: (x: MutArray[number | false | true],) -> MutArray[number | false | true]; class Temp‹T›() {let x: T}; fun ta: (ts: MutArray[Temp[bool]],) -> MutArray[Temp[bool]]; fun tat: (ts: MutArray[Temp[T]],) -> MutArray[Temp[T]]} diff --git a/ts2mls/js/src/test/diff/BasicFunctions.d.mls b/ts2mls/js/src/test/diff/BasicFunctions.mlsi similarity index 68% rename from ts2mls/js/src/test/diff/BasicFunctions.d.mls rename to ts2mls/js/src/test/diff/BasicFunctions.mlsi index 2c68fdee0..791152e8b 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.d.mls +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -18,11 +18,11 @@ class Foooooo() { let ooooooo: number } fun inn(f: Foooooo): unit -fun out(): Foooooo +fun out1(): Foooooo trait Barrrrrrrrr() { let rrrrrrr: number } fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr -//│ |#fun| |hello|(||)|#:| |unit|↵|#fun| |add|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |sub|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |foo|(||)|#:| |number|↵|#fun| |id|(|x|#:| |anything|)|#:| |anything|↵|#fun| |odd|(|x|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isnull|(|x|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |bar|(||)|#:| |anything|↵|#fun| |nu|(|n|#:| |null|)|#:| |null|↵|#fun| |un|(|n|#:| |undefined|)|#:| |undefined|↵|#fun| |fail|(||)|#:| |nothing|↵|#fun| |create|(||)|#:| |object|↵|#fun| |pa|(|x|#:| |number|)|#:| |number|↵|#fun| |wtf|(|x|#:| |anything|)|#:| |unit|↵|#class| |Foooooo|(||)| |{|→|#let| |ooooooo|#:| |number|←|↵|}|↵|#fun| |inn|(|f|#:| |Foooooo|)|#:| |unit|↵|#fun| |out|(||)|#:| |Foooooo|↵|#trait| |Barrrrrrrrr|(||)| |{|→|#let| |rrrrrrr|#:| |number|←|↵|}|↵|#fun| |inn2|(|b|#:| |Barrrrrrrrr|)|#:| |unit|↵|#fun| |out2|(||)|#:| |Barrrrrrrrr| -//│ Parsed: {fun hello: () -> unit; fun add: (x: number, y: number,) -> number; fun sub: (x: number, y: number,) -> number; fun foo: () -> number; fun id: (x: anything,) -> anything; fun odd: (x: number,) -> ((false,) | (true,)); fun isnull: (x: anything,) -> ((false,) | (true,)); fun bar: () -> anything; fun nu: (n: null,) -> null; fun un: (n: undefined,) -> undefined; fun fail: () -> nothing; fun create: () -> object; fun pa: (x: number,) -> number; fun wtf: (x: anything,) -> unit; class Foooooo() {let ooooooo: number}; fun inn: (f: Foooooo,) -> unit; fun out: () -> Foooooo; trait Barrrrrrrrr() {let rrrrrrr: number}; fun inn2: (b: Barrrrrrrrr,) -> unit; fun out2: () -> Barrrrrrrrr} +//│ |#fun| |hello|(||)|#:| |unit|↵|#fun| |add|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |sub|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |foo|(||)|#:| |number|↵|#fun| |id|(|x|#:| |anything|)|#:| |anything|↵|#fun| |odd|(|x|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isnull|(|x|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |bar|(||)|#:| |anything|↵|#fun| |nu|(|n|#:| |null|)|#:| |null|↵|#fun| |un|(|n|#:| |undefined|)|#:| |undefined|↵|#fun| |fail|(||)|#:| |nothing|↵|#fun| |create|(||)|#:| |object|↵|#fun| |pa|(|x|#:| |number|)|#:| |number|↵|#fun| |wtf|(|x|#:| |anything|)|#:| |unit|↵|#class| |Foooooo|(||)| |{|→|#let| |ooooooo|#:| |number|←|↵|}|↵|#fun| |inn|(|f|#:| |Foooooo|)|#:| |unit|↵|#fun| |out1|(||)|#:| |Foooooo|↵|#trait| |Barrrrrrrrr|(||)| |{|→|#let| |rrrrrrr|#:| |number|←|↵|}|↵|#fun| |inn2|(|b|#:| |Barrrrrrrrr|)|#:| |unit|↵|#fun| |out2|(||)|#:| |Barrrrrrrrr| +//│ Parsed: {fun hello: () -> unit; fun add: (x: number, y: number,) -> number; fun sub: (x: number, y: number,) -> number; fun foo: () -> number; fun id: (x: anything,) -> anything; fun odd: (x: number,) -> bool; fun isnull: (x: anything,) -> bool; fun bar: () -> anything; fun nu: (n: null,) -> null; fun un: (n: undefined,) -> undefined; fun fail: () -> nothing; fun create: () -> object; fun pa: (x: number,) -> number; fun wtf: (x: anything,) -> unit; class Foooooo() {let ooooooo: number}; fun inn: (f: Foooooo,) -> unit; fun out1: () -> Foooooo; trait Barrrrrrrrr() {let rrrrrrr: number}; fun inn2: (b: Barrrrrrrrr,) -> unit; fun out2: () -> Barrrrrrrrr} diff --git a/ts2mls/js/src/test/diff/ClassMember.d.mls b/ts2mls/js/src/test/diff/ClassMember.mlsi similarity index 76% rename from ts2mls/js/src/test/diff/ClassMember.d.mls rename to ts2mls/js/src/test/diff/ClassMember.mlsi index 06a8f40a8..f76a85294 100644 --- a/ts2mls/js/src/test/diff/ClassMember.d.mls +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -22,4 +22,4 @@ class TTT() { fun ttt2(x: T): T } //│ |#class| |Student|(|s|#:| |string|,| |age|#:| |number|)| |{|→|#let| |name|#:| |string|↵|#fun| |isFriend|(|other|#:| |Student|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |addScore|(|sub|#:| |string|,| |score|#:| |number|)|#:| |unit|↵|#fun| |getID|(||)|#:| |number|←|↵|}|↵|#class| |Foo|‹|T|›|(||)| |{|→|#fun| |bar|(|x|#:| |T|)|#:| |unit|←|↵|}|↵|#class| |EZ|(||)| |{|→|#fun| |inc|(|x|#:| |number|)|#:| |number|←|↵|}|↵|#class| |Outer|(||)| |{|→|#class| |Inner|(||)| |{|→|#let| |a|#:| |number|←|↵|}|←|↵|}|↵|#class| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|↵|#fun| |ttt2|(|x|#:| |T|)|#:| |T|←|↵|}| -//│ Parsed: {class Student(s: string, age: number,) {let name: string; fun isFriend: (other: Student,) -> ((false,) | (true,)); fun addScore: (sub: string, score: number,) -> unit; fun getID: () -> number}; class Foo‹T›() {fun bar: (x: T,) -> unit}; class EZ() {fun inc: (x: number,) -> number}; class Outer() {class Inner() {let a: number}}; class TTT‹T›() {fun ttt: (x: T,) -> T; fun ttt2: (x: T,) -> T}} +//│ Parsed: {class Student(s: string, age: number,) {let name: string; fun isFriend: (other: Student,) -> bool; fun addScore: (sub: string, score: number,) -> unit; fun getID: () -> number}; class Foo‹T›() {fun bar: (x: T,) -> unit}; class EZ() {fun inc: (x: number,) -> number}; class Outer() {class Inner() {let a: number}}; class TTT‹T›() {fun ttt: (x: T,) -> T; fun ttt2: (x: T,) -> T}} diff --git a/ts2mls/js/src/test/diff/Dec.d.mls b/ts2mls/js/src/test/diff/Dec.mlsi similarity index 70% rename from ts2mls/js/src/test/diff/Dec.d.mls rename to ts2mls/js/src/test/diff/Dec.mlsi index d6f9857c1..2506d3195 100644 --- a/ts2mls/js/src/test/diff/Dec.d.mls +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -11,4 +11,4 @@ class Person(name: string, age: number) { namespace OOO { } //│ |#fun| |getName|(|id|#:| |(|string|)| ||| |(|number|)|)|#:| |string|↵|#fun| |render|(|callback|#:| |(|unit| |=>| |unit|)| ||| |(|undefined|)|)|#:| |string|↵|#trait| |Get|(||)| |{|→|#fun| |__call|(|id|#:| |string|)|#:| |string|←|↵|}|↵|#class| |Person|(|name|#:| |string|,| |age|#:| |number|)| |{|→|#fun| |getName|(|id|#:| |number|)|#:| |string|←|↵|}|↵|#namespace| |OOO| |{|↵|}| -//│ Parsed: {fun getName: (id: (string,) | (number,),) -> string; fun render: (callback: (unit -> unit,) | (undefined,),) -> string; trait Get() {fun __call: (id: string,) -> string}; class Person(name: string, age: number,) {fun getName: (id: number,) -> string}; namespace OOO() {}} +//│ Parsed: {fun getName: (id: string | number,) -> string; fun render: (callback: unit -> unit | undefined,) -> string; trait Get() {fun __call: (id: string,) -> string}; class Person(name: string, age: number,) {fun getName: (id: number,) -> string}; module OOO() {}} diff --git a/ts2mls/js/src/test/diff/Enum.d.mls b/ts2mls/js/src/test/diff/Enum.mlsi similarity index 67% rename from ts2mls/js/src/test/diff/Enum.d.mls rename to ts2mls/js/src/test/diff/Enum.mlsi index 639bf9aae..2915b85cc 100644 --- a/ts2mls/js/src/test/diff/Enum.d.mls +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -4,4 +4,4 @@ fun pass(c: int): (false) | (true) fun stop(): int fun g(x: int): int //│ |#fun| |pass|(|c|#:| |int|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |stop|(||)|#:| |int|↵|#fun| |g|(|x|#:| |int|)|#:| |int| -//│ Parsed: {fun pass: (c: int,) -> ((false,) | (true,)); fun stop: () -> int; fun g: (x: int,) -> int} +//│ Parsed: {fun pass: (c: int,) -> bool; fun stop: () -> int; fun g: (x: int,) -> int} diff --git a/ts2mls/js/src/test/diff/Heritage.d.mls b/ts2mls/js/src/test/diff/Heritage.mlsi similarity index 79% rename from ts2mls/js/src/test/diff/Heritage.d.mls rename to ts2mls/js/src/test/diff/Heritage.mlsi index 34b56a6b6..68dba08a1 100644 --- a/ts2mls/js/src/test/diff/Heritage.d.mls +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -41,4 +41,4 @@ namespace Five { } class Y(): Five.ROTK {} //│ |#class| |A|(||)| |{|→|#fun| |foo|(||)|#:| |unit|←|↵|}|↵|#class| |B|(||)|#:| |A| |{||}|↵|#class| |C|‹|T|›|(||)| |{|→|#fun| |set|(|x|#:| |T|)|#:| |unit|↵|#fun| |get|(||)|#:| |T|←|↵|}|↵|#class| |D|(||)|#:| |C|‹|number|›| |{||}|↵|#trait| |Wu|(||)| |{|→|#let| |x|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#class| |WuWu|(||)|#:| |Wu| |{|→|#let| |y|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |WuWuWu|(||)|#:| |WuWu| |{|→|#let| |z|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |Never|(||)|#:| |WuWuWu| |{|→|#fun| |w|(||)|#:| |nothing|←|↵|}|↵|#class| |VG|‹|T|›|(||)| |{|→|#let| |x|#:| |T|←|↵|}|↵|#class| |Home|‹|T|›|(||)|#:| |VG|‹|string|›| |{|→|#let| |y|#:| |T|←|↵|}|↵|#trait| |O|‹|I|›|(||)| |{|→|#fun| |xx|(|x|#:| |I|)|#:| |I|←|↵|}|↵|#class| |OR|‹|R|›|(||)|#:| |O|‹|R|›| |{|→|#fun| |xx|(|x|#:| |R|)|#:| |R|←|↵|}|↵|#namespace| |Five| |{|→|#class| |ROTK|(||)| |{|→|#let| |wu|#:| |string|←|↵|}|↵|#class| |Y|(||)|#:| |Five|.ROTK| |{||}|←|↵|}|↵|#class| |Y|(||)|#:| |Five|.ROTK| |{||}| -//│ Parsed: {class A() {fun foo: () -> unit}; class B(): A {}; class C‹T›() {fun set: (x: T,) -> unit; fun get: () -> T}; class D(): C‹number› {}; trait Wu() {let x: (false,) | (true,)}; class WuWu(): Wu {let y: (false,) | (true,)}; trait WuWuWu(): WuWu {let z: (false,) | (true,)}; trait Never(): WuWuWu {fun w: () -> nothing}; class VG‹T›() {let x: T}; class Home‹T›(): VG‹string› {let y: T}; trait O‹I›() {fun xx: (x: I,) -> I}; class OR‹R›(): O‹R› {fun xx: (x: R,) -> R}; namespace Five() {class ROTK() {let wu: string}; class Y(): (Five).ROTK {}}; class Y(): (Five).ROTK {}} +//│ Parsed: {class A() {fun foo: () -> unit}; class B(): A {}; class C‹T›() {fun set: (x: T,) -> unit; fun get: () -> T}; class D(): C[number] {}; trait Wu() {let x: bool}; class WuWu(): Wu {let y: bool}; trait WuWuWu(): WuWu {let z: bool}; trait Never(): WuWuWu {fun w: () -> nothing}; class VG‹T›() {let x: T}; class Home‹T›(): VG[string] {let y: T}; trait O‹I›() {fun xx: (x: I,) -> I}; class OR‹R›(): O[R] {fun xx: (x: R,) -> R}; module Five() {class ROTK() {let wu: string}; class Y(): Five.ROTK {}}; class Y(): Five.ROTK {}} diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.d.mls b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi similarity index 100% rename from ts2mls/js/src/test/diff/HighOrderFunc.d.mls rename to ts2mls/js/src/test/diff/HighOrderFunc.mlsi diff --git a/ts2mls/js/src/test/diff/InterfaceMember.d.mls b/ts2mls/js/src/test/diff/InterfaceMember.mlsi similarity index 74% rename from ts2mls/js/src/test/diff/InterfaceMember.d.mls rename to ts2mls/js/src/test/diff/InterfaceMember.mlsi index 252b3f0e9..5eda9179e 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.d.mls +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -37,4 +37,4 @@ trait TTT() { fun ttt(x: T): T } //│ |#trait| |IFoo|(||)| |{|→|#let| |a|#:| |string|↵|#fun| |b|(|x|#:| |number|)|#:| |number|↵|#fun| |c|(||)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |d|(|x|#:| |string|)|#:| |unit|←|↵|}|↵|#trait| |II|‹|T|›|(||)| |{|→|#fun| |test|(|x|#:| |T|)|#:| |number|←|↵|}|↵|#fun| |create|(||)|#:| |{|v|#:| |number|,|}|↵|#fun| |get|(|x|#:| |{|t|#:| |string|,|}|)|#:| |string|↵|#trait| |IEvent|(||)| |{|→|#fun| |callback|(||)|#:| |(|number|)| |=>| |unit|←|↵|}|↵|#trait| |SearchFunc|(||)| |{|→|#fun| |__call|(|source|#:| |string|,| |subString|#:| |string|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |StringArray|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |string|←|↵|}|↵|#trait| |Counter|(||)| |{|→|#fun| |__call|(|start|#:| |number|)|#:| |string|↵|#let| |interval|#:| |number|↵|#fun| |reset|(||)|#:| |unit|←|↵|}|↵|#trait| |Simple|(||)| |{|→|#let| |a|#:| |number|↵|#fun| |b|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |string|←|↵|}|↵|#trait| |Simple2|‹|T|›|(||)| |{|→|#let| |abc|#:| |T|←|↵|}|↵|#trait| |Next|(||)|#:| |Simple| |{||}|↵|#trait| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|←|↵|}| -//│ Parsed: {trait IFoo() {let a: string; fun b: (x: number,) -> number; fun c: () -> ((false,) | (true,)); fun d: (x: string,) -> unit}; trait II‹T›() {fun test: (x: T,) -> number}; fun create: () -> {v: number}; fun get: (x: {t: string},) -> string; trait IEvent() {fun callback: () -> number -> unit}; trait SearchFunc() {fun __call: (source: string, subString: string,) -> ((false,) | (true,))}; trait StringArray() {fun __index: (index: number,) -> string}; trait Counter() {fun __call: (start: number,) -> string; let interval: number; fun reset: () -> unit}; trait Simple() {let a: number; fun b: (x: (false,) | (true,),) -> string}; trait Simple2‹T›() {let abc: T}; trait Next(): Simple {}; trait TTT‹T›() {fun ttt: (x: T,) -> T}} +//│ Parsed: {trait IFoo() {let a: string; fun b: (x: number,) -> number; fun c: () -> bool; fun d: (x: string,) -> unit}; trait II‹T›() {fun test: (x: T,) -> number}; fun create: () -> {v: number}; fun get: (x: {t: string},) -> string; trait IEvent() {fun callback: () -> number -> unit}; trait SearchFunc() {fun __call: (source: string, subString: string,) -> bool}; trait StringArray() {fun __index: (index: number,) -> string}; trait Counter() {fun __call: (start: number,) -> string; let interval: number; fun reset: () -> unit}; trait Simple() {let a: number; fun b: (x: bool,) -> string}; trait Simple2‹T›() {let abc: T}; trait Next(): Simple {}; trait TTT‹T›() {fun ttt: (x: T,) -> T}} diff --git a/ts2mls/js/src/test/diff/Intersection.d.mls b/ts2mls/js/src/test/diff/Intersection.mlsi similarity index 72% rename from ts2mls/js/src/test/diff/Intersection.d.mls rename to ts2mls/js/src/test/diff/Intersection.mlsi index b9e532b6b..033f4ff1e 100644 --- a/ts2mls/js/src/test/diff/Intersection.d.mls +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -18,4 +18,4 @@ class A() {} class B() {} fun inter(c: (A) & (B)): (A) & (B) //│ |#fun| |extend|‹|T|,| |U|›|(|first|#:| |T|,| |second|#:| |U|)|#:| |(|T|)| |&| |(|U|)|↵|#fun| |foo|‹|T|,| |U|›|(|x|#:| |(|T|)| |&| |(|U|)|)|#:| |unit|↵|#fun| |over|(|f|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|object|)| |=>| |string|)|)|#:| |string|↵|#trait| |IA|(||)| |{|→|#let| |x|#:| |number|←|↵|}|↵|#trait| |IB|(||)| |{|→|#let| |y|#:| |number|←|↵|}|↵|#fun| |iii|(|x|#:| |(|IA|)| |&| |(|IB|)|)|#:| |(|IA|)| |&| |(|IB|)|↵|#fun| |uu|‹|U|,| |V|,| |T|,| |P|›|(|x|#:| |(|(|(|(|U|)| |&| |(|T|)|)| ||| |(|(|U|)| |&| |(|P|)|)|)| ||| |(|(|V|)| |&| |(|T|)|)|)| ||| |(|(|V|)| |&| |(|P|)|)|)|#:| |(|(|(|(|U|)| |&| |(|T|)|)| ||| |(|(|U|)| |&| |(|P|)|)|)| ||| |(|(|V|)| |&| |(|T|)|)|)| ||| |(|(|V|)| |&| |(|P|)|)|↵|#fun| |iiii|‹|U|,| |T|,| |V|›|(|x|#:| |(|(|U|)| |&| |(|T|)|)| |&| |(|V|)|)|#:| |(|(|U|)| |&| |(|T|)|)| |&| |(|V|)|↵|#fun| |arr|‹|U|,| |T|›|(|a|#:| |(|MutArray|‹|U|›|)| |&| |(|MutArray|‹|T|›|)|)|#:| |(|MutArray|‹|U|›|)| |&| |(|MutArray|‹|T|›|)|↵|#fun| |tt|‹|U|,| |T|,| |V|›|(|x|#:| |(|(|U|,| |T|,| |)|)| |&| |(|(|V|,| |V|,| |)|)|)|#:| |(|(|U|,| |T|,| |)|)| |&| |(|(|V|,| |V|,| |)|)|↵|#class| |A|(||)| |{||}|↵|#class| |B|(||)| |{||}|↵|#fun| |inter|(|c|#:| |(|A|)| |&| |(|B|)|)|#:| |(|A|)| |&| |(|B|)| -//│ Parsed: {fun extend: (first: T, second: U,) -> ((T,) & (U,)); fun foo: (x: (T,) & (U,),) -> unit; fun over: (f: (number -> string,) & (object -> string,),) -> string; trait IA() {let x: number}; trait IB() {let y: number}; fun iii: (x: (IA,) & (IB,),) -> ((IA,) & (IB,)); fun uu: (x: ((((U,) & (T,),) | ((U,) & (P,),),) | ((V,) & (T,),),) | ((V,) & (P,),),) -> (((((U,) & (T,),) | ((U,) & (P,),),) | ((V,) & (T,),),) | ((V,) & (P,),)); fun iiii: (x: ((U,) & (T,),) & (V,),) -> (((U,) & (T,),) & (V,)); fun arr: (a: (MutArray[U],) & (MutArray[T],),) -> ((MutArray[U],) & (MutArray[T],)); fun tt: (x: ((U, T,),) & ((V, V,),),) -> (((U, T,),) & ((V, V,),)); class A() {}; class B() {}; fun inter: (c: (A,) & (B,),) -> ((A,) & (B,))} +//│ Parsed: {fun extend: (first: T, second: U,) -> (T & U); fun foo: (x: T & U,) -> unit; fun over: (f: number -> string & object -> string,) -> string; trait IA() {let x: number}; trait IB() {let y: number}; fun iii: (x: IA & IB,) -> (IA & IB); fun uu: (x: U & T | U & P | V & T | V & P,) -> (U & T | U & P | V & T | V & P); fun iiii: (x: U & T & V,) -> (U & T & V); fun arr: (a: MutArray[U] & MutArray[T],) -> (MutArray[U] & MutArray[T]); fun tt: (x: (U, T,) & (V, V,),) -> ((U, T,) & (V, V,)); class A() {}; class B() {}; fun inter: (c: A & B,) -> (A & B)} diff --git a/ts2mls/js/src/test/diff/Literal.d.mls b/ts2mls/js/src/test/diff/Literal.mlsi similarity index 100% rename from ts2mls/js/src/test/diff/Literal.d.mls rename to ts2mls/js/src/test/diff/Literal.mlsi diff --git a/ts2mls/js/src/test/diff/MultiFiles.d.mls b/ts2mls/js/src/test/diff/MultiFiles.mlsi similarity index 81% rename from ts2mls/js/src/test/diff/MultiFiles.d.mls rename to ts2mls/js/src/test/diff/MultiFiles.mlsi index e2d44c0bb..21007ede7 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.d.mls +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -19,4 +19,4 @@ trait Base() { class AnotherFoo(): AnotherBase {} fun multi5(): unit //│ |#fun| |multi1|(|x|#:| |number|)|#:| |number|↵|#fun| |multi3|(||)|#:| |unit|↵|#class| |Foo|(||)|#:| |Base| |{||}|↵|#trait| |AnotherBase|(||)| |{|→|#let| |y|#:| |string|←|↵|}|↵|#namespace| |N| |{|→|#fun| |f|(||)|#:| |unit|↵|#fun| |g|(||)|#:| |unit|↵|#fun| |h|(||)|#:| |unit|←|↵|}|↵|#fun| |multi2|(|x|#:| |string|)|#:| |string|↵|#fun| |multi4|(||)|#:| |unit|↵|#trait| |Base|(||)| |{|→|#let| |a|#:| |number|←|↵|}|↵|#class| |AnotherFoo|(||)|#:| |AnotherBase| |{||}|↵|#fun| |multi5|(||)|#:| |unit| -//│ Parsed: {fun multi1: (x: number,) -> number; fun multi3: () -> unit; class Foo(): Base {}; trait AnotherBase() {let y: string}; namespace N() {fun f: () -> unit; fun g: () -> unit; fun h: () -> unit}; fun multi2: (x: string,) -> string; fun multi4: () -> unit; trait Base() {let a: number}; class AnotherFoo(): AnotherBase {}; fun multi5: () -> unit} +//│ Parsed: {fun multi1: (x: number,) -> number; fun multi3: () -> unit; class Foo(): Base {}; trait AnotherBase() {let y: string}; module N() {fun f: () -> unit; fun g: () -> unit; fun h: () -> unit}; fun multi2: (x: string,) -> string; fun multi4: () -> unit; trait Base() {let a: number}; class AnotherFoo(): AnotherBase {}; fun multi5: () -> unit} diff --git a/ts2mls/js/src/test/diff/Namespace.d.mls b/ts2mls/js/src/test/diff/Namespace.mlsi similarity index 72% rename from ts2mls/js/src/test/diff/Namespace.d.mls rename to ts2mls/js/src/test/diff/Namespace.mlsi index 04d4d8176..1f0901ea6 100644 --- a/ts2mls/js/src/test/diff/Namespace.d.mls +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -29,4 +29,4 @@ namespace AA { fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C //│ |#namespace| |N1| |{|→|#fun| |f|(|x|#:| |anything|)|#:| |number|↵|#fun| |ff|(|y|#:| |anything|)|#:| |number|↵|#class| |C|(||)| |{|→|#fun| |f|(||)|#:| |unit|←|↵|}|↵|#trait| |I|(||)| |{|→|#fun| |f|(||)|#:| |number|←|↵|}|↵|#namespace| |N2| |{|→|#fun| |fff|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |number|↵|#fun| |gg|(|c|#:| |N1|.C|)|#:| |N1|.C|↵|#class| |BBB|(||)|#:| |N1|.C| |{||}|←|↵|}|←|↵|}|↵|#namespace| |AA| |{|→|#fun| |f|(|x|#:| |anything|)|#:| |string|↵|#class| |C|(||)| |{|→|#fun| |f|(||)|#:| |unit|←|↵|}|↵|#trait| |I|(||)| |{|→|#fun| |f|(||)|#:| |number|←|↵|}|↵|#namespace| |N2| |{|↵|}|←|↵|}|↵|#fun| |f1|(|x|#:| |N1|.C|)|#:| |N1|.C|↵|#fun| |f2|(|x|#:| |AA|.C|)|#:| |AA|.C| -//│ Parsed: {namespace N1() {fun f: (x: anything,) -> number; fun ff: (y: anything,) -> number; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; namespace N2() {fun fff: (x: (false,) | (true,),) -> number; fun gg: (c: N1.C,) -> N1.C; class BBB(): (N1).C {}}}; namespace AA() {fun f: (x: anything,) -> string; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; namespace N2() {}}; fun f1: (x: N1.C,) -> N1.C; fun f2: (x: AA.C,) -> AA.C} +//│ Parsed: {module N1() {fun f: (x: anything,) -> number; fun ff: (y: anything,) -> number; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; module N2() {fun fff: (x: bool,) -> number; fun gg: (c: N1.C,) -> N1.C; class BBB(): N1.C {}}}; module AA() {fun f: (x: anything,) -> string; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; module N2() {}}; fun f1: (x: N1.C,) -> N1.C; fun f2: (x: AA.C,) -> AA.C} diff --git a/ts2mls/js/src/test/diff/Optional.d.mls b/ts2mls/js/src/test/diff/Optional.mlsi similarity index 69% rename from ts2mls/js/src/test/diff/Optional.d.mls rename to ts2mls/js/src/test/diff/Optional.mlsi index dbcf0d2a1..07ea8fa40 100644 --- a/ts2mls/js/src/test/diff/Optional.d.mls +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -21,4 +21,4 @@ class B() { } fun boom(b: (B) | (undefined)): anything //│ |#fun| |buildName|(|firstName|#:| |string|,| |lastName|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |buildName2|(|firstName|#:| |string|,| |lastName|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |buildName3|(|firstName|#:| |string|,| |lastName|#:| |MutArray|‹|string|›|)|#:| |string|↵|#fun| |buildName4|(|firstName|#:| |string|,| |lastName|#:| |MutArray|‹|anything|›|)|#:| |string|↵|#trait| |SquareConfig|(||)| |{|→|#let| |color|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |width|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#fun| |did|(|x|#:| |number|,| |f|#:| |(|(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |getOrElse|(|arr|#:| |(|MutArray|‹|object|›|)| ||| |(|undefined|)|)|#:| |object|↵|#class| |ABC|(||)| |{||}|↵|#fun| |testABC|(|abc|#:| |(|ABC|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |testSquareConfig|(|conf|#:| |(|SquareConfig|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |err|(|msg|#:| |(|(|number|,| |string|,| |)|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toStr|(|x|#:| |(|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |boo|‹|T|,| |U|›|(|x|#:| |(|(|T|)| |&| |(|U|)|)| ||| |(|undefined|)|)|#:| |unit|↵|#class| |B|‹|T|›|(||)| |{|→|#let| |b|#:| |T|←|↵|}|↵|#fun| |boom|(|b|#:| |(|B|‹|nothing|›|)| ||| |(|undefined|)|)|#:| |anything| -//│ Parsed: {fun buildName: (firstName: string, lastName: (string,) | (undefined,),) -> string; fun buildName2: (firstName: string, lastName: (string,) | (undefined,),) -> string; fun buildName3: (firstName: string, lastName: MutArray[string],) -> string; fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string; trait SquareConfig() {let color: (string,) | (undefined,); let width: (number,) | (undefined,)}; fun did: (x: number, f: (number -> number,) | (undefined,),) -> number; fun getOrElse: (arr: (MutArray[object],) | (undefined,),) -> object; class ABC() {}; fun testABC: (abc: (ABC,) | (undefined,),) -> unit; fun testSquareConfig: (conf: (SquareConfig,) | (undefined,),) -> unit; fun err: (msg: ((number, string,),) | (undefined,),) -> unit; fun toStr: (x: (((number,) | (false,),) | (true,),) | (undefined,),) -> string; fun boo: (x: ((T,) & (U,),) | (undefined,),) -> unit; class B‹T›() {let b: T}; fun boom: (b: (B[nothing],) | (undefined,),) -> anything} +//│ Parsed: {fun buildName: (firstName: string, lastName: string | undefined,) -> string; fun buildName2: (firstName: string, lastName: string | undefined,) -> string; fun buildName3: (firstName: string, lastName: MutArray[string],) -> string; fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string; trait SquareConfig() {let color: string | undefined; let width: number | undefined}; fun did: (x: number, f: number -> number | undefined,) -> number; fun getOrElse: (arr: MutArray[object] | undefined,) -> object; class ABC() {}; fun testABC: (abc: ABC | undefined,) -> unit; fun testSquareConfig: (conf: SquareConfig | undefined,) -> unit; fun err: (msg: (number, string,) | undefined,) -> unit; fun toStr: (x: number | false | true | undefined,) -> string; fun boo: (x: T & U | undefined,) -> unit; class B‹T›() {let b: T}; fun boom: (b: B[nothing] | undefined,) -> anything} diff --git a/ts2mls/js/src/test/diff/Overload.d.mls b/ts2mls/js/src/test/diff/Overload.mlsi similarity index 75% rename from ts2mls/js/src/test/diff/Overload.d.mls rename to ts2mls/js/src/test/diff/Overload.mlsi index 0e89921fd..c68fd6716 100644 --- a/ts2mls/js/src/test/diff/Overload.d.mls +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -23,4 +23,4 @@ class WWW() { } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ //│ |#fun| |f|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|string|)| |=>| |string|)|↵|#class| |M|(||)| |{|→|#let| |foo|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|string|)| |=>| |string|)|←|↵|}|↵|#fun| |app|#:| |(|(|(|string|)| |=>| |unit|)| |=>| |(|number|)| |=>| |unit|)| |&| |(|(|(|string|)| |=>| |unit|)| |=>| |(|string|)| |=>| |unit|)|↵|#fun| |create|#:| |(|(|number|)| |=>| |unit| |=>| |(|false|)| ||| |(|true|)|)| |&| |(|(|(|false|)| ||| |(|true|)|)| |=>| |unit| |=>| |(|false|)| ||| |(|true|)|)|↵|#fun| |g0|#:| |(|(|MutArray|‹|string|›|)| |=>| |string|)| |&| |(|(|MutArray|‹|object|›|)| |=>| |string|)|↵|#fun| |db|#:| |(|(|number|)| |=>| |MutArray|‹|number|›|)| |&| |(|(|object|)| |=>| |MutArray|‹|number|›|)|↵|#class| |N|(||)| |{||}|↵|#fun| |id|#:| |(|(|M|)| |=>| |unit|)| |&| |(|(|N|)| |=>| |unit|)|↵|#fun| |tst|#:| |(|(|{|z|#:| |number|,|}|)| |=>| |{|y|#:| |string|,|}|)| |&| |(|(|{|z|#:| |(|false|)| ||| |(|true|)|,|}|)| |=>| |{|y|#:| |string|,|}|)|↵|#fun| |op|#:| |(|(|number|)| |=>| |(|(|number|)| ||| |(|undefined|)|)| |=>| |unit|)| |&| |(|(|number|)| |=>| |(|(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|)| |=>| |unit|)|↵|#fun| |swap|#:| |(|(|(|number|,| |string|,| |)|)| |=>| |(|number|,| |string|,| |)|)| |&| |(|(|(|string|,| |number|,| |)|)| |=>| |(|number|,| |string|,| |)|)|↵|#fun| |u|#:| |(|(|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|)| |=>| |string|)| |&| |(|(|object|)| |=>| |string|)|↵|#fun| |doSome|‹|T|,| |U|›|(|x|#:| |anything|)|#:| |unit| |/* warning: the overload of function doSome is not supported yet. */|↵|#namespace| |XX| |{|→|#fun| |f|‹|T|›|(|x|#:| |T|,| |n|#:| |anything|)|#:| |string| |/* warning: the overload of function f is not supported yet. */|←|↵|}|↵|#class| |WWW|(||)| |{|→|#fun| |F|‹|T|›|(|x|#:| |T|)|#:| |anything| |/* warning: the overload of function F is not supported yet. */|←|↵|}|↵|#fun| |baz|(||)|#:| |anything| |/* warning: the overload of function baz is not supported yet. */| -//│ Parsed: {fun f: (number -> string,) & (string -> string,); class M() {let foo: (number -> string,) & (string -> string,)}; fun app: ((string -> unit) -> number -> unit,) & ((string -> unit) -> string -> unit,); fun create: (number -> unit -> ((false,) | (true,)),) & (((false,) | (true,)) -> unit -> ((false,) | (true,)),); fun g0: (MutArray[string] -> string,) & (MutArray[object] -> string,); fun db: (number -> MutArray[number],) & (object -> MutArray[number],); class N() {}; fun id: (M -> unit,) & (N -> unit,); fun tst: ({z: number} -> {y: string},) & ({z: (false,) | (true,)} -> {y: string},); fun op: (number -> ((number,) | (undefined,)) -> unit,) & (number -> (((false,) | (true,),) | (undefined,)) -> unit,); fun swap: ((number, string,) -> (number, string,),) & ((string, number,) -> (number, string,),); fun u: ((((number,) | (false,),) | (true,)) -> string,) & (object -> string,); fun doSome: (x: anything,) -> unit; namespace XX() {fun f: (x: T, n: anything,) -> string}; class WWW() {fun F: (x: T,) -> anything}; fun baz: () -> anything} +//│ Parsed: {fun f: number -> string & string -> string; class M() {let foo: number -> string & string -> string}; fun app: (string -> unit) -> number -> unit & (string -> unit) -> string -> unit; fun create: number -> unit -> bool & bool -> unit -> bool; fun g0: MutArray[string] -> string & MutArray[object] -> string; fun db: number -> MutArray[number] & object -> MutArray[number]; class N() {}; fun id: M -> unit & N -> unit; fun tst: {z: number} -> {y: string} & {z: bool} -> {y: string}; fun op: number -> (number | undefined) -> unit & number -> (false | true | undefined) -> unit; fun swap: (number, string,) -> (number, string,) & (string, number,) -> (number, string,); fun u: (number | false | true) -> string & object -> string; fun doSome: (x: anything,) -> unit; module XX() {fun f: (x: T, n: anything,) -> string}; class WWW() {fun F: (x: T,) -> anything}; fun baz: () -> anything} diff --git a/ts2mls/js/src/test/diff/Tuple.d.mls b/ts2mls/js/src/test/diff/Tuple.mlsi similarity index 71% rename from ts2mls/js/src/test/diff/Tuple.d.mls rename to ts2mls/js/src/test/diff/Tuple.mlsi index 551620feb..915310204 100644 --- a/ts2mls/js/src/test/diff/Tuple.d.mls +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -17,4 +17,4 @@ class A() { class B() {} fun swap(x: (A, B, )): (B, A, ) //│ |#fun| |key|(|x|#:| |(|string|,| |(|false|)| ||| |(|true|)|,| |)|)|#:| |string|↵|#fun| |value|(|x|#:| |(|string|,| |(|false|)| ||| |(|true|)|,| |)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |third|(|x|#:| |(|number|,| |number|,| |number|,| |)|)|#:| |number|↵|#fun| |vec2|(|x|#:| |number|,| |y|#:| |number|)|#:| |(|number|,| |number|,| |)|↵|#fun| |twoFunctions|(|ff|#:| |(|(|number|)| |=>| |number|,| |(|number|)| |=>| |number|,| |)|,| |x|#:| |number|)|#:| |number|↵|#fun| |tupleIt|(|x|#:| |string|)|#:| |(|unit| |=>| |string|,| |)|↵|#fun| |s|(|flag|#:| |(|false|)| ||| |(|true|)|)|#:| |(|(|string|)| ||| |(|number|)|,| |(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|,| |)|↵|#fun| |s2|(|t|#:| |(|(|false|)| ||| |(|true|)|,| |(|string|)| ||| |(|number|)|,| |)|)|#:| |(|string|)| ||| |(|number|)|↵|#fun| |ex|‹|T|,| |U|›|(|x|#:| |T|,| |y|#:| |U|)|#:| |(|T|,| |U|,| |(|T|)| |&| |(|U|)|,| |)|↵|#fun| |foo|‹|T|,| |U|›|(|x|#:| |(|(|T|)| |&| |(|U|)|,| |)|)|#:| |unit|↵|#fun| |conv|(|x|#:| |{|y|#:| |number|,|}|)|#:| |(|{|y|#:| |number|,|}|,| |{|z|#:| |string|,|}|,| |)|↵|#class| |A|(||)| |{|→|#let| |x|#:| |number|←|↵|}|↵|#class| |B|(||)| |{||}|↵|#fun| |swap|(|x|#:| |(|A|,| |B|,| |)|)|#:| |(|B|,| |A|,| |)| -//│ Parsed: {fun key: (x: (string, (false,) | (true,),),) -> string; fun value: (x: (string, (false,) | (true,),),) -> ((false,) | (true,)); fun third: (x: (number, number, number,),) -> number; fun vec2: (x: number, y: number,) -> (number, number,); fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number; fun tupleIt: (x: string,) -> (unit -> string,); fun s: (flag: (false,) | (true,),) -> ((string,) | (number,), ((number,) | (false,),) | (true,),); fun s2: (t: ((false,) | (true,), (string,) | (number,),),) -> ((string,) | (number,)); fun ex: (x: T, y: U,) -> (T, U, (T,) & (U,),); fun foo: (x: ((T,) & (U,),),) -> unit; fun conv: (x: {y: number},) -> ({y: number}, {z: string},); class A() {let x: number}; class B() {}; fun swap: (x: (A, B,),) -> (B, A,)} +//│ Parsed: {fun key: (x: (string, bool,),) -> string; fun value: (x: (string, bool,),) -> bool; fun third: (x: (number, number, number,),) -> number; fun vec2: (x: number, y: number,) -> (number, number,); fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number; fun tupleIt: (x: string,) -> unit -> string; fun s: (flag: bool,) -> (string | number, number | false | true,); fun s2: (t: (bool, string | number,),) -> (string | number); fun ex: (x: T, y: U,) -> (T, U, T & U,); fun foo: (x: T & U,) -> unit; fun conv: (x: {y: number},) -> ({y: number}, {z: string},); class A() {let x: number}; class B() {}; fun swap: (x: (A, B,),) -> (B, A,)} diff --git a/ts2mls/js/src/test/diff/Type.d.mls b/ts2mls/js/src/test/diff/Type.mlsi similarity index 73% rename from ts2mls/js/src/test/diff/Type.d.mls rename to ts2mls/js/src/test/diff/Type.mlsi index c1f448a0b..de7bc2773 100644 --- a/ts2mls/js/src/test/diff/Type.d.mls +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -29,4 +29,4 @@ type G = ABC let none: {_tag: "None",} fun some(a: A): (None) | (Some) //│ |#trait| |None|(||)| |{|→|#let| |_tag|#:| |"None"|←|↵|}|↵|#trait| |Some|‹|A|›|(||)| |{|→|#let| |_tag|#:| |"Some"|↵|#let| |value|#:| |A|←|↵|}|↵|#type| |Option|‹|A|›| |#=| |(|None|)| ||| |(|Some|‹|A|›|)|↵|#type| |Func| |#=| |(|number|)| |=>| |number|↵|#type| |S2| |#=| |(|string|,| |string|,| |)|↵|#trait| |I1|(||)| |{||}|↵|#trait| |I2|(||)| |{||}|↵|#type| |I3| |#=| |(|I1|)| |&| |(|I2|)|↵|#type| |StringArray| |#=| |Array|‹|string|›|↵|#type| |SomeInterface| |#=| |{|x|#:| |number|,|y|#:| |number|,|}|↵|#class| |ABC|(||)| |{||}|↵|#type| |DEF| |#=| |ABC|↵|#type| |TP|‹|A|,| |B|,| |C|›| |#=| |(|A|,| |B|,| |C|,| |)|↵|#namespace| |NA| |{|→|#fun| |fb|(|b|#:| |string|)|#:| |unit|↵|#type| |B| |#=| |string|←|↵|}|↵|#class| |NC|(||)| |{|→|#let| |b|#:| |string|←|↵|}|↵|#type| |G| |#=| |ABC|↵|#let| |none|#:| |{|_tag|#:| |"None"|,|}|↵|#fun| |some|‹|A|›|(|a|#:| |A|)|#:| |(|None|)| ||| |(|Some|‹|A|›|)| -//│ Parsed: {trait None() {let _tag: "None"}; trait Some‹A›() {let _tag: "Some"; let value: A}; type alias Option‹A›() = | (None,) (Some‹A›,) {}; type alias Func() = (number,) => number {}; type alias S2() = '(' string, string, ')' {}; trait I1() {}; trait I2() {}; type alias I3() = & (I1,) (I2,) {}; type alias StringArray() = Array‹string› {}; type alias SomeInterface() = '{' {x: number, y: number} '}' {}; class ABC() {}; type alias DEF() = ABC {}; type alias TP‹A, B, C›() = '(' A, B, C, ')' {}; namespace NA() {fun fb: (b: string,) -> unit; type alias B() = string {}}; class NC() {let b: string}; type alias G() = ABC {}; let none: {_tag: "None"}; fun some: (a: A,) -> ((None,) | (Some[A],))} +//│ Parsed: {trait None() {let _tag: "None"}; trait Some‹A›() {let _tag: "Some"; let value: A}; type alias Option‹A›(): None | Some[A] {}; type alias Func(): number -> number {}; type alias S2(): (string, string,) {}; trait I1() {}; trait I2() {}; type alias I3(): I1 & I2 {}; type alias StringArray(): Array[string] {}; type alias SomeInterface(): {x: number, y: number} {}; class ABC() {}; type alias DEF(): ABC {}; type alias TP‹A, B, C›(): (A, B, C,) {}; module NA() {fun fb: (b: string,) -> unit; type alias B(): string {}}; class NC() {let b: string}; type alias G(): ABC {}; let none: {_tag: "None"}; fun some: (a: A,) -> (None | Some[A])} diff --git a/ts2mls/js/src/test/diff/TypeParameter.d.mls b/ts2mls/js/src/test/diff/TypeParameter.mlsi similarity index 100% rename from ts2mls/js/src/test/diff/TypeParameter.d.mls rename to ts2mls/js/src/test/diff/TypeParameter.mlsi diff --git a/ts2mls/js/src/test/diff/Union.d.mls b/ts2mls/js/src/test/diff/Union.mlsi similarity index 69% rename from ts2mls/js/src/test/diff/Union.d.mls rename to ts2mls/js/src/test/diff/Union.mlsi index 1124713fa..511d21313 100644 --- a/ts2mls/js/src/test/diff/Union.d.mls +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -8,4 +8,4 @@ fun get2(t: ((string, string, )) | ((number, string, ))): string fun typeVar(x: (T) | (U)): (T) | (U) fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) //│ |#fun| |getString|(|x|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |test|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |(|string|)| ||| |(|number|)|↵|#fun| |run|(|f|#:| |(|(|number|)| |=>| |number|)| ||| |(|(|number|)| |=>| |string|)|)|#:| |anything|↵|#fun| |get|(|arr|#:| |(|MutArray|‹|number|›|)| ||| |(|MutArray|‹|string|›|)|)|#:| |unit|↵|#fun| |get2|(|t|#:| |(|(|string|,| |string|,| |)|)| ||| |(|(|number|,| |string|,| |)|)|)|#:| |string|↵|#fun| |typeVar|‹|T|,| |U|›|(|x|#:| |(|T|)| ||| |(|U|)|)|#:| |(|T|)| ||| |(|U|)|↵|#fun| |uuuu|(|x|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)| -//│ Parsed: {fun getString: (x: (((string,) | (number,),) | (false,),) | (true,),) -> string; fun test: (x: (false,) | (true,),) -> ((string,) | (number,)); fun run: (f: (number -> number,) | (number -> string,),) -> anything; fun get: (arr: (MutArray[number],) | (MutArray[string],),) -> unit; fun get2: (t: ((string, string,),) | ((number, string,),),) -> string; fun typeVar: (x: (T,) | (U,),) -> ((T,) | (U,)); fun uuuu: (x: (((string,) | (number,),) | (false,),) | (true,),) -> ((((string,) | (number,),) | (false,),) | (true,))} +//│ Parsed: {fun getString: (x: string | number | false | true,) -> string; fun test: (x: bool,) -> (string | number); fun run: (f: number -> number | number -> string,) -> anything; fun get: (arr: MutArray[number] | MutArray[string],) -> unit; fun get2: (t: (string, string,) | (number, string,),) -> string; fun typeVar: (x: T | U,) -> (T | U); fun uuuu: (x: string | number | false | true,) -> (string | number | false | true)} diff --git a/ts2mls/js/src/test/diff/Variables.d.mls b/ts2mls/js/src/test/diff/Variables.mlsi similarity index 80% rename from ts2mls/js/src/test/diff/Variables.d.mls rename to ts2mls/js/src/test/diff/Variables.mlsi index 178e8f1e1..fbe763c78 100644 --- a/ts2mls/js/src/test/diff/Variables.d.mls +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -15,4 +15,4 @@ namespace DD { let bar: number } //│ |#let| |URI|#:| |string|↵|#let| |URI2|#:| |string|↵|#let| |foo|#:| |number|↵|#let| |bar|#:| |false|↵|#class| |FooBar|(||)| |{||}|↵|#let| |fb|#:| |FooBar|↵|#namespace| |ABC| |{|→|#class| |DEF|(||)| |{||}|←|↵|}|↵|#let| |d|#:| |ABC|.DEF|↵|#namespace| |DD| |{|→|#let| |foo|#:| |number|↵|#let| |bar|#:| |number|←|↵|}| -//│ Parsed: {let URI: string; let URI2: string; let foo: number; let bar: false; class FooBar() {}; let fb: FooBar; namespace ABC() {class DEF() {}}; let d: ABC.DEF; namespace DD() {let foo: number; let bar: number}} +//│ Parsed: {let URI: string; let URI2: string; let foo: number; let bar: false; class FooBar() {}; let fb: FooBar; module ABC() {class DEF() {}}; let d: ABC.DEF; module DD() {let foo: number; let bar: number}} diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index b5f973f4c..c13d79611 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -18,24 +18,24 @@ object TSTypeGenerationTest { private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" private val testsData = List( - (Seq("Array.ts"), "Array.d.mls"), - (Seq("BasicFunctions.ts"), "BasicFunctions.d.mls"), - (Seq("ClassMember.ts"), "ClassMember.d.mls"), - (Seq("Dec.d.ts"), "Dec.d.mls"), - (Seq("Enum.ts"), "Enum.d.mls"), - (Seq("Heritage.ts"), "Heritage.d.mls"), - (Seq("HighOrderFunc.ts"), "HighOrderFunc.d.mls"), - (Seq("InterfaceMember.ts"), "InterfaceMember.d.mls"), - (Seq("Intersection.ts"), "Intersection.d.mls"), - (Seq("Literal.ts"), "Literal.d.mls"), - (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.d.mls"), - (Seq("Namespace.ts"), "Namespace.d.mls"), - (Seq("Optional.ts"), "Optional.d.mls"), - (Seq("Overload.ts"), "Overload.d.mls"), - (Seq("Tuple.ts"), "Tuple.d.mls"), - (Seq("Type.ts"), "Type.d.mls"), - (Seq("TypeParameter.ts"), "TypeParameter.d.mls"), - (Seq("Union.ts"), "Union.d.mls"), - (Seq("Variables.ts"), "Variables.d.mls"), + (Seq("Array.ts"), "Array.mlsi"), + (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), + (Seq("ClassMember.ts"), "ClassMember.mlsi"), + (Seq("Dec.d.ts"), "Dec.mlsi"), + (Seq("Enum.ts"), "Enum.mlsi"), + (Seq("Heritage.ts"), "Heritage.mlsi"), + (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), + (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), + (Seq("Intersection.ts"), "Intersection.mlsi"), + (Seq("Literal.ts"), "Literal.mlsi"), + (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), + (Seq("Namespace.ts"), "Namespace.mlsi"), + (Seq("Optional.ts"), "Optional.mlsi"), + (Seq("Overload.ts"), "Overload.mlsi"), + (Seq("Tuple.ts"), "Tuple.mlsi"), + (Seq("Type.ts"), "Type.mlsi"), + (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), + (Seq("Union.ts"), "Union.mlsi"), + (Seq("Variables.ts"), "Variables.mlsi"), ) } diff --git a/ts2mls/js/src/test/typescript/BasicFunctions.ts b/ts2mls/js/src/test/typescript/BasicFunctions.ts index 27ae2c256..ef0b915ca 100644 --- a/ts2mls/js/src/test/typescript/BasicFunctions.ts +++ b/ts2mls/js/src/test/typescript/BasicFunctions.ts @@ -60,7 +60,7 @@ function inn(f: Foooooo) { console.log(f.ooooooo) } -function out(): Foooooo { +function out1(): Foooooo { return new Foooooo(); } From e52cb8ddca534eef38db5441b0c8708bb9c32674 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Apr 2023 12:45:14 +0800 Subject: [PATCH 029/202] WIP: Add es5 --- .../main/scala/ts2mls/types/Converter.scala | 3 +- ts2mls/js/src/test/diff/ES5.mlsi | 565 +++ .../scala/ts2mls/TSTypeGenerationTests.scala | 1 + ts2mls/js/src/test/typescript/ES5.d.ts | 4508 +++++++++++++++++ 4 files changed, 5076 insertions(+), 1 deletion(-) create mode 100644 ts2mls/js/src/test/diff/ES5.mlsi create mode 100644 ts2mls/js/src/test/typescript/ES5.d.ts diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 32760642b..53be206a6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -15,7 +15,8 @@ object Converter { "never" -> "nothing", "object" -> "object", "true" -> "true", - "false" -> "false" + "false" -> "false", + "symbol" -> "Symbol" ) def generateFunDeclaration(tsType: TSType, name: String)(implicit indent: String = ""): String = tsType match { diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi new file mode 100644 index 000000000..f28caa18e --- /dev/null +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -0,0 +1,565 @@ +:NewParser +:ParseOnly +let NaN: number +let Infinity: number +fun eval(x: string): anything +fun parseInt(string: string, radix: (number) | (undefined)): number +fun parseFloat(string: string): number +fun isNaN(number: number): (false) | (true) +fun isFinite(number: number): (false) | (true) +fun decodeURI(encodedURI: string): string +fun decodeURIComponent(encodedURIComponent: string): string +fun encodeURI(uri: string): string +fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string +fun escape(string: string): string +fun unescape(string: string): string +trait Symbol() { + fun toString(): string + fun valueOf(): Symbol +} +type PropertyKey = ((string) | (number)) | (Symbol) +trait PropertyDescriptor() { + let configurable: ((false) | (true)) | (undefined) + let set: ((anything) => unit) | (undefined) + let enumerable: ((false) | (true)) | (undefined) + let get: (unit => anything) | (undefined) + let writable: ((false) | (true)) | (undefined) + let value: (anything) | (undefined) +} +trait PropertyDescriptorMap() { + fun __index(key: ((string) | (number)) | (Symbol)): PropertyDescriptor +} +trait Object() { + fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) + fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) + fun valueOf(): Object + fun toLocaleString(): string + let constructor: Function + fun isPrototypeOf(v: Object): (false) | (true) + fun toString(): string +} +let Function: FunctionConstructor +trait FunctionConstructor() { + fun __new(args: MutArray): Function + fun __call(args: MutArray): Function + let prototype: Function +} +trait IArguments() { + fun __index(index: number): anything + let length: number + let callee: Function +} +trait String() { + fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +} +trait StringConstructor() { + fun __new(value: (anything) | (undefined)): String + fun __call(value: (anything) | (undefined)): string + let prototype: String + fun fromCharCode(codes: MutArray): string +} +let Boolean: BooleanConstructor +trait BooleanConstructor() { + fun __new(value: (anything) | (undefined)): Boolean + fun __call(value: (T) | (undefined)): (false) | (true) + let prototype: Boolean +} +trait Number() { + fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +} +trait NumberConstructor() { + fun __call(value: (anything) | (undefined)): number + let NaN: number + let MIN_VALUE: number + fun __new(value: (anything) | (undefined)): Number + let NEGATIVE_INFINITY: number + let POSITIVE_INFINITY: number + let MAX_VALUE: number + let prototype: Number +} +trait TemplateStringsArray(): ReadonlyArray { + let raw: ReadonlyArray +} +trait ImportMeta() {} +trait ImportCallOptions() { + let assert: (ImportAssertions) | (undefined) +} +trait ImportAssertions() { + fun __index(key: string): string +} +let Math: Math +trait Date() { + fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string + fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string + fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +} +trait DateConstructor() { + fun __call(): string + fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number + fun __new(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): Date + fun now(): number + fun parse(s: string): number + let prototype: Date +} +let RegExp: RegExpConstructor +let Error: ErrorConstructor +trait ErrorConstructor() { + fun __new(message: (string) | (undefined)): Error + fun __call(message: (string) | (undefined)): Error + let prototype: Error +} +let EvalError: EvalErrorConstructor +trait EvalErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): EvalError + fun __call(message: (string) | (undefined)): EvalError + let prototype: EvalError +} +let RangeError: RangeErrorConstructor +trait RangeErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): RangeError + fun __call(message: (string) | (undefined)): RangeError + let prototype: RangeError +} +let ReferenceError: ReferenceErrorConstructor +trait ReferenceErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): ReferenceError + fun __call(message: (string) | (undefined)): ReferenceError + let prototype: ReferenceError +} +let SyntaxError: SyntaxErrorConstructor +trait SyntaxErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): SyntaxError + fun __call(message: (string) | (undefined)): SyntaxError + let prototype: SyntaxError +} +let TypeError: TypeErrorConstructor +trait TypeErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): TypeError + fun __call(message: (string) | (undefined)): TypeError + let prototype: TypeError +} +let URIError: URIErrorConstructor +trait URIErrorConstructor(): ErrorConstructor { + fun __new(message: (string) | (undefined)): URIError + fun __call(message: (string) | (undefined)): URIError + let prototype: URIError +} +let JSON: JSON +trait ReadonlyArray() { + fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number + fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit + fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray + fun __index(n: number): T + fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray + fun concat(items: MutArray<(T) | (ConcatArray)>): MutArray + fun toLocaleString(): string + fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray + fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +} +trait ConcatArray() { + let length: number + fun __index(n: number): T + fun join(separator: (string) | (undefined)): string + fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +} +let Array: ArrayConstructor +trait ArrayConstructor() { + fun __new(items: MutArray): MutArray + fun __call(items: MutArray): MutArray + fun isArray(arg: anything): (false) | (true) + let prototype: MutArray +} +trait TypedPropertyDescriptor() { + let configurable: ((false) | (true)) | (undefined) + let set: ((T) => unit) | (undefined) + let enumerable: ((false) | (true)) | (undefined) + let get: (unit => T) | (undefined) + let writable: ((false) | (true)) | (undefined) + let value: (T) | (undefined) +} +type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +trait ThisType() {} +let ArrayBuffer: ArrayBufferConstructor +trait ArrayBufferTypes() { + let ArrayBuffer: ArrayBuffer +} +type ArrayBufferLike = ArrayBuffer +trait ArrayBufferConstructor() { + let prototype: ArrayBuffer + fun __new(byteLength: number): ArrayBuffer + fun isView(arg: anything): (false) | (true) +} +trait ArrayBufferView() { + let buffer: ArrayBuffer + let byteLength: number + let byteOffset: number +} +let DataView: DataViewConstructor +trait DataViewConstructor() { + let prototype: DataView + fun __new(buffer: ArrayBuffer, byteOffset: (number) | (undefined), byteLength: (number) | (undefined)): DataView +} +trait Int8Array() { + fun valueOf(): Int8Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array + fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array + fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Int8Array + fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Uint8Array() { + fun valueOf(): Uint8Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array + fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array + fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Uint8Array + fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Uint8ClampedArray() { + fun valueOf(): Uint8ClampedArray + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray + fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray + fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Uint8ClampedArray + fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Int16Array() { + fun valueOf(): Int16Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array + fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array + fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Int16Array + fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Uint16Array() { + fun valueOf(): Uint16Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array + fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array + fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Uint16Array + fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Int32Array() { + fun valueOf(): Int32Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array + fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array + fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Int32Array + fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Uint32Array() { + fun valueOf(): Uint32Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array + fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array + fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Uint32Array + fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Float32Array() { + fun valueOf(): Float32Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun toLocaleString(): string + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array + fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array + fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Float32Array + fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +trait Float64Array() { + fun valueOf(): Float64Array + fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number + fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (number) | (undefined)): unit + fun __index(index: number): number + fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U + fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array + fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array + let BYTES_PER_ELEMENT: number + fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array + fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array + fun join(separator: (string) | (undefined)): string + fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array + fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit + let buffer: ArrayBuffer + fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number + fun reverse(): Float64Array + fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array + fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array + let byteLength: number + fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U + fun toString(): string + let length: number + fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number + let byteOffset: number +} +namespace Intl { + trait CollatorOptions() { + let sensitivity: (string) | (undefined) + let ignorePunctuation: ((false) | (true)) | (undefined) + let usage: (string) | (undefined) + let localeMatcher: (string) | (undefined) + let numeric: ((false) | (true)) | (undefined) + let caseFirst: (string) | (undefined) + } + trait ResolvedCollatorOptions() { + let sensitivity: string + let ignorePunctuation: (false) | (true) + let usage: string + let locale: string + let numeric: (false) | (true) + let caseFirst: string + let collation: string + } + trait Collator() { + fun compare(x: string, y: string): number + fun resolvedOptions(): Intl.ResolvedCollatorOptions + } + trait NumberFormatOptions() { + let minimumSignificantDigits: (number) | (undefined) + let useGrouping: ((false) | (true)) | (undefined) + let style: (string) | (undefined) + let localeMatcher: (string) | (undefined) + let currency: (string) | (undefined) + let minimumIntegerDigits: (number) | (undefined) + let maximumFractionDigits: (number) | (undefined) + let currencySign: (string) | (undefined) + let maximumSignificantDigits: (number) | (undefined) + let minimumFractionDigits: (number) | (undefined) + } + trait ResolvedNumberFormatOptions() { + let numberingSystem: string + let minimumSignificantDigits: (number) | (undefined) + let useGrouping: (false) | (true) + let style: string + let locale: string + let currency: (string) | (undefined) + let minimumIntegerDigits: number + let maximumFractionDigits: number + let maximumSignificantDigits: (number) | (undefined) + let minimumFractionDigits: number + } + trait NumberFormat() { + fun format(value: number): string + fun resolvedOptions(): Intl.ResolvedNumberFormatOptions + } + trait DateTimeFormatOptions() { + let minute: ((string) | (string)) | (undefined) + let year: ((string) | (string)) | (undefined) + let hour: ((string) | (string)) | (undefined) + let hour12: ((false) | (true)) | (undefined) + let weekday: (((string) | (string)) | (string)) | (undefined) + let formatMatcher: ((string) | (string)) | (undefined) + let day: ((string) | (string)) | (undefined) + let timeZone: (string) | (undefined) + let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) + let second: ((string) | (string)) | (undefined) + let localeMatcher: ((string) | (string)) | (undefined) + let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) + let era: (((string) | (string)) | (string)) | (undefined) + } + trait ResolvedDateTimeFormatOptions() { + let numberingSystem: string + let minute: (string) | (undefined) + let year: (string) | (undefined) + let hour: (string) | (undefined) + let second: (string) | (undefined) + let hour12: ((false) | (true)) | (undefined) + let weekday: (string) | (undefined) + let day: (string) | (undefined) + let timeZone: string + let month: (string) | (undefined) + let locale: string + let calendar: string + let timeZoneName: (string) | (undefined) + let era: (string) | (undefined) + } + trait DateTimeFormat() { + fun format(date: ((number) | (Date)) | (undefined)): string + fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions + } +} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {fun __index: (key: string | number | Symbol,) -> PropertyDescriptor}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {fun __new: (args: MutArray[string],) -> Function; fun __call: (args: MutArray[string],) -> Function; let prototype: Function}; trait IArguments() {fun __index: (index: number,) -> anything; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {fun __new: (value: anything | undefined,) -> String; fun __call: (value: anything | undefined,) -> string; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {fun __new: (value: anything | undefined,) -> Boolean; fun __call: (value: T | undefined,) -> bool; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {fun __call: (value: anything | undefined,) -> number; let NaN: number; let MIN_VALUE: number; fun __new: (value: anything | undefined,) -> Number; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {fun __index: (key: string,) -> string}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {fun __call: () -> string; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; fun __new: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> Date; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {fun __new: (message: string | undefined,) -> Error; fun __call: (message: string | undefined,) -> Error; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> EvalError; fun __call: (message: string | undefined,) -> EvalError; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> RangeError; fun __call: (message: string | undefined,) -> RangeError; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> ReferenceError; fun __call: (message: string | undefined,) -> ReferenceError; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> SyntaxError; fun __call: (message: string | undefined,) -> SyntaxError; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> TypeError; fun __call: (message: string | undefined,) -> TypeError; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> URIError; fun __call: (message: string | undefined,) -> URIError; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; fun __index: (n: number,) -> T; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; fun __index: (n: number,) -> T; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {fun __new: (items: MutArray[T],) -> MutArray[T]; fun __call: (items: MutArray[T],) -> MutArray[T]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; fun __new: (byteLength: number,) -> ArrayBuffer; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; fun __new: (buffer: ArrayBuffer, byteOffset: number | undefined, byteLength: number | undefined,) -> DataView}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index c13d79611..fca24b7c3 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -23,6 +23,7 @@ object TSTypeGenerationTest { (Seq("ClassMember.ts"), "ClassMember.mlsi"), (Seq("Dec.d.ts"), "Dec.mlsi"), (Seq("Enum.ts"), "Enum.mlsi"), + (Seq("ES5.d.ts"), "ES5.mlsi"), (Seq("Heritage.ts"), "Heritage.mlsi"), (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts new file mode 100644 index 000000000..a0dd15a7d --- /dev/null +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -0,0 +1,4508 @@ +/// +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts a string to an integer. + * @param string A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in `string`. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(string: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an unencoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an unencoded URI component. + */ +declare function encodeURIComponent(uriComponent: string | number | boolean): string; + +/** + * Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence. + * @deprecated A legacy feature for browser compatibility + * @param string A string value + */ +declare function escape(string: string): string; + +/** + * Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. + * @deprecated A legacy feature for browser compatibility + * @param string A string value + */ +declare function unescape(string: string): string; + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): symbol; +} + +declare type PropertyKey = string | number | symbol; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get?(): any; + set?(v: any): void; +} + +interface PropertyDescriptorMap { + [key: PropertyKey]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +// interface ObjectConstructor { +// new(value?: any): Object; +// (): any; +// (value: any): any; + +// /** A reference to the prototype for a class of objects. */ +// readonly prototype: Object; + +// /** +// * Returns the prototype of an object. +// * @param o The object that references the prototype. +// */ +// getPrototypeOf(o: any): any; + +// /** +// * Gets the own property descriptor of the specified object. +// * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. +// * @param o Object that contains the property. +// * @param p Name of the property. +// */ +// getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; + +// /** +// * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly +// * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. +// * @param o Object that contains the own properties. +// */ +// getOwnPropertyNames(o: any): string[]; + +// /** +// * Creates an object that has the specified prototype or that has null prototype. +// * @param o Object to use as a prototype. May be null. +// */ +// create(o: object | null): any; + +// /** +// * Creates an object that has the specified prototype, and that optionally contains specified properties. +// * @param o Object to use as a prototype. May be null +// * @param properties JavaScript object that contains one or more property descriptors. +// */ +// create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + +// /** +// * Adds a property to an object, or modifies attributes of an existing property. +// * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. +// * @param p The property name. +// * @param attributes Descriptor for the property. It can be for a data property or an accessor property. +// */ +// defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; + +// /** +// * Adds one or more properties to an object, and/or modifies attributes of existing properties. +// * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. +// * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. +// */ +// defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; + +// /** +// * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// seal(o: T): T; + +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param f Object on which to lock the attributes. +// */ +// freeze(f: T): T; + +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// freeze(o: T): Readonly; + +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// freeze(o: T): Readonly; + +// /** +// * Prevents the addition of new properties to an object. +// * @param o Object to make non-extensible. +// */ +// preventExtensions(o: T): T; + +// /** +// * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. +// * @param o Object to test. +// */ +// isSealed(o: any): boolean; + +// /** +// * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. +// * @param o Object to test. +// */ +// isFrozen(o: any): boolean; + +// /** +// * Returns a value that indicates whether new properties can be added to an object. +// * @param o Object to test. +// */ +// isExtensible(o: any): boolean; + +// /** +// * Returns the names of the enumerable string properties and methods of an object. +// * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. +// */ +// keys(o: object): string[]; +// } + +// /** +// * Provides functionality common to all JavaScript objects. +// */ +// declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(this: Function, thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(this: Function, thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(this: Function, thisArg: any, ...argArray: any[]): any; + + /** Returns a string representation of a function. */ + toString(): string; + + prototype: any; + readonly length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new(...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} + +declare var Function: FunctionConstructor; + +// TODO: +/** + * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. + */ +// type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; + +/** + * Removes the 'this' parameter from a function type. + */ +// type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; + +// interface CallableFunction extends Function { +// /** +// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args An array of argument values to be passed to the function. +// */ +// apply(this: (this: T) => R, thisArg: T): R; +// apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; + +// /** +// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args Argument values to be passed to the function. +// */ +// call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; + +// /** +// * For a given function, creates a bound function that has the same body as the original function. +// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. +// * @param thisArg The object to be used as the this object. +// * @param args Arguments to bind to the parameters of the function. +// */ +// bind(this: T, thisArg: ThisParameterType): OmitThisParameter; +// bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; +// bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; +// } + +// interface NewableFunction extends Function { +// /** +// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args An array of argument values to be passed to the function. +// */ +// apply(this: new () => T, thisArg: T): void; +// apply(this: new (...args: A) => T, thisArg: T, args: A): void; + +// /** +// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args Argument values to be passed to the function. +// */ +// call(this: new (...args: A) => T, thisArg: T, ...args: A): void; + +// /** +// * For a given function, creates a bound function that has the same body as the original function. +// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. +// * @param thisArg The object to be used as the this object. +// * @param args Arguments to bind to the parameters of the function. +// */ +// bind(this: T, thisArg: any): T; +// bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; +// bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; +// } + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string | RegExp): RegExpMatchArray | null; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string or regular expression to search for. + * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. + */ + replace(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string | RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string | RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(locales?: string | string[]): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(locales?: string | string[]): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + readonly length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @deprecated A legacy feature for browser compatibility + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + readonly [index: number]: string; +} + +interface StringConstructor { + new(value?: any): String; + (value?: any): string; + readonly prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new(value?: any): Boolean; + (value?: T): boolean; + readonly prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new(value?: any): Number; + (value?: any): number; + readonly prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: readonly string[]; +} + +/** + * The type of `import.meta`. + * + * If you need to declare that a given property exists on `import.meta`, + * this type may be augmented via interface merging. + */ +interface ImportMeta { +} + +/** + * The type for the optional second argument to `import()`. + * + * If your host environment supports additional options, this type may be + * augmented via interface merging. + */ +interface ImportCallOptions { + assert?: ImportAssertions; +} + +/** + * The type for the `assert` property of the optional second argument to `import()`. + */ +interface ImportAssertions { + [key: string]: string; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + readonly E: number; + /** The natural logarithm of 10. */ + readonly LN10: number; + /** The natural logarithm of 2. */ + readonly LN2: number; + /** The base-2 logarithm of e. */ + readonly LOG2E: number; + /** The base-10 logarithm of e. */ + readonly LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + readonly PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + readonly SQRT1_2: number; + /** The square root of 2. */ + readonly SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest integer greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest integer less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest integer. + * @param x The value to be rounded to the nearest integer. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new(): Date; + new(value: number | string): Date; + /** + * Creates a new Date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ + now(): number; +} + +declare var Date: DateConstructor; + +// TODO: 0??? and $ +// interface RegExpMatchArray extends Array { +// /** +// * The index of the search at which the result was found. +// */ +// index?: number; +// /** +// * A copy of the search string. +// */ +// input?: string; +// /** +// * The first match. This will always be present because `null` will be returned if there are no matches. +// */ +// 0: string; +// } + +// interface RegExpExecArray extends Array { +// /** +// * The index of the search at which the result was found. +// */ +// index: number; +// /** +// * A copy of the search string. +// */ +// input: string; +// /** +// * The first match. This will always be present because `null` will be returned if there are no matches. +// */ +// 0: string; +// } + +// interface RegExp { +// /** +// * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. +// * @param string The String object or string literal on which to perform the search. +// */ +// exec(string: string): RegExpExecArray | null; + +// /** +// * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. +// * @param string String on which to perform the search. +// */ +// test(string: string): boolean; + +// /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ +// readonly source: string; + +// /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ +// readonly global: boolean; + +// /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ +// readonly ignoreCase: boolean; + +// /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ +// readonly multiline: boolean; + +// lastIndex: number; + +// // Non-standard extensions +// /** @deprecated A legacy feature for browser compatibility */ +// compile(pattern: string, flags?: string): this; +// } + +// interface RegExpConstructor { +// new(pattern: RegExp | string): RegExp; +// new(pattern: string, flags?: string): RegExp; +// (pattern: RegExp | string): RegExp; +// (pattern: string, flags?: string): RegExp; +// readonly prototype: RegExp; + +// // Non-standard extensions +// /** @deprecated A legacy feature for browser compatibility */ +// $1: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $2: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $3: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $4: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $5: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $6: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $7: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $8: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $9: string; +// /** @deprecated A legacy feature for browser compatibility */ +// input: string; +// /** @deprecated A legacy feature for browser compatibility */ +// $_: string; +// /** @deprecated A legacy feature for browser compatibility */ +// lastMatch: string; +// /** @deprecated A legacy feature for browser compatibility */ +// "$&": string; +// /** @deprecated A legacy feature for browser compatibility */ +// lastParen: string; +// /** @deprecated A legacy feature for browser compatibility */ +// "$+": string; +// /** @deprecated A legacy feature for browser compatibility */ +// leftContext: string; +// /** @deprecated A legacy feature for browser compatibility */ +// "$`": string; +// /** @deprecated A legacy feature for browser compatibility */ +// rightContext: string; +// /** @deprecated A legacy feature for browser compatibility */ +// "$'": string; +// } + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; + stack?: string; +} + +interface ErrorConstructor { + new(message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor extends ErrorConstructor { + new(message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor extends ErrorConstructor { + new(message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor extends ErrorConstructor { + new(message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor extends ErrorConstructor { + new(message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor extends ErrorConstructor { + new(message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor extends ErrorConstructor { + new(message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} + +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + */ + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: ConcatArray[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | ConcatArray)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; + + readonly [n: number]: T; +} + +interface ConcatArray { + readonly length: number; + readonly [n: number]: T; + join(separator?: string): string; + slice(start?: number, end?: number): T[]; +} + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest index in the array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + */ + toLocaleString(): string; + /** + * Removes the last element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + pop(): T | undefined; + /** + * Appends new elements to the end of an array, and returns the new length of the array. + * @param items New elements to add to the array. + */ + push(...items: T[]): number; + /** + * Combines two or more arrays. + * This method returns a new array without modifying any existing arrays. + * @param items Additional arrays and/or items to add to the end of the array. + */ + concat(...items: ConcatArray[]): T[]; + /** + * Combines two or more arrays. + * This method returns a new array without modifying any existing arrays. + * @param items Additional arrays and/or items to add to the end of the array. + */ + concat(...items: (T | ConcatArray)[]): T[]; + /** + * Adds all the elements of an array into a string, separated by the specified separator string. + * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an array in place. + * This method mutates the array and returns a reference to the same array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + shift(): T | undefined; + /** + * Returns a copy of a section of an array. + * For both start and end, a negative index can be used to indicate an offset from the end of the array. + * For example, -2 refers to the second to last element of the array. + * @param start The beginning index of the specified portion of the array. + * If start is undefined, then the slice begins at index 0. + * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. + * If end is undefined, then the slice extends to the end of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array in place. + * This method mutates the array and returns a reference to the same array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive + * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @returns An array containing the elements that were deleted. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + * @returns An array containing the elements that were deleted. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array, and returns the new length of the array. + * @param items Elements to insert at the start of the array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new(arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is any[]; + readonly prototype: any[]; +} + +declare var Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +// TODO: +// interface PromiseLike { +// /** +// * Attaches callbacks for the resolution and/or rejection of the Promise. +// * @param onfulfilled The callback to execute when the Promise is resolved. +// * @param onrejected The callback to execute when the Promise is rejected. +// * @returns A Promise for the completion of which ever callback is executed. +// */ +// then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +// } + +// /** +// * Represents the completion of an asynchronous operation +// */ +// interface Promise { +// /** +// * Attaches callbacks for the resolution and/or rejection of the Promise. +// * @param onfulfilled The callback to execute when the Promise is resolved. +// * @param onrejected The callback to execute when the Promise is rejected. +// * @returns A Promise for the completion of which ever callback is executed. +// */ +// then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + +// /** +// * Attaches a callback for only the rejection of the Promise. +// * @param onrejected The callback to execute when the Promise is rejected. +// * @returns A Promise for the completion of the callback. +// */ +// catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +// } + +// /** +// * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. +// */ +// type Awaited = +// T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode +// T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped +// F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument +// Awaited : // recursively unwrap the value +// never : // the argument to `then` was not callable +// T; // non-object or non-thenable + +// interface ArrayLike { +// readonly length: number; +// readonly [n: number]: T; +// } + +// /** +// * Make all properties in T optional +// */ +// type Partial = { +// [P in keyof T]?: T[P]; +// }; + +// /** +// * Make all properties in T required +// */ +// type Required = { +// [P in keyof T]-?: T[P]; +// }; + +// /** +// * Make all properties in T readonly +// */ +// type Readonly = { +// readonly [P in keyof T]: T[P]; +// }; + +// /** +// * From T, pick a set of properties whose keys are in the union K +// */ +// type Pick = { +// [P in K]: T[P]; +// }; + +// /** +// * Construct a type with a set of properties K of type T +// */ +// type Record = { +// [P in K]: T; +// }; + +// /** +// * Exclude from T those types that are assignable to U +// */ +// type Exclude = T extends U ? never : T; + +// /** +// * Extract from T those types that are assignable to U +// */ +// type Extract = T extends U ? T : never; + +// /** +// * Construct a type with the properties of T except for those in type K. +// */ +// type Omit = Pick>; + +// /** +// * Exclude null and undefined from T +// */ +// type NonNullable = T & {}; + +// /** +// * Obtain the parameters of a function type in a tuple +// */ +// type Parameters any> = T extends (...args: infer P) => any ? P : never; + +// /** +// * Obtain the parameters of a constructor function type in a tuple +// */ +// type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; + +// /** +// * Obtain the return type of a function type +// */ +// type ReturnType any> = T extends (...args: any) => infer R ? R : any; + +// /** +// * Obtain the return type of a constructor function type +// */ +// type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; + +// /** +// * Convert string literal type to uppercase +// */ +// type Uppercase = intrinsic; + +// /** +// * Convert string literal type to lowercase +// */ +// type Lowercase = intrinsic; + +// /** +// * Convert first character of string literal type to uppercase +// */ +// type Capitalize = intrinsic; + +// /** +// * Convert first character of string literal type to lowercase +// */ +// type Uncapitalize = intrinsic; + +/** + * Marker for contextual 'this' type + */ +interface ThisType { } + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} + +/** + * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. + */ +interface ArrayBufferTypes { + ArrayBuffer: ArrayBuffer; +} +type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; + +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new(byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + readonly prototype: DataView; + new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Int8Array; + + [index: number]: number; +} +// interface Int8ArrayConstructor { +// readonly prototype: Int8Array; +// new(length: number): Int8Array; +// new(array: ArrayLike | ArrayBufferLike): Int8Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int8Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int8Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; + + +// } +// declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Uint8Array; + + [index: number]: number; +} + +// TODO: of +// interface Uint8ArrayConstructor { +// readonly prototype: Uint8Array; +// new(length: number): Uint8Array; +// new(array: ArrayLike | ArrayBufferLike): Uint8Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint8Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; + +// } +// // declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Uint8ClampedArray; + + [index: number]: number; +} + +// interface Uint8ClampedArrayConstructor { +// readonly prototype: Uint8ClampedArray; +// new(length: number): Uint8ClampedArray; +// new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint8ClampedArray; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8ClampedArray; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; +// } +// declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Int16Array; + + [index: number]: number; +} + +// interface Int16ArrayConstructor { +// readonly prototype: Int16Array; +// new(length: number): Int16Array; +// new(array: ArrayLike | ArrayBufferLike): Int16Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int16Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int16Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; + + +// } +// declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Uint16Array; + + [index: number]: number; +} + +// interface Uint16ArrayConstructor { +// readonly prototype: Uint16Array; +// new(length: number): Uint16Array; +// new(array: ArrayLike | ArrayBufferLike): Uint16Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint16Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint16Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; + + +// } +// declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Int32Array; + + [index: number]: number; +} + +// interface Int32ArrayConstructor { +// readonly prototype: Int32Array; +// new(length: number): Int32Array; +// new(array: ArrayLike | ArrayBufferLike): Int32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; + +// } +// declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Uint32Array; + + [index: number]: number; +} + +// interface Uint32ArrayConstructor { +// readonly prototype: Uint32Array; +// new(length: number): Uint32Array; +// new(array: ArrayLike | ArrayBufferLike): Uint32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; + +// } +// declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Float32Array; + + [index: number]: number; +} + +// interface Float32ArrayConstructor { +// readonly prototype: Float32Array; +// new(length: number): Float32Array; +// new(array: ArrayLike | ArrayBufferLike): Float32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Float32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float32Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; + + +// } +// declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; + + /** + * The length in bytes of the array. + */ + readonly byteLength: number; + + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; + + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; + + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + readonly length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; + + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; + + /** + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Float64Array; + + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Float64Array; + + [index: number]: number; +} + +// interface Float64ArrayConstructor { +// readonly prototype: Float64Array; +// new(length: number): Float64Array; +// new(array: ArrayLike | ArrayBufferLike): Float64Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; + +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; + +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Float64Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float64Array; + +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; + +// } +// declare var Float64Array: Float64ArrayConstructor; + +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string | undefined; + localeMatcher?: string | undefined; + numeric?: boolean | undefined; + caseFirst?: string | undefined; + sensitivity?: string | undefined; + ignorePunctuation?: boolean | undefined; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new(locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string | undefined; + style?: string | undefined; + currency?: string | undefined; + currencySign?: string | undefined; + useGrouping?: boolean | undefined; + minimumIntegerDigits?: number | undefined; + minimumFractionDigits?: number | undefined; + maximumFractionDigits?: number | undefined; + minimumSignificantDigits?: number | undefined; + maximumSignificantDigits?: number | undefined; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + readonly prototype: NumberFormat; + }; + + interface DateTimeFormatOptions { + localeMatcher?: "best fit" | "lookup" | undefined; + weekday?: "long" | "short" | "narrow" | undefined; + era?: "long" | "short" | "narrow" | undefined; + year?: "numeric" | "2-digit" | undefined; + month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; + day?: "numeric" | "2-digit" | undefined; + hour?: "numeric" | "2-digit" | undefined; + minute?: "numeric" | "2-digit" | undefined; + second?: "numeric" | "2-digit" | undefined; + timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; + formatMatcher?: "best fit" | "basic" | undefined; + hour12?: boolean | undefined; + timeZone?: string | undefined; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + readonly prototype: DateTimeFormat; + }; +} + +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} + +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} + +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} From 70695416b49623be7cf9956d9440f7945bac8e86 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Apr 2023 16:01:44 +0800 Subject: [PATCH 030/202] WIP: Add unsupported types --- ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala | 4 ++++ ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala | 1 + ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 6 +++++- ts2mls/js/src/main/scala/ts2mls/types/Converter.scala | 1 + ts2mls/js/src/main/scala/ts2mls/types/TSType.scala | 1 + ts2mls/js/src/test/diff/ES5.mlsi | 4 +++- ts2mls/js/src/test/typescript/ES5.d.ts | 5 ++--- 7 files changed, 17 insertions(+), 5 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index b57f67d16..ff96c20a8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -23,6 +23,7 @@ object TypeScript { val syntaxKindStatic = ts.SyntaxKind.StaticKeyword val objectFlagsAnonymous = ts.ObjectFlags.Anonymous val symbolFlagsOptional = ts.SymbolFlags.Optional // this flag is only for checking optional members of interfaces + val typeFlagsConditional = ts.TypeFlags.Conditional def isToken(node: js.Dynamic) = ts.isToken(node) def isClassDeclaration(node: js.Dynamic) = ts.isClassDeclaration(node) @@ -146,6 +147,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val symbolType = TSTypeObject(checker.getTypeOfSymbolAtLocation(node.symbol, node)) lazy val literal = TSTokenObject(node.literal) lazy val name = TSIdentifierObject(node.name) + + override def toString(): String = node.getText().toString() } object TSNodeObject { @@ -194,6 +197,7 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isTypeParameter = flags == TypeScript.typeFlagsTypeParameter lazy val isObject = flags == TypeScript.typeFlagsObject lazy val isTypeParameterSubstitution = isObject && typeArguments.length > 0 + lazy val isConditionalType = flags == TypeScript.typeFlagsConditional } object TSTypeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 4bb94bcf5..3927f2edc 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -45,6 +45,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { case Right(name) => { val mem = members(name) mem match { + case TSUnsupportedType(original) => writer.writeln(s"// UNSUPPORTED: $original") case inter: TSIntersectionType => // overloaded functions writer.writeln(Converter.generateFunDeclaration(inter, name)(indent)) case f: TSFunctionType => diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index aa0f6e15a..f97077705 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -37,6 +37,7 @@ object TSSourceFile { if (obj.isAnonymous) TSInterfaceType("", getAnonymousPropertiesType(obj.properties), List(), List()) else TSReferenceType(obj.symbol.fullName) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) + else if (obj.isConditionalType) TSUnsupportedType("") // in this case, we can not get the full information of the node. the information will be filled in addNodeIntoNamespace else TSPrimitiveType(obj.intrinsicName) // the function `getMemberType` can't process function/tuple type alias correctly @@ -201,7 +202,10 @@ object TSSourceFile { else if (node.isInterfaceDeclaration) ns.put(name, parseMembers(name, node, false)) else if (node.isTypeAliasDeclaration) - ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node))) + getTypeAlias(node.`type`) match { + case _: TSUnsupportedType => ns.put(name, TSUnsupportedType(node.toString())) + case t => ns.put(name, TSTypeAlias(name, t, getTypeParameters(node))) + } else if (node.isObjectLiteral) ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List())) else if (node.isVariableDeclaration) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 53be206a6..1cb074ebb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -55,6 +55,7 @@ object Converter { if (tp.isEmpty) s"${indent}type $name = ${convert(ori)}" else s"${indent}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value + case TSUnsupportedType(_) => throw new AssertionError("unsupported type is not allowed.") } private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index ce0527db8..5d933d8e9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -46,3 +46,4 @@ case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType case class TSLiteralType(value: String, isString: Boolean) extends TSType +case class TSUnsupportedType(original: String) extends TSType diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index f28caa18e..6729aef7c 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -44,6 +44,8 @@ trait FunctionConstructor() { fun __call(args: MutArray): Function let prototype: Function } +// UNSUPPORTED: type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; +// UNSUPPORTED: type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; trait IArguments() { fun __index(index: number): anything let length: number @@ -561,5 +563,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|/* UNSUPPORTED: type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;*/|↵|/* UNSUPPORTED: type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;*/|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| //│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {fun __index: (key: string | number | Symbol,) -> PropertyDescriptor}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {fun __new: (args: MutArray[string],) -> Function; fun __call: (args: MutArray[string],) -> Function; let prototype: Function}; trait IArguments() {fun __index: (index: number,) -> anything; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {fun __new: (value: anything | undefined,) -> String; fun __call: (value: anything | undefined,) -> string; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {fun __new: (value: anything | undefined,) -> Boolean; fun __call: (value: T | undefined,) -> bool; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {fun __call: (value: anything | undefined,) -> number; let NaN: number; let MIN_VALUE: number; fun __new: (value: anything | undefined,) -> Number; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {fun __index: (key: string,) -> string}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {fun __call: () -> string; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; fun __new: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> Date; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {fun __new: (message: string | undefined,) -> Error; fun __call: (message: string | undefined,) -> Error; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> EvalError; fun __call: (message: string | undefined,) -> EvalError; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> RangeError; fun __call: (message: string | undefined,) -> RangeError; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> ReferenceError; fun __call: (message: string | undefined,) -> ReferenceError; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> SyntaxError; fun __call: (message: string | undefined,) -> SyntaxError; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> TypeError; fun __call: (message: string | undefined,) -> TypeError; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> URIError; fun __call: (message: string | undefined,) -> URIError; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; fun __index: (n: number,) -> T; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; fun __index: (n: number,) -> T; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {fun __new: (items: MutArray[T],) -> MutArray[T]; fun __call: (items: MutArray[T],) -> MutArray[T]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; fun __new: (byteLength: number,) -> ArrayBuffer; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; fun __new: (buffer: ArrayBuffer, byteOffset: number | undefined, byteLength: number | undefined,) -> DataView}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index a0dd15a7d..cf1d135db 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -300,16 +300,15 @@ interface FunctionConstructor { declare var Function: FunctionConstructor; -// TODO: /** * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. */ -// type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; +type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; /** * Removes the 'this' parameter from a function type. */ -// type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; +type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; // interface CallableFunction extends Function { // /** From 660c8a539b150f9b3b4d8ba075a01d0116cb33f8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Apr 2023 17:31:08 +0800 Subject: [PATCH 031/202] WIP: Use Unsupported instead --- .../main/scala/ts2mls/TSCompilerInfo.scala | 10 +++++ ts2mls/js/src/main/scala/ts2mls/TSData.scala | 25 ++++++++++++ .../src/main/scala/ts2mls/TSNamespace.scala | 1 - .../src/main/scala/ts2mls/TSSourceFile.scala | 39 +++++++++++-------- .../main/scala/ts2mls/types/Converter.scala | 3 +- .../src/main/scala/ts2mls/types/TSType.scala | 2 +- ts2mls/js/src/test/diff/ES5.mlsi | 8 ++-- 7 files changed, 64 insertions(+), 24 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index ff96c20a8..d64a8fe0d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -90,6 +90,7 @@ object TSSymbolObject { class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAny(node) { private lazy val modifiers = TSTokenArray(node.modifiers) + private lazy val parent = TSNodeObject(node.parent) lazy val isToken = TypeScript.isToken(node) lazy val isClassDeclaration = TypeScript.isClassDeclaration(node) @@ -149,6 +150,10 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val name = TSIdentifierObject(node.name) override def toString(): String = node.getText().toString() + lazy val filename: String = + if (parent.isUndefined) node.fileName.toString() + else parent.filename + lazy val pos = node.pos } object TSNodeObject { @@ -175,6 +180,7 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA private lazy val flags = obj.flags private lazy val objectFlags = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) + private lazy val root = TSNodeObject(obj.root.node) lazy val symbol = TSSymbolObject(obj.symbol) lazy val typeArguments = TSTypeArray(checker.getTypeArguments(obj)) @@ -198,6 +204,10 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isObject = flags == TypeScript.typeFlagsObject lazy val isTypeParameterSubstitution = isObject && typeArguments.length > 0 lazy val isConditionalType = flags == TypeScript.typeFlagsConditional + + override def toString(): String = root.toString() + lazy val filename = root.filename + lazy val pos = root.pos } object TSTypeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index 525664801..7c2ac97a0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -73,3 +73,28 @@ class TSSymbolMap(map: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAn object TSSymbolMap { def apply(map: js.Dynamic)(implicit checker: TSTypeChecker) = new TSSymbolMap(map) } + +class TSLineStartsHelper(arr: js.Dynamic) extends TSAny(arr) { + if (isUndefined) throw new AssertionError("can not read line starts from the source file.") + + // line, column in string + def getPos(pos: js.Dynamic): (String, String) = { + val len = arr.length + def run(index: Int): (String, String) = + if (index >= len) throw new AssertionError(s"invalid pos parameter $pos.") + else { + val starts = arr.selectDynamic(index.toString) + if (pos >= starts) { + if (index + 1 >= len) ((index + 1).toString, (pos - starts).toString()) + else { + val next = arr.selectDynamic((index + 1).toString) + if (pos >= next) run(index + 1) + else ((index + 1).toString, (pos - starts).toString()) + } + } + else throw new AssertionError(s"invalid pos parameter $pos.") + } + + run(0) + } +} diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 3927f2edc..4bb94bcf5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -45,7 +45,6 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { case Right(name) => { val mem = members(name) mem match { - case TSUnsupportedType(original) => writer.writeln(s"// UNSUPPORTED: $original") case inter: TSIntersectionType => // overloaded functions writer.writeln(Converter.generateFunDeclaration(inter, name)(indent)) case f: TSFunctionType => diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index f97077705..bc3fcb2a3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -5,19 +5,20 @@ import js.DynamicImplicits._ import types._ import mlscript.utils._ -object TSSourceFile { - def apply(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) = - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces - addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName)(global) - else if (!nodeObject.declarationList.isUndefined) { // for variables - val decNode = nodeObject.declarationList.declaration - addNodeIntoNamespace(decNode, decNode.symbol.escapedName)(global) - } +class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { + private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) + + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken) { + if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces + addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName)(global) + else if (!nodeObject.declarationList.isUndefined) { // for variables + val decNode = nodeObject.declarationList.declaration + addNodeIntoNamespace(decNode, decNode.symbol.escapedName)(global) } - }) + } + }) private def getSubstitutionArguments[T <: TSAny](args: TSArray[T]): List[TSType] = args.foldLeft(List[TSType]())((lst, arg) => arg match { @@ -37,7 +38,9 @@ object TSSourceFile { if (obj.isAnonymous) TSInterfaceType("", getAnonymousPropertiesType(obj.properties), List(), List()) else TSReferenceType(obj.symbol.fullName) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) - else if (obj.isConditionalType) TSUnsupportedType("") // in this case, we can not get the full information of the node. the information will be filled in addNodeIntoNamespace + else if (obj.isConditionalType) lineHelper.getPos(obj.pos) match { + case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) + } else TSPrimitiveType(obj.intrinsicName) // the function `getMemberType` can't process function/tuple type alias correctly @@ -202,10 +205,7 @@ object TSSourceFile { else if (node.isInterfaceDeclaration) ns.put(name, parseMembers(name, node, false)) else if (node.isTypeAliasDeclaration) - getTypeAlias(node.`type`) match { - case _: TSUnsupportedType => ns.put(name, TSUnsupportedType(node.toString())) - case t => ns.put(name, TSTypeAlias(name, t, getTypeParameters(node))) - } + ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node))) else if (node.isObjectLiteral) ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List())) else if (node.isVariableDeclaration) @@ -216,3 +216,8 @@ object TSSourceFile { private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = parseNamespaceLocals(node.locals)(ns.derive(node.symbol.escapedName)) } + +object TSSourceFile { + def apply(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) = + new TSSourceFile(sf, global) +} diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 1cb074ebb..8f5150b1e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -55,7 +55,8 @@ object Converter { if (tp.isEmpty) s"${indent}type $name = ${convert(ori)}" else s"${indent}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value - case TSUnsupportedType(_) => throw new AssertionError("unsupported type is not allowed.") + case TSUnsupportedType(code, filename, line, column) => + s"""Unsupported["$code", "$filename", $line, $column]""" } private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index 5d933d8e9..56e444d5f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -46,4 +46,4 @@ case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType case class TSLiteralType(value: String, isString: Boolean) extends TSType -case class TSUnsupportedType(original: String) extends TSType +case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 6729aef7c..6e6920c71 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -44,8 +44,8 @@ trait FunctionConstructor() { fun __call(args: MutArray): Function let prototype: Function } -// UNSUPPORTED: type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; -// UNSUPPORTED: type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; +type ThisParameterType = Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] +type OmitThisParameter = Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] trait IArguments() { fun __index(index: number): anything let length: number @@ -563,5 +563,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|/* UNSUPPORTED: type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;*/|↵|/* UNSUPPORTED: type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;*/|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {fun __index: (key: string | number | Symbol,) -> PropertyDescriptor}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {fun __new: (args: MutArray[string],) -> Function; fun __call: (args: MutArray[string],) -> Function; let prototype: Function}; trait IArguments() {fun __index: (index: number,) -> anything; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {fun __new: (value: anything | undefined,) -> String; fun __call: (value: anything | undefined,) -> string; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {fun __new: (value: anything | undefined,) -> Boolean; fun __call: (value: T | undefined,) -> bool; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {fun __call: (value: anything | undefined,) -> number; let NaN: number; let MIN_VALUE: number; fun __new: (value: anything | undefined,) -> Number; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {fun __index: (key: string,) -> string}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {fun __call: () -> string; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; fun __new: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> Date; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {fun __new: (message: string | undefined,) -> Error; fun __call: (message: string | undefined,) -> Error; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> EvalError; fun __call: (message: string | undefined,) -> EvalError; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> RangeError; fun __call: (message: string | undefined,) -> RangeError; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> ReferenceError; fun __call: (message: string | undefined,) -> ReferenceError; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> SyntaxError; fun __call: (message: string | undefined,) -> SyntaxError; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> TypeError; fun __call: (message: string | undefined,) -> TypeError; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> URIError; fun __call: (message: string | undefined,) -> URIError; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; fun __index: (n: number,) -> T; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; fun __index: (n: number,) -> T; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {fun __new: (items: MutArray[T],) -> MutArray[T]; fun __call: (items: MutArray[T],) -> MutArray[T]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; fun __new: (byteLength: number,) -> ArrayBuffer; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; fun __new: (buffer: ArrayBuffer, byteOffset: number | undefined, byteLength: number | undefined,) -> DataView}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|[|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|]|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|[|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|]|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {fun __index: (key: string | number | Symbol,) -> PropertyDescriptor}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {fun __new: (args: MutArray[string],) -> Function; fun __call: (args: MutArray[string],) -> Function; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait IArguments() {fun __index: (index: number,) -> anything; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {fun __new: (value: anything | undefined,) -> String; fun __call: (value: anything | undefined,) -> string; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {fun __new: (value: anything | undefined,) -> Boolean; fun __call: (value: T | undefined,) -> bool; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {fun __call: (value: anything | undefined,) -> number; let NaN: number; let MIN_VALUE: number; fun __new: (value: anything | undefined,) -> Number; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {fun __index: (key: string,) -> string}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {fun __call: () -> string; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; fun __new: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> Date; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {fun __new: (message: string | undefined,) -> Error; fun __call: (message: string | undefined,) -> Error; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> EvalError; fun __call: (message: string | undefined,) -> EvalError; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> RangeError; fun __call: (message: string | undefined,) -> RangeError; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> ReferenceError; fun __call: (message: string | undefined,) -> ReferenceError; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> SyntaxError; fun __call: (message: string | undefined,) -> SyntaxError; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> TypeError; fun __call: (message: string | undefined,) -> TypeError; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> URIError; fun __call: (message: string | undefined,) -> URIError; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; fun __index: (n: number,) -> T; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; fun __index: (n: number,) -> T; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {fun __new: (items: MutArray[T],) -> MutArray[T]; fun __call: (items: MutArray[T],) -> MutArray[T]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; fun __new: (byteLength: number,) -> ArrayBuffer; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; fun __new: (buffer: ArrayBuffer, byteOffset: number | undefined, byteLength: number | undefined,) -> DataView}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} From 0beaf5db8c4bdc67c4ec6565bd4496d135b06013 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Apr 2023 09:25:57 +0800 Subject: [PATCH 032/202] WIP: Use <> for all and ban unsupported tricky features --- .../main/scala/ts2mls/TSCompilerInfo.scala | 6 ++ .../src/main/scala/ts2mls/TSSourceFile.scala | 6 +- .../main/scala/ts2mls/types/Converter.scala | 2 +- ts2mls/js/src/test/diff/Dec.mlsi | 6 +- ts2mls/js/src/test/diff/ES5.mlsi | 92 +++++++++---------- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 10 +- 6 files changed, 66 insertions(+), 56 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index d64a8fe0d..f6384d4e9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -37,6 +37,9 @@ object TypeScript { def isLiteralTypeNode(node: js.Dynamic) = ts.isLiteralTypeNode(node) def isStringLiteral(node: js.Dynamic) = ts.isStringLiteral(node) def isVariableDeclaration(node: js.Dynamic) = ts.isVariableDeclaration(node) + def isIndexSignatureDeclaration(node: js.Dynamic) = ts.isIndexSignatureDeclaration(node) + def isConstructSignatureDeclaration(node: js.Dynamic) = ts.isConstructSignatureDeclaration(node) + def isCallSignatureDeclaration(node: js.Dynamic) = ts.isCallSignatureDeclaration(node) def forEachChild(root: js.Dynamic, func: js.Dynamic => Unit) = ts.forEachChild(root, func) def createProgram(filenames: Seq[String]) = @@ -99,6 +102,9 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isTypeAliasDeclaration = TypeScript.isTypeAliasDeclaration(node) lazy val isLiteralTypeNode = TypeScript.isLiteralTypeNode(node) lazy val isVariableDeclaration = TypeScript.isVariableDeclaration(node) + lazy val isIndexSignature = TypeScript.isIndexSignatureDeclaration(node) + lazy val isCallSignature = TypeScript.isCallSignatureDeclaration(node) + lazy val isConstructSignature = TypeScript.isConstructSignatureDeclaration(node) lazy val isObjectLiteral = !initializer.isUndefined && !initializer.isToken && TypeScript.isObjectLiteralExpression(node.initializer) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index bc3fcb2a3..a3d77227a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -62,7 +62,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // get the type of variables in classes/named interfaces/anonymous interfaces private def getMemberType(node: TSNodeObject): TSType = { val res: TSType = - if (node.isFunctionLike) getFunctionType(node) + if (node.isIndexSignature || node.isCallSignature || node.isConstructSignature) + lineHelper.getPos(node.pos) match { + case (line, column) => TSUnsupportedType(node.toString(), node.filename, line, column) + } + else if (node.isFunctionLike) getFunctionType(node) else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 8f5150b1e..bd0eb7d4a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -56,7 +56,7 @@ object Converter { else s"${indent}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => - s"""Unsupported["$code", "$filename", $line, $column]""" + s"""Unsupported<"$code", "$filename", $line, $column>""" } private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 2506d3195..a2bf5cab5 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -3,12 +3,12 @@ fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string trait Get() { - fun __call(id: string): string + let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } class Person(name: string, age: number) { fun getName(id: number): string } namespace OOO { } -//│ |#fun| |getName|(|id|#:| |(|string|)| ||| |(|number|)|)|#:| |string|↵|#fun| |render|(|callback|#:| |(|unit| |=>| |unit|)| ||| |(|undefined|)|)|#:| |string|↵|#trait| |Get|(||)| |{|→|#fun| |__call|(|id|#:| |string|)|#:| |string|←|↵|}|↵|#class| |Person|(|name|#:| |string|,| |age|#:| |number|)| |{|→|#fun| |getName|(|id|#:| |number|)|#:| |string|←|↵|}|↵|#namespace| |OOO| |{|↵|}| -//│ Parsed: {fun getName: (id: string | number,) -> string; fun render: (callback: unit -> unit | undefined,) -> string; trait Get() {fun __call: (id: string,) -> string}; class Person(name: string, age: number,) {fun getName: (id: number,) -> string}; module OOO() {}} +//│ |#fun| |getName|(|id|#:| |(|string|)| ||| |(|number|)|)|#:| |string|↵|#fun| |render|(|callback|#:| |(|unit| |=>| |unit|)| ||| |(|undefined|)|)|#:| |string|↵|#trait| |Get|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(id: string): string"|,| |"ts2mls/js/src/test/typescript/Dec.d.ts"|,| |4|,| |22|›|←|↵|}|↵|#class| |Person|(|name|#:| |string|,| |age|#:| |number|)| |{|→|#fun| |getName|(|id|#:| |number|)|#:| |string|←|↵|}|↵|#namespace| |OOO| |{|↵|}| +//│ Parsed: {fun getName: (id: string | number,) -> string; fun render: (callback: unit -> unit | undefined,) -> string; trait Get() {let __call: Unsupported["(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22]}; class Person(name: string, age: number,) {fun getName: (id: number,) -> string}; module OOO() {}} diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 6e6920c71..42fcdd0c6 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -27,7 +27,7 @@ trait PropertyDescriptor() { let value: (anything) | (undefined) } trait PropertyDescriptorMap() { - fun __index(key: ((string) | (number)) | (Symbol)): PropertyDescriptor + let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } trait Object() { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) @@ -40,14 +40,14 @@ trait Object() { } let Function: FunctionConstructor trait FunctionConstructor() { - fun __new(args: MutArray): Function - fun __call(args: MutArray): Function + let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31> + let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37> let prototype: Function } -type ThisParameterType = Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] -type OmitThisParameter = Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] +type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> +type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> trait IArguments() { - fun __index(index: number): anything + let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22> let length: number let callee: Function } @@ -55,25 +55,25 @@ trait String() { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } trait StringConstructor() { - fun __new(value: (anything) | (undefined)): String - fun __call(value: (anything) | (undefined)): string + let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29> + let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> let prototype: String fun fromCharCode(codes: MutArray): string } let Boolean: BooleanConstructor trait BooleanConstructor() { - fun __new(value: (anything) | (undefined)): Boolean - fun __call(value: (T) | (undefined)): (false) | (true) + let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30> + let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> let prototype: Boolean } trait Number() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } trait NumberConstructor() { - fun __call(value: (anything) | (undefined)): number + let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> let NaN: number let MIN_VALUE: number - fun __new(value: (anything) | (undefined)): Number + let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29> let NEGATIVE_INFINITY: number let POSITIVE_INFINITY: number let MAX_VALUE: number @@ -87,7 +87,7 @@ trait ImportCallOptions() { let assert: (ImportAssertions) | (undefined) } trait ImportAssertions() { - fun __index(key: string): string + let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28> } let Math: Math trait Date() { @@ -96,9 +96,9 @@ trait Date() { fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } trait DateConstructor() { - fun __call(): string + let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number - fun __new(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): Date + let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38> fun now(): number fun parse(s: string): number let prototype: Date @@ -106,44 +106,44 @@ trait DateConstructor() { let RegExp: RegExpConstructor let Error: ErrorConstructor trait ErrorConstructor() { - fun __new(message: (string) | (undefined)): Error - fun __call(message: (string) | (undefined)): Error + let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28> + let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33> let prototype: Error } let EvalError: EvalErrorConstructor trait EvalErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): EvalError - fun __call(message: (string) | (undefined)): EvalError + let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> + let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> let prototype: EvalError } let RangeError: RangeErrorConstructor trait RangeErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): RangeError - fun __call(message: (string) | (undefined)): RangeError + let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> + let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> let prototype: RangeError } let ReferenceError: ReferenceErrorConstructor trait ReferenceErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): ReferenceError - fun __call(message: (string) | (undefined)): ReferenceError + let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> + let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> let prototype: ReferenceError } let SyntaxError: SyntaxErrorConstructor trait SyntaxErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): SyntaxError - fun __call(message: (string) | (undefined)): SyntaxError + let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> + let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> let prototype: SyntaxError } let TypeError: TypeErrorConstructor trait TypeErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): TypeError - fun __call(message: (string) | (undefined)): TypeError + let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> + let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> let prototype: TypeError } let URIError: URIErrorConstructor trait URIErrorConstructor(): ErrorConstructor { - fun __new(message: (string) | (undefined)): URIError - fun __call(message: (string) | (undefined)): URIError + let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> + let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> let prototype: URIError } let JSON: JSON @@ -152,7 +152,7 @@ trait ReadonlyArray() { fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray - fun __index(n: number): T + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136> fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U fun join(separator: (string) | (undefined)): string fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray @@ -167,14 +167,14 @@ trait ReadonlyArray() { } trait ConcatArray() { let length: number - fun __index(n: number): T + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } let Array: ArrayConstructor trait ArrayConstructor() { - fun __new(items: MutArray): MutArray - fun __call(items: MutArray): MutArray + let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38> + let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34> fun isArray(arg: anything): (false) | (true) let prototype: MutArray } @@ -195,7 +195,7 @@ trait ArrayBufferTypes() { type ArrayBufferLike = ArrayBuffer trait ArrayBufferConstructor() { let prototype: ArrayBuffer - fun __new(byteLength: number): ArrayBuffer + let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36> fun isView(arg: anything): (false) | (true) } trait ArrayBufferView() { @@ -206,7 +206,7 @@ trait ArrayBufferView() { let DataView: DataViewConstructor trait DataViewConstructor() { let prototype: DataView - fun __new(buffer: ArrayBuffer, byteOffset: (number) | (undefined), byteLength: (number) | (undefined)): DataView + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33> } trait Int8Array() { fun valueOf(): Int8Array @@ -214,7 +214,7 @@ trait Int8Array() { fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array @@ -244,7 +244,7 @@ trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array @@ -274,7 +274,7 @@ trait Uint8ClampedArray() { fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray @@ -304,7 +304,7 @@ trait Int16Array() { fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array @@ -334,7 +334,7 @@ trait Uint16Array() { fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array @@ -364,7 +364,7 @@ trait Int32Array() { fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array @@ -394,7 +394,7 @@ trait Uint32Array() { fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array @@ -424,7 +424,7 @@ trait Float32Array() { fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array @@ -453,7 +453,7 @@ trait Float64Array() { fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun __index(index: number): number + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array @@ -563,5 +563,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#fun| |__index|(|key|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |PropertyDescriptor|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#fun| |__new|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#fun| |__call|(|args|#:| |MutArray|‹|string|›|)|#:| |Function|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|[|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|]|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|[|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|]|↵|#trait| |IArguments|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |anything|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |String|↵|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |string|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Boolean|↵|#fun| |__call|‹|T|›|(|value|#:| |(|T|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#fun| |__call|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#fun| |__new|(|value|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Number|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#fun| |__index|(|key|#:| |string|)|#:| |string|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#fun| |__call|(||)|#:| |string|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |__new|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Date|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |Error|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |EvalError|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |RangeError|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |ReferenceError|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |SyntaxError|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |TypeError|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#fun| |__new|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#fun| |__call|(|message|#:| |(|string|)| ||| |(|undefined|)|)|#:| |URIError|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#fun| |__index|(|n|#:| |number|)|#:| |T|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#fun| |__new|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |__call|‹|T|›|(|items|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|T|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#fun| |__new|(|byteLength|#:| |number|)|#:| |ArrayBuffer|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#fun| |__new|(|buffer|#:| |ArrayBuffer|,| |byteOffset|#:| |(|number|)| ||| |(|undefined|)|,| |byteLength|#:| |(|number|)| ||| |(|undefined|)|)|#:| |DataView|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |__index|(|index|#:| |number|)|#:| |number|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {fun __index: (key: string | number | Symbol,) -> PropertyDescriptor}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {fun __new: (args: MutArray[string],) -> Function; fun __call: (args: MutArray[string],) -> Function; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait IArguments() {fun __index: (index: number,) -> anything; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {fun __new: (value: anything | undefined,) -> String; fun __call: (value: anything | undefined,) -> string; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {fun __new: (value: anything | undefined,) -> Boolean; fun __call: (value: T | undefined,) -> bool; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {fun __call: (value: anything | undefined,) -> number; let NaN: number; let MIN_VALUE: number; fun __new: (value: anything | undefined,) -> Number; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {fun __index: (key: string,) -> string}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {fun __call: () -> string; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; fun __new: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> Date; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {fun __new: (message: string | undefined,) -> Error; fun __call: (message: string | undefined,) -> Error; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> EvalError; fun __call: (message: string | undefined,) -> EvalError; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> RangeError; fun __call: (message: string | undefined,) -> RangeError; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> ReferenceError; fun __call: (message: string | undefined,) -> ReferenceError; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> SyntaxError; fun __call: (message: string | undefined,) -> SyntaxError; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> TypeError; fun __call: (message: string | undefined,) -> TypeError; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {fun __new: (message: string | undefined,) -> URIError; fun __call: (message: string | undefined,) -> URIError; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; fun __index: (n: number,) -> T; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; fun __index: (n: number,) -> T; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {fun __new: (items: MutArray[T],) -> MutArray[T]; fun __call: (items: MutArray[T],) -> MutArray[T]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; fun __new: (byteLength: number,) -> ArrayBuffer; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; fun __new: (buffer: ArrayBuffer, byteOffset: number | undefined, byteLength: number | undefined,) -> DataView}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun __index: (index: number,) -> number; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 5eda9179e..e3d4fd6ae 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -15,13 +15,13 @@ trait IEvent() { fun callback(): (number) => unit } trait SearchFunc() { - fun __call(source: string, subString: string): (false) | (true) + let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> } trait StringArray() { - fun __index(index: number): string + let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> } trait Counter() { - fun __call(start: number): string + let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> let interval: number fun reset(): unit } @@ -36,5 +36,5 @@ trait Next(): Simple {} trait TTT() { fun ttt(x: T): T } -//│ |#trait| |IFoo|(||)| |{|→|#let| |a|#:| |string|↵|#fun| |b|(|x|#:| |number|)|#:| |number|↵|#fun| |c|(||)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |d|(|x|#:| |string|)|#:| |unit|←|↵|}|↵|#trait| |II|‹|T|›|(||)| |{|→|#fun| |test|(|x|#:| |T|)|#:| |number|←|↵|}|↵|#fun| |create|(||)|#:| |{|v|#:| |number|,|}|↵|#fun| |get|(|x|#:| |{|t|#:| |string|,|}|)|#:| |string|↵|#trait| |IEvent|(||)| |{|→|#fun| |callback|(||)|#:| |(|number|)| |=>| |unit|←|↵|}|↵|#trait| |SearchFunc|(||)| |{|→|#fun| |__call|(|source|#:| |string|,| |subString|#:| |string|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |StringArray|(||)| |{|→|#fun| |__index|(|index|#:| |number|)|#:| |string|←|↵|}|↵|#trait| |Counter|(||)| |{|→|#fun| |__call|(|start|#:| |number|)|#:| |string|↵|#let| |interval|#:| |number|↵|#fun| |reset|(||)|#:| |unit|←|↵|}|↵|#trait| |Simple|(||)| |{|→|#let| |a|#:| |number|↵|#fun| |b|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |string|←|↵|}|↵|#trait| |Simple2|‹|T|›|(||)| |{|→|#let| |abc|#:| |T|←|↵|}|↵|#trait| |Next|(||)|#:| |Simple| |{||}|↵|#trait| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|←|↵|}| -//│ Parsed: {trait IFoo() {let a: string; fun b: (x: number,) -> number; fun c: () -> bool; fun d: (x: string,) -> unit}; trait II‹T›() {fun test: (x: T,) -> number}; fun create: () -> {v: number}; fun get: (x: {t: string},) -> string; trait IEvent() {fun callback: () -> number -> unit}; trait SearchFunc() {fun __call: (source: string, subString: string,) -> bool}; trait StringArray() {fun __index: (index: number,) -> string}; trait Counter() {fun __call: (start: number,) -> string; let interval: number; fun reset: () -> unit}; trait Simple() {let a: number; fun b: (x: bool,) -> string}; trait Simple2‹T›() {let abc: T}; trait Next(): Simple {}; trait TTT‹T›() {fun ttt: (x: T,) -> T}} +//│ |#trait| |IFoo|(||)| |{|→|#let| |a|#:| |string|↵|#fun| |b|(|x|#:| |number|)|#:| |number|↵|#fun| |c|(||)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |d|(|x|#:| |string|)|#:| |unit|←|↵|}|↵|#trait| |II|‹|T|›|(||)| |{|→|#fun| |test|(|x|#:| |T|)|#:| |number|←|↵|}|↵|#fun| |create|(||)|#:| |{|v|#:| |number|,|}|↵|#fun| |get|(|x|#:| |{|t|#:| |string|,|}|)|#:| |string|↵|#trait| |IEvent|(||)| |{|→|#fun| |callback|(||)|#:| |(|number|)| |=>| |unit|←|↵|}|↵|#trait| |SearchFunc|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(source: string, subString: string): boolean;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |24|,| |22|›|←|↵|}|↵|#trait| |StringArray|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: string;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |28|,| |23|›|←|↵|}|↵|#trait| |Counter|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(start: number): string;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |32|,| |19|›|↵|#let| |interval|#:| |number|↵|#fun| |reset|(||)|#:| |unit|←|↵|}|↵|#trait| |Simple|(||)| |{|→|#let| |a|#:| |number|↵|#fun| |b|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |string|←|↵|}|↵|#trait| |Simple2|‹|T|›|(||)| |{|→|#let| |abc|#:| |T|←|↵|}|↵|#trait| |Next|(||)|#:| |Simple| |{||}|↵|#trait| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|←|↵|}| +//│ Parsed: {trait IFoo() {let a: string; fun b: (x: number,) -> number; fun c: () -> bool; fun d: (x: string,) -> unit}; trait II‹T›() {fun test: (x: T,) -> number}; fun create: () -> {v: number}; fun get: (x: {t: string},) -> string; trait IEvent() {fun callback: () -> number -> unit}; trait SearchFunc() {let __call: Unsupported["(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22]}; trait StringArray() {let __index: Unsupported["[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23]}; trait Counter() {let __call: Unsupported["(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19]; let interval: number; fun reset: () -> unit}; trait Simple() {let a: number; fun b: (x: bool,) -> string}; trait Simple2‹T›() {let abc: T}; trait Next(): Simple {}; trait TTT‹T›() {fun ttt: (x: T,) -> T}} From 77d7f55dcb3a4e0c915da2ef88f94c59590d13b8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Apr 2023 09:43:03 +0800 Subject: [PATCH 033/202] WIP: Fix interface function overriding --- .../src/main/scala/ts2mls/TSSourceFile.scala | 50 ++++---- ts2mls/js/src/test/diff/ES5.mlsi | 60 ++++++---- ts2mls/js/src/test/typescript/ES5.d.ts | 108 +++++++++--------- 3 files changed, 114 insertions(+), 104 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index a3d77227a..a274b9d5a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -107,6 +107,29 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType lst :+ getObjectType(h.types.get(index).typeNode) ) + private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType]): Map[String, TSMemberType] = mem match { + case func: TSFunctionType => { + if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, node.modifier)) + else { // deal with functions overloading + val old = others(name) + val res = old.base match { + case f @ TSFunctionType(_, _, tv) => + if (!tv.isEmpty || !func.typeVars.isEmpty) TSIgnoredOverload(func, name) + else if (!node.isImplementationOfOverload) TSIntersectionType(f, func) + else f + case int: TSIntersectionType => + if (!func.typeVars.isEmpty) TSIgnoredOverload(func, name) + else if (!node.isImplementationOfOverload) TSIntersectionType(int, func) + else int + case TSIgnoredOverload(_, name) => TSIgnoredOverload(func, name) // the implementation is always after declarations + case _ => old.base + } + others.removed(name) ++ Map(name -> TSMemberType(res, node.modifier)) + } + } + case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) + } + private def getClassMembersType(list: TSNodeArray, requireStatic: Boolean): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => { val name = p.symbol.escapedName @@ -115,30 +138,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val mem = if (!p.isStatic) getMemberType(p) else parseMembers(name, p.initializer, true) - - mem match { - case func: TSFunctionType => { - if (!mp.contains(name)) mp ++ Map(name -> TSMemberType(func, p.modifier)) - else { // deal with functions overloading - val old = mp(name) - val res = old.base match { - case f @ TSFunctionType(_, _, tv) => - if (!tv.isEmpty || !func.typeVars.isEmpty) TSIgnoredOverload(func, name) - else if (!p.isImplementationOfOverload) TSIntersectionType(f, func) - else f - case int: TSIntersectionType => - if (!func.typeVars.isEmpty) TSIgnoredOverload(func, name) - else if (!p.isImplementationOfOverload) TSIntersectionType(int, func) - else int - case TSIgnoredOverload(_, name) => TSIgnoredOverload(func, name) // the implementation is always after declarations - case _ => old.base - } - - mp.removed(name) ++ Map(name -> TSMemberType(res, p.modifier)) - } - } - case _ => mp ++ Map(name -> TSMemberType(mem, p.modifier)) - } + addMember(mem, p, name, mp) } else mp }) @@ -153,7 +153,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) private def getInterfacePropertiesType(list: TSNodeArray): Map[String, TSMemberType] = - list.foldLeft(Map[String, TSMemberType]())((mp, p) => mp ++ Map(p.symbol.escapedName -> TSMemberType(getMemberType(p)))) + list.foldLeft(Map[String, TSMemberType]())((mp, p) => addMember(getMemberType(p), p, p.symbol.escapedName, mp)) private def getAnonymousPropertiesType(list: TSSymbolArray): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 42fcdd0c6..48733201b 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -46,6 +46,16 @@ trait FunctionConstructor() { } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> +trait CallableFunction(): Function { + fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): R + fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +} +trait NewableFunction(): Function { + fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): unit + fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +} trait IArguments() { let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22> let length: number @@ -149,17 +159,17 @@ trait URIErrorConstructor(): ErrorConstructor { let JSON: JSON trait ReadonlyArray() { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number - fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit - fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray + fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136> - fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun join(separator: (string) | (undefined)): string fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray - fun concat(items: MutArray<(T) | (ConcatArray)>): MutArray + let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) fun toLocaleString(): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray - fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -215,7 +225,7 @@ trait Int8Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array let BYTES_PER_ELEMENT: number @@ -231,7 +241,7 @@ trait Int8Array() { fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -245,7 +255,7 @@ trait Uint8Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array let BYTES_PER_ELEMENT: number @@ -261,7 +271,7 @@ trait Uint8Array() { fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -275,7 +285,7 @@ trait Uint8ClampedArray() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray let BYTES_PER_ELEMENT: number @@ -291,7 +301,7 @@ trait Uint8ClampedArray() { fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -305,7 +315,7 @@ trait Int16Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array let BYTES_PER_ELEMENT: number @@ -321,7 +331,7 @@ trait Int16Array() { fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -335,7 +345,7 @@ trait Uint16Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array let BYTES_PER_ELEMENT: number @@ -351,7 +361,7 @@ trait Uint16Array() { fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -365,7 +375,7 @@ trait Int32Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array let BYTES_PER_ELEMENT: number @@ -381,7 +391,7 @@ trait Int32Array() { fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -395,7 +405,7 @@ trait Uint32Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array let BYTES_PER_ELEMENT: number @@ -411,7 +421,7 @@ trait Uint32Array() { fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -425,7 +435,7 @@ trait Float32Array() { fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array let BYTES_PER_ELEMENT: number @@ -441,7 +451,7 @@ trait Float32Array() { fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -454,7 +464,7 @@ trait Float64Array() { fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U + fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array let BYTES_PER_ELEMENT: number @@ -470,7 +480,7 @@ trait Float64Array() { fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U + fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string let length: number fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -563,5 +573,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#fun| |concat|(|items|#:| |MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)|#:| |MutArray|‹|T|›|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; fun concat: (items: MutArray[T | ConcatArray[T]],) -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index cf1d135db..203ec6c88 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -310,65 +310,65 @@ type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U */ type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; -// interface CallableFunction extends Function { -// /** -// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args An array of argument values to be passed to the function. -// */ -// apply(this: (this: T) => R, thisArg: T): R; -// apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; +interface CallableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: (this: T) => R, thisArg: T): R; + apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; -// /** -// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args Argument values to be passed to the function. -// */ -// call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; -// /** -// * For a given function, creates a bound function that has the same body as the original function. -// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. -// * @param thisArg The object to be used as the this object. -// * @param args Arguments to bind to the parameters of the function. -// */ -// bind(this: T, thisArg: ThisParameterType): OmitThisParameter; -// bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; -// bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; -// } + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: T, thisArg: ThisParameterType): OmitThisParameter; + bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; + bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; +} -// interface NewableFunction extends Function { -// /** -// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args An array of argument values to be passed to the function. -// */ -// apply(this: new () => T, thisArg: T): void; -// apply(this: new (...args: A) => T, thisArg: T, args: A): void; +interface NewableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: new () => T, thisArg: T): void; + apply(this: new (...args: A) => T, thisArg: T, args: A): void; -// /** -// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args Argument values to be passed to the function. -// */ -// call(this: new (...args: A) => T, thisArg: T, ...args: A): void; + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: new (...args: A) => T, thisArg: T, ...args: A): void; -// /** -// * For a given function, creates a bound function that has the same body as the original function. -// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. -// * @param thisArg The object to be used as the this object. -// * @param args Arguments to bind to the parameters of the function. -// */ -// bind(this: T, thisArg: any): T; -// bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; -// bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; -// } + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: T, thisArg: any): T; + bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; + bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; +} interface IArguments { [index: number]: any; From 1d36bb6ca59740d4ac8ead8352315eac35eb28e6 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Apr 2023 09:53:43 +0800 Subject: [PATCH 034/202] WIP: Fix multi-line unsupported code --- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 +- ts2mls/js/src/test/diff/ES5.mlsi | 39 +++++--- ts2mls/js/src/test/typescript/ES5.d.ts | 96 +++++++++---------- 3 files changed, 76 insertions(+), 62 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index f6384d4e9..b37a7f6f1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -155,7 +155,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val literal = TSTokenObject(node.literal) lazy val name = TSIdentifierObject(node.name) - override def toString(): String = node.getText().toString() + // TODO: multiline string support + override def toString(): String = node.getText().toString().replaceAll("\n", " ") lazy val filename: String = if (parent.isUndefined) node.fileName.toString() else parent.filename diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 48733201b..5695f0294 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -197,6 +197,19 @@ trait TypedPropertyDescriptor() { let value: (T) | (undefined) } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17> +trait ArrayLike() { + let length: number + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28> +} +type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20> +type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20> +type Omit = __type +type NonNullable = (T) & ({}) +type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50> +type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74> +type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50> +type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65> trait ThisType() {} let ArrayBuffer: ArrayBufferConstructor trait ArrayBufferTypes() { @@ -205,7 +218,7 @@ trait ArrayBufferTypes() { type ArrayBufferLike = ArrayBuffer trait ArrayBufferConstructor() { let prototype: ArrayBuffer - let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36> + let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> fun isView(arg: anything): (false) | (true) } trait ArrayBufferView() { @@ -216,7 +229,7 @@ trait ArrayBufferView() { let DataView: DataViewConstructor trait DataViewConstructor() { let prototype: DataView - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33> + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> } trait Int8Array() { fun valueOf(): Int8Array @@ -224,7 +237,7 @@ trait Int8Array() { fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array @@ -254,7 +267,7 @@ trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array @@ -284,7 +297,7 @@ trait Uint8ClampedArray() { fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray @@ -314,7 +327,7 @@ trait Int16Array() { fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array @@ -344,7 +357,7 @@ trait Uint16Array() { fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array @@ -374,7 +387,7 @@ trait Int32Array() { fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array @@ -404,7 +417,7 @@ trait Uint32Array() { fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array @@ -434,7 +447,7 @@ trait Float32Array() { fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array @@ -463,7 +476,7 @@ trait Float64Array() { fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array @@ -573,5 +586,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1665|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1817|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2065|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2347|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2630|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2910|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3193|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3475|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3756|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4038|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4312|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 203ec6c88..4b59abeda 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -1489,7 +1489,6 @@ interface TypedPropertyDescriptor { declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; -// TODO: // interface PromiseLike { // /** // * Attaches callbacks for the resolution and/or rejection of the Promise. @@ -1520,21 +1519,21 @@ declare type PromiseConstructorLike = new (executor: (resolve: (value: T | Pr // catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; // } -// /** -// * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. -// */ -// type Awaited = -// T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode -// T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped -// F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument -// Awaited : // recursively unwrap the value -// never : // the argument to `then` was not callable -// T; // non-object or non-thenable - -// interface ArrayLike { -// readonly length: number; -// readonly [n: number]: T; -// } +/** + * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. + */ +type Awaited = + T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode + T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped + F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument + Awaited : // recursively unwrap the value + never : // the argument to `then` was not callable + T; // non-object or non-thenable + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} // /** // * Make all properties in T optional @@ -1571,46 +1570,47 @@ declare type PromiseConstructorLike = new (executor: (resolve: (value: T | Pr // [P in K]: T; // }; -// /** -// * Exclude from T those types that are assignable to U -// */ -// type Exclude = T extends U ? never : T; +/** + * Exclude from T those types that are assignable to U + */ +type Exclude = T extends U ? never : T; -// /** -// * Extract from T those types that are assignable to U -// */ -// type Extract = T extends U ? T : never; +/** + * Extract from T those types that are assignable to U + */ +type Extract = T extends U ? T : never; -// /** -// * Construct a type with the properties of T except for those in type K. -// */ -// type Omit = Pick>; +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick>; -// /** -// * Exclude null and undefined from T -// */ -// type NonNullable = T & {}; +/** + * Exclude null and undefined from T + */ +type NonNullable = T & {}; -// /** -// * Obtain the parameters of a function type in a tuple -// */ -// type Parameters any> = T extends (...args: infer P) => any ? P : never; +/** + * Obtain the parameters of a function type in a tuple + */ +type Parameters any> = T extends (...args: infer P) => any ? P : never; -// /** -// * Obtain the parameters of a constructor function type in a tuple -// */ -// type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; +/** + * Obtain the parameters of a constructor function type in a tuple + */ +type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; -// /** -// * Obtain the return type of a function type -// */ -// type ReturnType any> = T extends (...args: any) => infer R ? R : any; +/** + * Obtain the return type of a function type + */ +type ReturnType any> = T extends (...args: any) => infer R ? R : any; -// /** -// * Obtain the return type of a constructor function type -// */ -// type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +/** + * Obtain the return type of a constructor function type + */ +type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +// TODO: intrinsic // /** // * Convert string literal type to uppercase // */ From 8be3757d69c89acfc13a7877e5990fae095ae5bf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Apr 2023 11:26:34 +0800 Subject: [PATCH 035/202] WIP: Handle more unsupported types --- .../main/scala/ts2mls/TSCompilerInfo.scala | 15 ++++- .../src/main/scala/ts2mls/TSSourceFile.scala | 7 ++- ts2mls/js/src/test/diff/ES5.mlsi | 31 ++++++---- ts2mls/js/src/test/typescript/ES5.d.ts | 60 +++++++++---------- 4 files changed, 66 insertions(+), 47 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index b37a7f6f1..2a06c76bf 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -22,8 +22,11 @@ object TypeScript { val syntaxKindProtected = ts.SyntaxKind.ProtectedKeyword val syntaxKindStatic = ts.SyntaxKind.StaticKeyword val objectFlagsAnonymous = ts.ObjectFlags.Anonymous + val objectFlagsMapped = ts.ObjectFlags.Mapped val symbolFlagsOptional = ts.SymbolFlags.Optional // this flag is only for checking optional members of interfaces - val typeFlagsConditional = ts.TypeFlags.Conditional + val typeFlagsConditional = ts.TypeFlags.Conditional // T extends U ? X : Y + val typeFlagsIndex = ts.TypeFlags.Index // keyof T + val typeFlagsIndexedAccess = ts.TypeFlags.IndexedAccess // T[K] def isToken(node: js.Dynamic) = ts.isToken(node) def isClassDeclaration(node: js.Dynamic) = ts.isClassDeclaration(node) @@ -187,7 +190,11 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA private lazy val flags = obj.flags private lazy val objectFlags = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) - private lazy val root = TSNodeObject(obj.root.node) + private lazy val root = + if (!IsUndefined(obj.root)) TSNodeObject(obj.root.node) + else if (!`type`.isUndefined && !`type`.symbol.isUndefined && !`type`.symbol.declaration.isUndefined) + `type`.symbol.declaration + else TSNodeObject(obj.declaration) lazy val symbol = TSSymbolObject(obj.symbol) lazy val typeArguments = TSTypeArray(checker.getTypeArguments(obj)) @@ -195,6 +202,7 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA if (!IsUndefined(obj.intrinsicName)) obj.intrinsicName.toString else baseType.intrinsicName + lazy val `type` = TSTypeObject(obj.selectDynamic("type")) lazy val types = TSTypeArray(obj.types) lazy val properties = TSSymbolArray(checker.getPropertiesOfType(obj)) lazy val node = TSNodeObject(checker.typeToTypeNode(obj)) @@ -207,10 +215,13 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isIntersectionType = obj.isIntersection() lazy val isFunctionLike = node.isFunctionLike lazy val isAnonymous = objectFlags == TypeScript.objectFlagsAnonymous + lazy val isMapped = objectFlags == TypeScript.objectFlagsMapped // mapping a type to another by using `keyof` and so on lazy val isTypeParameter = flags == TypeScript.typeFlagsTypeParameter lazy val isObject = flags == TypeScript.typeFlagsObject lazy val isTypeParameterSubstitution = isObject && typeArguments.length > 0 lazy val isConditionalType = flags == TypeScript.typeFlagsConditional + lazy val isIndexType = flags == TypeScript.typeFlagsIndex + lazy val isIndexedAccessType = flags == TypeScript.typeFlagsIndexedAccess override def toString(): String = root.toString() lazy val filename = root.filename diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index a274b9d5a..62b5a3f6c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -27,7 +27,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) private def getObjectType(obj: TSTypeObject): TSType = - if (obj.isEnumType) TSEnumType + if (obj.isMapped) lineHelper.getPos(obj.pos) match { + case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) + } + else if (obj.isEnumType) TSEnumType else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) else if (obj.isUnionType) getStructuralType(obj.types, true) @@ -38,7 +41,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (obj.isAnonymous) TSInterfaceType("", getAnonymousPropertiesType(obj.properties), List(), List()) else TSReferenceType(obj.symbol.fullName) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) - else if (obj.isConditionalType) lineHelper.getPos(obj.pos) match { + else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) lineHelper.getPos(obj.pos) match { case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) } else TSPrimitiveType(obj.intrinsicName) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 5695f0294..4a0ea08fb 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -202,6 +202,11 @@ trait ArrayLike() { let length: number let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28> } +type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17> +type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18> +type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18> +type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33> +type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37> type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20> type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20> type Omit = __type @@ -218,7 +223,7 @@ trait ArrayBufferTypes() { type ArrayBufferLike = ArrayBuffer trait ArrayBufferConstructor() { let prototype: ArrayBuffer - let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> + let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36> fun isView(arg: anything): (false) | (true) } trait ArrayBufferView() { @@ -229,7 +234,7 @@ trait ArrayBufferView() { let DataView: DataViewConstructor trait DataViewConstructor() { let prototype: DataView - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33> } trait Int8Array() { fun valueOf(): Int8Array @@ -237,7 +242,7 @@ trait Int8Array() { fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array @@ -267,7 +272,7 @@ trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array @@ -297,7 +302,7 @@ trait Uint8ClampedArray() { fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray @@ -327,7 +332,7 @@ trait Int16Array() { fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array @@ -357,7 +362,7 @@ trait Uint16Array() { fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array @@ -387,7 +392,7 @@ trait Int32Array() { fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array @@ -417,7 +422,7 @@ trait Uint32Array() { fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array @@ -447,7 +452,7 @@ trait Float32Array() { fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array @@ -476,7 +481,7 @@ trait Float64Array() { fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array @@ -586,5 +591,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1665|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1817|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2065|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2347|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2630|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2910|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3193|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3475|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3756|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4038|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4312|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Partial|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1541|,| |17|›|↵|#type| |Required|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]-?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1548|,| |18|›|↵|#type| |Readonly|‹|T|›| |#=| |Unsupported|‹|"{ readonly [P in keyof T]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1555|,| |18|›|↵|#type| |Pick|‹|T|,| |K|›| |#=| |Unsupported|‹|"{ [P in K]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1562|,| |33|›|↵|#type| |Record|‹|K|,| |T|›| |#=| |Unsupported|‹|"{ [P in K]: T; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1569|,| |37|›|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Partial‹T›(): Unsupported["{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17] {}; type alias Required‹T›(): Unsupported["{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18] {}; type alias Readonly‹T›(): Unsupported["{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18] {}; type alias Pick‹T, K›(): Unsupported["{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33] {}; type alias Record‹K, T›(): Unsupported["{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37] {}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 4b59abeda..553274d60 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -1535,40 +1535,40 @@ interface ArrayLike { readonly [n: number]: T; } -// /** -// * Make all properties in T optional -// */ -// type Partial = { -// [P in keyof T]?: T[P]; -// }; +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; -// /** -// * Make all properties in T required -// */ -// type Required = { -// [P in keyof T]-?: T[P]; -// }; +/** + * Make all properties in T required + */ +type Required = { + [P in keyof T]-?: T[P]; +}; -// /** -// * Make all properties in T readonly -// */ -// type Readonly = { -// readonly [P in keyof T]: T[P]; -// }; +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; -// /** -// * From T, pick a set of properties whose keys are in the union K -// */ -// type Pick = { -// [P in K]: T[P]; -// }; +/** + * From T, pick a set of properties whose keys are in the union K + */ +type Pick = { + [P in K]: T[P]; +}; -// /** -// * Construct a type with a set of properties K of type T -// */ -// type Record = { -// [P in K]: T; -// }; +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; /** * Exclude from T those types that are assignable to U From 184da9f8c7a81915bbf685407bea568218661b30 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Apr 2023 11:59:03 +0800 Subject: [PATCH 036/202] WIP: Generate for intrinsic --- .../src/main/scala/ts2mls/TSSourceFile.scala | 7 +++- ts2mls/js/src/test/diff/ES5.mlsi | 30 +++++++++-------- ts2mls/js/src/test/typescript/ES5.d.ts | 33 +++++++++---------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 62b5a3f6c..131e0aefd 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -50,7 +50,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getTypeAlias(tn: TSNodeObject): TSType = if (tn.isFunctionLike) getFunctionType(tn) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) - else getObjectType(tn.typeNode) + else getObjectType(tn.typeNode) match { + case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { + case (line, column) => TSUnsupportedType(tn.toString(), tn.filename, line, column) + } + case t => t + } // parse string/numeric literal types. we need to add quotes if it is a string literal private def getLiteralType(tp: TSNodeObject) = diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 4a0ea08fb..6af63d4b6 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -215,6 +215,10 @@ type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : neve type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74> type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50> type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65> +type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34> +type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34> +type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35> +type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37> trait ThisType() {} let ArrayBuffer: ArrayBufferConstructor trait ArrayBufferTypes() { @@ -223,7 +227,7 @@ trait ArrayBufferTypes() { type ArrayBufferLike = ArrayBuffer trait ArrayBufferConstructor() { let prototype: ArrayBuffer - let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36> + let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> fun isView(arg: anything): (false) | (true) } trait ArrayBufferView() { @@ -234,7 +238,7 @@ trait ArrayBufferView() { let DataView: DataViewConstructor trait DataViewConstructor() { let prototype: DataView - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33> + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> } trait Int8Array() { fun valueOf(): Int8Array @@ -242,7 +246,7 @@ trait Int8Array() { fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array @@ -272,7 +276,7 @@ trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array @@ -302,7 +306,7 @@ trait Uint8ClampedArray() { fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray @@ -332,7 +336,7 @@ trait Int16Array() { fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array @@ -362,7 +366,7 @@ trait Uint16Array() { fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array @@ -392,7 +396,7 @@ trait Int32Array() { fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array @@ -422,7 +426,7 @@ trait Uint32Array() { fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array @@ -452,7 +456,7 @@ trait Float32Array() { fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array @@ -481,7 +485,7 @@ trait Float64Array() { fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array @@ -591,5 +595,5 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Partial|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1541|,| |17|›|↵|#type| |Required|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]-?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1548|,| |18|›|↵|#type| |Readonly|‹|T|›| |#=| |Unsupported|‹|"{ readonly [P in keyof T]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1555|,| |18|›|↵|#type| |Pick|‹|T|,| |K|›| |#=| |Unsupported|‹|"{ [P in K]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1562|,| |33|›|↵|#type| |Record|‹|K|,| |T|›| |#=| |Unsupported|‹|"{ [P in K]: T; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1569|,| |37|›|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1666|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1818|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2066|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2348|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2631|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2911|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3194|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3476|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3757|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4039|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4313|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Partial‹T›(): Unsupported["{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17] {}; type alias Required‹T›(): Unsupported["{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18] {}; type alias Readonly‹T›(): Unsupported["{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18] {}; type alias Pick‹T, K›(): Unsupported["{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33] {}; type alias Record‹K, T›(): Unsupported["{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37] {}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1666, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1818, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2066, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2348, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2631, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2911, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3194, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3476, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3757, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4039, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4313, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Partial|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1541|,| |17|›|↵|#type| |Required|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]-?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1548|,| |18|›|↵|#type| |Readonly|‹|T|›| |#=| |Unsupported|‹|"{ readonly [P in keyof T]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1555|,| |18|›|↵|#type| |Pick|‹|T|,| |K|›| |#=| |Unsupported|‹|"{ [P in K]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1562|,| |33|›|↵|#type| |Record|‹|K|,| |T|›| |#=| |Unsupported|‹|"{ [P in K]: T; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1569|,| |37|›|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#type| |Uppercase|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1616|,| |34|›|↵|#type| |Lowercase|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1621|,| |34|›|↵|#type| |Capitalize|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1626|,| |35|›|↵|#type| |Uncapitalize|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1631|,| |37|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1665|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1817|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2065|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2347|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2630|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2910|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3193|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3475|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3756|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4038|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4312|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| +//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Partial‹T›(): Unsupported["{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17] {}; type alias Required‹T›(): Unsupported["{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18] {}; type alias Readonly‹T›(): Unsupported["{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18] {}; type alias Pick‹T, K›(): Unsupported["{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33] {}; type alias Record‹K, T›(): Unsupported["{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37] {}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; type alias Uppercase‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34] {}; type alias Lowercase‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34] {}; type alias Capitalize‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35] {}; type alias Uncapitalize‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 553274d60..5d5ce9d71 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -1610,26 +1610,25 @@ type ReturnType any> = T extends (...args: any) => i */ type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; -// TODO: intrinsic -// /** -// * Convert string literal type to uppercase -// */ -// type Uppercase = intrinsic; +/** + * Convert string literal type to uppercase + */ +type Uppercase = intrinsic; -// /** -// * Convert string literal type to lowercase -// */ -// type Lowercase = intrinsic; +/** + * Convert string literal type to lowercase + */ +type Lowercase = intrinsic; -// /** -// * Convert first character of string literal type to uppercase -// */ -// type Capitalize = intrinsic; +/** + * Convert first character of string literal type to uppercase + */ +type Capitalize = intrinsic; -// /** -// * Convert first character of string literal type to lowercase -// */ -// type Uncapitalize = intrinsic; +/** + * Convert first character of string literal type to lowercase + */ +type Uncapitalize = intrinsic; /** * Marker for contextual 'this' type From 905589cd51f6d72c8665682eca58f23194f32332 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 19 Apr 2023 19:51:19 +0800 Subject: [PATCH 037/202] WIP: Remove ParseOnly and use module keyword --- .../scala/mlscript/ConstraintSolver.scala | 4 +- .../src/main/scala/mlscript/NuTypeDefs.scala | 3 +- .../js/src/main/scala/ts2mls/JSWriter.scala | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 2 +- ts2mls/js/src/test/diff/Array.mlsi | 69 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 44 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 48 +- ts2mls/js/src/test/diff/Dec.mlsi | 25 +- ts2mls/js/src/test/diff/ES5.mlsi | 2669 ++++++++++++++++- ts2mls/js/src/test/diff/Enum.mlsi | 9 +- ts2mls/js/src/test/diff/Heritage.mlsi | 116 +- ts2mls/js/src/test/diff/HighOrderFunc.mlsi | 9 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 120 +- ts2mls/js/src/test/diff/Intersection.mlsi | 186 +- ts2mls/js/src/test/diff/Literal.mlsi | 9 +- ts2mls/js/src/test/diff/MultiFiles.mlsi | 57 +- ts2mls/js/src/test/diff/Namespace.mlsi | 90 +- ts2mls/js/src/test/diff/Optional.mlsi | 50 +- ts2mls/js/src/test/diff/Overload.mlsi | 48 +- ts2mls/js/src/test/diff/Tuple.mlsi | 52 +- ts2mls/js/src/test/diff/Type.mlsi | 83 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 91 +- ts2mls/js/src/test/diff/Union.mlsi | 28 +- ts2mls/js/src/test/diff/Variables.mlsi | 24 +- 24 files changed, 3760 insertions(+), 78 deletions(-) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 8441794ea..85c3ad3db 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -34,8 +34,8 @@ class ConstraintSolver extends NormalForms { self: Typer => val info = ctx.tyDefs2(clsNme) if (info.isComputing) { - - ??? // TODO support? + L(ErrorReport( + msg"${info.decl.kind.str.capitalize} `${info.decl.name}` is not supported yet." -> fld.toLoc :: Nil)) } else info.complete() match { diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index 88eaf4bff..dd746995f 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -607,8 +607,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val (res, funMembers) = td.kind match { case Trt => - err(msg"traits are not yet supported" -> td.toLoc :: Nil) - ??? + TypedNuAls(outerCtx.lvl, td, tparams, err(msg"traits are not yet supported" -> td.toLoc :: Nil)) -> Nil case Als => diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index ad8461547..f0de296a8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -18,7 +18,7 @@ class JSWriter(filename: String) { private var fileSize = 0 // how many bytes we've written in the file private var needTruncate = false - writeln(":NewParser\n:ParseOnly") + writeln(":NewParser\n:NewDefs\n:NoJS\n:AllowTypeErrors") def writeln(str: String) = { val strln = str + "\n" diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 4bb94bcf5..bd54aa568 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -38,7 +38,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { case Left(subName) => { - writer.writeln(s"${indent}namespace $subName {") + writer.writeln(s"${indent}module $subName {") subSpace(subName).generate(writer, indent + " ") writer.writeln(s"$indent}") } diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index 63668598c..df2a71a2f 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun first(x: MutArray): string fun getZero3(): MutArray fun first2(fs: MutArray<(number) => number>): (number) => number @@ -19,5 +21,66 @@ class Temp() { } fun ta(ts: MutArray>): MutArray> fun tat(ts: MutArray>): MutArray> -//│ |#fun| |first|(|x|#:| |MutArray|‹|string|›|)|#:| |string|↵|#fun| |getZero3|(||)|#:| |MutArray|‹|number|›|↵|#fun| |first2|(|fs|#:| |MutArray|‹|(|number|)| |=>| |number|›|)|#:| |(|number|)| |=>| |number|↵|#fun| |doEs|(|e|#:| |MutArray|‹|int|›|)|#:| |MutArray|‹|int|›|↵|#class| |C|(||)| |{||}|↵|#trait| |I|(||)| |{|→|#let| |i|#:| |number|←|↵|}|↵|#fun| |doCs|(|c|#:| |MutArray|‹|C|›|)|#:| |MutArray|‹|C|›|↵|#fun| |doIs|(|i|#:| |MutArray|‹|I|›|)|#:| |MutArray|‹|I|›|↵|#fun| |inter|‹|U|,| |T|›|(|x|#:| |MutArray|‹|(|U|)| |&| |(|T|)|›|)|#:| |MutArray|‹|(|U|)| |&| |(|T|)|›|↵|#fun| |clean|(|x|#:| |MutArray|‹|(|string|,| |number|,| |)|›|)|#:| |MutArray|‹|(|string|,| |number|,| |)|›|↵|#fun| |translate|‹|T|,| |U|›|(|x|#:| |MutArray|‹|T|›|)|#:| |MutArray|‹|U|›|↵|#fun| |uu|(|x|#:| |MutArray|‹|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|›|)|#:| |MutArray|‹|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|›|↵|#class| |Temp|‹|T|›|(||)| |{|→|#let| |x|#:| |T|←|↵|}|↵|#fun| |ta|(|ts|#:| |MutArray|‹|Temp|‹|(|false|)| ||| |(|true|)|›|›|)|#:| |MutArray|‹|Temp|‹|(|false|)| ||| |(|true|)|›|›|↵|#fun| |tat|‹|T|›|(|ts|#:| |MutArray|‹|Temp|‹|T|›|›|)|#:| |MutArray|‹|Temp|‹|T|›|›| -//│ Parsed: {fun first: (x: MutArray[string],) -> string; fun getZero3: () -> MutArray[number]; fun first2: (fs: MutArray[number -> number],) -> number -> number; fun doEs: (e: MutArray[int],) -> MutArray[int]; class C() {}; trait I() {let i: number}; fun doCs: (c: MutArray[C],) -> MutArray[C]; fun doIs: (i: MutArray[I],) -> MutArray[I]; fun inter: (x: MutArray[U & T],) -> MutArray[U & T]; fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)]; fun translate: (x: MutArray[T],) -> MutArray[U]; fun uu: (x: MutArray[number | false | true],) -> MutArray[number | false | true]; class Temp‹T›() {let x: T}; fun ta: (ts: MutArray[Temp[bool]],) -> MutArray[Temp[bool]]; fun tat: (ts: MutArray[Temp[T]],) -> MutArray[Temp[T]]} +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.10: trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.11: let i: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.12: } +//│ ╙── ^ +//│ ╔══[ERROR] trait I cannot be used as a type +//│ ║ l.14: fun doIs(i: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] trait I cannot be used as a type +//│ ║ l.14: fun doIs(i: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> +//│ ╙── ^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.17: fun translate(x: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.17: fun translate(x: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.17: fun translate(x: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.23: fun tat(ts: MutArray>): MutArray> +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.23: fun tat(ts: MutArray>): MutArray> +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.23: fun tat(ts: MutArray>): MutArray> +//│ ╙── ^ +//│ fun first: (x: MutArray[string],) -> string +//│ fun getZero3: () -> MutArray[number] +//│ fun first2: (fs: MutArray[number -> number],) -> number -> number +//│ fun doEs: (e: MutArray[int],) -> MutArray[int] +//│ class C() +//│ trait I() +//│ fun doCs: (c: MutArray[C],) -> MutArray[C] +//│ fun doIs: (i: MutArray[I],) -> MutArray[I] +//│ fun inter: (x: MutArray[error],) -> MutArray[error] +//│ fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)] +//│ fun translate: (x: MutArray[error],) -> MutArray[error] +//│ fun uu: (x: MutArray[false | number | true],) -> MutArray[false | number | true] +//│ class Temp[T]() { +//│ let x: T +//│ } +//│ fun ta: (ts: MutArray[Temp[bool]],) -> MutArray[Temp[bool]] +//│ fun tat: (ts: MutArray[Temp[error]],) -> MutArray[Temp[error]] diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 791152e8b..5cf704b88 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun hello(): unit fun add(x: number, y: number): number fun sub(x: number, y: number): number @@ -24,5 +26,41 @@ trait Barrrrrrrrr() { } fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr -//│ |#fun| |hello|(||)|#:| |unit|↵|#fun| |add|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |sub|(|x|#:| |number|,| |y|#:| |number|)|#:| |number|↵|#fun| |foo|(||)|#:| |number|↵|#fun| |id|(|x|#:| |anything|)|#:| |anything|↵|#fun| |odd|(|x|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isnull|(|x|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |bar|(||)|#:| |anything|↵|#fun| |nu|(|n|#:| |null|)|#:| |null|↵|#fun| |un|(|n|#:| |undefined|)|#:| |undefined|↵|#fun| |fail|(||)|#:| |nothing|↵|#fun| |create|(||)|#:| |object|↵|#fun| |pa|(|x|#:| |number|)|#:| |number|↵|#fun| |wtf|(|x|#:| |anything|)|#:| |unit|↵|#class| |Foooooo|(||)| |{|→|#let| |ooooooo|#:| |number|←|↵|}|↵|#fun| |inn|(|f|#:| |Foooooo|)|#:| |unit|↵|#fun| |out1|(||)|#:| |Foooooo|↵|#trait| |Barrrrrrrrr|(||)| |{|→|#let| |rrrrrrr|#:| |number|←|↵|}|↵|#fun| |inn2|(|b|#:| |Barrrrrrrrr|)|#:| |unit|↵|#fun| |out2|(||)|#:| |Barrrrrrrrr| -//│ Parsed: {fun hello: () -> unit; fun add: (x: number, y: number,) -> number; fun sub: (x: number, y: number,) -> number; fun foo: () -> number; fun id: (x: anything,) -> anything; fun odd: (x: number,) -> bool; fun isnull: (x: anything,) -> bool; fun bar: () -> anything; fun nu: (n: null,) -> null; fun un: (n: undefined,) -> undefined; fun fail: () -> nothing; fun create: () -> object; fun pa: (x: number,) -> number; fun wtf: (x: anything,) -> unit; class Foooooo() {let ooooooo: number}; fun inn: (f: Foooooo,) -> unit; fun out1: () -> Foooooo; trait Barrrrrrrrr() {let rrrrrrr: number}; fun inn2: (b: Barrrrrrrrr,) -> unit; fun out2: () -> Barrrrrrrrr} +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.16: fun create(): object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.24: trait Barrrrrrrrr() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: let rrrrrrr: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.26: } +//│ ╙── ^ +//│ ╔══[ERROR] trait Barrrrrrrrr cannot be used as a type +//│ ║ l.27: fun inn2(b: Barrrrrrrrr): unit +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Barrrrrrrrr cannot be used as a type +//│ ║ l.28: fun out2(): Barrrrrrrrr +//│ ╙── ^^^^^^^^^^^ +//│ fun hello: () -> unit +//│ fun add: (x: number, y: number,) -> number +//│ fun sub: (x: number, y: number,) -> number +//│ fun foo: () -> number +//│ fun id: (x: anything,) -> anything +//│ fun odd: (x: number,) -> bool +//│ fun isnull: (x: anything,) -> bool +//│ fun bar: () -> anything +//│ fun nu: (n: null,) -> null +//│ fun un: (n: undefined,) -> undefined +//│ fun fail: () -> nothing +//│ fun create: () -> error +//│ fun pa: (x: number,) -> number +//│ fun wtf: (x: anything,) -> unit +//│ class Foooooo() { +//│ let ooooooo: number +//│ } +//│ fun inn: (f: Foooooo,) -> unit +//│ fun out1: () -> Foooooo +//│ trait Barrrrrrrrr() +//│ fun inn2: (b: Barrrrrrrrr,) -> unit +//│ fun out2: () -> Barrrrrrrrr diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index f76a85294..a07ed66eb 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors class Student(s: string, age: number) { let name: string fun isFriend(other: Student): (false) | (true) @@ -21,5 +23,45 @@ class TTT() { fun ttt(x: T): T fun ttt2(x: T): T } -//│ |#class| |Student|(|s|#:| |string|,| |age|#:| |number|)| |{|→|#let| |name|#:| |string|↵|#fun| |isFriend|(|other|#:| |Student|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |addScore|(|sub|#:| |string|,| |score|#:| |number|)|#:| |unit|↵|#fun| |getID|(||)|#:| |number|←|↵|}|↵|#class| |Foo|‹|T|›|(||)| |{|→|#fun| |bar|(|x|#:| |T|)|#:| |unit|←|↵|}|↵|#class| |EZ|(||)| |{|→|#fun| |inc|(|x|#:| |number|)|#:| |number|←|↵|}|↵|#class| |Outer|(||)| |{|→|#class| |Inner|(||)| |{|→|#let| |a|#:| |number|←|↵|}|←|↵|}|↵|#class| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|↵|#fun| |ttt2|(|x|#:| |T|)|#:| |T|←|↵|}| -//│ Parsed: {class Student(s: string, age: number,) {let name: string; fun isFriend: (other: Student,) -> bool; fun addScore: (sub: string, score: number,) -> unit; fun getID: () -> number}; class Foo‹T›() {fun bar: (x: T,) -> unit}; class EZ() {fun inc: (x: number,) -> number}; class Outer() {class Inner() {let a: number}}; class TTT‹T›() {fun ttt: (x: T,) -> T; fun ttt2: (x: T,) -> T}} +//│ ╔══[ERROR] Member isFriend is declared but not defined +//│ ║ l.7: fun isFriend(other: Student): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member addScore is declared but not defined +//│ ║ l.8: fun addScore(sub: string, score: number): unit +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member getID is declared but not defined +//│ ║ l.9: fun getID(): number +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member bar is declared but not defined +//│ ║ l.12: fun bar(x: T): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member inc is declared but not defined +//│ ║ l.15: fun inc(x: number): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member ttt is declared but not defined +//│ ║ l.23: fun ttt(x: T): T +//│ ╙── ^^^ +//│ ╔══[ERROR] Member ttt2 is declared but not defined +//│ ║ l.24: fun ttt2(x: T): T +//│ ╙── ^^^^ +//│ class Student(s: string, age: number) { +//│ fun addScore: (sub: string, score: number,) -> unit +//│ fun getID: () -> number +//│ fun isFriend: (other: Student,) -> bool +//│ let name: string +//│ } +//│ class Foo[T]() { +//│ fun bar: (x: T,) -> unit +//│ } +//│ class EZ() { +//│ fun inc: (x: number,) -> number +//│ } +//│ class Outer() { +//│ class Inner() { +//│ let a: number +//│ } +//│ } +//│ class TTT[T]() { +//│ fun ttt: (x: T,) -> T +//│ fun ttt2: (x: T,) -> T +//│ } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index a2bf5cab5..83570c073 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string trait Get() { @@ -8,7 +10,22 @@ trait Get() { class Person(name: string, age: number) { fun getName(id: number): string } -namespace OOO { +module OOO { } -//│ |#fun| |getName|(|id|#:| |(|string|)| ||| |(|number|)|)|#:| |string|↵|#fun| |render|(|callback|#:| |(|unit| |=>| |unit|)| ||| |(|undefined|)|)|#:| |string|↵|#trait| |Get|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(id: string): string"|,| |"ts2mls/js/src/test/typescript/Dec.d.ts"|,| |4|,| |22|›|←|↵|}|↵|#class| |Person|(|name|#:| |string|,| |age|#:| |number|)| |{|→|#fun| |getName|(|id|#:| |number|)|#:| |string|←|↵|}|↵|#namespace| |OOO| |{|↵|}| -//│ Parsed: {fun getName: (id: string | number,) -> string; fun render: (callback: unit -> unit | undefined,) -> string; trait Get() {let __call: Unsupported["(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22]}; class Person(name: string, age: number,) {fun getName: (id: number,) -> string}; module OOO() {}} +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.7: trait Get() { +//│ ║ ^^^^^^^^^^^^^ +//│ ║ l.8: let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.9: } +//│ ╙── ^ +//│ ╔══[ERROR] Member getName is declared but not defined +//│ ║ l.11: fun getName(id: number): string +//│ ╙── ^^^^^^^ +//│ fun getName: (id: number | string,) -> string +//│ fun render: (callback: unit -> unit | undefined,) -> string +//│ trait Get() +//│ class Person(name: string, age: number) { +//│ fun getName: (id: number,) -> string +//│ } +//│ module OOO() diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 6af63d4b6..3f26c3078 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors let NaN: number let Infinity: number fun eval(x: string): anything @@ -509,7 +511,7 @@ trait Float64Array() { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number let byteOffset: number } -namespace Intl { +module Intl { trait CollatorOptions() { let sensitivity: (string) | (undefined) let ignorePunctuation: ((false) | (true)) | (undefined) @@ -595,5 +597,2664 @@ namespace Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ |#let| |NaN|#:| |number|↵|#let| |Infinity|#:| |number|↵|#fun| |eval|(|x|#:| |string|)|#:| |anything|↵|#fun| |parseInt|(|string|#:| |string|,| |radix|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |parseFloat|(|string|#:| |string|)|#:| |number|↵|#fun| |isNaN|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |isFinite|(|number|#:| |number|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |decodeURI|(|encodedURI|#:| |string|)|#:| |string|↵|#fun| |decodeURIComponent|(|encodedURIComponent|#:| |string|)|#:| |string|↵|#fun| |encodeURI|(|uri|#:| |string|)|#:| |string|↵|#fun| |encodeURIComponent|(|uriComponent|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |escape|(|string|#:| |string|)|#:| |string|↵|#fun| |unescape|(|string|#:| |string|)|#:| |string|↵|#trait| |Symbol|(||)| |{|→|#fun| |toString|(||)|#:| |string|↵|#fun| |valueOf|(||)|#:| |Symbol|←|↵|}|↵|#type| |PropertyKey| |#=| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|↵|#trait| |PropertyDescriptor|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|anything|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |anything|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|anything|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |PropertyDescriptorMap|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: PropertyKey]: PropertyDescriptor;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |101|,| |33|›|←|↵|}|↵|#trait| |Object|(||)| |{|→|#fun| |hasOwnProperty|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |propertyIsEnumerable|(|v|#:| |(|(|string|)| ||| |(|number|)|)| ||| |(|Symbol|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |valueOf|(||)|#:| |Object|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |constructor|#:| |Function|↵|#fun| |isPrototypeOf|(|v|#:| |Object|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |toString|(||)|#:| |string|←|↵|}|↵|#let| |Function|#:| |FunctionConstructor|↵|#trait| |FunctionConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |291|,| |31|›|↵|#let| |__call|#:| |Unsupported|‹|"(...args: string[]): Function;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |296|,| |37|›|↵|#let| |prototype|#:| |Function|←|↵|}|↵|#type| |ThisParameterType|‹|T|›| |#=| |Unsupported|‹|"T extends (this: infer U, ...args: never) => any ? U : unknown"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |306|,| |27|›|↵|#type| |OmitThisParameter|‹|T|›| |#=| |Unsupported|‹|"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |311|,| |27|›|↵|#trait| |CallableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |R|↵|#fun| |bind|‹|T|,| |AX|,| |R|›|(|thisArg|#:| |T|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |NewableFunction|(||)|#:| |Function| |{|→|#fun| |apply|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit| |/* warning: the overload of function apply is not supported yet. */|↵|#fun| |call|‹|T|,| |A|›|(|thisArg|#:| |T|,| |args|#:| |A|)|#:| |unit|↵|#fun| |bind|‹|AX|,| |R|›|(|thisArg|#:| |anything|,| |args|#:| |MutArray|‹|AX|›|)|#:| |(|MutArray|‹|AX|›|)| |=>| |R| |/* warning: the overload of function bind is not supported yet. */|←|↵|}|↵|#trait| |IArguments|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: any;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |373|,| |22|›|↵|#let| |length|#:| |number|↵|#let| |callee|#:| |Function|←|↵|}|↵|#trait| |String|(||)| |{|→|#fun| |localeCompare|(|that|#:| |string|,| |locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.CollatorOptions|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |StringConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): String;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |503|,| |29|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: any): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |504|,| |29|›|↵|#let| |prototype|#:| |String|↵|#fun| |fromCharCode|(|codes|#:| |MutArray|‹|number|›|)|#:| |string|←|↵|}|↵|#let| |Boolean|#:| |BooleanConstructor|↵|#trait| |BooleanConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |520|,| |30|›|↵|#let| |__call|#:| |Unsupported|‹|"(value?: T): boolean;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |521|,| |30|›|↵|#let| |prototype|#:| |Boolean|←|↵|}|↵|#trait| |Number|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.NumberFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |NumberConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(value?: any): number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |558|,| |29|›|↵|#let| |NaN|#:| |number|↵|#let| |MIN_VALUE|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(value?: any): Number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |557|,| |29|›|↵|#let| |NEGATIVE_INFINITY|#:| |number|↵|#let| |POSITIVE_INFINITY|#:| |number|↵|#let| |MAX_VALUE|#:| |number|↵|#let| |prototype|#:| |Number|←|↵|}|↵|#trait| |TemplateStringsArray|(||)|#:| |ReadonlyArray|‹|string|›| |{|→|#let| |raw|#:| |ReadonlyArray|‹|string|›|←|↵|}|↵|#trait| |ImportMeta|(||)| |{||}|↵|#trait| |ImportCallOptions|(||)| |{|→|#let| |assert|#:| |(|ImportAssertions|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ImportAssertions|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[key: string]: string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |616|,| |28|›|←|↵|}|↵|#let| |Math|#:| |Math|↵|#trait| |Date|(||)| |{|→|#fun| |toLocaleString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleDateString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |toLocaleTimeString|(|locales|#:| |(|(|string|)| ||| |(|MutArray|‹|string|›|)|)| ||| |(|undefined|)|,| |options|#:| |(|Intl|.DateTimeFormatOptions|)| ||| |(|undefined|)|)|#:| |string|←|↵|}|↵|#trait| |DateConstructor|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(): string;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |898|,| |128|›|↵|#fun| |UTC|(|year|#:| |number|,| |monthIndex|#:| |number|,| |date|#:| |(|number|)| ||| |(|undefined|)|,| |hours|#:| |(|number|)| ||| |(|undefined|)|,| |minutes|#:| |(|number|)| ||| |(|undefined|)|,| |seconds|#:| |(|number|)| ||| |(|undefined|)|,| |ms|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |__new|#:| |Unsupported|‹|"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |887|,| |38|›|↵|#fun| |now|(||)|#:| |number|↵|#fun| |parse|(|s|#:| |string|)|#:| |number|↵|#let| |prototype|#:| |Date|←|↵|}|↵|#let| |RegExp|#:| |RegExpConstructor|↵|#let| |Error|#:| |ErrorConstructor|↵|#trait| |ErrorConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1042|,| |28|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): Error;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1043|,| |33|›|↵|#let| |prototype|#:| |Error|←|↵|}|↵|#let| |EvalError|#:| |EvalErrorConstructor|↵|#trait| |EvalErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1053|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): EvalError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1054|,| |37|›|↵|#let| |prototype|#:| |EvalError|←|↵|}|↵|#let| |RangeError|#:| |RangeErrorConstructor|↵|#trait| |RangeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1064|,| |58|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): RangeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1065|,| |38|›|↵|#let| |prototype|#:| |RangeError|←|↵|}|↵|#let| |ReferenceError|#:| |ReferenceErrorConstructor|↵|#trait| |ReferenceErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1075|,| |62|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): ReferenceError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1076|,| |42|›|↵|#let| |prototype|#:| |ReferenceError|←|↵|}|↵|#let| |SyntaxError|#:| |SyntaxErrorConstructor|↵|#trait| |SyntaxErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1086|,| |59|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): SyntaxError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1087|,| |39|›|↵|#let| |prototype|#:| |SyntaxError|←|↵|}|↵|#let| |TypeError|#:| |TypeErrorConstructor|↵|#trait| |TypeErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1097|,| |57|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): TypeError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1098|,| |37|›|↵|#let| |prototype|#:| |TypeError|←|↵|}|↵|#let| |URIError|#:| |URIErrorConstructor|↵|#trait| |URIErrorConstructor|(||)|#:| |ErrorConstructor| |{|→|#let| |__new|#:| |Unsupported|‹|"new(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1108|,| |56|›|↵|#let| |__call|#:| |Unsupported|‹|"(message?: string): URIError;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1109|,| |36|›|↵|#let| |prototype|#:| |URIError|←|↵|}|↵|#let| |JSON|#:| |JSON|↵|#trait| |ReadonlyArray|‹|T|›|(||)| |{|→|#fun| |lastIndexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)| |/* warning: the overload of function every is not supported yet. */|↵|#fun| |forEach|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |filter|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›| |/* warning: the overload of function filter is not supported yet. */|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1272|,| |136|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|‹|U|›|(|callbackfn|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |MutArray|‹|U|›|↵|#let| |concat|#:| |(|(|MutArray|‹|ConcatArray|‹|T|›|›|)| |=>| |MutArray|‹|T|›|)| |&| |(|(|MutArray|‹|(|T|)| ||| |(|ConcatArray|‹|T|›|)|›|)| |=>| |MutArray|‹|T|›|)|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|T|)| |=>| |(|number|)| |=>| |(|ReadonlyArray|‹|T|›|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |T|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|←|↵|}|↵|#trait| |ConcatArray|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1278|,| |28|›|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |MutArray|‹|T|›|←|↵|}|↵|#let| |Array|#:| |ArrayConstructor|↵|#trait| |ArrayConstructor|(||)| |{|→|#let| |__new|#:| |Unsupported|‹|"new (...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1470|,| |38|›|↵|#let| |__call|#:| |Unsupported|‹|"(...items: T[]): T[];"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1473|,| |34|›|↵|#fun| |isArray|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|↵|#let| |prototype|#:| |MutArray|‹|anything|›|←|↵|}|↵|#trait| |TypedPropertyDescriptor|‹|T|›|(||)| |{|→|#let| |configurable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |set|#:| |(|(|T|)| |=>| |unit|)| ||| |(|undefined|)|↵|#let| |enumerable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |get|#:| |(|unit| |=>| |T|)| ||| |(|undefined|)|↵|#let| |writable|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |value|#:| |(|T|)| ||| |(|undefined|)|←|↵|}|↵|#type| |PromiseConstructorLike| |#=| |(|(|(|(|T|)| ||| |(|PromiseLike|‹|T|›|)|)| |=>| |unit|)| |=>| |(|(|(|anything|)| ||| |(|undefined|)|)| |=>| |unit|)| |=>| |unit|)| |=>| |PromiseLike|‹|T|›|↵|#type| |Awaited|‹|T|›| |#=| |Unsupported|‹|"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1525|,| |17|›|↵|#trait| |ArrayLike|‹|T|›|(||)| |{|→|#let| |length|#:| |number|↵|#let| |__index|#:| |Unsupported|‹|"readonly [n: number]: T;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1534|,| |28|›|←|↵|}|↵|#type| |Partial|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1541|,| |17|›|↵|#type| |Required|‹|T|›| |#=| |Unsupported|‹|"{ [P in keyof T]-?: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1548|,| |18|›|↵|#type| |Readonly|‹|T|›| |#=| |Unsupported|‹|"{ readonly [P in keyof T]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1555|,| |18|›|↵|#type| |Pick|‹|T|,| |K|›| |#=| |Unsupported|‹|"{ [P in K]: T[P]; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1562|,| |33|›|↵|#type| |Record|‹|K|,| |T|›| |#=| |Unsupported|‹|"{ [P in K]: T; }"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1569|,| |37|›|↵|#type| |Exclude|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? never : T"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1576|,| |20|›|↵|#type| |Extract|‹|T|,| |U|›| |#=| |Unsupported|‹|"T extends U ? T : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1581|,| |20|›|↵|#type| |Omit|‹|T|,| |K|›| |#=| |__type|↵|#type| |NonNullable|‹|T|›| |#=| |(|T|)| |&| |(|{||}|)|↵|#type| |Parameters|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1596|,| |50|›|↵|#type| |ConstructorParameters|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: infer P) => any ? P : never"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1601|,| |74|›|↵|#type| |ReturnType|‹|T|›| |#=| |Unsupported|‹|"T extends (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1606|,| |50|›|↵|#type| |InstanceType|‹|T|›| |#=| |Unsupported|‹|"T extends abstract new (...args: any) => infer R ? R : any"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1611|,| |65|›|↵|#type| |Uppercase|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1616|,| |34|›|↵|#type| |Lowercase|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1621|,| |34|›|↵|#type| |Capitalize|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1626|,| |35|›|↵|#type| |Uncapitalize|‹|S|›| |#=| |Unsupported|‹|"intrinsic"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1631|,| |37|›|↵|#trait| |ThisType|‹|T|›|(||)| |{||}|↵|#let| |ArrayBuffer|#:| |ArrayBufferConstructor|↵|#trait| |ArrayBufferTypes|(||)| |{|→|#let| |ArrayBuffer|#:| |ArrayBuffer|←|↵|}|↵|#type| |ArrayBufferLike| |#=| |ArrayBuffer|↵|#trait| |ArrayBufferConstructor|(||)| |{|→|#let| |prototype|#:| |ArrayBuffer|↵|#let| |__new|#:| |Unsupported|‹|"new(byteLength: number): ArrayBuffer;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1665|,| |36|›|↵|#fun| |isView|(|arg|#:| |anything|)|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |ArrayBufferView|(||)| |{|→|#let| |buffer|#:| |ArrayBuffer|↵|#let| |byteLength|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#let| |DataView|#:| |DataViewConstructor|↵|#trait| |DataViewConstructor|(||)| |{|→|#let| |prototype|#:| |DataView|↵|#let| |__new|#:| |Unsupported|‹|"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |1817|,| |33|›|←|↵|}|↵|#trait| |Int8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2065|,| |25|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2347|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint8ClampedArray|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint8ClampedArray|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2630|,| |33|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint8ClampedArray|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint8ClampedArray|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint8ClampedArray|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |2910|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint16Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint16Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3193|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint16Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint16Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint16Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Int32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Int32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3475|,| |26|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Int32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Int32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Int32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Uint32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Uint32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |3756|,| |27|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Uint32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Uint32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Uint32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float32Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float32Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toLocaleString|(||)|#:| |string|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4038|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float32Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float32Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float32Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#trait| |Float64Array|(||)| |{|→|#fun| |valueOf|(||)|#:| |Float64Array|↵|#fun| |lastIndexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |every|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |set|(|array|#:| |ArrayLike|‹|number|›|,| |offset|#:| |(|number|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |__index|#:| |Unsupported|‹|"[index: number]: number;"|,| |"ts2mls/js/src/test/typescript/ES5.d.ts"|,| |4312|,| |28|›|↵|#fun| |reduceRight|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduceRight is not supported yet. */|↵|#fun| |fill|(|value|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |sort|(|compareFn|#:| |(|(|number|)| |=>| |(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |BYTES_PER_ELEMENT|#:| |number|↵|#fun| |copyWithin|(|target|#:| |number|,| |start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |find|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |subarray|(|begin|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |join|(|separator|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |map|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |number|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |forEach|(|callbackfn|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |unit|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |unit|↵|#let| |buffer|#:| |ArrayBuffer|↵|#fun| |findIndex|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |(|false|)| ||| |(|true|)|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |reverse|(||)|#:| |Float64Array|↵|#fun| |filter|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#fun| |slice|(|start|#:| |(|number|)| ||| |(|undefined|)|,| |end|#:| |(|number|)| ||| |(|undefined|)|)|#:| |Float64Array|↵|#let| |byteLength|#:| |number|↵|#fun| |reduce|‹|U|›|(|callbackfn|#:| |(|U|)| |=>| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |U|,| |initialValue|#:| |U|)|#:| |U| |/* warning: the overload of function reduce is not supported yet. */|↵|#fun| |toString|(||)|#:| |string|↵|#let| |length|#:| |number|↵|#fun| |some|(|predicate|#:| |(|number|)| |=>| |(|number|)| |=>| |(|Float64Array|)| |=>| |anything|,| |thisArg|#:| |(|anything|)| ||| |(|undefined|)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |indexOf|(|searchElement|#:| |number|,| |fromIndex|#:| |(|number|)| ||| |(|undefined|)|)|#:| |number|↵|#let| |byteOffset|#:| |number|←|↵|}|↵|#namespace| |Intl| |{|→|#trait| |CollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |ignorePunctuation|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |usage|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |numeric|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |caseFirst|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedCollatorOptions|(||)| |{|→|#let| |sensitivity|#:| |string|↵|#let| |ignorePunctuation|#:| |(|false|)| ||| |(|true|)|↵|#let| |usage|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |numeric|#:| |(|false|)| ||| |(|true|)|↵|#let| |caseFirst|#:| |string|↵|#let| |collation|#:| |string|←|↵|}|↵|#trait| |Collator|(||)| |{|→|#fun| |compare|(|x|#:| |string|,| |y|#:| |string|)|#:| |number|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedCollatorOptions|←|↵|}|↵|#trait| |NumberFormatOptions|(||)| |{|→|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |style|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |maximumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |currencySign|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedNumberFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minimumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |useGrouping|#:| |(|false|)| ||| |(|true|)|↵|#let| |style|#:| |string|↵|#let| |locale|#:| |string|↵|#let| |currency|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |minimumIntegerDigits|#:| |number|↵|#let| |maximumFractionDigits|#:| |number|↵|#let| |maximumSignificantDigits|#:| |(|number|)| ||| |(|undefined|)|↵|#let| |minimumFractionDigits|#:| |number|←|↵|}|↵|#trait| |NumberFormat|(||)| |{|→|#fun| |format|(|value|#:| |number|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedNumberFormatOptions|←|↵|}|↵|#trait| |DateTimeFormatOptions|(||)| |{|→|#let| |minute|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |formatMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |month|#:| |(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |localeMatcher|#:| |(|(|string|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |timeZoneName|#:| |(|(|(|(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|(|(|string|)| ||| |(|string|)|)| ||| |(|string|)|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |ResolvedDateTimeFormatOptions|(||)| |{|→|#let| |numberingSystem|#:| |string|↵|#let| |minute|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |year|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |second|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |hour12|#:| |(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|↵|#let| |weekday|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |day|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |timeZone|#:| |string|↵|#let| |month|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |locale|#:| |string|↵|#let| |calendar|#:| |string|↵|#let| |timeZoneName|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |era|#:| |(|string|)| ||| |(|undefined|)|←|↵|}|↵|#trait| |DateTimeFormat|(||)| |{|→|#fun| |format|(|date|#:| |(|(|number|)| ||| |(|Date|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |resolvedOptions|(||)|#:| |Intl|.ResolvedDateTimeFormatOptions|←|↵|}|←|↵|}| -//│ Parsed: {let NaN: number; let Infinity: number; fun eval: (x: string,) -> anything; fun parseInt: (string: string, radix: number | undefined,) -> number; fun parseFloat: (string: string,) -> number; fun isNaN: (number: number,) -> bool; fun isFinite: (number: number,) -> bool; fun decodeURI: (encodedURI: string,) -> string; fun decodeURIComponent: (encodedURIComponent: string,) -> string; fun encodeURI: (uri: string,) -> string; fun encodeURIComponent: (uriComponent: string | number | false | true,) -> string; fun escape: (string: string,) -> string; fun unescape: (string: string,) -> string; trait Symbol() {fun toString: () -> string; fun valueOf: () -> Symbol}; type alias PropertyKey(): string | number | Symbol {}; trait PropertyDescriptor() {let configurable: false | true | undefined; let set: anything -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> anything | undefined; let writable: false | true | undefined; let value: anything | undefined}; trait PropertyDescriptorMap() {let __index: Unsupported["[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33]}; trait Object() {fun hasOwnProperty: (v: string | number | Symbol,) -> bool; fun propertyIsEnumerable: (v: string | number | Symbol,) -> bool; fun valueOf: () -> Object; fun toLocaleString: () -> string; let constructor: Function; fun isPrototypeOf: (v: Object,) -> bool; fun toString: () -> string}; let Function: FunctionConstructor; trait FunctionConstructor() {let __new: Unsupported["new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31]; let __call: Unsupported["(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37]; let prototype: Function}; type alias ThisParameterType‹T›(): Unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27] {}; type alias OmitThisParameter‹T›(): Unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27] {}; trait CallableFunction(): Function {fun apply: (thisArg: T, args: A,) -> R; fun call: (thisArg: T, args: A,) -> R; fun bind: (thisArg: T, args: MutArray[AX],) -> MutArray[AX] -> R}; trait NewableFunction(): Function {fun apply: (thisArg: T, args: A,) -> unit; fun call: (thisArg: T, args: A,) -> unit; fun bind: (thisArg: anything, args: MutArray[AX],) -> MutArray[AX] -> R}; trait IArguments() {let __index: Unsupported["[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22]; let length: number; let callee: Function}; trait String() {fun localeCompare: (that: string, locales: string | MutArray[string] | undefined, options: Intl.CollatorOptions | undefined,) -> number}; trait StringConstructor() {let __new: Unsupported["new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29]; let __call: Unsupported["(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29]; let prototype: String; fun fromCharCode: (codes: MutArray[number],) -> string}; let Boolean: BooleanConstructor; trait BooleanConstructor() {let __new: Unsupported["new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30]; let __call: Unsupported["(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30]; let prototype: Boolean}; trait Number() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.NumberFormatOptions | undefined,) -> string}; trait NumberConstructor() {let __call: Unsupported["(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29]; let NaN: number; let MIN_VALUE: number; let __new: Unsupported["new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29]; let NEGATIVE_INFINITY: number; let POSITIVE_INFINITY: number; let MAX_VALUE: number; let prototype: Number}; trait TemplateStringsArray(): ReadonlyArray[string] {let raw: ReadonlyArray[string]}; trait ImportMeta() {}; trait ImportCallOptions() {let assert: ImportAssertions | undefined}; trait ImportAssertions() {let __index: Unsupported["[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28]}; let Math: Math; trait Date() {fun toLocaleString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleDateString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string; fun toLocaleTimeString: (locales: string | MutArray[string] | undefined, options: Intl.DateTimeFormatOptions | undefined,) -> string}; trait DateConstructor() {let __call: Unsupported["(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128]; fun UTC: (year: number, monthIndex: number, date: number | undefined, hours: number | undefined, minutes: number | undefined, seconds: number | undefined, ms: number | undefined,) -> number; let __new: Unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38]; fun now: () -> number; fun parse: (s: string,) -> number; let prototype: Date}; let RegExp: RegExpConstructor; let Error: ErrorConstructor; trait ErrorConstructor() {let __new: Unsupported["new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28]; let __call: Unsupported["(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33]; let prototype: Error}; let EvalError: EvalErrorConstructor; trait EvalErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57]; let __call: Unsupported["(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37]; let prototype: EvalError}; let RangeError: RangeErrorConstructor; trait RangeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58]; let __call: Unsupported["(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38]; let prototype: RangeError}; let ReferenceError: ReferenceErrorConstructor; trait ReferenceErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62]; let __call: Unsupported["(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42]; let prototype: ReferenceError}; let SyntaxError: SyntaxErrorConstructor; trait SyntaxErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59]; let __call: Unsupported["(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39]; let prototype: SyntaxError}; let TypeError: TypeErrorConstructor; trait TypeErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57]; let __call: Unsupported["(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37]; let prototype: TypeError}; let URIError: URIErrorConstructor; trait URIErrorConstructor(): ErrorConstructor {let __new: Unsupported["new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56]; let __call: Unsupported["(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36]; let prototype: URIError}; let JSON: JSON; trait ReadonlyArray‹T›() {fun lastIndexOf: (searchElement: T, fromIndex: number | undefined,) -> number; fun every: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun forEach: (callbackfn: T -> number -> ReadonlyArray[T] -> unit, thisArg: anything | undefined,) -> unit; fun filter: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> MutArray[T]; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136]; fun reduceRight: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: T -> number -> ReadonlyArray[T] -> U, thisArg: anything | undefined,) -> MutArray[U]; let concat: MutArray[ConcatArray[T]] -> MutArray[T] & MutArray[T | ConcatArray[T]] -> MutArray[T]; fun toLocaleString: () -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]; fun reduce: (callbackfn: U -> T -> number -> ReadonlyArray[T] -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: T -> number -> ReadonlyArray[T] -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: T, fromIndex: number | undefined,) -> number}; trait ConcatArray‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28]; fun join: (separator: string | undefined,) -> string; fun slice: (start: number | undefined, end: number | undefined,) -> MutArray[T]}; let Array: ArrayConstructor; trait ArrayConstructor() {let __new: Unsupported["new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38]; let __call: Unsupported["(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34]; fun isArray: (arg: anything,) -> bool; let prototype: MutArray[anything]}; trait TypedPropertyDescriptor‹T›() {let configurable: false | true | undefined; let set: T -> unit | undefined; let enumerable: false | true | undefined; let get: unit -> T | undefined; let writable: false | true | undefined; let value: T | undefined}; type alias PromiseConstructorLike(): (((T | PromiseLike[T]) -> unit) -> ((anything | undefined) -> unit) -> unit) -> PromiseLike[T] {}; type alias Awaited‹T›(): Unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17] {}; trait ArrayLike‹T›() {let length: number; let __index: Unsupported["readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28]}; type alias Partial‹T›(): Unsupported["{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17] {}; type alias Required‹T›(): Unsupported["{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18] {}; type alias Readonly‹T›(): Unsupported["{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18] {}; type alias Pick‹T, K›(): Unsupported["{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33] {}; type alias Record‹K, T›(): Unsupported["{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37] {}; type alias Exclude‹T, U›(): Unsupported["T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20] {}; type alias Extract‹T, U›(): Unsupported["T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20] {}; type alias Omit‹T, K›(): __type {}; type alias NonNullable‹T›(): T & {} {}; type alias Parameters‹T›(): Unsupported["T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50] {}; type alias ConstructorParameters‹T›(): Unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74] {}; type alias ReturnType‹T›(): Unsupported["T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50] {}; type alias InstanceType‹T›(): Unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65] {}; type alias Uppercase‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34] {}; type alias Lowercase‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34] {}; type alias Capitalize‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35] {}; type alias Uncapitalize‹S›(): Unsupported["intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37] {}; trait ThisType‹T›() {}; let ArrayBuffer: ArrayBufferConstructor; trait ArrayBufferTypes() {let ArrayBuffer: ArrayBuffer}; type alias ArrayBufferLike(): ArrayBuffer {}; trait ArrayBufferConstructor() {let prototype: ArrayBuffer; let __new: Unsupported["new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36]; fun isView: (arg: anything,) -> bool}; trait ArrayBufferView() {let buffer: ArrayBuffer; let byteLength: number; let byteOffset: number}; let DataView: DataViewConstructor; trait DataViewConstructor() {let prototype: DataView; let __new: Unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33]}; trait Int8Array() {fun valueOf: () -> Int8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25]; fun reduceRight: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int8Array; fun find: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int8Array -> number, thisArg: anything | undefined,) -> Int8Array; fun forEach: (callbackfn: number -> number -> Int8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int8Array; fun filter: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> Int8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8Array() {fun valueOf: () -> Uint8Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8Array; fun find: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8Array -> number, thisArg: anything | undefined,) -> Uint8Array; fun forEach: (callbackfn: number -> number -> Uint8Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8Array; fun filter: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> Uint8Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint8ClampedArray() {fun valueOf: () -> Uint8ClampedArray; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33]; fun reduceRight: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint8ClampedArray; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun find: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint8ClampedArray; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint8ClampedArray -> number, thisArg: anything | undefined,) -> Uint8ClampedArray; fun forEach: (callbackfn: number -> number -> Uint8ClampedArray -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint8ClampedArray -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint8ClampedArray; fun filter: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> Uint8ClampedArray; fun slice: (start: number | undefined, end: number | undefined,) -> Uint8ClampedArray; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint8ClampedArray -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint8ClampedArray -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int16Array() {fun valueOf: () -> Int16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int16Array; fun find: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int16Array -> number, thisArg: anything | undefined,) -> Int16Array; fun forEach: (callbackfn: number -> number -> Int16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int16Array; fun filter: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> Int16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint16Array() {fun valueOf: () -> Uint16Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint16Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint16Array; fun find: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint16Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint16Array -> number, thisArg: anything | undefined,) -> Uint16Array; fun forEach: (callbackfn: number -> number -> Uint16Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint16Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint16Array; fun filter: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> Uint16Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint16Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint16Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint16Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Int32Array() {fun valueOf: () -> Int32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26]; fun reduceRight: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Int32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Int32Array; fun find: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Int32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Int32Array -> number, thisArg: anything | undefined,) -> Int32Array; fun forEach: (callbackfn: number -> number -> Int32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Int32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Int32Array; fun filter: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> Int32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Int32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Int32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Int32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Uint32Array() {fun valueOf: () -> Uint32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27]; fun reduceRight: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Uint32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Uint32Array; fun find: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Uint32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Uint32Array -> number, thisArg: anything | undefined,) -> Uint32Array; fun forEach: (callbackfn: number -> number -> Uint32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Uint32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Uint32Array; fun filter: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> Uint32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Uint32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Uint32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Uint32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float32Array() {fun valueOf: () -> Float32Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; fun toLocaleString: () -> string; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float32Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float32Array; fun find: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float32Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float32Array -> number, thisArg: anything | undefined,) -> Float32Array; fun forEach: (callbackfn: number -> number -> Float32Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float32Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float32Array; fun filter: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> Float32Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float32Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float32Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float32Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; trait Float64Array() {fun valueOf: () -> Float64Array; fun lastIndexOf: (searchElement: number, fromIndex: number | undefined,) -> number; fun every: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun set: (array: ArrayLike[number], offset: number | undefined,) -> unit; let __index: Unsupported["[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28]; fun reduceRight: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun fill: (value: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun sort: (compareFn: number -> number -> number | undefined,) -> Float64Array; let BYTES_PER_ELEMENT: number; fun copyWithin: (target: number, start: number | undefined, end: number | undefined,) -> Float64Array; fun find: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun subarray: (begin: number | undefined, end: number | undefined,) -> Float64Array; fun join: (separator: string | undefined,) -> string; fun map: (callbackfn: number -> number -> Float64Array -> number, thisArg: anything | undefined,) -> Float64Array; fun forEach: (callbackfn: number -> number -> Float64Array -> unit, thisArg: anything | undefined,) -> unit; let buffer: ArrayBuffer; fun findIndex: (predicate: number -> number -> Float64Array -> bool, thisArg: anything | undefined,) -> number; fun reverse: () -> Float64Array; fun filter: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> Float64Array; fun slice: (start: number | undefined, end: number | undefined,) -> Float64Array; let byteLength: number; fun reduce: (callbackfn: U -> number -> number -> Float64Array -> U, initialValue: U,) -> U; fun toString: () -> string; let length: number; fun some: (predicate: number -> number -> Float64Array -> anything, thisArg: anything | undefined,) -> bool; fun indexOf: (searchElement: number, fromIndex: number | undefined,) -> number; let byteOffset: number}; module Intl() {trait CollatorOptions() {let sensitivity: string | undefined; let ignorePunctuation: false | true | undefined; let usage: string | undefined; let localeMatcher: string | undefined; let numeric: false | true | undefined; let caseFirst: string | undefined}; trait ResolvedCollatorOptions() {let sensitivity: string; let ignorePunctuation: bool; let usage: string; let locale: string; let numeric: bool; let caseFirst: string; let collation: string}; trait Collator() {fun compare: (x: string, y: string,) -> number; fun resolvedOptions: () -> Intl.ResolvedCollatorOptions}; trait NumberFormatOptions() {let minimumSignificantDigits: number | undefined; let useGrouping: false | true | undefined; let style: string | undefined; let localeMatcher: string | undefined; let currency: string | undefined; let minimumIntegerDigits: number | undefined; let maximumFractionDigits: number | undefined; let currencySign: string | undefined; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number | undefined}; trait ResolvedNumberFormatOptions() {let numberingSystem: string; let minimumSignificantDigits: number | undefined; let useGrouping: bool; let style: string; let locale: string; let currency: string | undefined; let minimumIntegerDigits: number; let maximumFractionDigits: number; let maximumSignificantDigits: number | undefined; let minimumFractionDigits: number}; trait NumberFormat() {fun format: (value: number,) -> string; fun resolvedOptions: () -> Intl.ResolvedNumberFormatOptions}; trait DateTimeFormatOptions() {let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let formatMatcher: string | undefined; let day: string | undefined; let timeZone: string | undefined; let month: string | undefined; let second: string | undefined; let localeMatcher: string | undefined; let timeZoneName: string | undefined; let era: string | undefined}; trait ResolvedDateTimeFormatOptions() {let numberingSystem: string; let minute: string | undefined; let year: string | undefined; let hour: string | undefined; let second: string | undefined; let hour12: false | true | undefined; let weekday: string | undefined; let day: string | undefined; let timeZone: string; let month: string | undefined; let locale: string; let calendar: string; let timeZoneName: string | undefined; let era: string | undefined}; trait DateTimeFormat() {fun format: (date: number | Date | undefined,) -> string; fun resolvedOptions: () -> Intl.ResolvedDateTimeFormatOptions}}} +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.20: fun valueOf(): Symbol +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.18: trait Symbol() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.19: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.20: fun valueOf(): Symbol +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.21: } +//│ ╙── ^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.19: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.20: fun valueOf(): Symbol +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.22: type PropertyKey = ((string) | (number)) | (Symbol) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.23: trait PropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: let configurable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: let set: ((anything) => unit) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.26: let enumerable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.27: let get: (unit => anything) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.28: let writable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.29: let value: (anything) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.30: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.31: trait PropertyDescriptorMap() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.32: let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.33: } +//│ ╙── ^ +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait Object cannot be used as a type +//│ ║ l.37: fun valueOf(): Object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait Object cannot be used as a type +//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.34: trait Object() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.37: fun valueOf(): Object +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.38: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.39: let constructor: Function +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.41: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.42: } +//│ ╙── ^ +//│ ╔══[ERROR] Member hasOwnProperty is declared but not defined +//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member propertyIsEnumerable is declared but not defined +//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.37: fun valueOf(): Object +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.38: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isPrototypeOf is declared but not defined +//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.41: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type +//│ ║ l.43: let Function: FunctionConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.44: trait FunctionConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.45: let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.46: let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.47: let prototype: Function +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.48: } +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.49: type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.50: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.51: trait CallableFunction(): Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.52: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.53: fun call(thisArg: T, args: A): R +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.54: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.55: } +//│ ╙── ^ +//│ ╔══[ERROR] Member apply is declared but not defined +//│ ║ l.52: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member call is declared but not defined +//│ ║ l.53: fun call(thisArg: T, args: A): R +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member bind is declared but not defined +//│ ║ l.54: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.56: trait NewableFunction(): Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.57: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.58: fun call(thisArg: T, args: A): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.59: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.60: } +//│ ╙── ^ +//│ ╔══[ERROR] Member apply is declared but not defined +//│ ║ l.57: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member call is declared but not defined +//│ ║ l.58: fun call(thisArg: T, args: A): unit +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member bind is declared but not defined +//│ ║ l.59: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.61: trait IArguments() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.62: let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.63: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.64: let callee: Function +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.65: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.515: trait CollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.516: let sensitivity: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.517: let ignorePunctuation: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.518: let usage: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.519: let localeMatcher: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.520: let numeric: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.521: let caseFirst: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.522: } +//│ ╙── ^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.523: trait ResolvedCollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.524: let sensitivity: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.525: let ignorePunctuation: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.526: let usage: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.527: let locale: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.528: let numeric: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.529: let caseFirst: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.530: let collation: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.531: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Module `Intl` is not supported yet. +//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.532: trait Collator() { +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.533: fun compare(x: string, y: string): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.535: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member compare is declared but not defined +//│ ║ l.533: fun compare(x: string, y: string): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.536: trait NumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.537: let minimumSignificantDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.538: let useGrouping: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.539: let style: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.540: let localeMatcher: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.541: let currency: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.542: let minimumIntegerDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.543: let maximumFractionDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.544: let currencySign: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.545: let maximumSignificantDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.546: let minimumFractionDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.547: } +//│ ╙── ^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.548: trait ResolvedNumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.549: let numberingSystem: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.550: let minimumSignificantDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.551: let useGrouping: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.552: let style: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.553: let locale: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.554: let currency: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.555: let minimumIntegerDigits: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.556: let maximumFractionDigits: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.557: let maximumSignificantDigits: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.558: let minimumFractionDigits: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.559: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Module `Intl` is not supported yet. +//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.560: trait NumberFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.561: fun format(value: number): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.563: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member format is declared but not defined +//│ ║ l.561: fun format(value: number): string +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.564: trait DateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.565: let minute: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.566: let year: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.567: let hour: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.568: let hour12: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.569: let weekday: (((string) | (string)) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.570: let formatMatcher: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.571: let day: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.572: let timeZone: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.573: let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.574: let second: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.575: let localeMatcher: ((string) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.576: let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.577: let era: (((string) | (string)) | (string)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.578: } +//│ ╙── ^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.579: trait ResolvedDateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.580: let numberingSystem: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.581: let minute: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.582: let year: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.583: let hour: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.584: let second: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.585: let hour12: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.586: let weekday: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.587: let day: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.588: let timeZone: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.589: let month: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.590: let locale: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.591: let calendar: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.592: let timeZoneName: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.593: let era: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.594: } +//│ ╙── ^^^ +//│ ╔══[ERROR] trait Date cannot be used as a type +//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Module `Intl` is not supported yet. +//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.595: trait DateTimeFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.598: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member format is declared but not defined +//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.66: trait String() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.67: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.68: } +//│ ╙── ^ +//│ ╔══[ERROR] Member localeCompare is declared but not defined +//│ ║ l.67: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.69: trait StringConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.70: let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.71: let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.72: let prototype: String +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.73: fun fromCharCode(codes: MutArray): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.74: } +//│ ╙── ^ +//│ ╔══[ERROR] Member fromCharCode is declared but not defined +//│ ║ l.73: fun fromCharCode(codes: MutArray): string +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type +//│ ║ l.75: let Boolean: BooleanConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.76: trait BooleanConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.77: let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.78: let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.79: let prototype: Boolean +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.80: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.81: trait Number() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.82: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.83: } +//│ ╙── ^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.82: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.84: trait NumberConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.85: let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.86: let NaN: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.87: let MIN_VALUE: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.88: let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.89: let NEGATIVE_INFINITY: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.90: let POSITIVE_INFINITY: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.91: let MAX_VALUE: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.92: let prototype: Number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.93: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.94: trait TemplateStringsArray(): ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.95: let raw: ReadonlyArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.96: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.97: trait ImportMeta() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.98: trait ImportCallOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.99: let assert: (ImportAssertions) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.100: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.101: trait ImportAssertions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.102: let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.103: } +//│ ╙── ^ +//│ ╔══[ERROR] function Math cannot be used as a type +//│ ║ l.104: let Math: Math +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: Math +//│ ║ l.104: let Math: Math +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.105: trait Date() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.106: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.107: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.108: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.109: } +//│ ╙── ^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.106: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toLocaleDateString is declared but not defined +//│ ║ l.107: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toLocaleTimeString is declared but not defined +//│ ║ l.108: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.110: trait DateConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.111: let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.112: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.113: let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.114: fun now(): number +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.115: fun parse(s: string): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.116: let prototype: Date +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.117: } +//│ ╙── ^ +//│ ╔══[ERROR] Member UTC is declared but not defined +//│ ║ l.112: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member now is declared but not defined +//│ ║ l.114: fun now(): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member parse is declared but not defined +//│ ║ l.115: fun parse(s: string): number +//│ ╙── ^^^^^ +//│ ╔══[ERROR] type identifier not found: RegExpConstructor +//│ ║ l.118: let RegExp: RegExpConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type +//│ ║ l.119: let Error: ErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.120: trait ErrorConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.121: let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.122: let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.123: let prototype: Error +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.124: } +//│ ╙── ^ +//│ ╔══[ERROR] trait EvalErrorConstructor cannot be used as a type +//│ ║ l.125: let EvalError: EvalErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.126: trait EvalErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.127: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.128: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.129: let prototype: EvalError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.130: } +//│ ╙── ^ +//│ ╔══[ERROR] trait RangeErrorConstructor cannot be used as a type +//│ ║ l.131: let RangeError: RangeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.132: trait RangeErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.133: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.134: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.135: let prototype: RangeError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.136: } +//│ ╙── ^ +//│ ╔══[ERROR] trait ReferenceErrorConstructor cannot be used as a type +//│ ║ l.137: let ReferenceError: ReferenceErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.138: trait ReferenceErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.139: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.140: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.141: let prototype: ReferenceError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.142: } +//│ ╙── ^ +//│ ╔══[ERROR] trait SyntaxErrorConstructor cannot be used as a type +//│ ║ l.143: let SyntaxError: SyntaxErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.144: trait SyntaxErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.145: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.146: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.147: let prototype: SyntaxError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.148: } +//│ ╙── ^ +//│ ╔══[ERROR] trait TypeErrorConstructor cannot be used as a type +//│ ║ l.149: let TypeError: TypeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.150: trait TypeErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.151: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.152: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.153: let prototype: TypeError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.154: } +//│ ╙── ^ +//│ ╔══[ERROR] trait URIErrorConstructor cannot be used as a type +//│ ║ l.155: let URIError: URIErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.156: trait URIErrorConstructor(): ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.157: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.158: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.159: let prototype: URIError +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.160: } +//│ ╙── ^ +//│ ╔══[ERROR] function JSON cannot be used as a type +//│ ║ l.161: let JSON: JSON +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: JSON +//│ ║ l.161: let JSON: JSON +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type +//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.162: trait ReadonlyArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.163: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.167: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.169: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.171: let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.172: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.173: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.175: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.176: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.178: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.179: } +//│ ╙── ^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.163: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.169: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.172: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.173: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.175: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.178: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.180: trait ConcatArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.181: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.182: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.183: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.184: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.185: } +//│ ╙── ^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.183: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.184: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ╙── ^^^^^ +//│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type +//│ ║ l.186: let Array: ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.187: trait ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.188: let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.189: let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.190: fun isArray(arg: anything): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.191: let prototype: MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.192: } +//│ ╙── ^ +//│ ╔══[ERROR] Member isArray is declared but not defined +//│ ║ l.190: fun isArray(arg: anything): (false) | (true) +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.193: trait TypedPropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.194: let configurable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.195: let set: ((T) => unit) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.196: let enumerable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.197: let get: (unit => T) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.198: let writable: ((false) | (true)) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.199: let value: (T) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.200: } +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: PromiseLike +//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: PromiseLike +//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.202: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.203: trait ArrayLike() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.204: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.205: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.206: } +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.207: type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.208: type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.209: type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.210: type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.211: type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.212: type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.213: type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: __type +//│ ║ l.214: type Omit = __type +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.216: type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.217: type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.218: type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.219: type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.220: type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.221: type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.222: type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Unsupported +//│ ║ l.223: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.224: trait ThisType() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type +//│ ║ l.225: let ArrayBuffer: ArrayBufferConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.226: trait ArrayBufferTypes() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.227: let ArrayBuffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.228: } +//│ ╙── ^ +//│ ╔══[ERROR] function ArrayBuffer cannot be used as a type +//│ ║ l.229: type ArrayBufferLike = ArrayBuffer +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: ArrayBuffer +//│ ║ l.229: type ArrayBufferLike = ArrayBuffer +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.230: trait ArrayBufferConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.231: let prototype: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.232: let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.233: fun isView(arg: anything): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.234: } +//│ ╙── ^ +//│ ╔══[ERROR] Member isView is declared but not defined +//│ ║ l.233: fun isView(arg: anything): (false) | (true) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.235: trait ArrayBufferView() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.236: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.237: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.238: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.239: } +//│ ╙── ^ +//│ ╔══[ERROR] trait DataViewConstructor cannot be used as a type +//│ ║ l.240: let DataView: DataViewConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.241: trait DataViewConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.242: let prototype: DataView +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.243: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.244: } +//│ ╙── ^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.246: fun valueOf(): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.264: fun reverse(): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8Array cannot be used as a type +//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.245: trait Int8Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.246: fun valueOf(): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.247: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.250: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.251: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.255: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.259: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.262: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.264: fun reverse(): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.267: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.269: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.270: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.272: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.273: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.274: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.246: fun valueOf(): Int8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.247: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.250: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.259: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.264: fun reverse(): Int8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.269: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.272: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.276: fun valueOf(): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.294: fun reverse(): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.275: trait Uint8Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.276: fun valueOf(): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.277: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.280: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.281: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.285: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.289: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.292: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.294: fun reverse(): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.297: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.299: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.300: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.302: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.303: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.304: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.276: fun valueOf(): Uint8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.277: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.280: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.289: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.294: fun reverse(): Uint8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.299: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.302: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.306: fun valueOf(): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.324: fun reverse(): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type +//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.305: trait Uint8ClampedArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.306: fun valueOf(): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.307: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.310: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.311: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.315: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.319: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.322: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.324: fun reverse(): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.327: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.329: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.330: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.332: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.333: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.334: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.306: fun valueOf(): Uint8ClampedArray +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.307: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.310: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.319: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.324: fun reverse(): Uint8ClampedArray +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.329: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.332: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.336: fun valueOf(): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.354: fun reverse(): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16Array cannot be used as a type +//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.335: trait Int16Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.336: fun valueOf(): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.337: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.340: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.341: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.345: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.349: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.352: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.354: fun reverse(): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.357: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.359: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.360: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.362: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.363: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.364: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.336: fun valueOf(): Int16Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.337: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.340: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.349: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.354: fun reverse(): Int16Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.359: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.362: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.366: fun valueOf(): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.384: fun reverse(): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16Array cannot be used as a type +//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.365: trait Uint16Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.366: fun valueOf(): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.367: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.370: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.371: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.375: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.379: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.382: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.384: fun reverse(): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.387: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.389: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.390: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.392: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.393: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.394: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.366: fun valueOf(): Uint16Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.367: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.370: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.379: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.384: fun reverse(): Uint16Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.389: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.392: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.396: fun valueOf(): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.414: fun reverse(): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32Array cannot be used as a type +//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.395: trait Int32Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.396: fun valueOf(): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.397: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.400: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.401: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.405: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.409: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.412: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.414: fun reverse(): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.417: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.419: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.420: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.422: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.423: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.424: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.396: fun valueOf(): Int32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.397: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.400: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.409: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.414: fun reverse(): Int32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.419: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.422: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.426: fun valueOf(): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.444: fun reverse(): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32Array cannot be used as a type +//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.425: trait Uint32Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.426: fun valueOf(): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.427: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.430: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.431: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.435: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.439: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.442: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.444: fun reverse(): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.447: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.449: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.450: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.452: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.453: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.454: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.426: fun valueOf(): Uint32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.427: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.430: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.439: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.444: fun reverse(): Uint32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.449: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.452: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.456: fun valueOf(): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.474: fun reverse(): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32Array cannot be used as a type +//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.455: trait Float32Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.456: fun valueOf(): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.457: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.460: fun toLocaleString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.461: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.465: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.469: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.472: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.474: fun reverse(): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.477: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.479: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.480: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.482: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.483: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.484: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.456: fun valueOf(): Float32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.457: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.460: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.469: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.474: fun reverse(): Float32Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.479: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.482: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.486: fun valueOf(): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.503: fun reverse(): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64Array cannot be used as a type +//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.485: trait Float64Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.486: fun valueOf(): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.487: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.490: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.494: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.498: fun join(separator: (string) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.501: let buffer: ArrayBuffer +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.503: fun reverse(): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.506: let byteLength: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.508: fun toString(): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.509: let length: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.511: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.512: let byteOffset: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.513: } +//│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.486: fun valueOf(): Float64Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.487: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.498: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.503: fun reverse(): Float64Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.508: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.511: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ +//│ let NaN: number +//│ let Infinity: number +//│ fun eval: (x: string,) -> anything +//│ fun parseInt: (string: string, radix: number | undefined,) -> number +//│ fun parseFloat: (string: string,) -> number +//│ fun isNaN: (number: number,) -> bool +//│ fun isFinite: (number: number,) -> bool +//│ fun decodeURI: (encodedURI: string,) -> string +//│ fun decodeURIComponent: (encodedURIComponent: string,) -> string +//│ fun encodeURI: (uri: string,) -> string +//│ fun encodeURIComponent: (uriComponent: false | number | string | true,) -> string +//│ fun escape: (string: string,) -> string +//│ fun unescape: (string: string,) -> string +//│ trait Symbol() +//│ type PropertyKey = number | string | Symbol +//│ trait PropertyDescriptor() +//│ trait PropertyDescriptorMap() +//│ trait Object() +//│ let Function: FunctionConstructor +//│ trait FunctionConstructor() +//│ type ThisParameterType[T] = error +//│ type OmitThisParameter[T] = error +//│ trait CallableFunction() +//│ trait NewableFunction() +//│ trait IArguments() +//│ trait String() +//│ trait StringConstructor() +//│ let Boolean: BooleanConstructor +//│ trait BooleanConstructor() +//│ trait Number() +//│ trait NumberConstructor() +//│ trait TemplateStringsArray() +//│ trait ImportMeta() +//│ trait ImportCallOptions() +//│ trait ImportAssertions() +//│ let Math: error +//│ trait Date() +//│ trait DateConstructor() +//│ let RegExp: error +//│ let Error: ErrorConstructor +//│ trait ErrorConstructor() +//│ let EvalError: EvalErrorConstructor +//│ trait EvalErrorConstructor() +//│ let RangeError: RangeErrorConstructor +//│ trait RangeErrorConstructor() +//│ let ReferenceError: ReferenceErrorConstructor +//│ trait ReferenceErrorConstructor() +//│ let SyntaxError: SyntaxErrorConstructor +//│ trait SyntaxErrorConstructor() +//│ let TypeError: TypeErrorConstructor +//│ trait TypeErrorConstructor() +//│ let URIError: URIErrorConstructor +//│ trait URIErrorConstructor() +//│ let JSON: error +//│ trait ReadonlyArray[T]() +//│ trait ConcatArray[T]() +//│ let Array: ArrayConstructor +//│ trait ArrayConstructor() +//│ trait TypedPropertyDescriptor[T]() +//│ type PromiseConstructorLike = ((error -> unit) -> (anything -> unit) -> unit) -> error +//│ type Awaited[T] = error +//│ trait ArrayLike[T]() +//│ type Partial[T] = error +//│ type Required[T] = error +//│ type Readonly[T] = error +//│ type Pick[T, K] = error +//│ type Record[K, T] = error +//│ type Exclude[T, U] = error +//│ type Extract[T, U] = error +//│ type Omit[T, K] = error +//│ type NonNullable[T] = T +//│ type Parameters[T] = error +//│ type ConstructorParameters[T] = error +//│ type ReturnType[T] = error +//│ type InstanceType[T] = error +//│ type Uppercase[S] = error +//│ type Lowercase[S] = error +//│ type Capitalize[S] = error +//│ type Uncapitalize[S] = error +//│ trait ThisType[T]() +//│ let ArrayBuffer: ArrayBufferConstructor +//│ trait ArrayBufferTypes() +//│ type ArrayBufferLike = error +//│ trait ArrayBufferConstructor() +//│ trait ArrayBufferView() +//│ let DataView: DataViewConstructor +//│ trait DataViewConstructor() +//│ trait Int8Array() +//│ trait Uint8Array() +//│ trait Uint8ClampedArray() +//│ trait Int16Array() +//│ trait Uint16Array() +//│ trait Int32Array() +//│ trait Uint32Array() +//│ trait Float32Array() +//│ trait Float64Array() +//│ module Intl() { +//│ trait Collator() +//│ trait CollatorOptions() +//│ trait DateTimeFormat() +//│ trait DateTimeFormatOptions() +//│ trait NumberFormat() +//│ trait NumberFormatOptions() +//│ trait ResolvedCollatorOptions() +//│ trait ResolvedDateTimeFormatOptions() +//│ trait ResolvedNumberFormatOptions() +//│ } diff --git a/ts2mls/js/src/test/diff/Enum.mlsi b/ts2mls/js/src/test/diff/Enum.mlsi index 2915b85cc..c63abc820 100644 --- a/ts2mls/js/src/test/diff/Enum.mlsi +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -1,7 +1,10 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun pass(c: int): (false) | (true) fun stop(): int fun g(x: int): int -//│ |#fun| |pass|(|c|#:| |int|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |stop|(||)|#:| |int|↵|#fun| |g|(|x|#:| |int|)|#:| |int| -//│ Parsed: {fun pass: (c: int,) -> bool; fun stop: () -> int; fun g: (x: int,) -> int} +//│ fun pass: (c: int,) -> bool +//│ fun stop: () -> int +//│ fun g: (x: int,) -> int diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 68dba08a1..eb25c3537 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors class A() { fun foo(): unit } @@ -33,12 +35,118 @@ trait O() { class OR(): O { fun xx(x: R): R } -namespace Five { +module Five { class ROTK() { let wu: string } class Y(): Five.ROTK {} } class Y(): Five.ROTK {} -//│ |#class| |A|(||)| |{|→|#fun| |foo|(||)|#:| |unit|←|↵|}|↵|#class| |B|(||)|#:| |A| |{||}|↵|#class| |C|‹|T|›|(||)| |{|→|#fun| |set|(|x|#:| |T|)|#:| |unit|↵|#fun| |get|(||)|#:| |T|←|↵|}|↵|#class| |D|(||)|#:| |C|‹|number|›| |{||}|↵|#trait| |Wu|(||)| |{|→|#let| |x|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#class| |WuWu|(||)|#:| |Wu| |{|→|#let| |y|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |WuWuWu|(||)|#:| |WuWu| |{|→|#let| |z|#:| |(|false|)| ||| |(|true|)|←|↵|}|↵|#trait| |Never|(||)|#:| |WuWuWu| |{|→|#fun| |w|(||)|#:| |nothing|←|↵|}|↵|#class| |VG|‹|T|›|(||)| |{|→|#let| |x|#:| |T|←|↵|}|↵|#class| |Home|‹|T|›|(||)|#:| |VG|‹|string|›| |{|→|#let| |y|#:| |T|←|↵|}|↵|#trait| |O|‹|I|›|(||)| |{|→|#fun| |xx|(|x|#:| |I|)|#:| |I|←|↵|}|↵|#class| |OR|‹|R|›|(||)|#:| |O|‹|R|›| |{|→|#fun| |xx|(|x|#:| |R|)|#:| |R|←|↵|}|↵|#namespace| |Five| |{|→|#class| |ROTK|(||)| |{|→|#let| |wu|#:| |string|←|↵|}|↵|#class| |Y|(||)|#:| |Five|.ROTK| |{||}|←|↵|}|↵|#class| |Y|(||)|#:| |Five|.ROTK| |{||}| -//│ Parsed: {class A() {fun foo: () -> unit}; class B(): A {}; class C‹T›() {fun set: (x: T,) -> unit; fun get: () -> T}; class D(): C[number] {}; trait Wu() {let x: bool}; class WuWu(): Wu {let y: bool}; trait WuWuWu(): WuWu {let z: bool}; trait Never(): WuWuWu {fun w: () -> nothing}; class VG‹T›() {let x: T}; class Home‹T›(): VG[string] {let y: T}; trait O‹I›() {fun xx: (x: I,) -> I}; class OR‹R›(): O[R] {fun xx: (x: R,) -> R}; module Five() {class ROTK() {let wu: string}; class Y(): Five.ROTK {}}; class Y(): Five.ROTK {}} +//│ ╔══[ERROR] Member foo is declared but not defined +//│ ║ l.6: fun foo(): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.8: class B(): A {} +//│ ╙── ^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.10: fun set(x: T): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member get is declared but not defined +//│ ║ l.11: fun get(): T +//│ ╙── ^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.13: class D(): C {} +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.14: trait Wu() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.15: let x: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.16: } +//│ ╙── ^ +//│ ╔══[ERROR] trait Wu cannot be used as a type +//│ ║ l.17: class WuWu(): Wu { +//│ ╙── ^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.17: class WuWu(): Wu { +//│ ╙── ^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.20: trait WuWuWu(): WuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.21: let z: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.22: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.23: trait Never(): WuWuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: fun w(): nothing +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: } +//│ ╙── ^ +//│ ╔══[ERROR] Member w is declared but not defined +//│ ║ l.24: fun w(): nothing +//│ ╙── ^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.29: class Home(): VG { +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.32: trait O() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.33: fun xx(x: I): I +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.34: } +//│ ╙── ^ +//│ ╔══[ERROR] Member xx is declared but not defined +//│ ║ l.33: fun xx(x: I): I +//│ ╙── ^^ +//│ ╔══[ERROR] trait O cannot be used as a type +//│ ║ l.35: class OR(): O { +//│ ╙── ^^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.35: class OR(): O { +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member xx is declared but not defined +//│ ║ l.36: fun xx(x: R): R +//│ ╙── ^^ +//│ ╔══[ERROR] Module `Five` is not supported yet. +//│ ║ l.42: class Y(): Five.ROTK {} +//│ ╙── ^^^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.42: class Y(): Five.ROTK {} +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.44: class Y(): Five.ROTK {} +//│ ╙── ^^^^^^^^^ +//│ class A() { +//│ fun foo: () -> unit +//│ } +//│ class B() +//│ class C[T]() { +//│ fun get: () -> T +//│ fun set: (x: T,) -> unit +//│ } +//│ class D() +//│ trait Wu() +//│ class WuWu() { +//│ let y: bool +//│ } +//│ trait WuWuWu() +//│ trait Never() +//│ class VG[T]() { +//│ let x: T +//│ } +//│ class Home[T]() { +//│ let y: T +//│ } +//│ trait O[I]() +//│ class OR[R]() { +//│ fun xx: (x: R,) -> R +//│ } +//│ module Five() { +//│ class ROTK() { +//│ let wu: string +//│ } +//│ class Y() +//│ } +//│ class Y() diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi index 3a8f6ede3..9d5f46317 100644 --- a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi +++ b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi @@ -1,7 +1,10 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun h1(inc: (number) => number, num: number): number fun h2(hint: string): unit => string fun h3(f: (number) => number, g: (number) => number): (number) => number -//│ |#fun| |h1|(|inc|#:| |(|number|)| |=>| |number|,| |num|#:| |number|)|#:| |number|↵|#fun| |h2|(|hint|#:| |string|)|#:| |unit| |=>| |string|↵|#fun| |h3|(|f|#:| |(|number|)| |=>| |number|,| |g|#:| |(|number|)| |=>| |number|)|#:| |(|number|)| |=>| |number| -//│ Parsed: {fun h1: (inc: number -> number, num: number,) -> number; fun h2: (hint: string,) -> unit -> string; fun h3: (f: number -> number, g: number -> number,) -> number -> number} +//│ fun h1: (inc: number -> number, num: number,) -> number +//│ fun h2: (hint: string,) -> unit -> string +//│ fun h3: (f: number -> number, g: number -> number,) -> number -> number diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index e3d4fd6ae..e05f4112f 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors trait IFoo() { let a: string fun b(x: number): number @@ -36,5 +38,117 @@ trait Next(): Simple {} trait TTT() { fun ttt(x: T): T } -//│ |#trait| |IFoo|(||)| |{|→|#let| |a|#:| |string|↵|#fun| |b|(|x|#:| |number|)|#:| |number|↵|#fun| |c|(||)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |d|(|x|#:| |string|)|#:| |unit|←|↵|}|↵|#trait| |II|‹|T|›|(||)| |{|→|#fun| |test|(|x|#:| |T|)|#:| |number|←|↵|}|↵|#fun| |create|(||)|#:| |{|v|#:| |number|,|}|↵|#fun| |get|(|x|#:| |{|t|#:| |string|,|}|)|#:| |string|↵|#trait| |IEvent|(||)| |{|→|#fun| |callback|(||)|#:| |(|number|)| |=>| |unit|←|↵|}|↵|#trait| |SearchFunc|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(source: string, subString: string): boolean;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |24|,| |22|›|←|↵|}|↵|#trait| |StringArray|(||)| |{|→|#let| |__index|#:| |Unsupported|‹|"[index: number]: string;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |28|,| |23|›|←|↵|}|↵|#trait| |Counter|(||)| |{|→|#let| |__call|#:| |Unsupported|‹|"(start: number): string;"|,| |"ts2mls/js/src/test/typescript/InterfaceMember.ts"|,| |32|,| |19|›|↵|#let| |interval|#:| |number|↵|#fun| |reset|(||)|#:| |unit|←|↵|}|↵|#trait| |Simple|(||)| |{|→|#let| |a|#:| |number|↵|#fun| |b|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |string|←|↵|}|↵|#trait| |Simple2|‹|T|›|(||)| |{|→|#let| |abc|#:| |T|←|↵|}|↵|#trait| |Next|(||)|#:| |Simple| |{||}|↵|#trait| |TTT|‹|T|›|(||)| |{|→|#fun| |ttt|(|x|#:| |T|)|#:| |T|←|↵|}| -//│ Parsed: {trait IFoo() {let a: string; fun b: (x: number,) -> number; fun c: () -> bool; fun d: (x: string,) -> unit}; trait II‹T›() {fun test: (x: T,) -> number}; fun create: () -> {v: number}; fun get: (x: {t: string},) -> string; trait IEvent() {fun callback: () -> number -> unit}; trait SearchFunc() {let __call: Unsupported["(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22]}; trait StringArray() {let __index: Unsupported["[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23]}; trait Counter() {let __call: Unsupported["(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19]; let interval: number; fun reset: () -> unit}; trait Simple() {let a: number; fun b: (x: bool,) -> string}; trait Simple2‹T›() {let abc: T}; trait Next(): Simple {}; trait TTT‹T›() {fun ttt: (x: T,) -> T}} +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.5: trait IFoo() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.6: let a: string +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.7: fun b(x: number): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.8: fun c(): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.9: fun d(x: string): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: } +//│ ╙── ^ +//│ ╔══[ERROR] Member b is declared but not defined +//│ ║ l.7: fun b(x: number): number +//│ ╙── ^ +//│ ╔══[ERROR] Member c is declared but not defined +//│ ║ l.8: fun c(): (false) | (true) +//│ ╙── ^ +//│ ╔══[ERROR] Member d is declared but not defined +//│ ║ l.9: fun d(x: string): unit +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.11: trait II() { +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.12: fun test(x: T): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.13: } +//│ ╙── ^ +//│ ╔══[ERROR] Member test is declared but not defined +//│ ║ l.12: fun test(x: T): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.16: trait IEvent() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.17: fun callback(): (number) => unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.18: } +//│ ╙── ^ +//│ ╔══[ERROR] Member callback is declared but not defined +//│ ║ l.17: fun callback(): (number) => unit +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.19: trait SearchFunc() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.20: let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.21: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.22: trait StringArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.25: trait Counter() { +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.26: let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.27: let interval: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.28: fun reset(): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.29: } +//│ ╙── ^ +//│ ╔══[ERROR] Member reset is declared but not defined +//│ ║ l.28: fun reset(): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.30: trait Simple() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.31: let a: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.32: fun b(x: (false) | (true)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.33: } +//│ ╙── ^ +//│ ╔══[ERROR] Member b is declared but not defined +//│ ║ l.32: fun b(x: (false) | (true)): string +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.34: trait Simple2() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.35: let abc: T +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.36: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.37: trait Next(): Simple {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.38: trait TTT() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.39: fun ttt(x: T): T +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.40: } +//│ ╙── ^ +//│ ╔══[ERROR] Member ttt is declared but not defined +//│ ║ l.39: fun ttt(x: T): T +//│ ╙── ^^^ +//│ trait IFoo() +//│ trait II[T]() +//│ fun create: () -> {v: number} +//│ fun get: (x: {t: string},) -> string +//│ trait IEvent() +//│ trait SearchFunc() +//│ trait StringArray() +//│ trait Counter() +//│ trait Simple() +//│ trait Simple2[T]() +//│ trait Next() +//│ trait TTT[T]() diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 033f4ff1e..9182f0722 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit fun over(f: ((number) => string) & ((object) => string)): string @@ -17,5 +19,183 @@ fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) class A() {} class B() {} fun inter(c: (A) & (B)): (A) & (B) -//│ |#fun| |extend|‹|T|,| |U|›|(|first|#:| |T|,| |second|#:| |U|)|#:| |(|T|)| |&| |(|U|)|↵|#fun| |foo|‹|T|,| |U|›|(|x|#:| |(|T|)| |&| |(|U|)|)|#:| |unit|↵|#fun| |over|(|f|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|object|)| |=>| |string|)|)|#:| |string|↵|#trait| |IA|(||)| |{|→|#let| |x|#:| |number|←|↵|}|↵|#trait| |IB|(||)| |{|→|#let| |y|#:| |number|←|↵|}|↵|#fun| |iii|(|x|#:| |(|IA|)| |&| |(|IB|)|)|#:| |(|IA|)| |&| |(|IB|)|↵|#fun| |uu|‹|U|,| |V|,| |T|,| |P|›|(|x|#:| |(|(|(|(|U|)| |&| |(|T|)|)| ||| |(|(|U|)| |&| |(|P|)|)|)| ||| |(|(|V|)| |&| |(|T|)|)|)| ||| |(|(|V|)| |&| |(|P|)|)|)|#:| |(|(|(|(|U|)| |&| |(|T|)|)| ||| |(|(|U|)| |&| |(|P|)|)|)| ||| |(|(|V|)| |&| |(|T|)|)|)| ||| |(|(|V|)| |&| |(|P|)|)|↵|#fun| |iiii|‹|U|,| |T|,| |V|›|(|x|#:| |(|(|U|)| |&| |(|T|)|)| |&| |(|V|)|)|#:| |(|(|U|)| |&| |(|T|)|)| |&| |(|V|)|↵|#fun| |arr|‹|U|,| |T|›|(|a|#:| |(|MutArray|‹|U|›|)| |&| |(|MutArray|‹|T|›|)|)|#:| |(|MutArray|‹|U|›|)| |&| |(|MutArray|‹|T|›|)|↵|#fun| |tt|‹|U|,| |T|,| |V|›|(|x|#:| |(|(|U|,| |T|,| |)|)| |&| |(|(|V|,| |V|,| |)|)|)|#:| |(|(|U|,| |T|,| |)|)| |&| |(|(|V|,| |V|,| |)|)|↵|#class| |A|(||)| |{||}|↵|#class| |B|(||)| |{||}|↵|#fun| |inter|(|c|#:| |(|A|)| |&| |(|B|)|)|#:| |(|A|)| |&| |(|B|)| -//│ Parsed: {fun extend: (first: T, second: U,) -> (T & U); fun foo: (x: T & U,) -> unit; fun over: (f: number -> string & object -> string,) -> string; trait IA() {let x: number}; trait IB() {let y: number}; fun iii: (x: IA & IB,) -> (IA & IB); fun uu: (x: U & T | U & P | V & T | V & P,) -> (U & T | U & P | V & T | V & P); fun iiii: (x: U & T & V,) -> (U & T & V); fun arr: (a: MutArray[U] & MutArray[T],) -> (MutArray[U] & MutArray[T]); fun tt: (x: (U, T,) & (V, V,),) -> ((U, T,) & (V, V,)); class A() {}; class B() {}; fun inter: (c: A & B,) -> (A & B)} +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) +//│ ╙── ^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.6: fun foo(x: (T) & (U)): unit +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.6: fun foo(x: (T) & (U)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.6: fun foo(x: (T) & (U)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.7: fun over(f: ((number) => string) & ((object) => string)): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.8: trait IA() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.9: let x: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.10: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.11: trait IB() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.12: let y: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.13: } +//│ ╙── ^ +//│ ╔══[ERROR] trait IA cannot be used as a type +//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait IB cannot be used as a type +//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait IA cannot be used as a type +//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait IB cannot be used as a type +//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: P +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: P +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: P +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: P +//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) +//│ ╙── ^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) +//│ ╙── ^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) +//│ ╙── ^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: V +//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) +//│ ╙── ^ +//│ fun extend: (first: error, second: error,) -> error +//│ fun foo: (x: error,) -> unit +//│ fun over: (f: (error | number) -> string,) -> string +//│ trait IA() +//│ trait IB() +//│ fun iii: (x: IA & IB,) -> (IA & IB) +//│ fun uu: (x: error,) -> error +//│ fun iiii: (x: error,) -> error +//│ fun arr: (a: MutArray[error],) -> MutArray[error] +//│ fun tt: (x: (error, error,),) -> (error, error,) +//│ class A() +//│ class B() +//│ fun inter: (c: nothing,) -> nothing diff --git a/ts2mls/js/src/test/diff/Literal.mlsi b/ts2mls/js/src/test/diff/Literal.mlsi index 1b84fa53f..613f6b627 100644 --- a/ts2mls/js/src/test/diff/Literal.mlsi +++ b/ts2mls/js/src/test/diff/Literal.mlsi @@ -1,7 +1,10 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors let a: {a: "A",b: "B",} let num: {y: 114,} fun foo(x: {xx: "X",}): {yy: "Y",} -//│ |#let| |a|#:| |{|a|#:| |"A"|,|b|#:| |"B"|,|}|↵|#let| |num|#:| |{|y|#:| |114|,|}|↵|#fun| |foo|(|x|#:| |{|xx|#:| |"X"|,|}|)|#:| |{|yy|#:| |"Y"|,|}| -//│ Parsed: {let a: {a: "A", b: "B"}; let num: {y: 114}; fun foo: (x: {xx: "X"},) -> {yy: "Y"}} +//│ let a: {a: "A", b: "B"} +//│ let num: {y: 114} +//│ fun foo: (x: {xx: "X"},) -> {yy: "Y"} diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index 21007ede7..93f7bbeb2 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -1,12 +1,14 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun multi1(x: number): number fun multi3(): unit class Foo(): Base {} trait AnotherBase() { let y: string } -namespace N { +module N { fun f(): unit fun g(): unit fun h(): unit @@ -18,5 +20,52 @@ trait Base() { } class AnotherFoo(): AnotherBase {} fun multi5(): unit -//│ |#fun| |multi1|(|x|#:| |number|)|#:| |number|↵|#fun| |multi3|(||)|#:| |unit|↵|#class| |Foo|(||)|#:| |Base| |{||}|↵|#trait| |AnotherBase|(||)| |{|→|#let| |y|#:| |string|←|↵|}|↵|#namespace| |N| |{|→|#fun| |f|(||)|#:| |unit|↵|#fun| |g|(||)|#:| |unit|↵|#fun| |h|(||)|#:| |unit|←|↵|}|↵|#fun| |multi2|(|x|#:| |string|)|#:| |string|↵|#fun| |multi4|(||)|#:| |unit|↵|#trait| |Base|(||)| |{|→|#let| |a|#:| |number|←|↵|}|↵|#class| |AnotherFoo|(||)|#:| |AnotherBase| |{||}|↵|#fun| |multi5|(||)|#:| |unit| -//│ Parsed: {fun multi1: (x: number,) -> number; fun multi3: () -> unit; class Foo(): Base {}; trait AnotherBase() {let y: string}; module N() {fun f: () -> unit; fun g: () -> unit; fun h: () -> unit}; fun multi2: (x: string,) -> string; fun multi4: () -> unit; trait Base() {let a: number}; class AnotherFoo(): AnotherBase {}; fun multi5: () -> unit} +//│ ╔══[ERROR] trait Base cannot be used as a type +//│ ║ l.7: class Foo(): Base {} +//│ ╙── ^^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.7: class Foo(): Base {} +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.8: trait AnotherBase() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.9: let y: string +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.10: } +//│ ╙── ^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.12: fun f(): unit +//│ ╙── ^ +//│ ╔══[ERROR] Member g is declared but not defined +//│ ║ l.13: fun g(): unit +//│ ╙── ^ +//│ ╔══[ERROR] Member h is declared but not defined +//│ ║ l.14: fun h(): unit +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.18: trait Base() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.19: let a: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.20: } +//│ ╙── ^ +//│ ╔══[ERROR] trait AnotherBase cannot be used as a type +//│ ║ l.21: class AnotherFoo(): AnotherBase {} +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.21: class AnotherFoo(): AnotherBase {} +//│ ╙── ^^^^^^^^^^^ +//│ fun multi1: (x: number,) -> number +//│ fun multi3: () -> unit +//│ class Foo() +//│ trait AnotherBase() +//│ module N() { +//│ fun f: () -> unit +//│ fun g: () -> unit +//│ fun h: () -> unit +//│ } +//│ fun multi2: (x: string,) -> string +//│ fun multi4: () -> unit +//│ trait Base() +//│ class AnotherFoo() +//│ fun multi5: () -> unit diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 1f0901ea6..362f4f309 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,6 +1,8 @@ :NewParser -:ParseOnly -namespace N1 { +:NewDefs +:NoJS +:AllowTypeErrors +module N1 { fun f(x: anything): number fun ff(y: anything): number class C() { @@ -9,13 +11,13 @@ namespace N1 { trait I() { fun f(): number } - namespace N2 { + module N2 { fun fff(x: (false) | (true)): number fun gg(c: N1.C): N1.C class BBB(): N1.C {} } } -namespace AA { +module AA { fun f(x: anything): string class C() { fun f(): unit @@ -23,10 +25,84 @@ namespace AA { trait I() { fun f(): number } - namespace N2 { + module N2 { } } fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C -//│ |#namespace| |N1| |{|→|#fun| |f|(|x|#:| |anything|)|#:| |number|↵|#fun| |ff|(|y|#:| |anything|)|#:| |number|↵|#class| |C|(||)| |{|→|#fun| |f|(||)|#:| |unit|←|↵|}|↵|#trait| |I|(||)| |{|→|#fun| |f|(||)|#:| |number|←|↵|}|↵|#namespace| |N2| |{|→|#fun| |fff|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |number|↵|#fun| |gg|(|c|#:| |N1|.C|)|#:| |N1|.C|↵|#class| |BBB|(||)|#:| |N1|.C| |{||}|←|↵|}|←|↵|}|↵|#namespace| |AA| |{|→|#fun| |f|(|x|#:| |anything|)|#:| |string|↵|#class| |C|(||)| |{|→|#fun| |f|(||)|#:| |unit|←|↵|}|↵|#trait| |I|(||)| |{|→|#fun| |f|(||)|#:| |number|←|↵|}|↵|#namespace| |N2| |{|↵|}|←|↵|}|↵|#fun| |f1|(|x|#:| |N1|.C|)|#:| |N1|.C|↵|#fun| |f2|(|x|#:| |AA|.C|)|#:| |AA|.C| -//│ Parsed: {module N1() {fun f: (x: anything,) -> number; fun ff: (y: anything,) -> number; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; module N2() {fun fff: (x: bool,) -> number; fun gg: (c: N1.C,) -> N1.C; class BBB(): N1.C {}}}; module AA() {fun f: (x: anything,) -> string; class C() {fun f: () -> unit}; trait I() {fun f: () -> number}; module N2() {}}; fun f1: (x: N1.C,) -> N1.C; fun f2: (x: AA.C,) -> AA.C} +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.9: fun f(): unit +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.11: trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.12: fun f(): number +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.13: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.12: fun f(): number +//│ ╙── ^ +//│ ╔══[ERROR] Module `N1` is not supported yet. +//│ ║ l.16: fun gg(c: N1.C): N1.C +//│ ╙── ^^ +//│ ╔══[ERROR] Module `N1` is not supported yet. +//│ ║ l.16: fun gg(c: N1.C): N1.C +//│ ╙── ^^ +//│ ╔══[ERROR] Module `N1` is not supported yet. +//│ ║ l.17: class BBB(): N1.C {} +//│ ╙── ^^ +//│ ╔══[ERROR] type signatures not yet supported for classes +//│ ║ l.17: class BBB(): N1.C {} +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member fff is declared but not defined +//│ ║ l.15: fun fff(x: (false) | (true)): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member gg is declared but not defined +//│ ║ l.16: fun gg(c: N1.C): N1.C +//│ ╙── ^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.6: fun f(x: anything): number +//│ ╙── ^ +//│ ╔══[ERROR] Member ff is declared but not defined +//│ ║ l.7: fun ff(y: anything): number +//│ ╙── ^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.23: fun f(): unit +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.25: trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.26: fun f(): number +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.27: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.26: fun f(): number +//│ ╙── ^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.21: fun f(x: anything): string +//│ ╙── ^ +//│ module N1() { +//│ class C() { +//│ fun f: () -> unit +//│ } +//│ trait I() +//│ module N2() { +//│ class BBB() +//│ fun fff: (x: bool,) -> number +//│ fun gg: (c: error,) -> error +//│ } +//│ fun f: (x: anything,) -> number +//│ fun ff: (y: anything,) -> number +//│ } +//│ module AA() { +//│ class C() { +//│ fun f: () -> unit +//│ } +//│ trait I() +//│ module N2() +//│ fun f: (x: anything,) -> string +//│ } +//│ fun f1: (x: C,) -> C +//│ fun f2: (x: C,) -> C diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 07ea8fa40..e48826080 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun buildName(firstName: string, lastName: (string) | (undefined)): string fun buildName2(firstName: string, lastName: (string) | (undefined)): string fun buildName3(firstName: string, lastName: MutArray): string @@ -20,5 +22,47 @@ class B() { let b: T } fun boom(b: (B) | (undefined)): anything -//│ |#fun| |buildName|(|firstName|#:| |string|,| |lastName|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |buildName2|(|firstName|#:| |string|,| |lastName|#:| |(|string|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |buildName3|(|firstName|#:| |string|,| |lastName|#:| |MutArray|‹|string|›|)|#:| |string|↵|#fun| |buildName4|(|firstName|#:| |string|,| |lastName|#:| |MutArray|‹|anything|›|)|#:| |string|↵|#trait| |SquareConfig|(||)| |{|→|#let| |color|#:| |(|string|)| ||| |(|undefined|)|↵|#let| |width|#:| |(|number|)| ||| |(|undefined|)|←|↵|}|↵|#fun| |did|(|x|#:| |number|,| |f|#:| |(|(|number|)| |=>| |number|)| ||| |(|undefined|)|)|#:| |number|↵|#fun| |getOrElse|(|arr|#:| |(|MutArray|‹|object|›|)| ||| |(|undefined|)|)|#:| |object|↵|#class| |ABC|(||)| |{||}|↵|#fun| |testABC|(|abc|#:| |(|ABC|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |testSquareConfig|(|conf|#:| |(|SquareConfig|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |err|(|msg|#:| |(|(|number|,| |string|,| |)|)| ||| |(|undefined|)|)|#:| |unit|↵|#fun| |toStr|(|x|#:| |(|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|)| ||| |(|undefined|)|)|#:| |string|↵|#fun| |boo|‹|T|,| |U|›|(|x|#:| |(|(|T|)| |&| |(|U|)|)| ||| |(|undefined|)|)|#:| |unit|↵|#class| |B|‹|T|›|(||)| |{|→|#let| |b|#:| |T|←|↵|}|↵|#fun| |boom|(|b|#:| |(|B|‹|nothing|›|)| ||| |(|undefined|)|)|#:| |anything| -//│ Parsed: {fun buildName: (firstName: string, lastName: string | undefined,) -> string; fun buildName2: (firstName: string, lastName: string | undefined,) -> string; fun buildName3: (firstName: string, lastName: MutArray[string],) -> string; fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string; trait SquareConfig() {let color: string | undefined; let width: number | undefined}; fun did: (x: number, f: number -> number | undefined,) -> number; fun getOrElse: (arr: MutArray[object] | undefined,) -> object; class ABC() {}; fun testABC: (abc: ABC | undefined,) -> unit; fun testSquareConfig: (conf: SquareConfig | undefined,) -> unit; fun err: (msg: (number, string,) | undefined,) -> unit; fun toStr: (x: number | false | true | undefined,) -> string; fun boo: (x: T & U | undefined,) -> unit; class B‹T›() {let b: T}; fun boom: (b: B[nothing] | undefined,) -> anything} +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.9: trait SquareConfig() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: let color: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.11: let width: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.12: } +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.14: fun getOrElse(arr: (MutArray) | (undefined)): object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.14: fun getOrElse(arr: (MutArray) | (undefined)): object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait SquareConfig cannot be used as a type +//│ ║ l.17: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit +//│ ╙── ^^^ +//│ fun buildName: (firstName: string, lastName: string | undefined,) -> string +//│ fun buildName2: (firstName: string, lastName: string | undefined,) -> string +//│ fun buildName3: (firstName: string, lastName: MutArray[string],) -> string +//│ fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string +//│ trait SquareConfig() +//│ fun did: (x: number, f: number -> number | undefined,) -> number +//│ fun getOrElse: (arr: MutArray[error] | undefined,) -> error +//│ class ABC() +//│ fun testABC: (abc: ABC | undefined,) -> unit +//│ fun testSquareConfig: (conf: undefined | SquareConfig,) -> unit +//│ fun err: (msg: (number, string,) | undefined,) -> unit +//│ fun toStr: (x: false | number | true | undefined,) -> string +//│ fun boo: (x: error | undefined,) -> unit +//│ class B[T]() { +//│ let b: T +//│ } +//│ fun boom: (b: B[nothing] | undefined,) -> anything diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index c68fd6716..2dfd37494 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun f: ((number) => string) & ((string) => string) class M() { let foo: ((number) => string) & ((string) => string) @@ -15,12 +17,50 @@ fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ -namespace XX { +module XX { fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } class WWW() { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ -//│ |#fun| |f|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|string|)| |=>| |string|)|↵|#class| |M|(||)| |{|→|#let| |foo|#:| |(|(|number|)| |=>| |string|)| |&| |(|(|string|)| |=>| |string|)|←|↵|}|↵|#fun| |app|#:| |(|(|(|string|)| |=>| |unit|)| |=>| |(|number|)| |=>| |unit|)| |&| |(|(|(|string|)| |=>| |unit|)| |=>| |(|string|)| |=>| |unit|)|↵|#fun| |create|#:| |(|(|number|)| |=>| |unit| |=>| |(|false|)| ||| |(|true|)|)| |&| |(|(|(|false|)| ||| |(|true|)|)| |=>| |unit| |=>| |(|false|)| ||| |(|true|)|)|↵|#fun| |g0|#:| |(|(|MutArray|‹|string|›|)| |=>| |string|)| |&| |(|(|MutArray|‹|object|›|)| |=>| |string|)|↵|#fun| |db|#:| |(|(|number|)| |=>| |MutArray|‹|number|›|)| |&| |(|(|object|)| |=>| |MutArray|‹|number|›|)|↵|#class| |N|(||)| |{||}|↵|#fun| |id|#:| |(|(|M|)| |=>| |unit|)| |&| |(|(|N|)| |=>| |unit|)|↵|#fun| |tst|#:| |(|(|{|z|#:| |number|,|}|)| |=>| |{|y|#:| |string|,|}|)| |&| |(|(|{|z|#:| |(|false|)| ||| |(|true|)|,|}|)| |=>| |{|y|#:| |string|,|}|)|↵|#fun| |op|#:| |(|(|number|)| |=>| |(|(|number|)| ||| |(|undefined|)|)| |=>| |unit|)| |&| |(|(|number|)| |=>| |(|(|(|false|)| ||| |(|true|)|)| ||| |(|undefined|)|)| |=>| |unit|)|↵|#fun| |swap|#:| |(|(|(|number|,| |string|,| |)|)| |=>| |(|number|,| |string|,| |)|)| |&| |(|(|(|string|,| |number|,| |)|)| |=>| |(|number|,| |string|,| |)|)|↵|#fun| |u|#:| |(|(|(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|)| |=>| |string|)| |&| |(|(|object|)| |=>| |string|)|↵|#fun| |doSome|‹|T|,| |U|›|(|x|#:| |anything|)|#:| |unit| |/* warning: the overload of function doSome is not supported yet. */|↵|#namespace| |XX| |{|→|#fun| |f|‹|T|›|(|x|#:| |T|,| |n|#:| |anything|)|#:| |string| |/* warning: the overload of function f is not supported yet. */|←|↵|}|↵|#class| |WWW|(||)| |{|→|#fun| |F|‹|T|›|(|x|#:| |T|)|#:| |anything| |/* warning: the overload of function F is not supported yet. */|←|↵|}|↵|#fun| |baz|(||)|#:| |anything| |/* warning: the overload of function baz is not supported yet. */| -//│ Parsed: {fun f: number -> string & string -> string; class M() {let foo: number -> string & string -> string}; fun app: (string -> unit) -> number -> unit & (string -> unit) -> string -> unit; fun create: number -> unit -> bool & bool -> unit -> bool; fun g0: MutArray[string] -> string & MutArray[object] -> string; fun db: number -> MutArray[number] & object -> MutArray[number]; class N() {}; fun id: M -> unit & N -> unit; fun tst: {z: number} -> {y: string} & {z: bool} -> {y: string}; fun op: number -> (number | undefined) -> unit & number -> (false | true | undefined) -> unit; fun swap: (number, string,) -> (number, string,) & (string, number,) -> (number, string,); fun u: (number | false | true) -> string & object -> string; fun doSome: (x: anything,) -> unit; module XX() {fun f: (x: T, n: anything,) -> string}; class WWW() {fun F: (x: T,) -> anything}; fun baz: () -> anything} +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.11: fun g0: ((MutArray) => string) & ((MutArray) => string) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.12: fun db: ((number) => MutArray) & ((object) => MutArray) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.18: fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.19: fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ +//│ ╙── ^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.21: fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ +//│ ╙── ^ +//│ ╔══[ERROR] Member F is declared but not defined +//│ ║ l.24: fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ +//│ ╙── ^ +//│ fun f: (number | string) -> string +//│ class M() { +//│ let foo: (number | string) -> string +//│ } +//│ fun app: (string -> unit) -> (number | string) -> unit +//│ fun create: (false | number | true) -> unit -> bool +//│ fun g0: MutArray[out error | string] -> string +//│ fun db: (error | number) -> MutArray[number] +//│ class N() +//│ fun id: (M | N) -> unit +//│ fun tst: {z: false | number | true} -> {y: string} +//│ fun op: number -> (false | number | true | undefined) -> unit +//│ fun swap: (number | string, number | string,) -> (number, string,) +//│ fun u: (error | false | number | true) -> string +//│ fun doSome: (x: anything,) -> unit +//│ module XX() { +//│ fun f: (x: anything, n: anything,) -> string +//│ } +//│ class WWW() { +//│ fun F: (x: anything,) -> anything +//│ } +//│ fun baz: () -> anything diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 915310204..90e4ffbc0 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun key(x: (string, (false) | (true), )): string fun value(x: (string, (false) | (true), )): (false) | (true) fun third(x: (number, number, number, )): number @@ -16,5 +18,49 @@ class A() { } class B() {} fun swap(x: (A, B, )): (B, A, ) -//│ |#fun| |key|(|x|#:| |(|string|,| |(|false|)| ||| |(|true|)|,| |)|)|#:| |string|↵|#fun| |value|(|x|#:| |(|string|,| |(|false|)| ||| |(|true|)|,| |)|)|#:| |(|false|)| ||| |(|true|)|↵|#fun| |third|(|x|#:| |(|number|,| |number|,| |number|,| |)|)|#:| |number|↵|#fun| |vec2|(|x|#:| |number|,| |y|#:| |number|)|#:| |(|number|,| |number|,| |)|↵|#fun| |twoFunctions|(|ff|#:| |(|(|number|)| |=>| |number|,| |(|number|)| |=>| |number|,| |)|,| |x|#:| |number|)|#:| |number|↵|#fun| |tupleIt|(|x|#:| |string|)|#:| |(|unit| |=>| |string|,| |)|↵|#fun| |s|(|flag|#:| |(|false|)| ||| |(|true|)|)|#:| |(|(|string|)| ||| |(|number|)|,| |(|(|number|)| ||| |(|false|)|)| ||| |(|true|)|,| |)|↵|#fun| |s2|(|t|#:| |(|(|false|)| ||| |(|true|)|,| |(|string|)| ||| |(|number|)|,| |)|)|#:| |(|string|)| ||| |(|number|)|↵|#fun| |ex|‹|T|,| |U|›|(|x|#:| |T|,| |y|#:| |U|)|#:| |(|T|,| |U|,| |(|T|)| |&| |(|U|)|,| |)|↵|#fun| |foo|‹|T|,| |U|›|(|x|#:| |(|(|T|)| |&| |(|U|)|,| |)|)|#:| |unit|↵|#fun| |conv|(|x|#:| |{|y|#:| |number|,|}|)|#:| |(|{|y|#:| |number|,|}|,| |{|z|#:| |string|,|}|,| |)|↵|#class| |A|(||)| |{|→|#let| |x|#:| |number|←|↵|}|↵|#class| |B|(||)| |{||}|↵|#fun| |swap|(|x|#:| |(|A|,| |B|,| |)|)|#:| |(|B|,| |A|,| |)| -//│ Parsed: {fun key: (x: (string, bool,),) -> string; fun value: (x: (string, bool,),) -> bool; fun third: (x: (number, number, number,),) -> number; fun vec2: (x: number, y: number,) -> (number, number,); fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number; fun tupleIt: (x: string,) -> unit -> string; fun s: (flag: bool,) -> (string | number, number | false | true,); fun s2: (t: (bool, string | number,),) -> (string | number); fun ex: (x: T, y: U,) -> (T, U, T & U,); fun foo: (x: T & U,) -> unit; fun conv: (x: {y: number},) -> ({y: number}, {z: string},); class A() {let x: number}; class B() {}; fun swap: (x: (A, B,),) -> (B, A,)} +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) +//│ ╙── ^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.14: fun foo(x: ((T) & (U), )): unit +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.14: fun foo(x: ((T) & (U), )): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.14: fun foo(x: ((T) & (U), )): unit +//│ ╙── ^^^ +//│ fun key: (x: (string, bool,),) -> string +//│ fun value: (x: (string, bool,),) -> bool +//│ fun third: (x: (number, number, number,),) -> number +//│ fun vec2: (x: number, y: number,) -> (number, number,) +//│ fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number +//│ fun tupleIt: (x: string,) -> unit -> string +//│ fun s: (flag: bool,) -> (number | string, false | number | true,) +//│ fun s2: (t: (bool, number | string,),) -> (number | string) +//│ fun ex: (x: error, y: error,) -> (error, error, error,) +//│ fun foo: (x: error,) -> unit +//│ fun conv: (x: {y: number},) -> ({y: number}, {z: string},) +//│ class A() { +//│ let x: number +//│ } +//│ class B() +//│ fun swap: (x: (A, B,),) -> (B, A,) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index de7bc2773..dbc3c6690 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors trait None() { let _tag: "None" } @@ -18,7 +20,7 @@ type SomeInterface = {x: number,y: number,} class ABC() {} type DEF = ABC type TP = (A, B, C, ) -namespace NA { +module NA { fun fb(b: string): unit type B = string } @@ -28,5 +30,78 @@ class NC() { type G = ABC let none: {_tag: "None",} fun some(a: A): (None) | (Some) -//│ |#trait| |None|(||)| |{|→|#let| |_tag|#:| |"None"|←|↵|}|↵|#trait| |Some|‹|A|›|(||)| |{|→|#let| |_tag|#:| |"Some"|↵|#let| |value|#:| |A|←|↵|}|↵|#type| |Option|‹|A|›| |#=| |(|None|)| ||| |(|Some|‹|A|›|)|↵|#type| |Func| |#=| |(|number|)| |=>| |number|↵|#type| |S2| |#=| |(|string|,| |string|,| |)|↵|#trait| |I1|(||)| |{||}|↵|#trait| |I2|(||)| |{||}|↵|#type| |I3| |#=| |(|I1|)| |&| |(|I2|)|↵|#type| |StringArray| |#=| |Array|‹|string|›|↵|#type| |SomeInterface| |#=| |{|x|#:| |number|,|y|#:| |number|,|}|↵|#class| |ABC|(||)| |{||}|↵|#type| |DEF| |#=| |ABC|↵|#type| |TP|‹|A|,| |B|,| |C|›| |#=| |(|A|,| |B|,| |C|,| |)|↵|#namespace| |NA| |{|→|#fun| |fb|(|b|#:| |string|)|#:| |unit|↵|#type| |B| |#=| |string|←|↵|}|↵|#class| |NC|(||)| |{|→|#let| |b|#:| |string|←|↵|}|↵|#type| |G| |#=| |ABC|↵|#let| |none|#:| |{|_tag|#:| |"None"|,|}|↵|#fun| |some|‹|A|›|(|a|#:| |A|)|#:| |(|None|)| ||| |(|Some|‹|A|›|)| -//│ Parsed: {trait None() {let _tag: "None"}; trait Some‹A›() {let _tag: "Some"; let value: A}; type alias Option‹A›(): None | Some[A] {}; type alias Func(): number -> number {}; type alias S2(): (string, string,) {}; trait I1() {}; trait I2() {}; type alias I3(): I1 & I2 {}; type alias StringArray(): Array[string] {}; type alias SomeInterface(): {x: number, y: number} {}; class ABC() {}; type alias DEF(): ABC {}; type alias TP‹A, B, C›(): (A, B, C,) {}; module NA() {fun fb: (b: string,) -> unit; type alias B(): string {}}; class NC() {let b: string}; type alias G(): ABC {}; let none: {_tag: "None"}; fun some: (a: A,) -> (None | Some[A])} +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.5: trait None() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.6: let _tag: "None" +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.7: } +//│ ╙── ^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.8: trait Some() { +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.9: let _tag: "Some" +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: let value: A +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.11: } +//│ ╙── ^ +//│ ╔══[ERROR] trait None cannot be used as a type +//│ ║ l.12: type Option = (None) | (Some) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait Some cannot be used as a type +//│ ║ l.12: type Option = (None) | (Some) +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.15: trait I1() {} +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.16: trait I2() {} +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait I1 cannot be used as a type +//│ ║ l.17: type I3 = (I1) & (I2) +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait I2 cannot be used as a type +//│ ║ l.17: type I3 = (I1) & (I2) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member fb is declared but not defined +//│ ║ l.24: fun fb(b: string): unit +//│ ╙── ^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ╙── ^ +//│ ╔══[ERROR] trait None cannot be used as a type +//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait Some cannot be used as a type +//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ╙── ^ +//│ trait None() +//│ trait Some[A]() +//│ type Option[A] = None | Some[A] +//│ type Func = number -> number +//│ type S2 = (string, string,) +//│ trait I1() +//│ trait I2() +//│ type I3 = I1 & I2 +//│ type StringArray = Array[string] +//│ type SomeInterface = {x: number, y: number} +//│ class ABC() +//│ type DEF = ABC +//│ type TP[A, B, C] = (A, B, C,) +//│ module NA() { +//│ type B = string +//│ fun fb: (b: string,) -> unit +//│ } +//│ class NC() { +//│ let b: string +//│ } +//│ type G = ABC +//│ let none: {_tag: "None"} +//│ fun some: (a: error,) -> (None | Some[error]) diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 357be3f67..8f46f5d18 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun inc(x: T): number class CC() { fun print(s: T): unit @@ -25,5 +27,88 @@ class FFF() { } fun fff(p: FFF, s: string): unit fun getFFF(): FFF -//│ |#fun| |inc|‹|T|›|(|x|#:| |T|)|#:| |number|↵|#class| |CC|‹|T|›|(||)| |{|→|#fun| |print|(|s|#:| |T|)|#:| |unit|←|↵|}|↵|#fun| |con|‹|U|,| |T|›|(|t|#:| |T|)|#:| |U|↵|#class| |Printer|‹|T|›|(||)| |{|→|#fun| |print|(|t|#:| |T|)|#:| |unit|←|↵|}|↵|#fun| |setStringPrinter|(|p|#:| |Printer|‹|string|›|)|#:| |unit|↵|#fun| |getStringPrinter|(||)|#:| |Printer|‹|string|›|↵|#fun| |foo|‹|T|›|(|p|#:| |Printer|‹|T|›|,| |x|#:| |T|)|#:| |T|↵|#fun| |foo2|‹|T|›|(|p|#:| |Printer|‹|T|›|,| |x|#:| |T|)|#:| |T|↵|#class| |F|‹|T|›|(||)| |{|→|#let| |x|#:| |T|↵|#fun| |GG|‹|U|›|(|y|#:| |U|)|#:| |T|←|↵|}|↵|#trait| |I|‹|T|›|(||)| |{|→|#let| |x|#:| |T|↵|#fun| |GG|‹|U|›|(|y|#:| |U|)|#:| |T|←|↵|}|↵|#class| |FFF|‹|T|›|(||)| |{|→|#fun| |fff|(|x|#:| |T|)|#:| |unit|←|↵|}|↵|#fun| |fff|(|p|#:| |FFF|‹|string|›|,| |s|#:| |string|)|#:| |unit|↵|#fun| |getFFF|(||)|#:| |FFF|‹|number|›| -//│ Parsed: {fun inc: (x: T,) -> number; class CC‹T›() {fun print: (s: T,) -> unit}; fun con: (t: T,) -> U; class Printer‹T›() {fun print: (t: T,) -> unit}; fun setStringPrinter: (p: Printer[string],) -> unit; fun getStringPrinter: () -> Printer[string]; fun foo: (p: Printer[T], x: T,) -> T; fun foo2: (p: Printer[T], x: T,) -> T; class F‹T›() {let x: T; fun GG: (y: U,) -> T}; trait I‹T›() {let x: T; fun GG: (y: U,) -> T}; class FFF‹T›() {fun fff: (x: T,) -> unit}; fun fff: (p: FFF[string], s: string,) -> unit; fun getFFF: () -> FFF[number]} +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.5: fun inc(x: T): number +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.5: fun inc(x: T): number +//│ ╙── ^ +//│ ╔══[ERROR] Member print is declared but not defined +//│ ║ l.7: fun print(s: T): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.9: fun con(t: T): U +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.9: fun con(t: T): U +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.9: fun con(t: T): U +//│ ╙── ^ +//│ ╔══[ERROR] Member print is declared but not defined +//│ ║ l.11: fun print(t: T): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.15: fun foo(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun foo(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun foo(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.15: fun foo(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.16: fun foo2(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.16: fun foo2(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.16: fun foo2(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.16: fun foo2(p: Printer, x: T): T +//│ ╙── ^ +//│ ╔══[ERROR] Member GG is declared but not defined +//│ ║ l.19: fun GG(y: U): T +//│ ╙── ^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.21: trait I() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.22: let x: T +//│ ║ ^^^^^^^^^^ +//│ ║ l.23: fun GG(y: U): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: } +//│ ╙── ^ +//│ ╔══[ERROR] Member GG is declared but not defined +//│ ║ l.23: fun GG(y: U): T +//│ ╙── ^^ +//│ ╔══[ERROR] Member fff is declared but not defined +//│ ║ l.26: fun fff(x: T): unit +//│ ╙── ^^^ +//│ fun inc: (x: error,) -> number +//│ class CC[T]() { +//│ fun print: (s: T,) -> unit +//│ } +//│ fun con: (t: error,) -> error +//│ class Printer[T]() { +//│ fun print: (t: T,) -> unit +//│ } +//│ fun setStringPrinter: (p: Printer[string],) -> unit +//│ fun getStringPrinter: () -> Printer[string] +//│ fun foo: (p: Printer[error], x: error,) -> error +//│ fun foo2: (p: Printer[error], x: error,) -> error +//│ class F[T]() { +//│ fun GG: (y: anything,) -> T +//│ let x: T +//│ } +//│ trait I[T]() +//│ class FFF[T]() { +//│ fun fff: (x: T,) -> unit +//│ } +//│ fun fff: (p: FFF[string], s: string,) -> unit +//│ fun getFFF: () -> FFF[number] diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index 511d21313..7817bc8ba 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -1,5 +1,7 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors fun getString(x: (((string) | (number)) | (false)) | (true)): string fun test(x: (false) | (true)): (string) | (number) fun run(f: ((number) => number) | ((number) => string)): anything @@ -7,5 +9,25 @@ fun get(arr: (MutArray) | (MutArray)): unit fun get2(t: ((string, string, )) | ((number, string, ))): string fun typeVar(x: (T) | (U)): (T) | (U) fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) -//│ |#fun| |getString|(|x|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |string|↵|#fun| |test|(|x|#:| |(|false|)| ||| |(|true|)|)|#:| |(|string|)| ||| |(|number|)|↵|#fun| |run|(|f|#:| |(|(|number|)| |=>| |number|)| ||| |(|(|number|)| |=>| |string|)|)|#:| |anything|↵|#fun| |get|(|arr|#:| |(|MutArray|‹|number|›|)| ||| |(|MutArray|‹|string|›|)|)|#:| |unit|↵|#fun| |get2|(|t|#:| |(|(|string|,| |string|,| |)|)| ||| |(|(|number|,| |string|,| |)|)|)|#:| |string|↵|#fun| |typeVar|‹|T|,| |U|›|(|x|#:| |(|T|)| ||| |(|U|)|)|#:| |(|T|)| ||| |(|U|)|↵|#fun| |uuuu|(|x|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)|)|#:| |(|(|(|string|)| ||| |(|number|)|)| ||| |(|false|)|)| ||| |(|true|)| -//│ Parsed: {fun getString: (x: string | number | false | true,) -> string; fun test: (x: bool,) -> (string | number); fun run: (f: number -> number | number -> string,) -> anything; fun get: (arr: MutArray[number] | MutArray[string],) -> unit; fun get2: (t: (string, string,) | (number, string,),) -> string; fun typeVar: (x: T | U,) -> (T | U); fun uuuu: (x: string | number | false | true,) -> (string | number | false | true)} +//│ ╔══[ERROR] Type parameters here are not yet supported in this position +//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: T +//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: U +//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) +//│ ╙── ^^^ +//│ fun getString: (x: false | number | string | true,) -> string +//│ fun test: (x: bool,) -> (number | string) +//│ fun run: (f: number -> (number | string),) -> anything +//│ fun get: (arr: MutArray[out number | string],) -> unit +//│ fun get2: (t: (number | string, string,),) -> string +//│ fun typeVar: (x: error,) -> error +//│ fun uuuu: (x: false | number | string | true,) -> (false | number | string | true) diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index fbe763c78..c34b6eb86 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -1,18 +1,32 @@ :NewParser -:ParseOnly +:NewDefs +:NoJS +:AllowTypeErrors let URI: string let URI2: string let foo: number let bar: false class FooBar() {} let fb: FooBar -namespace ABC { +module ABC { class DEF() {} } let d: ABC.DEF -namespace DD { +module DD { let foo: number let bar: number } -//│ |#let| |URI|#:| |string|↵|#let| |URI2|#:| |string|↵|#let| |foo|#:| |number|↵|#let| |bar|#:| |false|↵|#class| |FooBar|(||)| |{||}|↵|#let| |fb|#:| |FooBar|↵|#namespace| |ABC| |{|→|#class| |DEF|(||)| |{||}|←|↵|}|↵|#let| |d|#:| |ABC|.DEF|↵|#namespace| |DD| |{|→|#let| |foo|#:| |number|↵|#let| |bar|#:| |number|←|↵|}| -//│ Parsed: {let URI: string; let URI2: string; let foo: number; let bar: false; class FooBar() {}; let fb: FooBar; module ABC() {class DEF() {}}; let d: ABC.DEF; module DD() {let foo: number; let bar: number}} +//│ let URI: string +//│ let URI2: string +//│ let foo: number +//│ let bar: false +//│ class FooBar() +//│ let fb: FooBar +//│ module ABC() { +//│ class DEF() +//│ } +//│ let d: DEF +//│ module DD() { +//│ let bar: number +//│ let foo: number +//│ } From 7ef30815687071ca61851c322c7ed7039e097477 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 20 Apr 2023 12:26:59 +0800 Subject: [PATCH 038/202] WIP: Use extends keyword --- .../main/scala/ts2mls/types/Converter.scala | 2 +- ts2mls/js/src/test/diff/ES5.mlsi | 54 ++++++------- ts2mls/js/src/test/diff/Heritage.mlsi | 77 ++++++++----------- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 6 +- ts2mls/js/src/test/diff/MultiFiles.mlsi | 36 ++++----- ts2mls/js/src/test/diff/Namespace.mlsi | 11 +-- 6 files changed, 84 insertions(+), 102 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index bd0eb7d4a..34816988e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -94,7 +94,7 @@ object Converter { val inheritance = if (parents.isEmpty) constructor - else parents.foldLeft(s"$constructor: ")((b, p) => s"$b${convert(p)}, ").dropRight(2) + else parents.foldLeft(s"$constructor extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) if (typeVars.isEmpty) s"${indent}$typeName$inheritance $body" else s"${indent}$typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 3f26c3078..00eccf7a0 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -48,12 +48,12 @@ trait FunctionConstructor() { } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> -trait CallableFunction(): Function { +trait CallableFunction() extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait NewableFunction(): Function { +trait NewableFunction() extends Function { fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): unit fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ @@ -91,7 +91,7 @@ trait NumberConstructor() { let MAX_VALUE: number let prototype: Number } -trait TemplateStringsArray(): ReadonlyArray { +trait TemplateStringsArray() extends ReadonlyArray { let raw: ReadonlyArray } trait ImportMeta() {} @@ -123,37 +123,37 @@ trait ErrorConstructor() { let prototype: Error } let EvalError: EvalErrorConstructor -trait EvalErrorConstructor(): ErrorConstructor { +trait EvalErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> let prototype: EvalError } let RangeError: RangeErrorConstructor -trait RangeErrorConstructor(): ErrorConstructor { +trait RangeErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> let prototype: RangeError } let ReferenceError: ReferenceErrorConstructor -trait ReferenceErrorConstructor(): ErrorConstructor { +trait ReferenceErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> let prototype: ReferenceError } let SyntaxError: SyntaxErrorConstructor -trait SyntaxErrorConstructor(): ErrorConstructor { +trait SyntaxErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> let prototype: SyntaxError } let TypeError: TypeErrorConstructor -trait TypeErrorConstructor(): ErrorConstructor { +trait TypeErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> let prototype: TypeError } let URIError: URIErrorConstructor -trait URIErrorConstructor(): ErrorConstructor { +trait URIErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> let prototype: URIError @@ -712,8 +712,8 @@ module Intl { //│ ║ l.50: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.51: trait CallableFunction(): Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.51: trait CallableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.52: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.53: fun call(thisArg: T, args: A): R @@ -732,8 +732,8 @@ module Intl { //│ ║ l.54: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.56: trait NewableFunction(): Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.56: trait NewableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.57: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.58: fun call(thisArg: T, args: A): unit @@ -1041,8 +1041,8 @@ module Intl { //│ ║ l.93: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: trait TemplateStringsArray(): ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.94: trait TemplateStringsArray() extends ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.95: let raw: ReadonlyArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.96: } @@ -1137,8 +1137,8 @@ module Intl { //│ ║ l.125: let EvalError: EvalErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.126: trait EvalErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.126: trait EvalErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.127: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.128: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> @@ -1151,8 +1151,8 @@ module Intl { //│ ║ l.131: let RangeError: RangeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.132: trait RangeErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.132: trait RangeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.133: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.134: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> @@ -1165,8 +1165,8 @@ module Intl { //│ ║ l.137: let ReferenceError: ReferenceErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.138: trait ReferenceErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.138: trait ReferenceErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.139: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.140: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> @@ -1179,8 +1179,8 @@ module Intl { //│ ║ l.143: let SyntaxError: SyntaxErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.144: trait SyntaxErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.144: trait SyntaxErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.145: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.146: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> @@ -1193,8 +1193,8 @@ module Intl { //│ ║ l.149: let TypeError: TypeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.150: trait TypeErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.150: trait TypeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.151: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.152: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> @@ -1207,8 +1207,8 @@ module Intl { //│ ║ l.155: let URIError: URIErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.156: trait URIErrorConstructor(): ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.156: trait URIErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.157: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.158: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index eb25c3537..f60f7c679 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -5,58 +5,58 @@ class A() { fun foo(): unit } -class B(): A {} +class B() extends A {} class C() { fun set(x: T): unit fun get(): T } -class D(): C {} +class D() extends C {} trait Wu() { let x: (false) | (true) } -class WuWu(): Wu { +class WuWu() extends Wu { let y: (false) | (true) } -trait WuWuWu(): WuWu { +trait WuWuWu() extends WuWu { let z: (false) | (true) } -trait Never(): WuWuWu { +trait Never() extends WuWuWu { fun w(): nothing } class VG() { let x: T } -class Home(): VG { +class Home() extends VG { let y: T } trait O() { fun xx(x: I): I } -class OR(): O { +class OR() extends O { fun xx(x: R): R } module Five { class ROTK() { let wu: string } - class Y(): Five.ROTK {} + class Y() extends Five.ROTK {} } -class Y(): Five.ROTK {} +class Y() extends Five.ROTK {} //│ ╔══[ERROR] Member foo is declared but not defined //│ ║ l.6: fun foo(): unit //│ ╙── ^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.8: class B(): A {} -//│ ╙── ^ +//│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) +//│ ║ l.8: class B() extends A {} +//│ ╙── ^ //│ ╔══[ERROR] Member set is declared but not defined //│ ║ l.10: fun set(x: T): unit //│ ╙── ^^^ //│ ╔══[ERROR] Member get is declared but not defined //│ ║ l.11: fun get(): T //│ ╙── ^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.13: class D(): C {} -//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.13: class D() extends C {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.14: trait Wu() { //│ ║ ^^^^^^^^^^^^ @@ -64,22 +64,19 @@ class Y(): Five.ROTK {} //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.16: } //│ ╙── ^ -//│ ╔══[ERROR] trait Wu cannot be used as a type -//│ ║ l.17: class WuWu(): Wu { -//│ ╙── ^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.17: class WuWu(): Wu { -//│ ╙── ^^ +//│ ╔══[ERROR] Cannot inherit from a type alias +//│ ║ l.17: class WuWu() extends Wu { +//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.20: trait WuWuWu(): WuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.20: trait WuWuWu() extends WuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: let z: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.22: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait Never(): WuWuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: trait Never() extends WuWuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: fun w(): nothing //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.25: } @@ -87,9 +84,9 @@ class Y(): Five.ROTK {} //│ ╔══[ERROR] Member w is declared but not defined //│ ║ l.24: fun w(): nothing //│ ╙── ^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.29: class Home(): VG { -//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.29: class Home() extends VG { +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.32: trait O() { //│ ║ ^^^^^^^^^^^^^^ @@ -100,24 +97,18 @@ class Y(): Five.ROTK {} //│ ╔══[ERROR] Member xx is declared but not defined //│ ║ l.33: fun xx(x: I): I //│ ╙── ^^ -//│ ╔══[ERROR] trait O cannot be used as a type -//│ ║ l.35: class OR(): O { -//│ ╙── ^^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.35: class OR(): O { -//│ ╙── ^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.35: class OR() extends O { +//│ ╙── ^^^^ //│ ╔══[ERROR] Member xx is declared but not defined //│ ║ l.36: fun xx(x: R): R //│ ╙── ^^ -//│ ╔══[ERROR] Module `Five` is not supported yet. -//│ ║ l.42: class Y(): Five.ROTK {} -//│ ╙── ^^^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.42: class Y(): Five.ROTK {} -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.44: class Y(): Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.42: class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.44: class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ class A() { //│ fun foo: () -> unit //│ } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index e05f4112f..5fcb02ab4 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -34,7 +34,7 @@ trait Simple() { trait Simple2() { let abc: T } -trait Next(): Simple {} +trait Next() extends Simple {} trait TTT() { fun ttt(x: T): T } @@ -128,8 +128,8 @@ trait TTT() { //│ ║ l.36: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.37: trait Next(): Simple {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.37: trait Next() extends Simple {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.38: trait TTT() { //│ ║ ^^^^^^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index 93f7bbeb2..948286e8e 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -4,7 +4,7 @@ :AllowTypeErrors fun multi1(x: number): number fun multi3(): unit -class Foo(): Base {} +class Foo() extends Base {} trait AnotherBase() { let y: string } @@ -18,14 +18,18 @@ fun multi4(): unit trait Base() { let a: number } -class AnotherFoo(): AnotherBase {} +class AnotherFoo() extends AnotherBase {} fun multi5(): unit -//│ ╔══[ERROR] trait Base cannot be used as a type -//│ ║ l.7: class Foo(): Base {} -//│ ╙── ^^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.7: class Foo(): Base {} -//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.18: trait Base() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.19: let a: number +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.20: } +//│ ╙── ^ +//│ ╔══[ERROR] Cannot inherit from a type alias +//│ ║ l.7: class Foo() extends Base {} +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.8: trait AnotherBase() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ @@ -42,19 +46,9 @@ fun multi5(): unit //│ ╔══[ERROR] Member h is declared but not defined //│ ║ l.14: fun h(): unit //│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: trait Base() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.19: let a: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.20: } -//│ ╙── ^ -//│ ╔══[ERROR] trait AnotherBase cannot be used as a type -//│ ║ l.21: class AnotherFoo(): AnotherBase {} -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.21: class AnotherFoo(): AnotherBase {} -//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Cannot inherit from a type alias +//│ ║ l.21: class AnotherFoo() extends AnotherBase {} +//│ ╙── ^^^^^^^^^^^ //│ fun multi1: (x: number,) -> number //│ fun multi3: () -> unit //│ class Foo() diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 362f4f309..c9c04a8e1 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -14,7 +14,7 @@ module N1 { module N2 { fun fff(x: (false) | (true)): number fun gg(c: N1.C): N1.C - class BBB(): N1.C {} + class BBB() extends N1.C {} } } module AA { @@ -49,12 +49,9 @@ fun f2(x: AA.C): AA.C //│ ╔══[ERROR] Module `N1` is not supported yet. //│ ║ l.16: fun gg(c: N1.C): N1.C //│ ╙── ^^ -//│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.17: class BBB(): N1.C {} -//│ ╙── ^^ -//│ ╔══[ERROR] type signatures not yet supported for classes -//│ ║ l.17: class BBB(): N1.C {} -//│ ╙── ^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.17: class BBB() extends N1.C {} +//│ ╙── ^^^^ //│ ╔══[ERROR] Member fff is declared but not defined //│ ║ l.15: fun fff(x: (false) | (true)): number //│ ╙── ^^^ From b401e1df0579813d45c9184075c5d9ab45dfd2b9 Mon Sep 17 00:00:00 2001 From: Lionel Parreaux Date: Thu, 20 Apr 2023 14:02:00 +0800 Subject: [PATCH 039/202] Add `export` keyword --- shared/src/main/scala/mlscript/NewLexer.scala | 1 + .../src/main/scala/mlscript/NewParser.scala | 18 ++++++++---- .../src/main/scala/mlscript/NuTypeDefs.scala | 2 +- shared/src/main/scala/mlscript/Typer.scala | 9 +++--- shared/src/main/scala/mlscript/helpers.scala | 2 ++ shared/src/main/scala/mlscript/syntax.scala | 6 ++-- shared/src/test/diff/nu/Export.mls | 29 +++++++++++++++++++ 7 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 shared/src/test/diff/nu/Export.mls diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 2b1eb5d82..c6cfdeaed 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -262,6 +262,7 @@ object NewLexer { // "all", "mut", "declare", + "export", "class", "trait", "mixin", diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index a1ca8e93f..07898da00 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -284,6 +284,10 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D consume yeetSpaces go(acc.copy(acc.mods + ("declare" -> l0))) + case (KEYWORD("export"), l0) :: c => + consume + yeetSpaces + go(acc.copy(acc.mods + ("export" -> l0))) case _ if acc.mods.isEmpty => acc case (KEYWORD("class" | "infce" | "trait" | "mixin" | "type" | "namespace" | "module" | "fun"), l0) :: _ => acc @@ -322,7 +326,8 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case ModifierSet(mods, (KEYWORD(k @ ("class" | "infce" | "trait" | "mixin" | "type" | "namespace" | "module")), l0) :: c) => consume val (isDecl, mods2) = mods.handle("declare") - mods2.done + val (isExported, mods3) = mods2.handle("export") + mods3.done val kind = k match { case "class" => Cls case "trait" => Trt @@ -392,13 +397,14 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case _ => Nil } val body = curlyTypingUnit - val res = NuTypeDef(kind, tn, tparams, params, sig, ps, N, N, body)(isDecl) + val res = NuTypeDef(kind, tn, tparams, params, sig, ps, N, N, body)(isDecl, isExported) R(res.withLoc(S(l0 ++ res.getLoc))) case ModifierSet(mods, (KEYWORD(kwStr @ ("fun" | "let")), l0) :: c) => // TODO support rec? consume val (isDecl, mods2) = mods.handle("declare") - mods2.done + val ( isExported, mods3) = mods2.handle("export") + mods3.done val isLetRec = yeetSpaces match { case (KEYWORD("rec"), l1) :: _ if kwStr === "let" => consume @@ -461,7 +467,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D val body = expr(0) val newBody = transformBody.fold(body)(_(body)) val annotatedBody = asc.fold(newBody)(ty => Asc(newBody, ty)) - R(NuFunDef(isLetRec, v, tparams, L(ps.foldRight(annotatedBody)((i, acc) => Lam(i, acc))))(isDecl)) + R(NuFunDef(isLetRec, v, tparams, L(ps.foldRight(annotatedBody)((i, acc) => Lam(i, acc))))(isDecl, isExported)) case c => asc match { case S(ty) => @@ -469,14 +475,14 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D R(NuFunDef(isLetRec, v, tparams, R(PolyType(Nil, ps.foldRight(ty)((p, r) => Function(p.toType match { case L(diag) => raise(diag); Top // TODO better case R(tp) => tp - }, r)))))(isDecl)) // TODO rm PolyType after FCP is merged + }, r)))))(isDecl, isExported)) // TODO rm PolyType after FCP is merged case N => // TODO dedup: val (tkstr, loc) = c.headOption.fold(("end of input", lastLoc))(_.mapFirst(_.describe).mapSecond(some)) err(( msg"Expected ':' or '=' followed by a function body or signature; found ${tkstr} instead" -> loc :: Nil)) consume - R(NuFunDef(isLetRec, v, Nil, L(ps.foldRight(errExpr: Term)((i, acc) => Lam(i, acc))))(isDecl)) + R(NuFunDef(isLetRec, v, Nil, L(ps.foldRight(errExpr: Term)((i, acc) => Lam(i, acc))))(isDecl, isExported)) } } } diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index 88eaf4bff..5664f98b0 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -539,7 +539,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => if (isComputing) { val ty = err(msg"Unhandled cyclic definition", decl.toLoc) // * Hacky: return a dummy decl to avoid possible infinite completion recursions - TypedNuFun(0, NuFunDef(N, decl.nameVar, Nil, R(Top))(N), ty) + TypedNuFun(0, NuFunDef(N, decl.nameVar, Nil, R(Top))(N, N), ty) } else trace(s"Completing ${decl.showDbg}") { println(s"Type params ${tparams.mkString(" ")}") diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index a69e65e8c..138e1d2a7 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -1310,7 +1310,8 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) def goDecl(d: NuMember)(implicit ectx: ExpCtx): NuDecl = d match { case TypedNuAls(level, td, tparams, body) => ectx(tparams) |> { implicit ectx => - NuTypeDef(td.kind, td.nme, td.tparams, Tup(Nil), S(go(body)), Nil, N, N, TypingUnit(Nil))(td.declareLoc) + NuTypeDef(td.kind, td.nme, td.tparams, Tup(Nil), S(go(body)), Nil, N, N, TypingUnit(Nil))( + td.declareLoc, td.exportLoc) } case TypedNuMxn(td, thisTy, superTy, tparams, params, members, ttu) => ectx(tparams) |> { implicit ectx => @@ -1320,7 +1321,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) Nil,//TODO Option.when(!(TopType <:< superTy))(go(superTy)), Option.when(!(TopType <:< thisTy))(go(thisTy)), - mkTypingUnit(thisTy, members))(td.declareLoc) + mkTypingUnit(thisTy, members))(td.declareLoc, td.exportLoc) } case TypedNuCls(level, td, ttu, tparams, params, members, thisTy) => ectx(tparams) |> { implicit ectx => @@ -1330,10 +1331,10 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) Nil,//TODO N,//TODO Option.when(!(TopType <:< thisTy))(go(thisTy)), - mkTypingUnit(thisTy, members))(td.declareLoc) + mkTypingUnit(thisTy, members))(td.declareLoc, td.exportLoc) } case tf @ TypedNuFun(level, fd, bodyTy) => - NuFunDef(fd.isLetRec, fd.nme, Nil, R(go(tf.typeSignature)))(fd.declareLoc) + NuFunDef(fd.isLetRec, fd.nme, Nil, R(go(tf.typeSignature)))(fd.declareLoc, fd.exportLoc) case p: NuParam => ??? // TODO } diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index 8a650163e..49a5fb1e1 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -388,8 +388,10 @@ trait NuDeclImpl extends Located { self: NuDecl => val body: Located def kind: DeclKind val declareLoc: Opt[Loc] + val exportLoc: Opt[Loc] def isDecl: Bool = declareLoc.nonEmpty def declStr: Str = if (isDecl) "declare " else "" + def isExported: Bool = isDecl || exportLoc.isDefined val nameVar: Var = self match { case td: NuTypeDef => td.nme.toVar case fd: NuFunDef => fd.nme diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index cd0e7fc63..44df61430 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -187,14 +187,16 @@ final case class NuTypeDef( superAnnot: Opt[Type], thisAnnot: Opt[Type], body: TypingUnit -)(val declareLoc: Opt[Loc]) extends NuDecl with Statement +)(val declareLoc: Opt[Loc], val exportLoc: Opt[Loc]) + extends NuDecl with Statement final case class NuFunDef( isLetRec: Opt[Bool], // None means it's a `fun`, which is always recursive; Some means it's a `let` nme: Var, tparams: Ls[TypeName], rhs: Term \/ Type, -)(val declareLoc: Opt[Loc]) extends NuDecl with DesugaredStatement { +)(val declareLoc: Opt[Loc], val exportLoc: Opt[Loc]) + extends NuDecl with DesugaredStatement { val body: Located = rhs.fold(identity, identity) def kind: DeclKind = Val } diff --git a/shared/src/test/diff/nu/Export.mls b/shared/src/test/diff/nu/Export.mls new file mode 100644 index 000000000..6a4e455c4 --- /dev/null +++ b/shared/src/test/diff/nu/Export.mls @@ -0,0 +1,29 @@ +:NewDefs + + +export class A +//│ class A() + + +module M { + export fun g = A() + fun f = A() +} +//│ module M() { +//│ fun f: A +//│ fun g: A +//│ } + +let a = M.g +//│ let a: A +//│ a +//│ = A {} + +// TODO reject +// :e +let a = M.f +//│ let a: A +//│ a +//│ = A {} + + From 3c0a859423b39ef114f8d10150fe1c53128e801f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 20 Apr 2023 22:58:41 +0800 Subject: [PATCH 040/202] WIP: Add identifier escape --- shared/src/main/scala/mlscript/NewLexer.scala | 6 ++ shared/src/test/diff/nu/IdentEscape.mls | 65 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 shared/src/test/diff/nu/IdentEscape.mls diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index c6cfdeaed..b8bbc9409 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -104,6 +104,12 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { lex(k, ind, next(k, COMMENT(txt.dropRight(2)))) // case BracketKind(Left(k)) => go(i + 1, OPEN_BRACKET(k)) // case BracketKind(Right(k)) => go(i + 1, CLOSE_BRACKET(k)) + case 'i' if (bytes(i + 1) === 'd' && bytes(i + 2) === '"') => + val (n, j) = takeWhile(i + 3)(isIdentChar) + lex(j + 1, ind, next(j + 1, + if (bytes(j) === '"' && !n.isEmpty()) IDENT(n, isAlphaOp(n)) + else { pe(msg"unexpected identifier escape"); ERROR } + )) case BracketKind(Left(k)) => lex(i + 1, ind, next(i + 1, OPEN_BRACKET(k))) case BracketKind(Right(k)) => lex(i + 1, ind, next(i + 1, CLOSE_BRACKET(k))) case '\n' => diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls new file mode 100644 index 000000000..64b1b7cb5 --- /dev/null +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -0,0 +1,65 @@ +:NewDefs + +let id"of" = 42 +fun id"fun"(x: int) = x + 1 +//│ let of: 42 +//│ fun fun: (x: int,) -> int +//│ of +//│ = 42 + +id"fun"(id"of") +//│ int +//│ res +//│ = 43 + +let id"if" = 1 +id"if" + 1 +//│ let if: 1 +//│ int +//│ if +//│ = 1 +//│ res +//│ = 2 + +// FIXME +class Foo(id"class": int) { + fun id"mixin"(x: int) = id"class" + x +} +let foo = Foo(2) +foo.id"mixin"(3) +//│ ╔══[WARNING] Paren-less applications should use the 'of' keyword +//│ ║ l.29: foo.id"mixin"(3) +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Class `Foo` does not contain member `id` +//│ ║ l.29: foo.id"mixin"(3) +//│ ╙── ^^^ +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.29: foo.id"mixin"(3) +//│ ║ ^^^^^^^^^^ +//│ ╟── string literal of type `"mixin"` is not a function +//│ ║ l.29: foo.id"mixin"(3) +//│ ╙── ^^^^^^^ +//│ class Foo(class: int) { +//│ fun mixin: (x: int,) -> int +//│ } +//│ let foo: Foo +//│ error +//│ foo +//│ Syntax error: +//│ Unexpected token ')' +//│ res + +:pe +id"" +//│ ╔══[LEXICAL ERROR] unexpected identifier escape +//│ ║ l.53: id"" +//│ ╙── ^ +//│ ╔══[PARSE ERROR] Unexpected error in expression position +//│ ║ l.53: id"" +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here +//│ ║ l.53: id"" +//│ ╙── ^ +//│ undefined +//│ res +//│ = undefined From e5084ce134dc75c99e3f02816e5a060374c8ee2d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 21 Apr 2023 11:15:44 +0800 Subject: [PATCH 041/202] Fix selection parsing and new class ctor runtime name --- .../src/main/scala/mlscript/JSBackend.scala | 36 +++++++----- shared/src/main/scala/mlscript/NewLexer.scala | 26 ++++++--- shared/src/test/diff/nu/IdentEscape.mls | 55 ++++++++++++------- 3 files changed, 75 insertions(+), 42 deletions(-) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index fbf96f082..7f6f8b264 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -506,7 +506,8 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val localScope = scope.derive(s"local ${sym.lexicalName}") val nd = translateNewTypeDefinition(sym, N, false, false)(localScope) val ctorMth = localScope.declareValue("ctor", Some(false), false).runtimeName - val (constructor, params) = translateNewClassParameters(nd) + val ctorScope = localScope.derive(s"${sym.lexicalName} ctor") + val (constructor, params) = translateNewClassParameters(nd)(ctorScope) JSConstDecl(sym.lexicalName, JSImmEvalFn( N, Nil, R(Ls( nd, JSLetDecl.from(Ls(ctorMth)), @@ -624,16 +625,13 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { ))) } - protected def translateNewClassParameters(classBody: JSClassNewDecl) = { - val constructor = classBody match { - case dec: JSClassNewDecl => dec.fields.map(JSNamePattern(_)) + protected def translateNewClassParameters(classBody: JSClassNewDecl)(implicit scope: Scope) = + classBody.fields.flatMap { f => + { val v = scope.declareValue(f, S(false), false); JSNamePattern(v.runtimeName) :: JSIdent(v.runtimeName) :: Nil } + }.partitionMap { + case p: JSNamePattern => L(p) + case id: JSIdent => R(id) } - val params = classBody match { - case dec: JSClassNewDecl => dec.fields.map(JSIdent(_)) - } - - (constructor, params) - } protected def translateNewClassDeclaration( classSymbol: NewClassSymbol, @@ -643,9 +641,10 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val outerSymbol = getterScope.declareOuterSymbol() siblingsMembers.foreach(getterScope.captureSymbol(outerSymbol, _)) + val ctorScope = scope.derive(s"${classSymbol.lexicalName} ctor") val classBody = translateNewTypeDefinition(classSymbol, N, false, false)(getterScope) - val (constructor, params) = translateNewClassParameters(classBody) + val (constructor, params) = translateNewClassParameters(classBody)(ctorScope) val privateIdent = JSIdent(s"this.#${classSymbol.lexicalName}") val outerStmt = JSConstDecl(outerSymbol.runtimeName, JSIdent("this")) @@ -918,27 +917,36 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { (body, members, stmts, nested) } + def checkNewTypeName(nme: Str): Unit = + if (Symbol.isKeyword(nme)) + throw CodeGenError(s"$nme is a reserved keyword in ECMAScript and can not be used as type name.") + typeDefs.foreach { - case td @ NuTypeDef(Mxn, TypeName(mxName), tps, tup @ Tup(fs), sig, pars, sup, ths, unit) => { - val (body, members, stmts, nested) = prepare(mxName, fs, pars, unit) - val sym = MixinSymbol(mxName, tps map { _._2.name }, body, members, stmts, nested, isNested).tap(scope.register) + case td @ NuTypeDef(Mxn, TypeName(nme), tps, tup @ Tup(fs), sig, pars, sup, ths, unit) => { + checkNewTypeName(nme) + val (body, members, stmts, nested) = prepare(nme, fs, pars, unit) + val sym = MixinSymbol(nme, tps map { _._2.name }, body, members, stmts, nested, isNested).tap(scope.register) if (!td.isDecl) mixins += sym } case td @ NuTypeDef(Nms, TypeName(nme), tps, tup @ Tup(fs), sig, pars, sup, ths, unit) => { + checkNewTypeName(nme) val (body, members, stmts, nested) = prepare(nme, fs, pars, unit) val sym = ModuleSymbol(nme, tps map { _._2.name }, body, members, stmts, pars, nested, isNested).tap(scope.register) if (!td.isDecl) modules += sym } case td @ NuTypeDef(Als, TypeName(nme), tps, _, sig, pars, _, _, _) => { + checkNewTypeName(nme) scope.declareTypeAlias(nme, tps map { _._2.name }, sig.getOrElse(Top)) } case td @ NuTypeDef(Cls, TypeName(nme), tps, tup @ Tup(fs), sig, pars, sup, ths, unit) => { + checkNewTypeName(nme) val (body, members, stmts, nested) = prepare(nme, fs, pars, unit) val sym = NewClassSymbol(nme, tps map { _._2.name }, body, members, stmts, pars, nested, isNested).tap(scope.register) if (!td.isDecl) classes += sym } case td @ NuTypeDef(Trt, TypeName(nme), tps, tup @ Tup(fs), sig, pars, sup, ths, unit) => { + checkNewTypeName(nme) val (body, members, _, _) = prepare(nme, fs, pars, unit) val sym = scope.declareTrait(nme, tps map { _._2.name }, body, members) if (!td.isDecl) traits += sym diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index b8bbc9409..8b9aee10e 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -67,6 +67,13 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { // @inline // def go(j: Int, tok: Token) = lex(j, ind, (tok, loc(i, j)) :: acc) def next(j: Int, tok: Token) = (tok, loc(i, j)) :: acc + def isIdentEscape(i: Int): Bool = i + 2 < length && bytes(i) === 'i' && bytes(i + 1) === 'd' && bytes(i + 2) === '"' + def takeIdentFromEscape(i: Int, ctor: Str => Token) = { + val (n, j) = takeWhile(i + 3)(isIdentChar) + if (j < length && bytes(j) === '"' && !n.isEmpty()) (ctor(n), j + 1) + else { pe(msg"unexpected identifier escape"); (ERROR, j + 1) } + } + c match { case ' ' => val (_, j) = takeWhile(i)(_ === ' ') @@ -104,12 +111,6 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { lex(k, ind, next(k, COMMENT(txt.dropRight(2)))) // case BracketKind(Left(k)) => go(i + 1, OPEN_BRACKET(k)) // case BracketKind(Right(k)) => go(i + 1, CLOSE_BRACKET(k)) - case 'i' if (bytes(i + 1) === 'd' && bytes(i + 2) === '"') => - val (n, j) = takeWhile(i + 3)(isIdentChar) - lex(j + 1, ind, next(j + 1, - if (bytes(j) === '"' && !n.isEmpty()) IDENT(n, isAlphaOp(n)) - else { pe(msg"unexpected identifier escape"); ERROR } - )) case BracketKind(Left(k)) => lex(i + 1, ind, next(i + 1, OPEN_BRACKET(k))) case BracketKind(Right(k)) => lex(i + 1, ind, next(i + 1, CLOSE_BRACKET(k))) case '\n' => @@ -136,6 +137,9 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { else (NEWLINE, loc(i, k)) :: acc ) } + case _ if isIdentEscape(i) => + val (tok, n) = takeIdentFromEscape(i, s => IDENT(s, isAlphaOp(s))) + lex(n, ind, next(n, tok)) case _ if isIdentFirstChar(c) => val (n, j) = takeWhile(i)(isIdentChar) // go(j, if (keywords.contains(n)) KEYWORD(n) else IDENT(n, isAlphaOp(n))) @@ -143,9 +147,13 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { case _ if isOpChar(c) => val (n, j) = takeWhile(i)(isOpChar) if (n === "." && j < length && isIdentFirstChar(bytes(j))) { - val (name, k) = takeWhile(j)(isIdentChar) - // go(k, SELECT(name)) - lex(k, ind, next(k, SELECT(name))) + val (body, m) = + if (isIdentEscape(j)) takeIdentFromEscape(j, SELECT) + else { + val (name, k) = takeWhile(j)(isIdentChar) + (SELECT(name), k) + } + lex(m, ind, next(m, body)) } // else go(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true)) else lex(j, ind, next(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true))) diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls index 64b1b7cb5..ec4f3333b 100644 --- a/shared/src/test/diff/nu/IdentEscape.mls +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -2,15 +2,20 @@ let id"of" = 42 fun id"fun"(x: int) = x + 1 +fun id"declare"(id"if": int) = id"of" + id"if" //│ let of: 42 //│ fun fun: (x: int,) -> int +//│ fun declare: (if: int,) -> int //│ of //│ = 42 id"fun"(id"of") +id"declare"(id"of") //│ int //│ res //│ = 43 +//│ res +//│ = 84 let id"if" = 1 id"if" + 1 @@ -21,45 +26,57 @@ id"if" + 1 //│ res //│ = 2 -// FIXME + class Foo(id"class": int) { fun id"mixin"(x: int) = id"class" + x } let foo = Foo(2) foo.id"mixin"(3) -//│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.29: foo.id"mixin"(3) -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Class `Foo` does not contain member `id` -//│ ║ l.29: foo.id"mixin"(3) -//│ ╙── ^^^ -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.29: foo.id"mixin"(3) -//│ ║ ^^^^^^^^^^ -//│ ╟── string literal of type `"mixin"` is not a function -//│ ║ l.29: foo.id"mixin"(3) -//│ ╙── ^^^^^^^ //│ class Foo(class: int) { //│ fun mixin: (x: int,) -> int //│ } //│ let foo: Foo -//│ error +//│ int //│ foo -//│ Syntax error: -//│ Unexpected token ')' +//│ = Foo {} //│ res +//│ = 5 :pe id"" //│ ╔══[LEXICAL ERROR] unexpected identifier escape -//│ ║ l.53: id"" +//│ ║ l.46: id"" //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected error in expression position -//│ ║ l.53: id"" +//│ ║ l.46: id"" //│ ╙── ^^^^ //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.53: id"" +//│ ║ l.46: id"" //│ ╙── ^ //│ undefined //│ res //│ = undefined + +:pe +id"id +//│ ╔══[LEXICAL ERROR] unexpected identifier escape +//│ ║ l.61: id"id +//│ ╙── ^ +//│ ╔══[PARSE ERROR] Unexpected error in expression position +//│ ║ l.61: id"id +//│ ╙── ^^^^^^ +//│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here +//│ ║ l.61: id"id +//│ ╙── ^ +//│ undefined +//│ res +//│ = undefined + +class id"of" +//│ class of() + +:ge +class id"class" +//│ class class() +//│ Code generation encountered an error: +//│ class is a reserved keyword in ECMAScript and can not be used as type name. From 9a1973df47a001fa44a0356213a7d8200db66cf3 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 24 Apr 2023 11:11:02 +0800 Subject: [PATCH 042/202] Merge from new definition typing --- .../scala/mlscript/compiler/ClassLifter.scala | 34 ++++---- .../mlscript/compiler/PrettyPrinter.scala | 6 +- compiler/shared/test/diff/LiftType.mls | 16 ++-- compiler/shared/test/diff/Lifter.mls | 73 ++++++++--------- compiler/shared/test/diff/LifterBlks.mls | 48 +++++------ driver/js/src/main/scala/driver/Driver.scala | 2 +- .../scala/mlscript/ConstraintSolver.scala | 6 +- shared/src/main/scala/mlscript/NewLexer.scala | 6 +- .../src/main/scala/mlscript/NewParser.scala | 7 +- shared/src/main/scala/mlscript/Typer.scala | 9 ++- .../main/scala/mlscript/codegen/Scope.scala | 1 + shared/src/test/diff/nu/Declarations.mls | 79 ++++++++++++++++--- shared/src/test/diff/nu/MethodSignatures.mls | 45 +++++++++++ shared/src/test/diff/nu/Numbers.mls | 23 ++++++ shared/src/test/diff/ucs/SimpleUCS.mls | 6 +- 15 files changed, 243 insertions(+), 118 deletions(-) create mode 100644 shared/src/test/diff/nu/MethodSignatures.mls create mode 100644 shared/src/test/diff/nu/Numbers.mls diff --git a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala index b7328e40b..f4afa1aa8 100644 --- a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala +++ b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala @@ -89,7 +89,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { private def getFields(etts: List[Statement]): Set[Var] = { etts.flatMap{ case NuFunDef(_, nm, _, _) => Some(nm) - case NuTypeDef(_, TypeName(nm), _, _, _, _) => Some(Var(nm)) + case nuty: NuTypeDef => Some(Var(nuty.name)) case Let(_, name, _, _) => Some(name) case _ => None }.toSet @@ -180,13 +180,13 @@ class ClassLifter(logDebugMsg: Boolean = false) { }.fold(emptyCtx)(_ ++ _) case TyApp(trm, tpLst) => getFreeVars(trm).addT(tpLst.flatMap(_.collectTypeNames.map(TypeName(_)))) - case NuTypeDef(_, nm, tps, param, pars, body) => + case NuTypeDef(_, nm, tps, param, _, pars, _, _, body) => val prmVs = getFreeVars(param)(using emptyCtx, Map(), None) val newVs = prmVs.vSet ++ getFields(body.entities) + Var(nm.name) - val nCtx = ctx.addV(newVs).addT(nm).addT(tps) + val nCtx = ctx.addV(newVs).addT(nm).addT(tps.map(_._2)) val parVs = pars.map(getFreeVars(_)(using nCtx)).fold(emptyCtx)(_ ++ _) val bodyVs = body.entities.map(getFreeVars(_)(using nCtx)).fold(emptyCtx)(_ ++ _) - (bodyVs ++ parVs -+ prmVs).extT(tps) + (bodyVs ++ parVs -+ prmVs).extT(tps.map(_._2)) case Blk(stmts) => val newVs = getFields(stmts) stmts.map(getFreeVars(_)(using ctx.addV(newVs))).fold(emptyCtx)(_ ++ _) @@ -197,7 +197,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { } private def collectClassInfo(cls: NuTypeDef, preClss: Set[TypeName])(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): ClassInfoCache = { - val NuTypeDef(_, nm, tps, param, pars, body) = cls + val NuTypeDef(_, nm, tps, param, _, pars, _, _, body) = cls log(s"grep context of ${cls.nme.name} under {\n$ctx\n$cache\n$outer\n}\n") val (clses, funcs, trms) = splitEntities(cls.body.entities) val (supNms, rcdFlds) = pars.map(getSupClsInfoByTerm).unzip @@ -209,7 +209,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { }.unzip log(s"par record: ${flds._2.flatten}") val fields = (param.fields.flatMap(tupleEntityToVar) ++ funcs.map(_.nme) ++ clses.map(x => Var(x.nme.name)) ++ trms.flatMap(grepFieldsInTrm) ++ flds._1).toSet - val nCtx = ctx.addV(fields).addV(flds._1).extT(tps) + val nCtx = ctx.addV(fields).addV(flds._1).extT(tps.map(_._2)) val tmpCtx = ((body.entities.map(getFreeVars(_)(using nCtx)) ++ pars.map(getFreeVars(_)(using nCtx))).fold(emptyCtx)(_ ++ _).moveT2V(preClss) ).addT(flds._2.flatten.toSet).extV(supNms.flatten.map(x => Var(x.name))) @@ -379,13 +379,14 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nTpNm = TypeName(genAnoName(t.name)) val cls = cache.get(t).get val supArgs = Tup(cls.body.params.fields.flatMap(tupleEntityToVar).map(toFldsEle)) - val anoCls = NuTypeDef(Cls, nTpNm, Nil, cls.body.params, List(App(Var(t.name), supArgs)), tu) + val anoCls = NuTypeDef(Cls, nTpNm, Nil, cls.body.params, None, + List(App(Var(t.name), supArgs)), None, None, tu)(None) val nSta = New(Some((nTpNm, prm)), TypingUnit(Nil)) val ret = liftEntities(List(anoCls, nSta)) (Blk(ret._1), ret._2) case New(None, tu) => val nTpNm = TypeName(genAnoName()) - val anoCls = NuTypeDef(Cls, nTpNm, Nil, Tup(Nil), Nil, tu) + val anoCls = NuTypeDef(Cls, nTpNm, Nil, Tup(Nil), None, Nil, None, None, tu)(None) val nSta = New(Some((nTpNm, Tup(Nil))), TypingUnit(Nil)) val ret = liftEntities(List(anoCls, nSta)) (Blk(ret._1), ret._2) @@ -464,7 +465,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nlhs = liftType(lb) val nrhs = liftType(ub) Bounds(nlhs._1, nrhs._1) -> (nlhs._2 ++ nrhs._2) - case Constrained(base, bounds, where) => + case Constrained(base: Type, bounds, where) => val (nTargs, nCtx) = bounds.map { case (tv, Bounds(lb, ub)) => val nlhs = liftType(lb) val nrhs = liftType(ub) @@ -478,6 +479,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { val (nBase, bCtx) = liftType(base) Constrained(nBase, nTargs, bounds2) -> ((nCtx ++ nCtx2).fold(emptyCtx)(_ ++ _) ++ bCtx) + case Constrained(_, _, _) => die case Function(lhs, rhs) => val nlhs = liftType(lhs) val nrhs = liftType(rhs) @@ -531,7 +533,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { case PolyType(targs, body) => val (body2, ctx) = liftType(body) PolyType(targs, body2) -> ctx - case Top | Bot | _: Literal | _: TypeTag | _: TypeVar => target -> emptyCtx + case Top | Bot | _: Literal | _: TypeTag | _: TypeVar => target.asInstanceOf[Type] -> emptyCtx } @@ -541,14 +543,14 @@ class ClassLifter(logDebugMsg: Boolean = false) { body match{ case Left(value) => val ret = liftTerm(value)(using ctx.addV(nm).addT(tpVs)) - (func.copy(rhs = Left(ret._1)), ret._2) + (func.copy(rhs = Left(ret._1))(None), ret._2) case Right(PolyType(targs, body)) => val nBody = liftType(body)(using ctx.addT(tpVs)) val nTargs = targs.map { case L(tp) => liftTypeName(tp)(using ctx.addT(tpVs)).mapFirst(Left.apply) case R(tv) => R(tv) -> emptyCtx }.unzip - (func.copy(rhs = Right(PolyType(nTargs._1, nBody._1))), nTargs._2.fold(nBody._2)(_ ++ _)) + (func.copy(rhs = Right(PolyType(nTargs._1, nBody._1)))(None), nTargs._2.fold(nBody._2)(_ ++ _)) } } @@ -624,14 +626,14 @@ class ClassLifter(logDebugMsg: Boolean = false) { ).flatten.toMap } log("lift type " + target.toString() + " with cache " + cache.toString()) - val NuTypeDef(kind, nme, tps, params, pars, body) = target + val NuTypeDef(kind, nme, tps, params, sig, pars, supAnn, thisAnn, body) = target val nOuter = cache.get(nme) val ClassInfoCache(_, nName, freeVs, flds, inners, sups, _, _, _) = nOuter.get val (clsList, funcList, termList) = splitEntities(body.entities) val innerNmsSet = clsList.map(_.nme).toSet val nCache = cache ++ inners ++ getAllInners(sups) - val nTps = (tps ++ (freeVs.tSet -- nCache.keySet).toList).distinct + val nTps = (tps.map(_._2) ++ (freeVs.tSet -- nCache.keySet).toList).distinct val nCtx = freeVs.addT(nTps) val nParams = outer.map(x => List(toFldsEle(Var(genParName(x.liftedNm.name))))).getOrElse(Nil) @@ -641,7 +643,9 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nFuncs = funcList.map(liftFunc(_)(using emptyCtx, nCache, nOuter)).unzip val nTerms = termList.map(liftTerm(_)(using emptyCtx, nCache, nOuter)).unzip clsList.foreach(x => liftTypeDefNew(x)(using nCache, nOuter)) - retSeq = retSeq.appended(NuTypeDef(kind, nName, nTps, Tup(nParams), nPars._1, TypingUnit(nFuncs._1 ++ nTerms._1))) + retSeq = retSeq.appended(NuTypeDef( + kind, nName, nTps.map((None, _)), Tup(nParams), None, nPars._1, + None, None, TypingUnit(nFuncs._1 ++ nTerms._1))(None)) } def liftTypingUnit(rawUnit: TypingUnit): TypingUnit = { diff --git a/compiler/shared/main/scala/mlscript/compiler/PrettyPrinter.scala b/compiler/shared/main/scala/mlscript/compiler/PrettyPrinter.scala index f2a10bef0..8bdee95fc 100644 --- a/compiler/shared/main/scala/mlscript/compiler/PrettyPrinter.scala +++ b/compiler/shared/main/scala/mlscript/compiler/PrettyPrinter.scala @@ -36,9 +36,9 @@ object PrettyPrinter: case Some(true) => "let'" } s"$st ${funDef.nme.name}" - + (if funDef.targs.isEmpty + + (if funDef.tparams.isEmpty then "" - else funDef.targs.map(_.name).mkString("[", ", ", "]")) + else funDef.tparams.map(_.name).mkString("[", ", ", "]")) + " = " + funDef.rhs.fold(_.toString, _.show) @@ -46,7 +46,7 @@ object PrettyPrinter: s"${tyDef.kind.str} ${tyDef.nme.name}" + (if tyDef.tparams.isEmpty then "" - else tyDef.tparams.map(_.name).mkString("[", ",", "]")) + else tyDef.tparams.map(_._2.name).mkString("[", ",", "]")) + "(" + tyDef.params + ")" + (if tyDef.parents.isEmpty then "" diff --git a/compiler/shared/test/diff/LiftType.mls b/compiler/shared/test/diff/LiftType.mls index 488e54e49..bda3a602a 100644 --- a/compiler/shared/test/diff/LiftType.mls +++ b/compiler/shared/test/diff/LiftType.mls @@ -8,7 +8,7 @@ class CTX{ //│ |#class| |CTX|{|→|#class| |A| |{||}|↵|#fun| |foo|(|f|#:| |A| |=>| |A|)|#:| |(|A| |=>| |A|)| |=>| |A| |#=| |f|(|#new| |A|)|←|↵|}| //│ Parsed: {class CTX() {class A() {}; fun foo = (f: (A,) => A,) => f (new A() {},) : (A -> A) -> A}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List())))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List())))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2(par$CTX$1,) {} @@ -25,11 +25,11 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |(|A|,| |B|)|)|#:| |(|B|,| |A|)| |#=| |(|any|._2|,| |any|._1|)|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A() {fun foo = x}; class B(): A {fun foo = y}; fun foo = (any: '(' A, B, ')',) => '(' (any)._2, (any)._1, ')' : (B, A,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (Var(A)), TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), _2), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), _2), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2(par$CTX$1,) {fun foo = ((this).par$CTX$1).x} -//│ class CTX$1_B$3(par$CTX$1,): CTX$1_A$2 ((this).par$CTX$1,) {fun foo = ((this).par$CTX$1).y} +//│ class CTX$1_B$3(par$CTX$1,) {fun foo = ((this).par$CTX$1).y} //│ class CTX$1(x, y,) { //│ fun foo = (any: '(' CTX$1_A$2, CTX$1_B$3, ')',) => '(' (any)._2, (any)._1, ')' : (CTX$1_B$3, CTX$1_A$2,) //│ } @@ -43,11 +43,11 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |{|p1|#:| |A|,| |p2|#:| |B|}|)|#:| |(|B|,| |A|)| |#=| |(|any|.p2|,| |any|.p1|)|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A() {fun foo = x}; class B(): A {fun foo = y}; fun foo = (any: '{' {p1: A, p2: B} '}',) => '(' (any).p2, (any).p1, ')' : (B, A,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (Var(A)), TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = true, Rcd(Var(p1) = Var(A), Var(p2) = Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), p2), _: Sel(Var(any), p1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = true, Rcd(Var(p1) = Var(A), Var(p2) = Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), p2), _: Sel(Var(any), p1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2(par$CTX$1,) {fun foo = ((this).par$CTX$1).x} -//│ class CTX$1_B$3(par$CTX$1,): CTX$1_A$2 ((this).par$CTX$1,) {fun foo = ((this).par$CTX$1).y} +//│ class CTX$1_B$3(par$CTX$1,) {fun foo = ((this).par$CTX$1).y} //│ class CTX$1(x, y,) { //│ fun foo = (any: '{' {p1: CTX$1_A$2, p2: CTX$1_B$3} '}',) => '(' (any).p2, (any).p1, ')' : (CTX$1_B$3, CTX$1_A$2,) //│ } @@ -61,7 +61,7 @@ class CTX(x, y){ //│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|‹|T|›| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |(|A|,| |B|‹|A|›|)|)|#:| |(|(|B|‹|A|›|,| |A|)|,| |A|)| |#=| |(|any|,| |any|._1|)|←|↵|}| //│ Parsed: {class CTX(x, y,) {class A() {fun foo = x}; class B‹T›() {fun foo = y}; fun foo = (any: '(' A, B‹A›, ')',) => '(' any, (any)._1, ')' : ((B[A], A,), A,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, (TypeName(T)), Tup(), (), TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: TyApp(Var(B), List(TypeName(A)))))), Asc(Bra(rcd = false, Tup(_: Var(any), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,Tuple(List((None,Field(None,AppliedType(TypeName(B),List(TypeName(A))))), (None,Field(None,TypeName(A))))))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(x)))), NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(y)))), NuFunDef(None, foo, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: TyApp(Var(B), List(TypeName(A)))))), Asc(Bra(rcd = false, Tup(_: Var(any), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,Tuple(List((None,Field(None,AppliedType(TypeName(B),List(TypeName(A))))), (None,Field(None,TypeName(A))))))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2(par$CTX$1,) {fun foo = ((this).par$CTX$1).x} @@ -80,9 +80,9 @@ class CTX{ (new CTX).bar } //│ |#class| |CTX|{|→|#fun| |ctx|(|x|,|y|)| |#=| |→|#class| |A|{| |#fun| |foo| |#=| |x| |}|↵|#fun| |bar|‹|T|›|(|any|#:| |T|)|#:| |A| |#=| |→|#let| |x| |#=| |#new| |T|↵|#new| |A|←|↵|(|#new| |CTX|)|.bar|‹|CTX|›|←|←|↵|}| -//│ Parsed: {class CTX() {fun ctx = (x, y,) => {class A() {fun foo = x}; fun bar = (any: T,) => {let x = new T() {}; new A() {}} : A; ('(' new CTX() {}, ')').bar‹CTX›}}} +//│ Parsed: {class CTX() {fun ctx = (x, y,) => {class A() {fun foo = x}; fun bar = (any: T,) => {let x = new T() {}; new A() {}} : A; ('(' new CTX() {} ')').bar‹CTX›}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), TypingUnit(NuFunDef(None, ctx, [], Lam(Tup(_: Var(x), _: Var(y)), Blk(...)))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, ctx, [], Lam(Tup(_: Var(x), _: Var(y)), Blk(...)))))) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter. diff --git a/compiler/shared/test/diff/Lifter.mls b/compiler/shared/test/diff/Lifter.mls index d1eb609d9..566d12696 100644 --- a/compiler/shared/test/diff/Lifter.mls +++ b/compiler/shared/test/diff/Lifter.mls @@ -28,7 +28,7 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getB1| |#=| |B1|(|y|)|↵|#class| |C|(|z|)| |{|→|#fun| |inc|(||)| |#=| |x| |+| |1|↵|#fun| |getY| |#=| |y|↵|#fun| |getA| |#=| |A|(|z|)|↵|#fun| |getB|(|w|)| |#=| |B|(|w|)|↵|#fun| |getC| |#=| |#new| |C|(|inc|(||)|)|↵|#fun| |getSelf| |#=| |this|←|↵|}|←|↵|}|↵|#class| |B1|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getY| |#=| |y|↵|#fun| |getB| |#=| |#new| |B|(|y|)|↵|#fun| |getB1| |#=| |#new| |B1|(|y|)|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|(|x|)|↵|#fun| |getB2|(|y|)| |#=| |B1|(|y|)|↵|#fun| |getB3|(|z|)| |#=| |getB2|(|z|)|↵|#fun| |getA| |#=| |A|(|x|)|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {fun getX = x; fun getB1 = B1 (y,); class C(z,) {fun inc = () => + (x,) (1,); fun getY = y; fun getA = A (z,); fun getB = (w,) => B (w,); fun getC = new C(inc (),) {}; fun getSelf = this}}; class B1(y,) {fun getX = x; fun getY = y; fun getB = new B(y,) {}; fun getB1 = new B1(y,) {}}; fun getB = new B(x,) {}; fun getB2 = (y,) => B1 (y,); fun getB3 = (z,) => getB2 (z,); fun getA = A (x,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getB1, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), TypingUnit(NuFunDef(None, inc, [], Lam(Tup(), App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))))), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, [], New(Some((TypeName(C),inc (),)), TypingUnit(List()))), NuFunDef(None, getSelf, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getB, [], New(Some((TypeName(B),y,)), TypingUnit(List()))), NuFunDef(None, getB1, [], New(Some((TypeName(B1),y,)), TypingUnit(List()))))), NuFunDef(None, getB, [], New(Some((TypeName(B),x,)), TypingUnit(List()))), NuFunDef(None, getB2, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(x))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getB1, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, inc, [], Lam(Tup(), App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))))), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, [], New(Some((TypeName(C),inc (),)), TypingUnit(List()))), NuFunDef(None, getSelf, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getB, [], New(Some((TypeName(B),y,)), TypingUnit(List()))), NuFunDef(None, getB1, [], New(Some((TypeName(B1),y,)), TypingUnit(List()))))), NuFunDef(None, getB, [], New(Some((TypeName(B),x,)), TypingUnit(List()))), NuFunDef(None, getB2, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(x))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_C$4(par$A$1_B$2, z,) { @@ -67,7 +67,7 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#class| |C|(|z|)| |{|→|#fun| |sum| |#=| |x| |+| |y| |+| |z|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {class C(z,) {fun sum = + (+ (x,) (y,),) (z,)}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), TypingUnit(NuTypeDef(class, C, (), Tup(_: Var(z)), (), TypingUnit(NuFunDef(None, sum, [], App(App(Var(+), Tup(_: App(App(Var(+), Tup(_: Var(x))), Tup(_: Var(y))))), Tup(_: Var(z))))))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, sum, [], App(App(Var(+), Tup(_: App(App(Var(+), Tup(_: Var(x))), Tup(_: Var(y))))), Tup(_: Var(z))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_C$3(par$A$1_B$2, z,) { @@ -106,18 +106,9 @@ new C{ //│ |#class| |A|(|x|)| |{|→|#class| |B|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |11|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |2|↵|#fun| |bar| |#=| |12|←|↵|}|↵|#fun| |bar| |#=| |13|←|↵|}|↵|#class| |C|#:| |A|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |3|↵|#fun| |bar| |#=| |14|←|↵|}|↵|#fun| |bar| |#=| |15|←|↵|}|↵|#new| |C|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |4|↵|#fun| |bar| |#=| |16|←|↵|}|↵|#fun| |bar| |#=| |17|←|↵|}| //│ Parsed: {class A(x,) {class B() {fun foo = 1; fun bar = 11}; fun getB = new B() {fun foo = 2; fun bar = 12}; fun bar = 13}; class C(): A {fun getB = new B() {fun foo = 3; fun bar = 14}; fun bar = 15}; new C() {fun getB = new B() {fun foo = 4; fun bar = 16}; fun bar = 17}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], IntLit(1)), NuFunDef(None, bar, [], IntLit(11)))), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 2, fun bar = 12)))), NuFunDef(None, bar, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (Var(A)), TypingUnit(NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 3, fun bar = 14)))), NuFunDef(None, bar, [], IntLit(15)))), New(Some((TypeName(C),)), TypingUnit(List(fun getB = new B() {fun foo = 4; fun bar = 16}, fun bar = 17)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)), NuFunDef(None, bar, [], IntLit(11)))), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 2, fun bar = 12)))), NuFunDef(None, bar, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 3, fun bar = 14)))), NuFunDef(None, bar, [], IntLit(15)))), New(Some((TypeName(C),)), TypingUnit(List(fun getB = new B() {fun foo = 4; fun bar = 16}, fun bar = 17)))) //│ Lifted: -//│ TypingUnit { -//│ class A$1_B$1$4(par$A$1,): A$1_B$3 ((this).par$A$1,) {fun foo = 2; fun bar = 12} -//│ class A$1_B$3(par$A$1,) {fun foo = 1; fun bar = 11} -//│ class A$1(x,) {fun getB = {new A$1_B$1$4(this,) {}}; fun bar = 13} -//│ class C$2_B$2$5(par$C$2,): A$1_B$3 ((this).par$C$2,) {fun foo = 3; fun bar = 14} -//│ class C$2(): A$1 () {fun getB = {new C$2_B$2$5(this,) {}}; fun bar = 15} -//│ class C$3$6_B$4$7(par$C$3$6,): A$1_B$3 ((this).par$C$3$6,) {fun foo = 4; fun bar = 16} -//│ class C$3$6(): C$2 () {fun getB = {new C$3$6_B$4$7(this,) {}}; fun bar = 17} -//│ Code(List({new C$3$6() {}})) -//│ } +//│ Lifting failed: java.util.NoSuchElementException: None.get @@ -131,7 +122,7 @@ class Parent(x) { //│ |#class| |Parent|‹|T|,| |U|,| |V|›|(|x|)| |{| |→|#fun| |foo|(|x|#:| |Int|)|#:| |T| |#=| |x|+|1|↵|#class| |Inner|‹|W|›|(|y|#:| |Int|)|{|→|#fun| |bar|(|z|#:| |U|)| |#=| |foo|(|y|)|↵|#fun| |boo|(|z|#:| |W|)| |#=| |z|←|↵|}|←|↵|}| //│ Parsed: {class Parent‹T, U, V›(x,) {fun foo = (x: Int,) => + (x,) (1,) : T; class Inner‹W›(y: Int,) {fun bar = (z: U,) => foo (y,); fun boo = (z: W,) => z}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Parent, (TypeName(T), TypeName(U), TypeName(V)), Tup(_: Var(x)), (), TypingUnit(NuFunDef(None, foo, [], Lam(Tup(x: Var(Int)), Asc(App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))), TypeName(T)))), NuTypeDef(class, Inner, (TypeName(W)), Tup(y: Var(Int)), (), TypingUnit(NuFunDef(None, bar, [], Lam(Tup(z: Var(U)), App(Var(foo), Tup(_: Var(y))))), NuFunDef(None, boo, [], Lam(Tup(z: Var(W)), Var(z)))))))) +//│ TypingUnit(NuTypeDef(class, Parent, ((None,TypeName(T)), (None,TypeName(U)), (None,TypeName(V))), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, [], Lam(Tup(x: Var(Int)), Asc(App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))), TypeName(T)))), NuTypeDef(class, Inner, ((None,TypeName(W))), Tup(y: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, bar, [], Lam(Tup(z: Var(U)), App(Var(foo), Tup(_: Var(y))))), NuFunDef(None, boo, [], Lam(Tup(z: Var(W)), Var(z)))))))) //│ Lifted: //│ TypingUnit { //│ class Parent$1_Inner$2[W,U](par$Parent$1, y: Int,) { @@ -151,31 +142,31 @@ class A(x: Int): {a1: Int} & B & D(x){ } } //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)|#:| |{|a1|#:| |Int|}| |&| |B|‹|T|›| |&| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|#:| |T|)| |#=| |x|←|↵|}|←|↵|}| -//│ Parsed: {class B‹T›() {}; class C() {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): & (& ('{' {a1: Int} '}',) (B‹T›,),) (D (x,),) {fun getA = () => new C() {fun foo = (x: T,) => x}}} +//│ Parsed: {class B‹T›() {}; class C() {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): {a1: Int} & B[T] & D[(x,)] {fun getA = () => new C() {fun foo = (x: T,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, (TypeName(T)), Tup(), (), TypingUnit()), NuTypeDef(class, C, (), Tup(), (), TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), TypingUnit()), NuTypeDef(class, A, (TypeName(T), TypeName(U)), Tup(x: Var(Int)), (App(App(Var(&), Tup(_: App(App(Var(&), Tup(_: Bra(rcd = true, Rcd(Var(a1) = Var(Int))))), Tup(_: TyApp(Var(B), List(TypeName(T))))))), Tup(_: App(Var(D), Tup(_: Var(x)))))), TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x: T,) => x)))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x: T,) => x)))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]() {} //│ class C$2() {} //│ class D$3(y: Int,) {} //│ class A$4_C$1$5[T](par$A$4,): C$2 () {fun foo = (x: T,) => x} -//│ class A$4[T,U](x: Int,): & (& ('{' {a1: Int} '}',) (B$1 ()‹T›,),) (D$3 ((this).x,),) {fun getA = () => {new A$4_C$1$5(this,) {}}} +//│ class A$4[T,U](x: Int,) {fun getA = () => {new A$4_C$1$5(this,) {}}} //│ } // │ TypingUnit(NuTypeDef(class, B, (TypeName(T)), Tup(), (), TypingUnit()), NuTypeDef(class, C, (), Tup(), (), TypingUnit()), NuTypeDef(class, A, (TypeName(T), TypeName(U)), Tup(x: Var(Int)), (App(App(Var(&), Tup(_: Bra(rcd = true, Rcd(Var(a1) = Var(Int)})))), Tup(_: TyApp(Var(B), List(TypeName(T)))))), TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = x: T, => x)))))))) class B {} class C {} class D(y: Int) {} -class A(x: Int): {a1: Int}, B, D(x){ +class A(x: Int) extends {a1: Int}, B, D(x){ fun getA() = new C{ fun foo(x) = x } } -//│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)|#:| |{|a1|#:| |Int|}|,| |B|‹|T|›|,| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|)| |#=| |x|←|↵|}|←|↵|}| +//│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)| |#extends| |{|a1|#:| |Int|}|,| |B|‹|T|›|,| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T›() {}; class C() {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): '{' {a1: Int} '}', B‹T›, D (x,) {fun getA = () => new C() {fun foo = (x,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, (TypeName(T)), Tup(), (), TypingUnit()), NuTypeDef(class, C, (), Tup(), (), TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), TypingUnit()), NuTypeDef(class, A, (TypeName(T), TypeName(U)), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x,) => x)))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x,) => x)))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]() {} @@ -193,15 +184,15 @@ class Child(x): { age: T } & { name: String} { fun boo = new Inner } //│ |#class| |Child|‹|T|,| |U|›|(|x|)|#:| |{| |age|#:| |T| |}| |&| |{| |name|#:| |String|}| |{|→|#class| |Inner|{|→|#fun| |foo| |#=| |age|←|↵|}|↵|#fun| |bar| |#=| |age|↵|#fun| |boo| |#=| |#new| |Inner|←|↵|}| -//│ Parsed: {class Child‹T, U›(x,): & ('{' {age: T} '}',) ('{' {name: String} '}',) {class Inner() {fun foo = age}; fun bar = age; fun boo = new Inner() {}}} +//│ Parsed: {class Child‹T, U›(x,): {age: T} & {name: String} {class Inner() {fun foo = age}; fun bar = age; fun boo = new Inner() {}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Child, (TypeName(T), TypeName(U)), Tup(_: Var(x)), (App(App(Var(&), Tup(_: Bra(rcd = true, Rcd(Var(age) = Var(T))))), Tup(_: Bra(rcd = true, Rcd(Var(name) = Var(String)))))), TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], Var(age)))), NuFunDef(None, bar, [], Var(age)), NuFunDef(None, boo, [], New(Some((TypeName(Inner),)), TypingUnit(List())))))) +//│ TypingUnit(NuTypeDef(class, Child, ((None,TypeName(T)), (None,TypeName(U))), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(age)))), NuFunDef(None, bar, [], Var(age)), NuFunDef(None, boo, [], New(Some((TypeName(Inner),)), TypingUnit(List())))))) //│ Lifted: //│ TypingUnit { -//│ class Child$1_Inner$2(par$Child$1,) {fun foo = ((this).par$Child$1).age} -//│ class Child$1[T,U](x,): & ('{' {age: T} '}',) ('{' {name: String} '}',) { -//│ fun bar = (this).age -//│ fun boo = new Child$1_Inner$2(this,) {} +//│ class Child$1_Inner$2(par$Child$1, age,) {fun foo = (this).age} +//│ class Child$1[T,U](x,) { +//│ fun bar = age +//│ fun boo = new Child$1_Inner$2(this, age,) {} //│ } //│ } @@ -217,7 +208,7 @@ new A(0) { //│ |#class| |A|(|x|#:| |Int|)| |{|→|#fun| |getA|#:| |Int| |#=| |0|↵|#fun| |getA1| |#=| |1|←|↵|}|↵|#new| |A|(|0|)| |{|→|#fun| |getA| |#=| |3|↵|#fun| |getA2| |#=| |2|←|↵|}| //│ Parsed: {class A(x: Int,) {fun getA = 0 : Int; fun getA1 = 1}; new A(0,) {fun getA = 3; fun getA2 = 2}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), TypingUnit(NuFunDef(None, getA, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, [], IntLit(1)))), New(Some((TypeName(A),0,)), TypingUnit(List(fun getA = 3, fun getA2 = 2)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, [], IntLit(1)))), New(Some((TypeName(A),0,)), TypingUnit(List(fun getA = 3, fun getA2 = 2)))) //│ Lifted: //│ TypingUnit { //│ class A$1(x: Int,) {fun getA = 0 : Int; fun getA1 = 1} @@ -237,7 +228,7 @@ new A(1) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{| |}|←|↵|}|↵|#new| |A|(|1|)| |{|→|#fun| |getB| |#=| |#new| |B|(|2|)|{|→|#fun| |getB| |#=| |#new| |B|(|3|)|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {}}; new A(1,) {fun getB = new B(2,) {fun getB = new B(3,) {}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), TypingUnit()))), New(Some((TypeName(A),1,)), TypingUnit(List(fun getB = new B(2,) {fun getB = new B(3,) {}})))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit()))), New(Some((TypeName(A),1,)), TypingUnit(List(fun getB = new B(2,) {fun getB = new B(3,) {}})))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1, y,) {} @@ -269,11 +260,11 @@ new B{ //│ |#class| |A| |{|→|#fun| |getA| |#=| |0|↵|#fun| |funcA| |#=| |10|←|↵|}|↵|#class| |B|#:| |A|{|→|#fun| |getA| |#=| |1|↵|#fun| |funcB| |#=| |11|←|↵|}|↵|#new| |A|↵|#new| |B|↵|#fun| |f|(|x|)| |#=| |#if| |x| |is| |A| |#then| |0| |#else| |1|↵|f|(|#new| |A|{|→|#fun| |getA| |#=| |2|←|↵|}|)|↵|#new| |B|{|→|#fun| |getA| |#=| |funcB|←|↵|}| //│ Parsed: {class A() {fun getA = 0; fun funcA = 10}; class B(): A {fun getA = 1; fun funcB = 11}; new A() {}; new B() {}; fun f = (x,) => if (is (x,) (A,)) then 0 else 1; f (new A() {fun getA = 2},); new B() {fun getA = funcB}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuFunDef(None, getA, [], IntLit(0)), NuFunDef(None, funcA, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (Var(A)), TypingUnit(NuFunDef(None, getA, [], IntLit(1)), NuFunDef(None, funcB, [], IntLit(11)))), New(Some((TypeName(A),)), TypingUnit(List())), New(Some((TypeName(B),)), TypingUnit(List())), NuFunDef(None, f, [], Lam(Tup(_: Var(x)), If(IfThen(App(App(Var(is), Tup(_: Var(x))), Tup(_: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List(fun getA = 2))))), New(Some((TypeName(B),)), TypingUnit(List(fun getA = funcB)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(0)), NuFunDef(None, funcA, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(1)), NuFunDef(None, funcB, [], IntLit(11)))), New(Some((TypeName(A),)), TypingUnit(List())), New(Some((TypeName(B),)), TypingUnit(List())), NuFunDef(None, f, [], Lam(Tup(_: Var(x)), If(IfThen(App(App(Var(is), Tup(_: Var(x))), Tup(_: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List(fun getA = 2))))), New(Some((TypeName(B),)), TypingUnit(List(fun getA = funcB)))) //│ Lifted: //│ TypingUnit { //│ class A$1() {fun getA = 0; fun funcA = 10} -//│ class B$2(): A$1 () {fun getA = 1; fun funcB = 11} +//│ class B$2() {fun getA = 1; fun funcB = 11} //│ class A$1$3(): A$1 () {fun getA = 2} //│ class B$2$4(): B$2 () {fun getA = (this).funcB} //│ fun f = (x,) => if (is (x,) (A$1 (),)) then 0 else 1 @@ -309,13 +300,13 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A() {class B() {fun funB = 1; fun foo = 100}; class C(): B {fun funC = 2; fun foo = 1000}; class D() {fun funD = 3; fun foo = 10000; class E(): C {fun funE = 4; fun foo = 100000}; class F(): E {fun funF = 5; fun foo = 1000000}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (Var(B)), TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)))), NuTypeDef(class, D, (), Tup(), (), TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (Var(C)), TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)))), NuTypeDef(class, F, (), Tup(), (Var(E)), TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000))))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {fun funB = 1; fun foo = 100} -//│ class A$1_C$3(par$A$1,): A$1_B$2 ((this).par$A$1,) {fun funC = 2; fun foo = 1000} -//│ class A$1_D$4_E$5(par$A$1_D$4,): A$1_C$3 (((this).par$A$1_D$4).par$A$1,) {fun funE = 4; fun foo = 100000} -//│ class A$1_D$4_F$6(par$A$1_D$4,): A$1_D$4_E$5 ((this).par$A$1_D$4,) {fun funF = 5; fun foo = 1000000} +//│ class A$1_C$3(par$A$1,) {fun funC = 2; fun foo = 1000} +//│ class A$1_D$4_E$5(par$A$1_D$4,) {fun funE = 4; fun foo = 100000} +//│ class A$1_D$4_F$6(par$A$1_D$4,) {fun funF = 5; fun foo = 1000000} //│ class A$1_D$4(par$A$1,) {fun funD = 3; fun foo = 10000} //│ class A$1() {} //│ } @@ -351,22 +342,22 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|↵|#fun| |getB| |#=| |#new| |B|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|↵|#fun| |getD| |#=| |#new| |D|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|↵|#fun| |getE| |#=| |#new| |E|{|→|#fun| |foo| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A() {class B() {fun funB = 1; fun foo = 100}; class C(): B {fun funC = 2; fun foo = 1000; fun getB = new B() {}}; class D() {fun funD = 3; fun foo = 10000; class E(): C {fun funE = 4; fun foo = 100000; fun getD = new D() {}}; class F(): E {fun funF = 5; fun foo = 1000000; fun getE = new E() {fun foo = 0}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (Var(B)), TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List()))))), NuTypeDef(class, D, (), Tup(), (), TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (Var(C)), TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)), NuFunDef(None, getD, [], New(Some((TypeName(D),)), TypingUnit(List()))))), NuTypeDef(class, F, (), Tup(), (Var(E)), TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000)), NuFunDef(None, getE, [], New(Some((TypeName(E),)), TypingUnit(List(fun foo = 0))))))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List()))))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)), NuFunDef(None, getD, [], New(Some((TypeName(D),)), TypingUnit(List()))))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000)), NuFunDef(None, getE, [], New(Some((TypeName(E),)), TypingUnit(List(fun foo = 0))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {fun funB = 1; fun foo = 100} -//│ class A$1_C$3(par$A$1,): A$1_B$2 ((this).par$A$1,) { +//│ class A$1_C$3(par$A$1,) { //│ fun funC = 2 //│ fun foo = 1000 //│ fun getB = new A$1_B$2((this).par$A$1,) {} //│ } -//│ class A$1_D$4_E$5(par$A$1_D$4,): A$1_C$3 (((this).par$A$1_D$4).par$A$1,) { +//│ class A$1_D$4_E$5(par$A$1_D$4,) { //│ fun funE = 4 //│ fun foo = 100000 //│ fun getD = new A$1_D$4(((this).par$A$1_D$4).par$A$1,) {} //│ } //│ class A$1_D$4_F$6_E$1$7(par$A$1_D$4_F$6,): A$1_D$4_E$5 (((this).par$A$1_D$4_F$6).par$A$1_D$4,) {fun foo = 0} -//│ class A$1_D$4_F$6(par$A$1_D$4,): A$1_D$4_E$5 ((this).par$A$1_D$4,) { +//│ class A$1_D$4_F$6(par$A$1_D$4,) { //│ fun funF = 5 //│ fun foo = 1000000 //│ fun getE = {new A$1_D$4_F$6_E$1$7(this,) {}} @@ -386,7 +377,7 @@ new A //│ |#class| |A|{|→|#class| |B|{|→|#fun| |foo| |#=| |1|←|↵|}|↵|#fun| |bar| |#=| |#new| |B|←|↵|}|↵|#new| |A| //│ Parsed: {class A() {class B() {fun foo = 1}; fun bar = new B() {}}; new A() {}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit(NuFunDef(None, foo, [], IntLit(1)))), NuFunDef(None, bar, [], New(Some((TypeName(B),)), TypingUnit(List()))))), New(Some((TypeName(A),)), TypingUnit(List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)))), NuFunDef(None, bar, [], New(Some((TypeName(B),)), TypingUnit(List()))))), New(Some((TypeName(A),)), TypingUnit(List()))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {fun foo = 1} @@ -410,7 +401,7 @@ let x = new A{ //│ |#class| |A|(|x|)| |{|→|#fun| |foo| |#=| |0|↵|#fun| |bar| |#=| |x|←|↵|}|↵|#let| |x| |#=| |#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |newFun| |#=| |2|↵|#fun| |bar| |#=| |#new| |A|(|foo|)|{|→|#fun| |foo| |#=| |bar| |+| |1|↵|#fun| |bar2| |#=| |newFun| |+| |1|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {fun foo = 0; fun bar = x}; let x = new A() {fun foo = 1; fun newFun = 2; fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuFunDef(None, foo, [], IntLit(0)), NuFunDef(None, bar, [], Var(x)))), NuFunDef(Some(false), x, [], New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun newFun = 2, fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(0)), NuFunDef(None, bar, [], Var(x)))), NuFunDef(Some(false), x, [], New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun newFun = 2, fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}))))) //│ Lifted: //│ TypingUnit { //│ class A$1(x,) {fun foo = 0; fun bar = (this).x} @@ -446,7 +437,7 @@ new A{ //│ |#class| |A| |{||}|↵|#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |#new| |A|{|→|#fun| |foo1| |#=| |foo|↵|#fun| |bar1| |#=| |#new| |A|{|→|#fun| |foo2| |#=| |foo|↵|#fun| |bar2| |#=| |#new| |A|{|→|#fun| |foo3| |#=| |foo|↵|#fun| |bar3| |#=| |#new| |A|{|→|#fun| |foo4| |#=| |foo|↵|#fun| |bar4| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A() {}; new A() {fun foo = 1; fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit()), New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}})))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}})))) //│ Lifted: //│ TypingUnit { //│ class A$1() {} diff --git a/compiler/shared/test/diff/LifterBlks.mls b/compiler/shared/test/diff/LifterBlks.mls index b4e8d2df0..6089f1926 100644 --- a/compiler/shared/test/diff/LifterBlks.mls +++ b/compiler/shared/test/diff/LifterBlks.mls @@ -18,7 +18,7 @@ class A{ //│ |#class| |A|{|→|#class| |B| |{||}|↵|#fun| |foo|(|x|#:| |B|)| |#=| |(|x|#:|B|)|←|↵|}| //│ Parsed: {class A() {class B() {}; fun foo = (x: B,) => '(' x: B, ')'}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(x: Var(B)), Bra(rcd = false, Tup(x: Var(B)))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(x: Var(B)), Bra(rcd = false, Tup(x: Var(B)))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {} @@ -37,13 +37,13 @@ fun foo = print of local of 0 + local of 1 fun tmp = 2 //│ |#fun| |foo| |#=|→|#fun| |local|(|x|)| |#=|→|#class| |Foo| |{|→|#fun| |bar| |#=| |x| |+| |1|←|↵|}|↵|Foo|(||)|.bar|←|↵|print| |#of| |local|(|0|)| |+| |local|(|1|)|↵|print| |#of| |(|local| |#of| |0|)| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |1|↵|print| |#of| |local| |#of| |0| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |2|←| -//│ Parsed: {fun foo = {fun local = (x,) => {class Foo() {fun bar = + (x,) (1,)}; (Foo ()).bar}; print (+ (local (0,),) (local (1,),),); print (+ (local (0,),) (local (1,),),); fun tmp = 1; print (local (+ (0,) (local (1,),),),); fun tmp = 2}} +//│ Parsed: {fun foo = {fun local = (x,) => {class Foo() {fun bar = + (x,) (1,)}; (Foo ()).bar}; print (+ (local (0,),) (local (1,),),); print (+ ('(' local (0,) ')',) (local (1,),),); fun tmp = 1; print (local (+ (0,) (local (1,),),),); fun tmp = 2}} //│ Parsed: //│ TypingUnit(NuFunDef(None, foo, [], Blk(...))) //│ Lifted: //│ TypingUnit { //│ class Foo$1(x,) {fun bar = + ((this).x,) (1,)} -//│ fun foo = {fun local = (x,) => {(Foo$1 (x,)).bar}; fun tmp = 1; fun tmp = 2; print (+ (local (0,),) (local (1,),),); print (+ (local (0,),) (local (1,),),); print (local (+ (0,) (local (1,),),),)} +//│ fun foo = {fun local = (x,) => {(Foo$1 (x,)).bar}; fun tmp = 1; fun tmp = 2; print (+ (local (0,),) (local (1,),),); print (+ ('(' local (0,) ')',) (local (1,),),); print (local (+ (0,) (local (1,),),),)} //│ } class A(y){} @@ -52,7 +52,7 @@ f(0) //│ |#class| |A|(|y|)|{||}|↵|#let| |f| |#=| |x| |=>| |#new| |A|(|0|)|{|#fun| |bar| |#=| |x|+|y|}|↵|f|(|0|)| //│ Parsed: {class A(y,) {}; let f = (x,) => new A(0,) {fun bar = + (x,) (y,)}; f (0,)} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), TypingUnit()), NuFunDef(Some(false), f, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),0,)), TypingUnit(List(fun bar = + (x,) (y,)))))), App(Var(f), Tup(_: IntLit(0)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), None, None, TypingUnit()), NuFunDef(Some(false), f, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),0,)), TypingUnit(List(fun bar = + (x,) (y,)))))), App(Var(f), Tup(_: IntLit(0)))) //│ Lifted: //│ TypingUnit { //│ class A$1(y,) {} @@ -74,7 +74,7 @@ class A(x){ //│ |#class| |A|(|x|)|{|→|#fun| |w| |#=| |x|↵|#fun| |foo|(|y|)| |#=| |→|#class| |B|(|z|)|{|→|#fun| |bar| |#=| |x|+|y|+|z|←|↵|}|↵|#new| |B|(|0|)|{|→|#fun| |bar| |#=| |w|+|y|+|z|←|↵|}|←|←|↵|}| //│ Parsed: {class A(x,) {fun w = x; fun foo = (y,) => {class B(z,) {fun bar = + (+ (x,) (y,),) (z,)}; new B(0,) {fun bar = + (+ (w,) (y,),) (z,)}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), TypingUnit(NuFunDef(None, w, [], Var(x)), NuFunDef(None, foo, [], Lam(Tup(_: Var(y)), Blk(...)))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, w, [], Var(x)), NuFunDef(None, foo, [], Lam(Tup(_: Var(y)), Blk(...)))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1, z, y,) { @@ -98,10 +98,10 @@ fun f(x,y,z) = fun foo = new A fun bar2 = y } - class C: A,B{ + class C extends A, B { fun bar = bar1 + bar2 } -//│ |#fun| |f|(|x|,|y|,|z|)| |#=| |→|#class| |A|{|→|#fun| |foo| |#=| |#new| |B|↵|#fun| |bar1| |#=| |x|←|↵|}|↵|#class| |B|{|→|#fun| |foo| |#=| |#new| |A|↵|#fun| |bar2| |#=| |y|←|↵|}|↵|#class| |C|#:| |A|,|B|{|→|#fun| |bar| |#=| |bar1| |+| |bar2|←|↵|}|←| +//│ |#fun| |f|(|x|,|y|,|z|)| |#=| |→|#class| |A|{|→|#fun| |foo| |#=| |#new| |B|↵|#fun| |bar1| |#=| |x|←|↵|}|↵|#class| |B|{|→|#fun| |foo| |#=| |#new| |A|↵|#fun| |bar2| |#=| |y|←|↵|}|↵|#class| |C| |#extends| |A|,| |B| |{|→|#fun| |bar| |#=| |bar1| |+| |bar2|←|↵|}|←| //│ Parsed: {fun f = (x, y, z,) => {class A() {fun foo = new B() {}; fun bar1 = x}; class B() {fun foo = new A() {}; fun bar2 = y}; class C(): A, B {fun bar = + (bar1,) (bar2,)}}} //│ Parsed: //│ TypingUnit(NuFunDef(None, f, [], Lam(Tup(_: Var(x), _: Var(y), _: Var(z)), Blk(...)))) @@ -132,7 +132,7 @@ fun f(x,y,z) = fun boo = (new A).bar1 + B().bar2 + z } //│ |#fun| |f|(|x|,|y|,|z|)| |#=| |→|#class| |C|{|→|#class| |A|{|→|#fun| |foo| |#=| |#new| |B|↵|#fun| |bar1| |#=| |x|←|↵|}|↵|#class| |B|{|→|#fun| |foo| |#=| |#new| |A|↵|#fun| |bar2| |#=| |y|←|↵|}|↵|#fun| |boo| |#=| |(|#new| |A|)|.bar1| |+| |B|(||)|.bar2| |+| |z|←|↵|}|←| -//│ Parsed: {fun f = (x, y, z,) => {class C() {class A() {fun foo = new B() {}; fun bar1 = x}; class B() {fun foo = new A() {}; fun bar2 = y}; fun boo = + (+ (('(' new A() {}, ')').bar1,) ((B ()).bar2,),) (z,)}}} +//│ Parsed: {fun f = (x, y, z,) => {class C() {class A() {fun foo = new B() {}; fun bar1 = x}; class B() {fun foo = new A() {}; fun bar2 = y}; fun boo = + (+ (('(' new A() {} ')').bar1,) ((B ()).bar2,),) (z,)}}} //│ Parsed: //│ TypingUnit(NuFunDef(None, f, [], Lam(Tup(_: Var(x), _: Var(y), _: Var(z)), Blk(...)))) //│ Lifted: @@ -146,7 +146,7 @@ fun f(x,y,z) = //│ fun bar2 = ((this).par$C$1).y //│ } //│ class C$1(x, y, z,) { -//│ fun boo = + (+ (('(' new C$1_A$2(this,) {}, ')').bar1,) ((C$1_B$3 (this,)).bar2,),) ((this).z,) +//│ fun boo = + (+ (('(' new C$1_A$2(this,) {} ')').bar1,) ((C$1_B$3 (this,)).bar2,),) ((this).z,) //│ } //│ fun f = (x, y, z,) => {} //│ } @@ -185,22 +185,22 @@ fun f(x) = //│ fun f = (x,) => {let g = (x,) => {let h = (x,) => + (x,) (2,); (Foo$1 (h (x,), x, g,)).bar}; (Foo$1 (x, x, g,)).bar} //│ } -class Foo(x, y): Bar(y, x), Baz(x + y) -//│ |#class| |Foo|(|x|,| |y|)|#:| |Bar|(|y|,| |x|)|,| |Baz|(|x| |+| |y|)| +class Foo(x, y) extends Bar(y, x), Baz(x + y) +//│ |#class| |Foo|(|x|,| |y|)| |#extends| |Bar|(|y|,| |x|)|,| |Baz|(|x| |+| |y|)| //│ Parsed: {class Foo(x, y,): Bar (y, x,), Baz (+ (x,) (y,),) {}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Foo, (), Tup(_: Var(x), _: Var(y)), (App(Var(Bar), Tup(_: Var(y), _: Var(x))), App(Var(Baz), Tup(_: App(App(Var(+), Tup(_: Var(x))), Tup(_: Var(y)))))), TypingUnit())) +//│ TypingUnit(NuTypeDef(class, Foo, (), Tup(_: Var(x), _: Var(y)), (App(Var(Bar), Tup(_: Var(y), _: Var(x))), App(Var(Baz), Tup(_: App(App(Var(+), Tup(_: Var(x))), Tup(_: Var(y)))))), None, None, TypingUnit())) //│ Lifted: //│ TypingUnit { //│ class Foo$1(x, y,): Bar ((this).y, (this).x,), Baz (+ ((this).x,) ((this).y,),) {} //│ } fun foo(x: T): string = - class A(y): B, C(y: U) { + class A(y) extends B, C(y: U) { fun bar = this } "rua" -//│ |#fun| |foo|‹|T|,| |U|›|(|x|#:| |T|)|#:| |string| |#=| |→|#class| |A|(|y|)|#:| |B|‹|T|›|,| |C|(|y|#:| |U|)| |{|→|#fun| |bar| |#=| |this|←|↵|}|↵|"rua"|←| +//│ |#fun| |foo|‹|T|,| |U|›|(|x|#:| |T|)|#:| |string| |#=| |→|#class| |A|(|y|)| |#extends| |B|‹|T|›|,| |C|(|y|#:| |U|)| |{|→|#fun| |bar| |#=| |this|←|↵|}|↵|"rua"|←| //│ Parsed: {fun foo = (x: T,) => {class A(y,): B‹T›, C (y: U,) {fun bar = this}; "rua"} : string} //│ Parsed: //│ TypingUnit(NuFunDef(None, foo, [TypeName(T), TypeName(U)], Lam(Tup(x: Var(T)), Asc(Blk(...), TypeName(string))))) @@ -219,7 +219,7 @@ class A{ //│ |#class| |A|‹|T|›|{|→|#class| |B|{|→|#fun| |f|#:| |T| |=>| |B| |=>| |T| |#=| |x| |=>| |y| |=>| |x|↵|#fun| |g|#:| |T| |=>| |B| |=>| |T|←|↵|}|←|↵|}| //│ Parsed: {class A‹T›() {class B() {fun f = (x,) => (y,) => x : T -> B -> T; fun g: T -> B -> T}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (TypeName(T)), Tup(), (), TypingUnit(NuTypeDef(class, B, (), Tup(), (), TypingUnit(NuFunDef(None, f, [], Asc(Lam(Tup(_: Var(x)), Lam(Tup(_: Var(y)), Var(x))), Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T))))), NuFunDef(None, g, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T)))))))))) +//│ TypingUnit(NuTypeDef(class, A, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, f, [], Asc(Lam(Tup(_: Var(x)), Lam(Tup(_: Var(y)), Var(x))), Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T))))), NuFunDef(None, g, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T)))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2[T](par$A$1,) { @@ -235,14 +235,14 @@ class Foo{ class Bar: {any: RectangleBox => StackedRectangleBoxes} } //│ |#class| |Foo|‹|T|›|{|→|#class| |RectangleBox|#:| |Box|‹|T|›| |&| |{| |breadth|#:| |T| |}|↵|#class| |StackedRectangleBoxes|‹|N|›| |#:| |RectangleBox|‹|T|›| |&| |{| |size|#:| |N| |}|↵|#class| |Bar|#:| |{|any|#:| |RectangleBox| |=>| |StackedRectangleBoxes|}|←|↵|}| -//│ Parsed: {class Foo‹T›() {class RectangleBox(): & (Box‹T›,) ('{' {breadth: T} '}',) {}; class StackedRectangleBoxes‹N›(): & (RectangleBox‹T›,) ('{' {size: N} '}',) {}; class Bar(): '{' {any: (RectangleBox,) => StackedRectangleBoxes} '}' {}}} +//│ Parsed: {class Foo‹T›() {class RectangleBox(): Box[T] & {breadth: T} {}; class StackedRectangleBoxes‹N›(): RectangleBox[T] & {size: N} {}; class Bar(): {any: RectangleBox -> StackedRectangleBoxes} {}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Foo, (TypeName(T)), Tup(), (), TypingUnit(NuTypeDef(class, RectangleBox, (), Tup(), (App(App(Var(&), Tup(_: TyApp(Var(Box), List(TypeName(T))))), Tup(_: Bra(rcd = true, Rcd(Var(breadth) = Var(T)))))), TypingUnit()), NuTypeDef(class, StackedRectangleBoxes, (TypeName(N)), Tup(), (App(App(Var(&), Tup(_: TyApp(Var(RectangleBox), List(TypeName(T))))), Tup(_: Bra(rcd = true, Rcd(Var(size) = Var(N)))))), TypingUnit()), NuTypeDef(class, Bar, (), Tup(), (Bra(rcd = true, Rcd(Var(any) = Lam(Tup(_: Var(RectangleBox)), Var(StackedRectangleBoxes))))), TypingUnit())))) +//│ TypingUnit(NuTypeDef(class, Foo, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuTypeDef(class, RectangleBox, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, StackedRectangleBoxes, ((None,TypeName(N))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, Bar, (), Tup(), (), None, None, TypingUnit())))) //│ Lifted: //│ TypingUnit { -//│ class Foo$1_RectangleBox$2[T](par$Foo$1,): & (Box‹T›,) ('{' {breadth: T} '}',) {} -//│ class Foo$1_StackedRectangleBoxes$3[N,T](par$Foo$1,): & (Foo$1_RectangleBox$2 ((this).par$Foo$1,)‹T›,) ('{' {size: N} '}',) {} -//│ class Foo$1_Bar$4(par$Foo$1,): '{' {any: (Foo$1_RectangleBox$2,) => Foo$1_StackedRectangleBoxes$3} '}' {} +//│ class Foo$1_RectangleBox$2(par$Foo$1,) {} +//│ class Foo$1_StackedRectangleBoxes$3[N](par$Foo$1,) {} +//│ class Foo$1_Bar$4(par$Foo$1,) {} //│ class Foo$1[T]() {} //│ } @@ -257,14 +257,14 @@ fun ctx(a,b) = fun apply(x) = a+x }, b) //│ |#class| |Func|‹|T|,| |U|›| |{|→|#fun| |apply|#:| |T| |=>| |U|←|↵|}|↵|#class| |Lambda|‹|T|,| |U|›| |#:| |Func|‹|T|,| |U|›| |{||}|↵|#fun| |ctx|(|a|,|b|)| |#=|→|#fun| |foo|(|f|#:| |Func|,| |x|)| |#=| |→|f|.apply|(|x|)|←|↵|foo|(|#new| |Lambda|{|→|#fun| |apply|(|x|)| |#=| |a|+|x|←|↵|}|,| |b|)|←| -//│ Parsed: {class Func‹T, U›() {fun apply: T -> U}; class Lambda‹T, U›(): Func‹T, U› {}; fun ctx = (a, b,) => {fun foo = (f: Func, x,) => {(f).apply (x,)}; foo (new Lambda() {fun apply = (x,) => + (a,) (x,)}, b,)}} +//│ Parsed: {class Func‹T, U›() {fun apply: T -> U}; class Lambda‹T, U›(): Func[T, U] {}; fun ctx = (a, b,) => {fun foo = (f: Func, x,) => {(f).apply (x,)}; foo (new Lambda() {fun apply = (x,) => + (a,) (x,)}, b,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Func, (TypeName(T), TypeName(U)), Tup(), (), TypingUnit(NuFunDef(None, apply, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),TypeName(U)))))), NuTypeDef(class, Lambda, (TypeName(T), TypeName(U)), Tup(), (TyApp(Var(Func), List(TypeName(T), TypeName(U)))), TypingUnit()), NuFunDef(None, ctx, [], Lam(Tup(_: Var(a), _: Var(b)), Blk(...)))) +//│ TypingUnit(NuTypeDef(class, Func, ((None,TypeName(T)), (None,TypeName(U))), Tup(), (), None, None, TypingUnit(NuFunDef(None, apply, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),TypeName(U)))))), NuTypeDef(class, Lambda, ((None,TypeName(T)), (None,TypeName(U))), Tup(), (), None, None, TypingUnit()), NuFunDef(None, ctx, [], Lam(Tup(_: Var(a), _: Var(b)), Blk(...)))) //│ Lifted: //│ TypingUnit { //│ class Func$1[T,U]() {fun apply = T -> U} -//│ class Lambda$2[T,U](): Func$1 ()‹T, U› {} -//│ class Lambda$1$3[T,U](a,): Lambda$2 () {fun apply = (x,) => + ((this).a,) (x,)} +//│ class Lambda$2[T,U]() {} +//│ class Lambda$1$3(a,): Lambda$2 () {fun apply = (x,) => + ((this).a,) (x,)} //│ fun ctx = (a, b,) => {fun foo = (f: Func$1, x,) => {(f).apply (x,)}; foo ({new Lambda$1$3(a,) {}}, b,)} //│ } diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 213a47d02..97826037d 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -99,7 +99,7 @@ class Driver(options: DriverOptions) { case Some(content) => parse(filename, content) match { case (_, declarations, _, origin) => TypingUnit( - NuTypeDef(Nms, TypeName(moduleName), Nil, Tup(Nil), N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin))) :: Nil, Nil) + NuTypeDef(Nms, TypeName(moduleName), Nil, Tup(Nil), N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N) :: Nil, Nil) } case None => throw ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 85c3ad3db..c0e43dfc3 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -31,7 +31,7 @@ class ConstraintSolver extends NormalForms { self: Typer => (implicit ctx: Ctx, raise: Raise) : Either[Diagnostic, NuMember] = { - val info = ctx.tyDefs2(clsNme) + val info = ctx.tyDefs2.getOrElse(clsNme, die/*TODO*/) if (info.isComputing) { L(ErrorReport( @@ -54,7 +54,7 @@ class ConstraintSolver extends NormalForms { self: Typer => (implicit ctx: Ctx, raise: Raise) : FieldType = { - val info = ctx.tyDefs2(clsNme) + val info = ctx.tyDefs2.getOrElse(clsNme, die/*TODO*/) // require(!info.isComputing) // TODO intersect with found signature! @@ -165,7 +165,7 @@ class ConstraintSolver extends NormalForms { self: Typer => // (implicit raise: Raise, cctx: ConCtx, ctx: Ctx, shadows: Shadows) (implicit ctx: Ctx, raise: Raise) : TypedNuCls = { - val info = ctx.tyDefs2(clsNme) + val info = ctx.tyDefs2.getOrElse(clsNme, die/*TODO*/) info.complete() match { case td: TypedNuCls => diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 8b9aee10e..3ed2b725e 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -264,6 +264,8 @@ object NewLexer { "then", "else", "fun", + "val", + "var", // "is", // "as", "of", @@ -293,7 +295,9 @@ object NewLexer { "exists", "in", "out", - "import" + "import", + "null", + "undefined", ) def printToken(tl: TokLoc): Str = tl match { diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 07898da00..682112e2f 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -289,7 +289,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D yeetSpaces go(acc.copy(acc.mods + ("export" -> l0))) case _ if acc.mods.isEmpty => acc - case (KEYWORD("class" | "infce" | "trait" | "mixin" | "type" | "namespace" | "module" | "fun"), l0) :: _ => + case (KEYWORD("class" | "infce" | "trait" | "mixin" | "type" | "namespace" | "module" | "fun" | "val"), l0) :: _ => acc case (tok, loc) :: _ => // TODO support indented blocks of modified declarations... @@ -400,7 +400,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D val res = NuTypeDef(kind, tn, tparams, params, sig, ps, N, N, body)(isDecl, isExported) R(res.withLoc(S(l0 ++ res.getLoc))) - case ModifierSet(mods, (KEYWORD(kwStr @ ("fun" | "let")), l0) :: c) => // TODO support rec? + case ModifierSet(mods, (KEYWORD(kwStr @ ("fun" | "val" | "let")), l0) :: c) => // TODO support rec? consume val (isDecl, mods2) = mods.handle("declare") val ( isExported, mods3) = mods2.handle("export") @@ -548,6 +548,9 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case (LITVAL(lit), l0) :: _ => consume exprCont(lit.withLoc(S(l0)), prec, allowNewlines = false) + case (KEYWORD(kwStr @ ("undefined" | "null")), l0) :: _ => + consume + exprCont(UnitLit(kwStr === "undefined").withLoc(S(l0)), prec, allowNewlines = false) case (IDENT(nme, false), l0) :: _ => consume exprCont(Var(nme).withLoc(S(l0)), prec, allowNewlines = false) diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 138e1d2a7..c6f2da421 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -66,7 +66,6 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) lvl: Int, inPattern: Bool, tyDefs: Map[Str, TypeDef], - // tyDefs2: MutMap[Str, NuTypeDef], tyDefs2: MutMap[Str, DelayedTypeInfo], inRecursiveDef: Opt[Var], // TODO rm extrCtx: ExtrCtx, @@ -259,6 +258,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) Map( "true" -> TrueType, "false" -> FalseType, + "NaN" -> DecType, "document" -> BotType, "window" -> BotType, "typeof" -> fun(singleTup(TopType), StrType)(noProv), @@ -430,9 +430,10 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool) case Literal(lit) => ClassTag(lit, lit.baseClasses)(tyTp(ty.toLoc, "literal type")) case TypeName("this") => - ctx.env.getOrElse("this", err(msg"undeclared this" -> ty.toLoc :: Nil)) match { - case AbstractConstructor(_, _) => die - case VarSymbol(t: SimpleType, _) => t + ctx.env.get("this") match { + case S(AbstractConstructor(_, _)) => die + case S(VarSymbol(t: SimpleType, _)) => t + case N => err(msg"undeclared this" -> ty.toLoc :: Nil) } case tn @ TypeTag(name) => rec(TypeName(name.decapitalize)) // TODO rm this hack // case tn @ TypeTag(name) => rec(TypeName(name)) diff --git a/shared/src/main/scala/mlscript/codegen/Scope.scala b/shared/src/main/scala/mlscript/codegen/Scope.scala index 3f2f222e0..bd2e0297f 100644 --- a/shared/src/main/scala/mlscript/codegen/Scope.scala +++ b/shared/src/main/scala/mlscript/codegen/Scope.scala @@ -34,6 +34,7 @@ class Scope(name: Str, enclosing: Opt[Scope]) { Ls( "true", "false", + "NaN", "id", "emptyArray", "succ", diff --git a/shared/src/test/diff/nu/Declarations.mls b/shared/src/test/diff/nu/Declarations.mls index a5a960892..a1d2d0b24 100644 --- a/shared/src/test/diff/nu/Declarations.mls +++ b/shared/src/test/diff/nu/Declarations.mls @@ -2,15 +2,19 @@ -declare fun console: nothing -//│ fun console: nothing - -console.error("hello") +declare fun btoa: nothing +declare fun atob: nothing +//│ fun btoa: nothing +//│ fun atob: nothing + +let str = btoa("hello") +atob(str) +//│ let str: nothing //│ nothing +//│ str +//│ = 'aGVsbG8=' //│ res -//│ = undefined -//│ // Output -//│ hello +//│ = 'hello' declare module console { @@ -30,13 +34,14 @@ console.error("hello") :e console.log("hello") //│ ╔══[ERROR] Module `console` does not contain member `log` -//│ ║ l.31: console.log("hello") +//│ ║ l.35: console.log("hello") //│ ╙── ^^^^ //│ error //│ res //│ = undefined + declare module Foo { fun foo: int } @@ -52,7 +57,7 @@ Foo.foo //│ ReferenceError: Foo is not defined -declare type A = int +declare type A = int //│ type A = int 42 : A @@ -62,14 +67,62 @@ declare type A = int +declare class Sanitizer { + fun sanitizeFor(element: string, input: string): string +} +//│ class Sanitizer() { +//│ fun sanitizeFor: (element: string, input: string,) -> string +//│ } + +:re +let s = Sanitizer() +//│ let s: Sanitizer +//│ s +//│ Runtime error: +//│ ReferenceError: Sanitizer is not defined + + + +// * TODO allow Buffer2 to be named Buffer... +// :d +declare module Buffer { + class Buffer2 { + val length: int + } + fun bar: int + fun from(a: Array[int]): Buffer2 = from(a) + // fun from1(a: Array[int]): this.Buffer2 = from1(a) // FIXME + // fun from2(a: Array[int]): Buffer.Buffer2 = from2(a) // FIXME +} +//│ module Buffer() { +//│ class Buffer2() { +//│ let length: int +//│ } +//│ fun bar: int +//│ fun from: (a: Array[int],) -> Buffer2 +//│ } + +let b = Buffer.from([0, 1, 2]) +//│ let b: Buffer2 +//│ b +//│ = + +b.length +//│ int +//│ res +//│ = 3 + + + + :pe declare 42 //│ ╔══[PARSE ERROR] Unexpected literal token after modifier -//│ ║ l.66: declare 42 -//│ ╙── ^^ +//│ ║ l.119: declare 42 +//│ ╙── ^^ //│ ╔══[PARSE ERROR] Unexpected literal token after modifier -//│ ║ l.66: declare 42 -//│ ╙── ^^ +//│ ║ l.119: declare 42 +//│ ╙── ^^ //│ 42 //│ res //│ = 42 diff --git a/shared/src/test/diff/nu/MethodSignatures.mls b/shared/src/test/diff/nu/MethodSignatures.mls new file mode 100644 index 000000000..c447ed09a --- /dev/null +++ b/shared/src/test/diff/nu/MethodSignatures.mls @@ -0,0 +1,45 @@ +:NewDefs + + +// FIXME currently type signatures are typed too early (not in the context where the other defns live) +// We need to move all the typing unit setup to lazy type info prelude +// :d +module M { + class A + fun a: A + fun a = 1 +} +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.9: fun a: A +//│ ╙── ^ +//│ module M() { +//│ class A() +//│ fun a: error +//│ } + +// FIXME similar +module M { + class A + fun a: this.A + fun a = 1 +} +//│ ╔══[ERROR] undeclared this +//│ ║ l.23: fun a: this.A +//│ ╙── ^^^^ +//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. + +// FIXME similar +module M { + class A + fun a: M.A + fun a = 1 +} +//│ ╔══[ERROR] Module `M` is not supported yet. +//│ ║ l.34: fun a: M.A +//│ ╙── ^^ +//│ module M() { +//│ class A() +//│ fun a: error +//│ } + + diff --git a/shared/src/test/diff/nu/Numbers.mls b/shared/src/test/diff/nu/Numbers.mls new file mode 100644 index 000000000..abeaf0436 --- /dev/null +++ b/shared/src/test/diff/nu/Numbers.mls @@ -0,0 +1,23 @@ +:NewDefs + + +let x = NaN +//│ let x: number +//│ x +//│ = NaN + +// TODO polymorphic number operations +x + 1 +//│ ╔══[ERROR] Type mismatch in operator application: +//│ ║ l.10: x + 1 +//│ ║ ^^^ +//│ ╟── reference of type `number` is not an instance of type `int` +//│ ║ l.4: let x = NaN +//│ ║ ^^^ +//│ ╟── but it flows into reference with expected type `int` +//│ ║ l.10: x + 1 +//│ ╙── ^ +//│ error | int +//│ res +//│ = NaN + diff --git a/shared/src/test/diff/ucs/SimpleUCS.mls b/shared/src/test/diff/ucs/SimpleUCS.mls index 929d3111e..0155bffbe 100644 --- a/shared/src/test/diff/ucs/SimpleUCS.mls +++ b/shared/src/test/diff/ucs/SimpleUCS.mls @@ -315,7 +315,7 @@ class Var(name) class ValBase class IntVal(value): ValBase class BoolVal(value): ValBase -class Lit(val) +class Lit(value) //│ Defined class Var //│ Defined class ValBase //│ Defined class IntVal @@ -329,7 +329,7 @@ class Lit(val) //│ = [Function: IntVal1] //│ BoolVal: 'value -> (BoolVal & {value: 'value}) //│ = [Function: BoolVal1] -//│ Lit: 'val -> (Lit & {val: 'val}) +//│ Lit: 'value -> (Lit & {value: 'value}) //│ = [Function: Lit1] fun p(e, context) = @@ -339,7 +339,7 @@ fun p(e, context) = Some(BoolVal(v)) then Right(v) Lit(IntVal(v)) then Left(v) Lit(BoolVal(v)) then Right(v) -//│ p: (Lit & {val: BoolVal & {value: 'value} | IntVal & {value: 'value0}} | Var & {name: 'name}, {get: 'name -> (Some & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}})},) -> (Left & {leftValue: 'value0} | Right & {rightValue: 'value}) +//│ p: (Lit & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}} | Var & {name: 'name}, {get: 'name -> (Some & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}})},) -> (Left & {leftValue: 'value0} | Right & {rightValue: 'value}) //│ = [Function: p1] class Nil() From 11842ee53bee516dcc4650b4e554b9d1a5dafc4b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 25 Apr 2023 09:10:28 +0800 Subject: [PATCH 043/202] Enhance ident escape error message and fix symbolic argument --- shared/src/main/scala/mlscript/NewLexer.scala | 6 +++--- shared/src/main/scala/mlscript/NewParser.scala | 6 +++++- shared/src/test/diff/nu/IdentEscape.mls | 10 ++-------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 3ed2b725e..b8b0743ba 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -70,8 +70,8 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { def isIdentEscape(i: Int): Bool = i + 2 < length && bytes(i) === 'i' && bytes(i + 1) === 'd' && bytes(i + 2) === '"' def takeIdentFromEscape(i: Int, ctor: Str => Token) = { val (n, j) = takeWhile(i + 3)(isIdentChar) - if (j < length && bytes(j) === '"' && !n.isEmpty()) (ctor(n), j + 1) - else { pe(msg"unexpected identifier escape"); (ERROR, j + 1) } + if (j < length && bytes(j) === '"') (ctor(n), j + 1) + else { pe(msg"unfinished identifier escape"); (ERROR, j + 1) } } c match { @@ -138,7 +138,7 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { ) } case _ if isIdentEscape(i) => - val (tok, n) = takeIdentFromEscape(i, s => IDENT(s, isAlphaOp(s))) + val (tok, n) = takeIdentFromEscape(i, s => IDENT(s, false)) lex(n, ind, next(n, tok)) case _ if isIdentFirstChar(c) => val (n, j) = takeWhile(i)(isIdentChar) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 682112e2f..71a85e004 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -553,7 +553,11 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D exprCont(UnitLit(kwStr === "undefined").withLoc(S(l0)), prec, allowNewlines = false) case (IDENT(nme, false), l0) :: _ => consume - exprCont(Var(nme).withLoc(S(l0)), prec, allowNewlines = false) + if (nme.isEmpty()) { + err(msg"empty identifier escaped." -> S(l0) :: Nil) + R(errExpr) + } + else exprCont(Var(nme).withLoc(S(l0)), prec, allowNewlines = false) case (KEYWORD("super"), l0) :: _ => consume exprCont(Super().withLoc(S(l0)), prec, allowNewlines = false) diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls index ec4f3333b..c1973565d 100644 --- a/shared/src/test/diff/nu/IdentEscape.mls +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -44,22 +44,16 @@ foo.id"mixin"(3) :pe id"" -//│ ╔══[LEXICAL ERROR] unexpected identifier escape -//│ ║ l.46: id"" -//│ ╙── ^ -//│ ╔══[PARSE ERROR] Unexpected error in expression position +//│ ╔══[PARSE ERROR] empty identifier escaped. //│ ║ l.46: id"" //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.46: id"" -//│ ╙── ^ //│ undefined //│ res //│ = undefined :pe id"id -//│ ╔══[LEXICAL ERROR] unexpected identifier escape +//│ ╔══[LEXICAL ERROR] unfinished identifier escape //│ ║ l.61: id"id //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected error in expression position From aa24b106a2a7c55eed49ab4d6204744748010114 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 25 Apr 2023 10:12:19 +0800 Subject: [PATCH 044/202] Replace keywords with ident escape in ts2mls --- shared/src/test/diff/nu/IdentEscape.mls | 6 +- .../main/scala/ts2mls/types/Converter.scala | 12 +- ts2mls/js/src/test/diff/ES5.mlsi | 3128 ++++++----------- ts2mls/js/src/test/typescript/ES5.d.ts | 754 ++-- 4 files changed, 1394 insertions(+), 2506 deletions(-) diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls index c1973565d..17e9ea41c 100644 --- a/shared/src/test/diff/nu/IdentEscape.mls +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -54,13 +54,13 @@ id"" :pe id"id //│ ╔══[LEXICAL ERROR] unfinished identifier escape -//│ ║ l.61: id"id +//│ ║ l.55: id"id //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected error in expression position -//│ ║ l.61: id"id +//│ ║ l.55: id"id //│ ╙── ^^^^^^ //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.61: id"id +//│ ║ l.55: id"id //│ ╙── ^ //│ undefined //│ res diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 34816988e..abf535f87 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -19,11 +19,17 @@ object Converter { "symbol" -> "Symbol" ) + private def escapeIdent(name: String) = { + import mlscript.NewLexer + if (NewLexer.keywords(name)) s"""id"$name"""" + else name + } + def generateFunDeclaration(tsType: TSType, name: String)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" - s"${indent}fun $name$tpList($pList): ${convert(res)("")}" + s"${indent}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name)} ${overload.warning}" case inter: TSIntersectionType => s"${indent}fun ${name}: ${Converter.convert(inter)}" @@ -63,11 +69,11 @@ object Converter { parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType])(implicit indent: String) = { val allRecs = members.toList.map((m) => m._2.modifier match { case Public => - if (typeName === "trait ") s"${m._1}: ${convert(m._2)}," + if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" - case _ => s"${indent} let ${m._1}: ${convert(m._2)}\n" + case _ => s"${indent} let ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members }) ::: diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 00eccf7a0..79a457de2 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -40,14 +40,32 @@ trait Object() { fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } +trait ObjectConstructor() { + let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> + fun getOwnPropertyNames(o: anything): MutArray + fun isFrozen(o: anything): (false) | (true) + fun getPrototypeOf(o: anything): anything + fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T + let prototype: Object + fun isSealed(o: anything): (false) | (true) + fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T + fun preventExtensions(o: T): T + let create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) + fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ + let __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> + fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor + fun seal(o: T): T + fun keys(o: object): MutArray + fun isExtensible(o: anything): (false) | (true) +} let Function: FunctionConstructor trait FunctionConstructor() { - let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31> - let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37> + let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> + let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> let prototype: Function } -type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> -type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> +type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> +type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> trait CallableFunction() extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R @@ -59,7 +77,7 @@ trait NewableFunction() extends Function { fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } trait IArguments() { - let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22> + let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> let length: number let callee: Function } @@ -67,25 +85,25 @@ trait String() { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } trait StringConstructor() { - let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29> - let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> + let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> + let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> let prototype: String fun fromCharCode(codes: MutArray): string } let Boolean: BooleanConstructor trait BooleanConstructor() { - let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30> - let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> + let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> + let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> let prototype: Boolean } trait Number() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } trait NumberConstructor() { - let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> + let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> let NaN: number let MIN_VALUE: number - let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29> + let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> let NEGATIVE_INFINITY: number let POSITIVE_INFINITY: number let MAX_VALUE: number @@ -99,7 +117,7 @@ trait ImportCallOptions() { let assert: (ImportAssertions) | (undefined) } trait ImportAssertions() { - let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28> + let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } let Math: Math trait Date() { @@ -108,54 +126,63 @@ trait Date() { fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } trait DateConstructor() { - let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128> + let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number - let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38> + let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> fun now(): number fun parse(s: string): number let prototype: Date } -let RegExp: RegExpConstructor +trait RegExp() { + fun test(string: string): (false) | (true) + let multiline: (false) | (true) + let source: string + fun compile(pattern: string, flags: (string) | (undefined)): RegExp + let global: (false) | (true) + let lastIndex: number + let ignoreCase: (false) | (true) + fun exec(string: string): RegExpExecArray +} let Error: ErrorConstructor trait ErrorConstructor() { - let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28> - let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33> + let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> + let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> let prototype: Error } let EvalError: EvalErrorConstructor trait EvalErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> - let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> + let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> + let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> let prototype: EvalError } let RangeError: RangeErrorConstructor trait RangeErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> - let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> + let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> + let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> let prototype: RangeError } let ReferenceError: ReferenceErrorConstructor trait ReferenceErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> - let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> + let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> + let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> let prototype: ReferenceError } let SyntaxError: SyntaxErrorConstructor trait SyntaxErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> - let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> + let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> + let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> let prototype: SyntaxError } let TypeError: TypeErrorConstructor trait TypeErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> - let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> + let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> + let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> let prototype: TypeError } let URIError: URIErrorConstructor trait URIErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> - let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> + let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> + let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> let prototype: URIError } let JSON: JSON @@ -164,7 +191,7 @@ trait ReadonlyArray() { fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136> + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun join(separator: (string) | (undefined)): string fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray @@ -179,14 +206,14 @@ trait ReadonlyArray() { } trait ConcatArray() { let length: number - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28> + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } let Array: ArrayConstructor trait ArrayConstructor() { - let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38> - let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34> + let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> + let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) let prototype: MutArray } @@ -199,28 +226,28 @@ trait TypedPropertyDescriptor() { let value: (T) | (undefined) } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike -type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17> +type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> trait ArrayLike() { let length: number - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28> + let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } -type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17> -type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18> -type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18> -type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33> -type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37> -type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20> -type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20> +type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> +type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> +type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> +type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> +type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> +type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> +type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> type Omit = __type type NonNullable = (T) & ({}) -type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50> -type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74> -type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50> -type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65> -type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34> -type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34> -type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35> -type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37> +type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> +type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> +type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> +type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> +type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> +type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> +type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> +type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> trait ThisType() {} let ArrayBuffer: ArrayBufferConstructor trait ArrayBufferTypes() { @@ -229,7 +256,7 @@ trait ArrayBufferTypes() { type ArrayBufferLike = ArrayBuffer trait ArrayBufferConstructor() { let prototype: ArrayBuffer - let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> + let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } trait ArrayBufferView() { @@ -240,37 +267,15 @@ trait ArrayBufferView() { let DataView: DataViewConstructor trait DataViewConstructor() { let prototype: DataView - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } -trait Int8Array() { - fun valueOf(): Int8Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array +let Int8Array: Int8ArrayConstructor +trait Int8ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + let prototype: Int8Array + fun id"of"(items: MutArray): Int8Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array - fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array - fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Int8Array - fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } trait Uint8Array() { fun valueOf(): Uint8Array @@ -278,7 +283,7 @@ trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> + let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array @@ -302,214 +307,68 @@ trait Uint8Array() { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number let byteOffset: number } -trait Uint8ClampedArray() { - fun valueOf(): Uint8ClampedArray - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray +trait Uint8ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + let prototype: Uint8Array + fun id"of"(items: MutArray): Uint8Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray - fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray - fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Uint8ClampedArray - fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Int16Array() { - fun valueOf(): Int16Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array +let Uint8ClampedArray: Uint8ClampedArrayConstructor +trait Uint8ClampedArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + let prototype: Uint8ClampedArray + fun id"of"(items: MutArray): Uint8ClampedArray let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array - fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array - fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Int16Array - fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Uint16Array() { - fun valueOf(): Uint16Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array +let Int16Array: Int16ArrayConstructor +trait Int16ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + let prototype: Int16Array + fun id"of"(items: MutArray): Int16Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array - fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array - fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Uint16Array - fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Int32Array() { - fun valueOf(): Int32Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array +let Uint16Array: Uint16ArrayConstructor +trait Uint16ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + let prototype: Uint16Array + fun id"of"(items: MutArray): Uint16Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array - fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array - fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Int32Array - fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Uint32Array() { - fun valueOf(): Uint32Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array +let Int32Array: Int32ArrayConstructor +trait Int32ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + let prototype: Int32Array + fun id"of"(items: MutArray): Int32Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array - fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array - fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Uint32Array - fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Float32Array() { - fun valueOf(): Float32Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array +let Uint32Array: Uint32ArrayConstructor +trait Uint32ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + let prototype: Uint32Array + fun id"of"(items: MutArray): Uint32Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array - fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array - fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Float32Array - fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } -trait Float64Array() { - fun valueOf(): Float64Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array +let Float32Array: Float32ArrayConstructor +trait Float32ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + let prototype: Float32Array + fun id"of"(items: MutArray): Float32Array + let BYTES_PER_ELEMENT: number +} +let Float64Array: Float64ArrayConstructor +trait Float64ArrayConstructor() { + let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> + fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + let prototype: Float64Array + fun id"of"(items: MutArray): Float64Array let BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array - fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array - fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Float64Array - fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array - let byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - let length: number - fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number } module Intl { trait CollatorOptions() { @@ -691,2466 +550,1477 @@ module Intl { //│ ╔══[ERROR] Member toString is declared but not defined //│ ║ l.41: fun toString(): string //│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait PropertyDescriptor cannot be used as a type +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ThisType cannot be used as a type +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait PropertyDescriptorMap cannot be used as a type +//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ThisType cannot be used as a type +//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: __type +//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait Symbol cannot be used as a type +//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] trait PropertyDescriptor cannot be used as a type +//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Object cannot be used as a type +//│ ║ l.58: fun keys(o: object): MutArray +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: object +//│ ║ l.58: fun keys(o: object): MutArray +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.43: trait ObjectConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.44: let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.47: fun getPrototypeOf(o: anything): anything +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.49: let prototype: Object +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.50: fun isSealed(o: anything): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.52: fun preventExtensions(o: T): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.53: let create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.55: let __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.57: fun seal(o: T): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.58: fun keys(o: object): MutArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.60: } +//│ ╙── ^ +//│ ╔══[ERROR] Member getOwnPropertyNames is declared but not defined +//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isFrozen is declared but not defined +//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member getPrototypeOf is declared but not defined +//│ ║ l.47: fun getPrototypeOf(o: anything): anything +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member defineProperty is declared but not defined +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isSealed is declared but not defined +//│ ║ l.50: fun isSealed(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member defineProperties is declared but not defined +//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member preventExtensions is declared but not defined +//│ ║ l.52: fun preventExtensions(o: T): T +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member freeze is declared but not defined +//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member getOwnPropertyDescriptor is declared but not defined +//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member seal is declared but not defined +//│ ║ l.57: fun seal(o: T): T +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member keys is declared but not defined +//│ ║ l.58: fun keys(o: object): MutArray +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member isExtensible is declared but not defined +//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type -//│ ║ l.43: let Function: FunctionConstructor +//│ ║ l.61: let Function: FunctionConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.44: trait FunctionConstructor() { +//│ ║ l.62: trait FunctionConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.45: let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 291, 31> +//│ ║ l.63: let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.46: let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 296, 37> +//│ ║ l.64: let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.47: let prototype: Function +//│ ║ l.65: let prototype: Function //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.48: } +//│ ║ l.66: } //│ ╙── ^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.49: type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 306, 27> +//│ ║ l.67: type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.50: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 311, 27> +//│ ║ l.68: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.51: trait CallableFunction() extends Function { +//│ ║ l.69: trait CallableFunction() extends Function { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.52: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ +//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.53: fun call(thisArg: T, args: A): R +//│ ║ l.71: fun call(thisArg: T, args: A): R //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.54: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.55: } +//│ ║ l.73: } //│ ╙── ^ //│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.52: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ +//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ╙── ^^^^^ //│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.53: fun call(thisArg: T, args: A): R +//│ ║ l.71: fun call(thisArg: T, args: A): R //│ ╙── ^^^^ //│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.54: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.56: trait NewableFunction() extends Function { +//│ ║ l.74: trait NewableFunction() extends Function { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.57: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ +//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.58: fun call(thisArg: T, args: A): unit +//│ ║ l.76: fun call(thisArg: T, args: A): unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.59: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.60: } +//│ ║ l.78: } //│ ╙── ^ //│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.57: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ +//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ╙── ^^^^^ //│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.58: fun call(thisArg: T, args: A): unit +//│ ║ l.76: fun call(thisArg: T, args: A): unit //│ ╙── ^^^^ //│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.59: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.61: trait IArguments() { +//│ ║ l.79: trait IArguments() { //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.62: let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 373, 22> +//│ ║ l.80: let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.63: let length: number +//│ ║ l.81: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.64: let callee: Function +//│ ║ l.82: let callee: Function //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.65: } +//│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.515: trait CollatorOptions() { +//│ ║ l.374: trait CollatorOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.516: let sensitivity: (string) | (undefined) +//│ ║ l.375: let sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.517: let ignorePunctuation: ((false) | (true)) | (undefined) +//│ ║ l.376: let ignorePunctuation: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.518: let usage: (string) | (undefined) +//│ ║ l.377: let usage: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.519: let localeMatcher: (string) | (undefined) +//│ ║ l.378: let localeMatcher: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.520: let numeric: ((false) | (true)) | (undefined) +//│ ║ l.379: let numeric: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.521: let caseFirst: (string) | (undefined) +//│ ║ l.380: let caseFirst: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.522: } +//│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.523: trait ResolvedCollatorOptions() { +//│ ║ l.382: trait ResolvedCollatorOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.524: let sensitivity: string +//│ ║ l.383: let sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.525: let ignorePunctuation: (false) | (true) +//│ ║ l.384: let ignorePunctuation: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.526: let usage: string +//│ ║ l.385: let usage: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.527: let locale: string +//│ ║ l.386: let locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.528: let numeric: (false) | (true) +//│ ║ l.387: let numeric: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.529: let caseFirst: string +//│ ║ l.388: let caseFirst: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.530: let collation: string +//│ ║ l.389: let collation: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.531: } +//│ ║ l.390: } //│ ╙── ^^^ //│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.532: trait Collator() { +//│ ║ l.391: trait Collator() { //│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.533: fun compare(x: string, y: string): number +//│ ║ l.392: fun compare(x: string, y: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.535: } +//│ ║ l.394: } //│ ╙── ^^^ //│ ╔══[ERROR] Member compare is declared but not defined -//│ ║ l.533: fun compare(x: string, y: string): number +//│ ║ l.392: fun compare(x: string, y: string): number //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.534: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.536: trait NumberFormatOptions() { +//│ ║ l.395: trait NumberFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.537: let minimumSignificantDigits: (number) | (undefined) +//│ ║ l.396: let minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.538: let useGrouping: ((false) | (true)) | (undefined) +//│ ║ l.397: let useGrouping: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.539: let style: (string) | (undefined) +//│ ║ l.398: let style: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.540: let localeMatcher: (string) | (undefined) +//│ ║ l.399: let localeMatcher: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.541: let currency: (string) | (undefined) +//│ ║ l.400: let currency: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.542: let minimumIntegerDigits: (number) | (undefined) +//│ ║ l.401: let minimumIntegerDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.543: let maximumFractionDigits: (number) | (undefined) +//│ ║ l.402: let maximumFractionDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.544: let currencySign: (string) | (undefined) +//│ ║ l.403: let currencySign: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.545: let maximumSignificantDigits: (number) | (undefined) +//│ ║ l.404: let maximumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.546: let minimumFractionDigits: (number) | (undefined) +//│ ║ l.405: let minimumFractionDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.547: } +//│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.548: trait ResolvedNumberFormatOptions() { +//│ ║ l.407: trait ResolvedNumberFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.549: let numberingSystem: string +//│ ║ l.408: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.550: let minimumSignificantDigits: (number) | (undefined) +//│ ║ l.409: let minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.551: let useGrouping: (false) | (true) +//│ ║ l.410: let useGrouping: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.552: let style: string +//│ ║ l.411: let style: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.553: let locale: string +//│ ║ l.412: let locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.554: let currency: (string) | (undefined) +//│ ║ l.413: let currency: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.555: let minimumIntegerDigits: number +//│ ║ l.414: let minimumIntegerDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.556: let maximumFractionDigits: number +//│ ║ l.415: let maximumFractionDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.557: let maximumSignificantDigits: (number) | (undefined) +//│ ║ l.416: let maximumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.558: let minimumFractionDigits: number +//│ ║ l.417: let minimumFractionDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.559: } +//│ ║ l.418: } //│ ╙── ^^^ //│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.560: trait NumberFormat() { +//│ ║ l.419: trait NumberFormat() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.561: fun format(value: number): string +//│ ║ l.420: fun format(value: number): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.563: } +//│ ║ l.422: } //│ ╙── ^^^ //│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.561: fun format(value: number): string +//│ ║ l.420: fun format(value: number): string //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.562: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.564: trait DateTimeFormatOptions() { +//│ ║ l.423: trait DateTimeFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.565: let minute: ((string) | (string)) | (undefined) +//│ ║ l.424: let minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.566: let year: ((string) | (string)) | (undefined) +//│ ║ l.425: let year: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.567: let hour: ((string) | (string)) | (undefined) +//│ ║ l.426: let hour: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.568: let hour12: ((false) | (true)) | (undefined) +//│ ║ l.427: let hour12: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.569: let weekday: (((string) | (string)) | (string)) | (undefined) +//│ ║ l.428: let weekday: (((string) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.570: let formatMatcher: ((string) | (string)) | (undefined) +//│ ║ l.429: let formatMatcher: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.571: let day: ((string) | (string)) | (undefined) +//│ ║ l.430: let day: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.572: let timeZone: (string) | (undefined) +//│ ║ l.431: let timeZone: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.573: let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ l.432: let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.574: let second: ((string) | (string)) | (undefined) +//│ ║ l.433: let second: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.575: let localeMatcher: ((string) | (string)) | (undefined) +//│ ║ l.434: let localeMatcher: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.576: let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ l.435: let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.577: let era: (((string) | (string)) | (string)) | (undefined) +//│ ║ l.436: let era: (((string) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.578: } +//│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.579: trait ResolvedDateTimeFormatOptions() { +//│ ║ l.438: trait ResolvedDateTimeFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.580: let numberingSystem: string +//│ ║ l.439: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.581: let minute: (string) | (undefined) +//│ ║ l.440: let minute: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.582: let year: (string) | (undefined) +//│ ║ l.441: let year: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.583: let hour: (string) | (undefined) +//│ ║ l.442: let hour: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.584: let second: (string) | (undefined) +//│ ║ l.443: let second: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.585: let hour12: ((false) | (true)) | (undefined) +//│ ║ l.444: let hour12: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.586: let weekday: (string) | (undefined) +//│ ║ l.445: let weekday: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.587: let day: (string) | (undefined) +//│ ║ l.446: let day: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.588: let timeZone: string +//│ ║ l.447: let timeZone: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.589: let month: (string) | (undefined) +//│ ║ l.448: let month: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.590: let locale: string +//│ ║ l.449: let locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.591: let calendar: string +//│ ║ l.450: let calendar: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.592: let timeZoneName: (string) | (undefined) +//│ ║ l.451: let timeZoneName: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.593: let era: (string) | (undefined) +//│ ║ l.452: let era: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.594: } +//│ ║ l.453: } //│ ╙── ^^^ //│ ╔══[ERROR] trait Date cannot be used as a type -//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ╙── ^^^^^^ //│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.595: trait DateTimeFormat() { +//│ ║ l.454: trait DateTimeFormat() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.598: } +//│ ║ l.457: } //│ ╙── ^^^ //│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.596: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.597: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.66: trait String() { +//│ ║ l.84: trait String() { //│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.67: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.68: } +//│ ║ l.86: } //│ ╙── ^ //│ ╔══[ERROR] Member localeCompare is declared but not defined -//│ ║ l.67: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.69: trait StringConstructor() { +//│ ║ l.87: trait StringConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.70: let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 503, 29> +//│ ║ l.88: let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.71: let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> +//│ ║ l.89: let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.72: let prototype: String +//│ ║ l.90: let prototype: String //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.73: fun fromCharCode(codes: MutArray): string +//│ ║ l.91: fun fromCharCode(codes: MutArray): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.74: } +//│ ║ l.92: } //│ ╙── ^ //│ ╔══[ERROR] Member fromCharCode is declared but not defined -//│ ║ l.73: fun fromCharCode(codes: MutArray): string +//│ ║ l.91: fun fromCharCode(codes: MutArray): string //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type -//│ ║ l.75: let Boolean: BooleanConstructor +//│ ║ l.93: let Boolean: BooleanConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.76: trait BooleanConstructor() { +//│ ║ l.94: trait BooleanConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.77: let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 520, 30> +//│ ║ l.95: let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.78: let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> +//│ ║ l.96: let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.79: let prototype: Boolean +//│ ║ l.97: let prototype: Boolean //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.80: } +//│ ║ l.98: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.81: trait Number() { +//│ ║ l.99: trait Number() { //│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.82: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.83: } -//│ ╙── ^ +//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.101: } +//│ ╙── ^ //│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.82: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^ +//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.84: trait NumberConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.85: let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.86: let NaN: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.87: let MIN_VALUE: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.88: let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 557, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.89: let NEGATIVE_INFINITY: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.90: let POSITIVE_INFINITY: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.91: let MAX_VALUE: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.92: let prototype: Number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.93: } -//│ ╙── ^ +//│ ║ l.102: trait NumberConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.103: let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.104: let NaN: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.105: let MIN_VALUE: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.106: let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.107: let NEGATIVE_INFINITY: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.108: let POSITIVE_INFINITY: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.109: let MAX_VALUE: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.110: let prototype: Number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.111: } +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: trait TemplateStringsArray() extends ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.95: let raw: ReadonlyArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.96: } -//│ ╙── ^ +//│ ║ l.112: trait TemplateStringsArray() extends ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.113: let raw: ReadonlyArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.114: } +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.97: trait ImportMeta() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.115: trait ImportMeta() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.98: trait ImportCallOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.99: let assert: (ImportAssertions) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.100: } +//│ ║ l.116: trait ImportCallOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.117: let assert: (ImportAssertions) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.118: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.101: trait ImportAssertions() { +//│ ║ l.119: trait ImportAssertions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.102: let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 616, 28> +//│ ║ l.120: let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.103: } +//│ ║ l.121: } //│ ╙── ^ //│ ╔══[ERROR] function Math cannot be used as a type -//│ ║ l.104: let Math: Math +//│ ║ l.122: let Math: Math //│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: Math -//│ ║ l.104: let Math: Math +//│ ║ l.122: let Math: Math //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.105: trait Date() { +//│ ║ l.123: trait Date() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.106: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.107: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.108: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.109: } +//│ ║ l.127: } //│ ╙── ^ //│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.106: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] Member toLocaleDateString is declared but not defined -//│ ║ l.107: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Member toLocaleTimeString is declared but not defined -//│ ║ l.108: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.110: trait DateConstructor() { +//│ ║ l.128: trait DateConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.111: let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 898, 128> +//│ ║ l.129: let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.112: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number +//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.113: let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 887, 38> +//│ ║ l.131: let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.114: fun now(): number +//│ ║ l.132: fun now(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.115: fun parse(s: string): number +//│ ║ l.133: fun parse(s: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.116: let prototype: Date +//│ ║ l.134: let prototype: Date //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.117: } +//│ ║ l.135: } //│ ╙── ^ //│ ╔══[ERROR] Member UTC is declared but not defined -//│ ║ l.112: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number +//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number //│ ╙── ^^^ //│ ╔══[ERROR] Member now is declared but not defined -//│ ║ l.114: fun now(): number +//│ ║ l.132: fun now(): number //│ ╙── ^^^ //│ ╔══[ERROR] Member parse is declared but not defined -//│ ║ l.115: fun parse(s: string): number +//│ ║ l.133: fun parse(s: string): number //│ ╙── ^^^^^ -//│ ╔══[ERROR] type identifier not found: RegExpConstructor -//│ ║ l.118: let RegExp: RegExpConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait RegExp cannot be used as a type +//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: RegExpExecArray +//│ ║ l.144: fun exec(string: string): RegExpExecArray +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.136: trait RegExp() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.137: fun test(string: string): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.138: let multiline: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.139: let source: string +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.141: let global: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.142: let lastIndex: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.143: let ignoreCase: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.144: fun exec(string: string): RegExpExecArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.145: } +//│ ╙── ^ +//│ ╔══[ERROR] Member test is declared but not defined +//│ ║ l.137: fun test(string: string): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member compile is declared but not defined +//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member exec is declared but not defined +//│ ║ l.144: fun exec(string: string): RegExpExecArray +//│ ╙── ^^^^ //│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type -//│ ║ l.119: let Error: ErrorConstructor +//│ ║ l.146: let Error: ErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.120: trait ErrorConstructor() { +//│ ║ l.147: trait ErrorConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.121: let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1042, 28> +//│ ║ l.148: let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.122: let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1043, 33> +//│ ║ l.149: let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.123: let prototype: Error +//│ ║ l.150: let prototype: Error //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.124: } +//│ ║ l.151: } //│ ╙── ^ //│ ╔══[ERROR] trait EvalErrorConstructor cannot be used as a type -//│ ║ l.125: let EvalError: EvalErrorConstructor +//│ ║ l.152: let EvalError: EvalErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.126: trait EvalErrorConstructor() extends ErrorConstructor { +//│ ║ l.153: trait EvalErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.127: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1053, 57> +//│ ║ l.154: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.128: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1054, 37> +//│ ║ l.155: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.129: let prototype: EvalError +//│ ║ l.156: let prototype: EvalError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.130: } +//│ ║ l.157: } //│ ╙── ^ //│ ╔══[ERROR] trait RangeErrorConstructor cannot be used as a type -//│ ║ l.131: let RangeError: RangeErrorConstructor +//│ ║ l.158: let RangeError: RangeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.132: trait RangeErrorConstructor() extends ErrorConstructor { +//│ ║ l.159: trait RangeErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.133: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1064, 58> +//│ ║ l.160: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.134: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1065, 38> +//│ ║ l.161: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.135: let prototype: RangeError +//│ ║ l.162: let prototype: RangeError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.136: } +//│ ║ l.163: } //│ ╙── ^ //│ ╔══[ERROR] trait ReferenceErrorConstructor cannot be used as a type -//│ ║ l.137: let ReferenceError: ReferenceErrorConstructor +//│ ║ l.164: let ReferenceError: ReferenceErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.138: trait ReferenceErrorConstructor() extends ErrorConstructor { +//│ ║ l.165: trait ReferenceErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.139: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1075, 62> +//│ ║ l.166: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.140: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1076, 42> +//│ ║ l.167: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.141: let prototype: ReferenceError +//│ ║ l.168: let prototype: ReferenceError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.142: } +//│ ║ l.169: } //│ ╙── ^ //│ ╔══[ERROR] trait SyntaxErrorConstructor cannot be used as a type -//│ ║ l.143: let SyntaxError: SyntaxErrorConstructor +//│ ║ l.170: let SyntaxError: SyntaxErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.144: trait SyntaxErrorConstructor() extends ErrorConstructor { +//│ ║ l.171: trait SyntaxErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.145: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1086, 59> +//│ ║ l.172: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.146: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1087, 39> +//│ ║ l.173: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.147: let prototype: SyntaxError +//│ ║ l.174: let prototype: SyntaxError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.148: } +//│ ║ l.175: } //│ ╙── ^ //│ ╔══[ERROR] trait TypeErrorConstructor cannot be used as a type -//│ ║ l.149: let TypeError: TypeErrorConstructor +//│ ║ l.176: let TypeError: TypeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.150: trait TypeErrorConstructor() extends ErrorConstructor { +//│ ║ l.177: trait TypeErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.151: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1097, 57> +//│ ║ l.178: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.152: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1098, 37> +//│ ║ l.179: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.153: let prototype: TypeError +//│ ║ l.180: let prototype: TypeError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.154: } +//│ ║ l.181: } //│ ╙── ^ //│ ╔══[ERROR] trait URIErrorConstructor cannot be used as a type -//│ ║ l.155: let URIError: URIErrorConstructor +//│ ║ l.182: let URIError: URIErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.156: trait URIErrorConstructor() extends ErrorConstructor { +//│ ║ l.183: trait URIErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.157: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1108, 56> +//│ ║ l.184: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.158: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1109, 36> +//│ ║ l.185: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.159: let prototype: URIError +//│ ║ l.186: let prototype: URIError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.160: } +//│ ║ l.187: } //│ ╙── ^ //│ ╔══[ERROR] function JSON cannot be used as a type -//│ ║ l.161: let JSON: JSON +//│ ║ l.188: let JSON: JSON //│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: JSON -//│ ║ l.161: let JSON: JSON +//│ ║ l.188: let JSON: JSON //│ ╙── ^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.162: trait ReadonlyArray() { +//│ ║ l.189: trait ReadonlyArray() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.163: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.167: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1272, 136> +//│ ║ l.194: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.169: fun join(separator: (string) | (undefined)): string +//│ ║ l.196: fun join(separator: (string) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.171: let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) +//│ ║ l.198: let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.172: fun toLocaleString(): string +//│ ║ l.199: fun toLocaleString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.173: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.175: fun toString(): string +//│ ║ l.202: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.176: let length: number +//│ ║ l.203: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.178: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.179: } +//│ ║ l.206: } //│ ╙── ^ //│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.163: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.164: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ //│ ╙── ^^^^^ //│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.165: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.166: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.168: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.169: fun join(separator: (string) | (undefined)): string +//│ ║ l.196: fun join(separator: (string) | (undefined)): string //│ ╙── ^^^^ //│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.170: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray //│ ╙── ^^^ //│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.172: fun toLocaleString(): string +//│ ║ l.199: fun toLocaleString(): string //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.173: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray //│ ╙── ^^^^^ //│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.174: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.175: fun toString(): string +//│ ║ l.202: fun toString(): string //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.177: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^ //│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.178: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.180: trait ConcatArray() { +//│ ║ l.207: trait ConcatArray() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.181: let length: number +//│ ║ l.208: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.182: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1278, 28> +//│ ║ l.209: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.183: fun join(separator: (string) | (undefined)): string +//│ ║ l.210: fun join(separator: (string) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.184: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.185: } +//│ ║ l.212: } //│ ╙── ^ //│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.183: fun join(separator: (string) | (undefined)): string +//│ ║ l.210: fun join(separator: (string) | (undefined)): string //│ ╙── ^^^^ //│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.184: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray //│ ╙── ^^^^^ //│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type -//│ ║ l.186: let Array: ArrayConstructor +//│ ║ l.213: let Array: ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.187: trait ArrayConstructor() { +//│ ║ l.214: trait ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.188: let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1470, 38> +//│ ║ l.215: let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.189: let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1473, 34> +//│ ║ l.216: let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.190: fun isArray(arg: anything): (false) | (true) +//│ ║ l.217: fun isArray(arg: anything): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.191: let prototype: MutArray +//│ ║ l.218: let prototype: MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.192: } +//│ ║ l.219: } //│ ╙── ^ //│ ╔══[ERROR] Member isArray is declared but not defined -//│ ║ l.190: fun isArray(arg: anything): (false) | (true) +//│ ║ l.217: fun isArray(arg: anything): (false) | (true) //│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.193: trait TypedPropertyDescriptor() { +//│ ║ l.220: trait TypedPropertyDescriptor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.194: let configurable: ((false) | (true)) | (undefined) +//│ ║ l.221: let configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.195: let set: ((T) => unit) | (undefined) +//│ ║ l.222: let set: ((T) => unit) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.196: let enumerable: ((false) | (true)) | (undefined) +//│ ║ l.223: let enumerable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.197: let get: (unit => T) | (undefined) +//│ ║ l.224: let get: (unit => T) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.198: let writable: ((false) | (true)) | (undefined) +//│ ║ l.225: let writable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.199: let value: (T) | (undefined) +//│ ║ l.226: let value: (T) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.200: } +//│ ║ l.227: } //│ ╙── ^ //│ ╔══[ERROR] type identifier not found: T -//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike //│ ╙── ^^^ //│ ╔══[ERROR] type identifier not found: PromiseLike -//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: PromiseLike -//│ ║ l.201: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike +//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.202: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1525, 17> +//│ ║ l.229: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.203: trait ArrayLike() { +//│ ║ l.230: trait ArrayLike() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.204: let length: number +//│ ║ l.231: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.205: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1534, 28> +//│ ║ l.232: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.206: } +//│ ║ l.233: } //│ ╙── ^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.207: type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1541, 17> +//│ ║ l.234: type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.208: type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1548, 18> +//│ ║ l.235: type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.209: type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1555, 18> +//│ ║ l.236: type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.210: type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1562, 33> +//│ ║ l.237: type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.211: type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1569, 37> +//│ ║ l.238: type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.212: type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1576, 20> +//│ ║ l.239: type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.213: type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1581, 20> +//│ ║ l.240: type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: __type -//│ ║ l.214: type Omit = __type +//│ ║ l.241: type Omit = __type //│ ╙── ^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.216: type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1596, 50> +//│ ║ l.243: type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.217: type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1601, 74> +//│ ║ l.244: type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.218: type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1606, 50> +//│ ║ l.245: type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.219: type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1611, 65> +//│ ║ l.246: type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.220: type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1616, 34> +//│ ║ l.247: type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.221: type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1621, 34> +//│ ║ l.248: type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.222: type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1626, 35> +//│ ║ l.249: type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.223: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1631, 37> +//│ ║ l.250: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.224: trait ThisType() {} +//│ ║ l.251: trait ThisType() {} //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type -//│ ║ l.225: let ArrayBuffer: ArrayBufferConstructor +//│ ║ l.252: let ArrayBuffer: ArrayBufferConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.226: trait ArrayBufferTypes() { +//│ ║ l.253: trait ArrayBufferTypes() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.227: let ArrayBuffer: ArrayBuffer +//│ ║ l.254: let ArrayBuffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.228: } +//│ ║ l.255: } //│ ╙── ^ //│ ╔══[ERROR] function ArrayBuffer cannot be used as a type -//│ ║ l.229: type ArrayBufferLike = ArrayBuffer +//│ ║ l.256: type ArrayBufferLike = ArrayBuffer //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: ArrayBuffer -//│ ║ l.229: type ArrayBufferLike = ArrayBuffer +//│ ║ l.256: type ArrayBufferLike = ArrayBuffer //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.230: trait ArrayBufferConstructor() { +//│ ║ l.257: trait ArrayBufferConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.231: let prototype: ArrayBuffer +//│ ║ l.258: let prototype: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.232: let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1665, 36> +//│ ║ l.259: let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.233: fun isView(arg: anything): (false) | (true) +//│ ║ l.260: fun isView(arg: anything): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.234: } +//│ ║ l.261: } //│ ╙── ^ //│ ╔══[ERROR] Member isView is declared but not defined -//│ ║ l.233: fun isView(arg: anything): (false) | (true) +//│ ║ l.260: fun isView(arg: anything): (false) | (true) //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.235: trait ArrayBufferView() { +//│ ║ l.262: trait ArrayBufferView() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.236: let buffer: ArrayBuffer +//│ ║ l.263: let buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.237: let byteLength: number +//│ ║ l.264: let byteLength: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.238: let byteOffset: number +//│ ║ l.265: let byteOffset: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.239: } +//│ ║ l.266: } //│ ╙── ^ //│ ╔══[ERROR] trait DataViewConstructor cannot be used as a type -//│ ║ l.240: let DataView: DataViewConstructor +//│ ║ l.267: let DataView: DataViewConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.241: trait DataViewConstructor() { +//│ ║ l.268: trait DataViewConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.242: let prototype: DataView +//│ ║ l.269: let prototype: DataView //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.243: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1817, 33> +//│ ║ l.270: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.244: } +//│ ║ l.271: } //│ ╙── ^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.246: fun valueOf(): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int8ArrayConstructor cannot be used as a type +//│ ║ l.272: let Int8Array: Int8ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.264: fun reverse(): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Int8Array cannot be used as a type +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int8Array cannot be used as a type -//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int8Array +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] function Int8Array cannot be used as a type +//│ ║ l.277: fun id"of"(items: MutArray): Int8Array +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int8Array +//│ ║ l.277: fun id"of"(items: MutArray): Int8Array +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.245: trait Int8Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.246: fun valueOf(): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.247: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.250: fun toLocaleString(): string +//│ ║ l.273: trait Int8ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.251: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2065, 25> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.255: let BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.259: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.262: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.264: fun reverse(): Int8Array +//│ ║ l.274: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.276: let prototype: Int8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.267: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.269: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.270: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.272: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.273: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.274: } +//│ ║ l.277: fun id"of"(items: MutArray): Int8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.278: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.279: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.246: fun valueOf(): Int8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.247: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.248: fun every(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.249: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.250: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.252: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.253: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.254: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.256: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.257: fun find(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.258: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.259: fun join(separator: (string) | (undefined)): string +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.260: fun map(callbackfn: (number) => (number) => (Int8Array) => number, thisArg: (anything) | (undefined)): Int8Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.261: fun forEach(callbackfn: (number) => (number) => (Int8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.263: fun findIndex(predicate: (number) => (number) => (Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.264: fun reverse(): Int8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.265: fun filter(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.266: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int8Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.268: fun reduce(callbackfn: (U) => (number) => (number) => (Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.277: fun id"of"(items: MutArray): Int8Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.269: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.271: fun some(predicate: (number) => (number) => (Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.272: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.276: fun valueOf(): Uint8Array +//│ ║ l.281: fun valueOf(): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit //│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.294: fun reverse(): Uint8Array +//│ ║ l.299: fun reverse(): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.275: trait Uint8Array() { +//│ ║ l.280: trait Uint8Array() { //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.276: fun valueOf(): Uint8Array +//│ ║ l.281: fun valueOf(): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.277: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.280: fun toLocaleString(): string +//│ ║ l.285: fun toLocaleString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.281: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2347, 26> +//│ ║ l.286: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.285: let BYTES_PER_ELEMENT: number +//│ ║ l.290: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.289: fun join(separator: (string) | (undefined)): string +//│ ║ l.294: fun join(separator: (string) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.292: let buffer: ArrayBuffer +//│ ║ l.297: let buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.294: fun reverse(): Uint8Array +//│ ║ l.299: fun reverse(): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.297: let byteLength: number +//│ ║ l.302: let byteLength: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.299: fun toString(): string +//│ ║ l.304: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.300: let length: number +//│ ║ l.305: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.302: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.303: let byteOffset: number +//│ ║ l.308: let byteOffset: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.304: } +//│ ║ l.309: } //│ ╙── ^ //│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.276: fun valueOf(): Uint8Array +//│ ║ l.281: fun valueOf(): Uint8Array //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.277: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.278: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^ //│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.279: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit //│ ╙── ^^^ //│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.280: fun toLocaleString(): string +//│ ║ l.285: fun toLocaleString(): string //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.282: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.283: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^ //│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.284: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array //│ ╙── ^^^^ //│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.286: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.287: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ╙── ^^^^ //│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.288: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.289: fun join(separator: (string) | (undefined)): string +//│ ║ l.294: fun join(separator: (string) | (undefined)): string //│ ╙── ^^^^ //│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.290: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^ //│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.291: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.293: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.294: fun reverse(): Uint8Array +//│ ║ l.299: fun reverse(): Uint8Array //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.295: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.296: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ╙── ^^^^^ //│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.298: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ╙── ^^^^^^ //│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.299: fun toString(): string +//│ ║ l.304: fun toString(): string //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.301: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^ //│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.302: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number //│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.306: fun valueOf(): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.324: fun reverse(): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArray cannot be used as a type -//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint8Array cannot be used as a type +//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.305: trait Uint8ClampedArray() { +//│ ║ l.310: trait Uint8ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.311: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.313: let prototype: Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.306: fun valueOf(): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.307: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.310: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.311: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2630, 33> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.315: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.319: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.322: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.324: fun reverse(): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.327: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.329: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.330: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.332: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.333: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.334: } +//│ ║ l.316: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.306: fun valueOf(): Uint8ClampedArray -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.307: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.308: fun every(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.309: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.310: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.312: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.313: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.314: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8ClampedArray +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] trait Uint8ClampedArrayConstructor cannot be used as a type +//│ ║ l.317: let Uint8ClampedArray: Uint8ClampedArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait ArrayLike cannot be used as a type +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint8ClampedArray cannot be used as a type +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint8ClampedArray +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint8ClampedArray cannot be used as a type +//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint8ClampedArray +//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.318: trait Uint8ClampedArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.319: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.321: let prototype: Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.323: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.324: } +//│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.316: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.317: fun find(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.318: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.319: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.320: fun map(callbackfn: (number) => (number) => (Uint8ClampedArray) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.321: fun forEach(callbackfn: (number) => (number) => (Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.323: fun findIndex(predicate: (number) => (number) => (Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.324: fun reverse(): Uint8ClampedArray -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.325: fun filter(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.326: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8ClampedArray -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.328: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.329: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.331: fun some(predicate: (number) => (number) => (Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.332: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.336: fun valueOf(): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int16ArrayConstructor cannot be used as a type +//│ ║ l.325: let Int16Array: Int16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.354: fun reverse(): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int16Array cannot be used as a type -//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Int16Array cannot be used as a type +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int16Array +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] function Int16Array cannot be used as a type +//│ ║ l.330: fun id"of"(items: MutArray): Int16Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int16Array +//│ ║ l.330: fun id"of"(items: MutArray): Int16Array +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.335: trait Int16Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.336: fun valueOf(): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.337: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.340: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.341: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2910, 26> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.345: let BYTES_PER_ELEMENT: number +//│ ║ l.326: trait Int16ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.349: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.352: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.354: fun reverse(): Int16Array +//│ ║ l.327: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.329: let prototype: Int16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.357: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.359: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.360: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.362: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.363: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.364: } +//│ ║ l.330: fun id"of"(items: MutArray): Int16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.331: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.332: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.336: fun valueOf(): Int16Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.337: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.338: fun every(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.339: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.340: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.342: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.343: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.344: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int16Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.346: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.347: fun find(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.348: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.349: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.350: fun map(callbackfn: (number) => (number) => (Int16Array) => number, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.351: fun forEach(callbackfn: (number) => (number) => (Int16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.353: fun findIndex(predicate: (number) => (number) => (Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.354: fun reverse(): Int16Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.355: fun filter(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.356: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int16Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.358: fun reduce(callbackfn: (U) => (number) => (number) => (Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.330: fun id"of"(items: MutArray): Int16Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.359: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.361: fun some(predicate: (number) => (number) => (Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.362: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.366: fun valueOf(): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint16ArrayConstructor cannot be used as a type +//│ ║ l.333: let Uint16Array: Uint16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.384: fun reverse(): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint16Array cannot be used as a type -//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint16Array cannot be used as a type +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint16Array +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint16Array cannot be used as a type +//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint16Array +//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.365: trait Uint16Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.366: fun valueOf(): Uint16Array +//│ ║ l.334: trait Uint16ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.335: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.337: let prototype: Uint16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.367: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.370: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.371: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3193, 27> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.375: let BYTES_PER_ELEMENT: number +//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.339: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.379: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.382: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.384: fun reverse(): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.387: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.389: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.390: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.392: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.393: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.394: } +//│ ║ l.340: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.366: fun valueOf(): Uint16Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.367: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.368: fun every(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.369: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.370: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.372: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.373: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.374: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint16Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.376: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.377: fun find(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.378: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.379: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.380: fun map(callbackfn: (number) => (number) => (Uint16Array) => number, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.381: fun forEach(callbackfn: (number) => (number) => (Uint16Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.383: fun findIndex(predicate: (number) => (number) => (Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.384: fun reverse(): Uint16Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.385: fun filter(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.386: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint16Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.388: fun reduce(callbackfn: (U) => (number) => (number) => (Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.389: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.391: fun some(predicate: (number) => (number) => (Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.392: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.396: fun valueOf(): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Int32ArrayConstructor cannot be used as a type +//│ ║ l.341: let Int32Array: Int32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.414: fun reverse(): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Int32Array cannot be used as a type -//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Int32Array cannot be used as a type +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int32Array +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] function Int32Array cannot be used as a type +//│ ║ l.346: fun id"of"(items: MutArray): Int32Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Int32Array +//│ ║ l.346: fun id"of"(items: MutArray): Int32Array +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: trait Int32Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.396: fun valueOf(): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.397: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.400: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.401: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3475, 26> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.405: let BYTES_PER_ELEMENT: number +//│ ║ l.342: trait Int32ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.409: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.412: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.414: fun reverse(): Int32Array +//│ ║ l.343: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.345: let prototype: Int32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.417: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.419: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.420: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.422: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.423: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.424: } +//│ ║ l.346: fun id"of"(items: MutArray): Int32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.347: let BYTES_PER_ELEMENT: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.348: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.396: fun valueOf(): Int32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.397: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.398: fun every(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.399: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.400: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.402: fun reduceRight(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.403: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.404: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Int32Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.406: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.407: fun find(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.408: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.409: fun join(separator: (string) | (undefined)): string +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.410: fun map(callbackfn: (number) => (number) => (Int32Array) => number, thisArg: (anything) | (undefined)): Int32Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.411: fun forEach(callbackfn: (number) => (number) => (Int32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.413: fun findIndex(predicate: (number) => (number) => (Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.414: fun reverse(): Int32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.415: fun filter(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.346: fun id"of"(items: MutArray): Int32Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.416: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Int32Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.418: fun reduce(callbackfn: (U) => (number) => (number) => (Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.419: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.421: fun some(predicate: (number) => (number) => (Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.422: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.426: fun valueOf(): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Uint32ArrayConstructor cannot be used as a type +//│ ║ l.349: let Uint32Array: Uint32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.444: fun reverse(): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint32Array cannot be used as a type -//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint32Array cannot be used as a type +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint32Array +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] function Uint32Array cannot be used as a type +//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Uint32Array +//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.425: trait Uint32Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.426: fun valueOf(): Uint32Array +//│ ║ l.350: trait Uint32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.351: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.353: let prototype: Uint32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.427: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.430: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.431: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3756, 27> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.435: let BYTES_PER_ELEMENT: number +//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.355: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.439: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.442: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.444: fun reverse(): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.447: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.449: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.450: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.452: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.453: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.454: } +//│ ║ l.356: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.426: fun valueOf(): Uint32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.427: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.428: fun every(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.429: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.430: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.432: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.433: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.434: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint32Array +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.436: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.437: fun find(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.438: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.439: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.440: fun map(callbackfn: (number) => (number) => (Uint32Array) => number, thisArg: (anything) | (undefined)): Uint32Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.441: fun forEach(callbackfn: (number) => (number) => (Uint32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.443: fun findIndex(predicate: (number) => (number) => (Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.444: fun reverse(): Uint32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.445: fun filter(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.446: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint32Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.448: fun reduce(callbackfn: (U) => (number) => (number) => (Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.449: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.451: fun some(predicate: (number) => (number) => (Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.452: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.456: fun valueOf(): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float32ArrayConstructor cannot be used as a type +//│ ║ l.357: let Float32Array: Float32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.474: fun reverse(): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float32Array cannot be used as a type -//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Float32Array cannot be used as a type +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Float32Array +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Float32Array cannot be used as a type +//│ ║ l.362: fun id"of"(items: MutArray): Float32Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Float32Array +//│ ║ l.362: fun id"of"(items: MutArray): Float32Array +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.455: trait Float32Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.456: fun valueOf(): Float32Array +//│ ║ l.358: trait Float32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.359: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.361: let prototype: Float32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.457: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.460: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.461: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4038, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.465: let BYTES_PER_ELEMENT: number +//│ ║ l.362: fun id"of"(items: MutArray): Float32Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.363: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.469: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.472: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.474: fun reverse(): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.477: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.479: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.480: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.482: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.483: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.484: } +//│ ║ l.364: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.456: fun valueOf(): Float32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.457: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.458: fun every(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.459: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.460: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.462: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.463: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.464: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float32Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.466: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.467: fun find(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.468: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.469: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.470: fun map(callbackfn: (number) => (number) => (Float32Array) => number, thisArg: (anything) | (undefined)): Float32Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.471: fun forEach(callbackfn: (number) => (number) => (Float32Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.473: fun findIndex(predicate: (number) => (number) => (Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.474: fun reverse(): Float32Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.475: fun filter(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.362: fun id"of"(items: MutArray): Float32Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.476: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float32Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.478: fun reduce(callbackfn: (U) => (number) => (number) => (Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.479: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.481: fun some(predicate: (number) => (number) => (Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.482: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.486: fun valueOf(): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] trait Float64ArrayConstructor cannot be used as a type +//│ ║ l.365: let Float64Array: Float64ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.503: fun reverse(): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Float64Array cannot be used as a type -//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Float64Array cannot be used as a type +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Float64Array +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] function Float64Array cannot be used as a type +//│ ║ l.370: fun id"of"(items: MutArray): Float64Array +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Float64Array +//│ ║ l.370: fun id"of"(items: MutArray): Float64Array +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.485: trait Float64Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.486: fun valueOf(): Float64Array +//│ ║ l.366: trait Float64ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.367: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.369: let prototype: Float64Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.487: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.490: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4312, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.494: let BYTES_PER_ELEMENT: number +//│ ║ l.370: fun id"of"(items: MutArray): Float64Array +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.371: let BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.498: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.501: let buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.503: fun reverse(): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.506: let byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.508: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.509: let length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.511: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.512: let byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.513: } +//│ ║ l.372: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.486: fun valueOf(): Float64Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.487: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.488: fun every(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.489: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.491: fun reduceRight(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.492: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.493: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Float64Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.495: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.496: fun find(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.497: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.498: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.499: fun map(callbackfn: (number) => (number) => (Float64Array) => number, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.500: fun forEach(callbackfn: (number) => (number) => (Float64Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.502: fun findIndex(predicate: (number) => (number) => (Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.503: fun reverse(): Float64Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.504: fun filter(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.505: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Float64Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.507: fun reduce(callbackfn: (U) => (number) => (number) => (Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.370: fun id"of"(items: MutArray): Float64Array //│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.508: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.510: fun some(predicate: (number) => (number) => (Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.511: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ //│ let NaN: number //│ let Infinity: number //│ fun eval: (x: string,) -> anything @@ -3169,6 +2039,7 @@ module Intl { //│ trait PropertyDescriptor() //│ trait PropertyDescriptorMap() //│ trait Object() +//│ trait ObjectConstructor() //│ let Function: FunctionConstructor //│ trait FunctionConstructor() //│ type ThisParameterType[T] = error @@ -3189,7 +2060,7 @@ module Intl { //│ let Math: error //│ trait Date() //│ trait DateConstructor() -//│ let RegExp: error +//│ trait RegExp() //│ let Error: ErrorConstructor //│ trait ErrorConstructor() //│ let EvalError: EvalErrorConstructor @@ -3238,15 +2109,24 @@ module Intl { //│ trait ArrayBufferView() //│ let DataView: DataViewConstructor //│ trait DataViewConstructor() -//│ trait Int8Array() +//│ let Int8Array: Int8ArrayConstructor +//│ trait Int8ArrayConstructor() //│ trait Uint8Array() -//│ trait Uint8ClampedArray() -//│ trait Int16Array() -//│ trait Uint16Array() -//│ trait Int32Array() -//│ trait Uint32Array() -//│ trait Float32Array() -//│ trait Float64Array() +//│ trait Uint8ArrayConstructor() +//│ let Uint8ClampedArray: Uint8ClampedArrayConstructor +//│ trait Uint8ClampedArrayConstructor() +//│ let Int16Array: Int16ArrayConstructor +//│ trait Int16ArrayConstructor() +//│ let Uint16Array: Uint16ArrayConstructor +//│ trait Uint16ArrayConstructor() +//│ let Int32Array: Int32ArrayConstructor +//│ trait Int32ArrayConstructor() +//│ let Uint32Array: Uint32ArrayConstructor +//│ trait Uint32ArrayConstructor() +//│ let Float32Array: Float32ArrayConstructor +//│ trait Float32ArrayConstructor() +//│ let Float64Array: Float64ArrayConstructor +//│ trait Float64ArrayConstructor() //│ module Intl() { //│ trait Collator() //│ trait CollatorOptions() diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 5d5ce9d71..e2023e7fc 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -134,121 +134,122 @@ interface Object { propertyIsEnumerable(v: PropertyKey): boolean; } -// interface ObjectConstructor { -// new(value?: any): Object; -// (): any; -// (value: any): any; +interface ObjectConstructor { + new(value?: any): Object; + (): any; + (value: any): any; -// /** A reference to the prototype for a class of objects. */ -// readonly prototype: Object; + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; -// /** -// * Returns the prototype of an object. -// * @param o The object that references the prototype. -// */ -// getPrototypeOf(o: any): any; + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; -// /** -// * Gets the own property descriptor of the specified object. -// * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. -// * @param o Object that contains the property. -// * @param p Name of the property. -// */ -// getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; -// /** -// * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly -// * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. -// * @param o Object that contains the own properties. -// */ -// getOwnPropertyNames(o: any): string[]; + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; -// /** -// * Creates an object that has the specified prototype or that has null prototype. -// * @param o Object to use as a prototype. May be null. -// */ -// create(o: object | null): any; + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; -// /** -// * Creates an object that has the specified prototype, and that optionally contains specified properties. -// * @param o Object to use as a prototype. May be null -// * @param properties JavaScript object that contains one or more property descriptors. -// */ -// create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; -// /** -// * Adds a property to an object, or modifies attributes of an existing property. -// * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. -// * @param p The property name. -// * @param attributes Descriptor for the property. It can be for a data property or an accessor property. -// */ -// defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; -// /** -// * Adds one or more properties to an object, and/or modifies attributes of existing properties. -// * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. -// * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. -// */ -// defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; -// /** -// * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// seal(o: T): T; + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param f Object on which to lock the attributes. -// */ -// freeze(f: T): T; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param f Object on which to lock the attributes. + */ + freeze(f: T): T; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// freeze(o: T): Readonly; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// freeze(o: T): Readonly; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): Readonly; -// /** -// * Prevents the addition of new properties to an object. -// * @param o Object to make non-extensible. -// */ -// preventExtensions(o: T): T; + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; -// /** -// * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. -// * @param o Object to test. -// */ -// isSealed(o: any): boolean; + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; -// /** -// * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. -// * @param o Object to test. -// */ -// isFrozen(o: any): boolean; + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; -// /** -// * Returns a value that indicates whether new properties can be added to an object. -// * @param o Object to test. -// */ -// isExtensible(o: any): boolean; + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; -// /** -// * Returns the names of the enumerable string properties and methods of an object. -// * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. -// */ -// keys(o: object): string[]; -// } + /** + * Returns the names of the enumerable string properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: object): string[]; +} -// /** -// * Provides functionality common to all JavaScript objects. -// */ +// TODO: name clash? +/** + * Provides functionality common to all JavaScript objects. + */ // declare var Object: ObjectConstructor; /** @@ -920,7 +921,7 @@ interface DateConstructor { declare var Date: DateConstructor; -// TODO: 0??? and $ +// TODO: 0? // interface RegExpMatchArray extends Array { // /** // * The index of the search at which the result was found. @@ -951,38 +952,39 @@ declare var Date: DateConstructor; // 0: string; // } -// interface RegExp { -// /** -// * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. -// * @param string The String object or string literal on which to perform the search. -// */ -// exec(string: string): RegExpExecArray | null; +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; -// /** -// * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. -// * @param string String on which to perform the search. -// */ -// test(string: string): boolean; + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; -// /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ -// readonly source: string; + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; -// /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ -// readonly global: boolean; + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; -// /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ -// readonly ignoreCase: boolean; + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; -// /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ -// readonly multiline: boolean; + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; -// lastIndex: number; + lastIndex: number; -// // Non-standard extensions -// /** @deprecated A legacy feature for browser compatibility */ -// compile(pattern: string, flags?: string): this; -// } + // Non-standard extensions + /** @deprecated A legacy feature for browser compatibility */ + compile(pattern: string, flags?: string): this; +} +// TODO: $+ // interface RegExpConstructor { // new(pattern: RegExp | string): RegExp; // new(pattern: string, flags?: string): RegExp; @@ -1031,7 +1033,7 @@ declare var Date: DateConstructor; // "$'": string; // } -declare var RegExp: RegExpConstructor; +// declare var RegExp: RegExpConstructor; interface Error { name: string; @@ -2066,40 +2068,40 @@ interface Int8Array { [index: number]: number; } -// interface Int8ArrayConstructor { -// readonly prototype: Int8Array; -// new(length: number): Int8Array; -// new(array: ArrayLike | ArrayBufferLike): Int8Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new(length: number): Int8Array; + new(array: ArrayLike | ArrayBufferLike): Int8Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int8Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; -// } -// declare var Int8Array: Int8ArrayConstructor; +} +declare var Int8Array: Int8ArrayConstructor; /** * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the @@ -2349,40 +2351,39 @@ interface Uint8Array { [index: number]: number; } -// TODO: of -// interface Uint8ArrayConstructor { -// readonly prototype: Uint8Array; -// new(length: number): Uint8Array; -// new(array: ArrayLike | ArrayBufferLike): Uint8Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new(length: number): Uint8Array; + new(array: ArrayLike | ArrayBufferLike): Uint8Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint8Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; -// } -// // declare var Uint8Array: Uint8ArrayConstructor; +} +// declare var Uint8Array: Uint8ArrayConstructor; /** * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. @@ -2632,38 +2633,38 @@ interface Uint8ClampedArray { [index: number]: number; } -// interface Uint8ClampedArrayConstructor { -// readonly prototype: Uint8ClampedArray; -// new(length: number): Uint8ClampedArray; -// new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new(length: number): Uint8ClampedArray; + new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint8ClampedArray; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint8ClampedArray; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint8ClampedArray; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; -// } -// declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the @@ -2912,40 +2913,40 @@ interface Int16Array { [index: number]: number; } -// interface Int16ArrayConstructor { -// readonly prototype: Int16Array; -// new(length: number): Int16Array; -// new(array: ArrayLike | ArrayBufferLike): Int16Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new(length: number): Int16Array; + new(array: ArrayLike | ArrayBufferLike): Int16Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int16Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; -// } -// declare var Int16Array: Int16ArrayConstructor; +} +declare var Int16Array: Int16ArrayConstructor; /** * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the @@ -3195,40 +3196,41 @@ interface Uint16Array { [index: number]: number; } -// interface Uint16ArrayConstructor { -// readonly prototype: Uint16Array; -// new(length: number): Uint16Array; -// new(array: ArrayLike | ArrayBufferLike): Uint16Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new(length: number): Uint16Array; + new(array: ArrayLike | ArrayBufferLike): Uint16Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint16Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; -// } -// declare var Uint16Array: Uint16ArrayConstructor; +} +declare var Uint16Array: Uint16ArrayConstructor; + /** * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the * requested number of bytes could not be allocated an exception is raised. @@ -3477,39 +3479,39 @@ interface Int32Array { [index: number]: number; } -// interface Int32ArrayConstructor { -// readonly prototype: Int32Array; -// new(length: number): Int32Array; -// new(array: ArrayLike | ArrayBufferLike): Int32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new(length: number): Int32Array; + new(array: ArrayLike | ArrayBufferLike): Int32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; -// } -// declare var Int32Array: Int32ArrayConstructor; +} +declare var Int32Array: Int32ArrayConstructor; /** * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the @@ -3758,39 +3760,39 @@ interface Uint32Array { [index: number]: number; } -// interface Uint32ArrayConstructor { -// readonly prototype: Uint32Array; -// new(length: number): Uint32Array; -// new(array: ArrayLike | ArrayBufferLike): Uint32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new(length: number): Uint32Array; + new(array: ArrayLike | ArrayBufferLike): Uint32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; -// } -// declare var Uint32Array: Uint32ArrayConstructor; +} +declare var Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -4040,40 +4042,40 @@ interface Float32Array { [index: number]: number; } -// interface Float32ArrayConstructor { -// readonly prototype: Float32Array; -// new(length: number): Float32Array; -// new(array: ArrayLike | ArrayBufferLike): Float32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new(length: number): Float32Array; + new(array: ArrayLike | ArrayBufferLike): Float32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Float32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Float32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Float32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; -// } -// declare var Float32Array: Float32ArrayConstructor; +} +declare var Float32Array: Float32ArrayConstructor; /** * A typed array of 64-bit float values. The contents are initialized to 0. If the requested @@ -4314,39 +4316,39 @@ interface Float64Array { [index: number]: number; } -// interface Float64ArrayConstructor { -// readonly prototype: Float64Array; -// new(length: number): Float64Array; -// new(array: ArrayLike | ArrayBufferLike): Float64Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new(length: number): Float64Array; + new(array: ArrayLike | ArrayBufferLike): Float64Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Float64Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Float64Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Float64Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; -// } -// declare var Float64Array: Float64ArrayConstructor; +} +declare var Float64Array: Float64ArrayConstructor; ///////////////////////////// /// ECMAScript Internationalization API From 0158f2be1faeb5a50a5eb554d579327609359c47 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 25 Apr 2023 11:06:12 +0800 Subject: [PATCH 045/202] Add declare keyword in ts2mls --- .../src/main/scala/ts2mls/TSNamespace.scala | 2 +- .../main/scala/ts2mls/types/Converter.scala | 4 +- ts2mls/js/src/test/diff/Array.mlsi | 10 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 8 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 33 +- ts2mls/js/src/test/diff/Dec.mlsi | 13 +- ts2mls/js/src/test/diff/ES5.mlsi | 647 +++++------------- ts2mls/js/src/test/diff/Heritage.mlsi | 94 +-- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 84 +-- ts2mls/js/src/test/diff/Intersection.mlsi | 16 +- ts2mls/js/src/test/diff/MultiFiles.mlsi | 35 +- ts2mls/js/src/test/diff/Namespace.mlsi | 57 +- ts2mls/js/src/test/diff/Optional.mlsi | 10 +- ts2mls/js/src/test/diff/Overload.mlsi | 14 +- ts2mls/js/src/test/diff/Tuple.mlsi | 4 +- ts2mls/js/src/test/diff/Type.mlsi | 33 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 29 +- ts2mls/js/src/test/diff/Variables.mlsi | 8 +- 18 files changed, 336 insertions(+), 765 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index bd54aa568..3db8d82a9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -38,7 +38,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { case Left(subName) => { - writer.writeln(s"${indent}module $subName {") + writer.writeln(s"${indent}declare module $subName {") subSpace(subName).generate(writer, indent + " ") writer.writeln(s"$indent}") } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index abf535f87..5fc0870f8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -101,9 +101,9 @@ object Converter { val inheritance = if (parents.isEmpty) constructor else parents.foldLeft(s"$constructor extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) - if (typeVars.isEmpty) s"${indent}$typeName$inheritance $body" + if (typeVars.isEmpty) s"${indent}declare $typeName$inheritance $body" else - s"${indent}$typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints + s"${indent}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index df2a71a2f..f31874727 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -6,8 +6,8 @@ fun first(x: MutArray): string fun getZero3(): MutArray fun first2(fs: MutArray<(number) => number>): (number) => number fun doEs(e: MutArray): MutArray -class C() {} -trait I() { +declare class C() {} +declare trait I() { let i: number } fun doCs(c: MutArray): MutArray @@ -16,14 +16,14 @@ fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> fun translate(x: MutArray): MutArray fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> -class Temp() { +declare class Temp() { let x: T } fun ta(ts: MutArray>): MutArray> fun tat(ts: MutArray>): MutArray> //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.10: trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.10: declare trait I() { +//│ ║ ^^^^^^^^^^^ //│ ║ l.11: let i: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.12: } diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 5cf704b88..26bdfa103 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -16,12 +16,12 @@ fun fail(): nothing fun create(): object fun pa(x: number): number fun wtf(x: anything): unit -class Foooooo() { +declare class Foooooo() { let ooooooo: number } fun inn(f: Foooooo): unit fun out1(): Foooooo -trait Barrrrrrrrr() { +declare trait Barrrrrrrrr() { let rrrrrrr: number } fun inn2(b: Barrrrrrrrr): unit @@ -30,8 +30,8 @@ fun out2(): Barrrrrrrrr //│ ║ l.16: fun create(): object //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.24: trait Barrrrrrrrr() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: declare trait Barrrrrrrrr() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: let rrrrrrr: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.26: } diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index a07ed66eb..5aff4c680 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -2,48 +2,27 @@ :NewDefs :NoJS :AllowTypeErrors -class Student(s: string, age: number) { +declare class Student(s: string, age: number) { let name: string fun isFriend(other: Student): (false) | (true) fun addScore(sub: string, score: number): unit fun getID(): number } -class Foo() { +declare class Foo() { fun bar(x: T): unit } -class EZ() { +declare class EZ() { fun inc(x: number): number } -class Outer() { - class Inner() { +declare class Outer() { + declare class Inner() { let a: number } } -class TTT() { +declare class TTT() { fun ttt(x: T): T fun ttt2(x: T): T } -//│ ╔══[ERROR] Member isFriend is declared but not defined -//│ ║ l.7: fun isFriend(other: Student): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member addScore is declared but not defined -//│ ║ l.8: fun addScore(sub: string, score: number): unit -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member getID is declared but not defined -//│ ║ l.9: fun getID(): number -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member bar is declared but not defined -//│ ║ l.12: fun bar(x: T): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member inc is declared but not defined -//│ ║ l.15: fun inc(x: number): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member ttt is declared but not defined -//│ ║ l.23: fun ttt(x: T): T -//│ ╙── ^^^ -//│ ╔══[ERROR] Member ttt2 is declared but not defined -//│ ║ l.24: fun ttt2(x: T): T -//│ ╙── ^^^^ //│ class Student(s: string, age: number) { //│ fun addScore: (sub: string, score: number,) -> unit //│ fun getID: () -> number diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 83570c073..52c4b6b67 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -4,24 +4,21 @@ :AllowTypeErrors fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string -trait Get() { +declare trait Get() { let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } -class Person(name: string, age: number) { +declare class Person(name: string, age: number) { fun getName(id: number): string } -module OOO { +declare module OOO { } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.7: trait Get() { -//│ ║ ^^^^^^^^^^^^^ +//│ ║ l.7: declare trait Get() { +//│ ║ ^^^^^^^^^^^^^ //│ ║ l.8: let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.9: } //│ ╙── ^ -//│ ╔══[ERROR] Member getName is declared but not defined -//│ ║ l.11: fun getName(id: number): string -//│ ╙── ^^^^^^^ //│ fun getName: (id: number | string,) -> string //│ fun render: (callback: unit -> unit | undefined,) -> string //│ trait Get() diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 79a457de2..0e80ef7d5 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -15,12 +15,12 @@ fun encodeURI(uri: string): string fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string fun escape(string: string): string fun unescape(string: string): string -trait Symbol() { +declare trait Symbol() { fun toString(): string fun valueOf(): Symbol } type PropertyKey = ((string) | (number)) | (Symbol) -trait PropertyDescriptor() { +declare trait PropertyDescriptor() { let configurable: ((false) | (true)) | (undefined) let set: ((anything) => unit) | (undefined) let enumerable: ((false) | (true)) | (undefined) @@ -28,10 +28,10 @@ trait PropertyDescriptor() { let writable: ((false) | (true)) | (undefined) let value: (anything) | (undefined) } -trait PropertyDescriptorMap() { +declare trait PropertyDescriptorMap() { let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } -trait Object() { +declare trait Object() { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) fun valueOf(): Object @@ -40,7 +40,7 @@ trait Object() { fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } -trait ObjectConstructor() { +declare trait ObjectConstructor() { let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> fun getOwnPropertyNames(o: anything): MutArray fun isFrozen(o: anything): (false) | (true) @@ -59,47 +59,47 @@ trait ObjectConstructor() { fun isExtensible(o: anything): (false) | (true) } let Function: FunctionConstructor -trait FunctionConstructor() { +declare trait FunctionConstructor() { let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> let prototype: Function } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -trait CallableFunction() extends Function { +declare trait CallableFunction() extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait NewableFunction() extends Function { +declare trait NewableFunction() extends Function { fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): unit fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait IArguments() { +declare trait IArguments() { let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> let length: number let callee: Function } -trait String() { +declare trait String() { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } -trait StringConstructor() { +declare trait StringConstructor() { let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> let prototype: String fun fromCharCode(codes: MutArray): string } let Boolean: BooleanConstructor -trait BooleanConstructor() { +declare trait BooleanConstructor() { let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> let prototype: Boolean } -trait Number() { +declare trait Number() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } -trait NumberConstructor() { +declare trait NumberConstructor() { let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> let NaN: number let MIN_VALUE: number @@ -109,23 +109,23 @@ trait NumberConstructor() { let MAX_VALUE: number let prototype: Number } -trait TemplateStringsArray() extends ReadonlyArray { +declare trait TemplateStringsArray() extends ReadonlyArray { let raw: ReadonlyArray } -trait ImportMeta() {} -trait ImportCallOptions() { +declare trait ImportMeta() {} +declare trait ImportCallOptions() { let assert: (ImportAssertions) | (undefined) } -trait ImportAssertions() { +declare trait ImportAssertions() { let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } let Math: Math -trait Date() { +declare trait Date() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } -trait DateConstructor() { +declare trait DateConstructor() { let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> @@ -133,7 +133,7 @@ trait DateConstructor() { fun parse(s: string): number let prototype: Date } -trait RegExp() { +declare trait RegExp() { fun test(string: string): (false) | (true) let multiline: (false) | (true) let source: string @@ -144,49 +144,49 @@ trait RegExp() { fun exec(string: string): RegExpExecArray } let Error: ErrorConstructor -trait ErrorConstructor() { +declare trait ErrorConstructor() { let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> let prototype: Error } let EvalError: EvalErrorConstructor -trait EvalErrorConstructor() extends ErrorConstructor { +declare trait EvalErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> let prototype: EvalError } let RangeError: RangeErrorConstructor -trait RangeErrorConstructor() extends ErrorConstructor { +declare trait RangeErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> let prototype: RangeError } let ReferenceError: ReferenceErrorConstructor -trait ReferenceErrorConstructor() extends ErrorConstructor { +declare trait ReferenceErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> let prototype: ReferenceError } let SyntaxError: SyntaxErrorConstructor -trait SyntaxErrorConstructor() extends ErrorConstructor { +declare trait SyntaxErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> let prototype: SyntaxError } let TypeError: TypeErrorConstructor -trait TypeErrorConstructor() extends ErrorConstructor { +declare trait TypeErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> let prototype: TypeError } let URIError: URIErrorConstructor -trait URIErrorConstructor() extends ErrorConstructor { +declare trait URIErrorConstructor() extends ErrorConstructor { let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> let prototype: URIError } let JSON: JSON -trait ReadonlyArray() { +declare trait ReadonlyArray() { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit @@ -204,20 +204,20 @@ trait ReadonlyArray() { fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number } -trait ConcatArray() { +declare trait ConcatArray() { let length: number let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } let Array: ArrayConstructor -trait ArrayConstructor() { +declare trait ArrayConstructor() { let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) let prototype: MutArray } -trait TypedPropertyDescriptor() { +declare trait TypedPropertyDescriptor() { let configurable: ((false) | (true)) | (undefined) let set: ((T) => unit) | (undefined) let enumerable: ((false) | (true)) | (undefined) @@ -227,7 +227,7 @@ trait TypedPropertyDescriptor() { } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -trait ArrayLike() { +declare trait ArrayLike() { let length: number let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } @@ -248,36 +248,36 @@ type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5. type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -trait ThisType() {} +declare trait ThisType() {} let ArrayBuffer: ArrayBufferConstructor -trait ArrayBufferTypes() { +declare trait ArrayBufferTypes() { let ArrayBuffer: ArrayBuffer } type ArrayBufferLike = ArrayBuffer -trait ArrayBufferConstructor() { +declare trait ArrayBufferConstructor() { let prototype: ArrayBuffer let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } -trait ArrayBufferView() { +declare trait ArrayBufferView() { let buffer: ArrayBuffer let byteLength: number let byteOffset: number } let DataView: DataViewConstructor -trait DataViewConstructor() { +declare trait DataViewConstructor() { let prototype: DataView let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } let Int8Array: Int8ArrayConstructor -trait Int8ArrayConstructor() { +declare trait Int8ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ let prototype: Int8Array fun id"of"(items: MutArray): Int8Array let BYTES_PER_ELEMENT: number } -trait Uint8Array() { +declare trait Uint8Array() { fun valueOf(): Uint8Array fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -307,7 +307,7 @@ trait Uint8Array() { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number let byteOffset: number } -trait Uint8ArrayConstructor() { +declare trait Uint8ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ let prototype: Uint8Array @@ -315,7 +315,7 @@ trait Uint8ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Uint8ClampedArray: Uint8ClampedArrayConstructor -trait Uint8ClampedArrayConstructor() { +declare trait Uint8ClampedArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ let prototype: Uint8ClampedArray @@ -323,7 +323,7 @@ trait Uint8ClampedArrayConstructor() { let BYTES_PER_ELEMENT: number } let Int16Array: Int16ArrayConstructor -trait Int16ArrayConstructor() { +declare trait Int16ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ let prototype: Int16Array @@ -331,7 +331,7 @@ trait Int16ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Uint16Array: Uint16ArrayConstructor -trait Uint16ArrayConstructor() { +declare trait Uint16ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ let prototype: Uint16Array @@ -339,7 +339,7 @@ trait Uint16ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Int32Array: Int32ArrayConstructor -trait Int32ArrayConstructor() { +declare trait Int32ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ let prototype: Int32Array @@ -347,7 +347,7 @@ trait Int32ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Uint32Array: Uint32ArrayConstructor -trait Uint32ArrayConstructor() { +declare trait Uint32ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ let prototype: Uint32Array @@ -355,7 +355,7 @@ trait Uint32ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Float32Array: Float32ArrayConstructor -trait Float32ArrayConstructor() { +declare trait Float32ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ let prototype: Float32Array @@ -363,15 +363,15 @@ trait Float32ArrayConstructor() { let BYTES_PER_ELEMENT: number } let Float64Array: Float64ArrayConstructor -trait Float64ArrayConstructor() { +declare trait Float64ArrayConstructor() { let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ let prototype: Float64Array fun id"of"(items: MutArray): Float64Array let BYTES_PER_ELEMENT: number } -module Intl { - trait CollatorOptions() { +declare module Intl { + declare trait CollatorOptions() { let sensitivity: (string) | (undefined) let ignorePunctuation: ((false) | (true)) | (undefined) let usage: (string) | (undefined) @@ -379,7 +379,7 @@ module Intl { let numeric: ((false) | (true)) | (undefined) let caseFirst: (string) | (undefined) } - trait ResolvedCollatorOptions() { + declare trait ResolvedCollatorOptions() { let sensitivity: string let ignorePunctuation: (false) | (true) let usage: string @@ -388,11 +388,11 @@ module Intl { let caseFirst: string let collation: string } - trait Collator() { + declare trait Collator() { fun compare(x: string, y: string): number fun resolvedOptions(): Intl.ResolvedCollatorOptions } - trait NumberFormatOptions() { + declare trait NumberFormatOptions() { let minimumSignificantDigits: (number) | (undefined) let useGrouping: ((false) | (true)) | (undefined) let style: (string) | (undefined) @@ -404,7 +404,7 @@ module Intl { let maximumSignificantDigits: (number) | (undefined) let minimumFractionDigits: (number) | (undefined) } - trait ResolvedNumberFormatOptions() { + declare trait ResolvedNumberFormatOptions() { let numberingSystem: string let minimumSignificantDigits: (number) | (undefined) let useGrouping: (false) | (true) @@ -416,11 +416,11 @@ module Intl { let maximumSignificantDigits: (number) | (undefined) let minimumFractionDigits: number } - trait NumberFormat() { + declare trait NumberFormat() { fun format(value: number): string fun resolvedOptions(): Intl.ResolvedNumberFormatOptions } - trait DateTimeFormatOptions() { + declare trait DateTimeFormatOptions() { let minute: ((string) | (string)) | (undefined) let year: ((string) | (string)) | (undefined) let hour: ((string) | (string)) | (undefined) @@ -435,7 +435,7 @@ module Intl { let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) let era: (((string) | (string)) | (string)) | (undefined) } - trait ResolvedDateTimeFormatOptions() { + declare trait ResolvedDateTimeFormatOptions() { let numberingSystem: string let minute: (string) | (undefined) let year: (string) | (undefined) @@ -451,7 +451,7 @@ module Intl { let timeZoneName: (string) | (undefined) let era: (string) | (undefined) } - trait DateTimeFormat() { + declare trait DateTimeFormat() { fun format(date: ((number) | (Date)) | (undefined)): string fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } @@ -460,26 +460,20 @@ module Intl { //│ ║ l.20: fun valueOf(): Symbol //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: trait Symbol() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.18: declare trait Symbol() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.19: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.20: fun valueOf(): Symbol //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: } //│ ╙── ^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.19: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.20: fun valueOf(): Symbol -//│ ╙── ^^^^^^^ //│ ╔══[ERROR] trait Symbol cannot be used as a type //│ ║ l.22: type PropertyKey = ((string) | (number)) | (Symbol) //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait PropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: declare trait PropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: let configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: let set: ((anything) => unit) | (undefined) @@ -495,8 +489,8 @@ module Intl { //│ ║ l.30: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: trait PropertyDescriptorMap() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.31: declare trait PropertyDescriptorMap() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.32: let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.33: } @@ -514,8 +508,8 @@ module Intl { //│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: trait Object() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.34: declare trait Object() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) @@ -532,24 +526,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.42: } //│ ╙── ^ -//│ ╔══[ERROR] Member hasOwnProperty is declared but not defined -//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member propertyIsEnumerable is declared but not defined -//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.37: fun valueOf(): Object -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.38: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isPrototypeOf is declared but not defined -//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.41: fun toString(): string -//│ ╙── ^^^^^^^^ //│ ╔══[ERROR] trait Symbol cannot be used as a type //│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T //│ ╙── ^^^^^^^^ @@ -581,8 +557,8 @@ module Intl { //│ ║ l.58: fun keys(o: object): MutArray //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.43: trait ObjectConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.43: declare trait ObjectConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.44: let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray @@ -617,48 +593,12 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.60: } //│ ╙── ^ -//│ ╔══[ERROR] Member getOwnPropertyNames is declared but not defined -//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isFrozen is declared but not defined -//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member getPrototypeOf is declared but not defined -//│ ║ l.47: fun getPrototypeOf(o: anything): anything -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member defineProperty is declared but not defined -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isSealed is declared but not defined -//│ ║ l.50: fun isSealed(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member defineProperties is declared but not defined -//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member preventExtensions is declared but not defined -//│ ║ l.52: fun preventExtensions(o: T): T -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member freeze is declared but not defined -//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member getOwnPropertyDescriptor is declared but not defined -//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member seal is declared but not defined -//│ ║ l.57: fun seal(o: T): T -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member keys is declared but not defined -//│ ║ l.58: fun keys(o: object): MutArray -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member isExtensible is declared but not defined -//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type //│ ║ l.61: let Function: FunctionConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.62: trait FunctionConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.62: declare trait FunctionConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.63: let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.64: let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> @@ -674,8 +614,8 @@ module Intl { //│ ║ l.68: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.69: trait CallableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.69: declare trait CallableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.71: fun call(thisArg: T, args: A): R @@ -684,18 +624,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.73: } //│ ╙── ^ -//│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.71: fun call(thisArg: T, args: A): R -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.74: trait NewableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.74: declare trait NewableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.76: fun call(thisArg: T, args: A): unit @@ -704,18 +635,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.78: } //│ ╙── ^ -//│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.76: fun call(thisArg: T, args: A): unit -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.79: trait IArguments() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.79: declare trait IArguments() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.80: let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.81: let length: number @@ -725,8 +647,8 @@ module Intl { //│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.374: trait CollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.374: declare trait CollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.375: let sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.376: let ignorePunctuation: ((false) | (true)) | (undefined) @@ -742,8 +664,8 @@ module Intl { //│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.382: trait ResolvedCollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.382: declare trait ResolvedCollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.383: let sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.384: let ignorePunctuation: (false) | (true) @@ -764,23 +686,17 @@ module Intl { //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.391: trait Collator() { -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.391: declare trait Collator() { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.392: fun compare(x: string, y: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.394: } //│ ╙── ^^^ -//│ ╔══[ERROR] Member compare is declared but not defined -//│ ║ l.392: fun compare(x: string, y: string): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions -//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: trait NumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.395: declare trait NumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.396: let minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.397: let useGrouping: ((false) | (true)) | (undefined) @@ -804,8 +720,8 @@ module Intl { //│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.407: trait ResolvedNumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.407: declare trait ResolvedNumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.408: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.409: let minimumSignificantDigits: (number) | (undefined) @@ -832,23 +748,17 @@ module Intl { //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.419: trait NumberFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.419: declare trait NumberFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.420: fun format(value: number): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.422: } //│ ╙── ^^^ -//│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.420: fun format(value: number): string -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.423: trait DateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.423: declare trait DateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.424: let minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.425: let year: ((string) | (string)) | (undefined) @@ -878,8 +788,8 @@ module Intl { //│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.438: trait ResolvedDateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.438: declare trait ResolvedDateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.439: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.440: let minute: (string) | (undefined) @@ -917,33 +827,24 @@ module Intl { //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.454: trait DateTimeFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.454: declare trait DateTimeFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.457: } //│ ╙── ^^^ -//│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.84: trait String() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.84: declare trait String() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.86: } //│ ╙── ^ -//│ ╔══[ERROR] Member localeCompare is declared but not defined -//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.87: trait StringConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.87: declare trait StringConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.88: let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.89: let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> @@ -954,15 +855,12 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.92: } //│ ╙── ^ -//│ ╔══[ERROR] Member fromCharCode is declared but not defined -//│ ║ l.91: fun fromCharCode(codes: MutArray): string -//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type //│ ║ l.93: let Boolean: BooleanConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: trait BooleanConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.94: declare trait BooleanConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.95: let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.96: let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> @@ -972,18 +870,15 @@ module Intl { //│ ║ l.98: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.99: trait Number() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.99: declare trait Number() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.101: } //│ ╙── ^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.102: trait NumberConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.102: declare trait NumberConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.103: let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.104: let NaN: number @@ -1003,25 +898,25 @@ module Intl { //│ ║ l.111: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.112: trait TemplateStringsArray() extends ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.112: declare trait TemplateStringsArray() extends ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.113: let raw: ReadonlyArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.114: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.115: trait ImportMeta() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.115: declare trait ImportMeta() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.116: trait ImportCallOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.116: declare trait ImportCallOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.117: let assert: (ImportAssertions) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.118: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.119: trait ImportAssertions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.119: declare trait ImportAssertions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.120: let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.121: } @@ -1033,8 +928,8 @@ module Intl { //│ ║ l.122: let Math: Math //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.123: trait Date() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.123: declare trait Date() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string @@ -1043,18 +938,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.127: } //│ ╙── ^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toLocaleDateString is declared but not defined -//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toLocaleTimeString is declared but not defined -//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.128: trait DateConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.128: declare trait DateConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.129: let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number @@ -1069,15 +955,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.135: } //│ ╙── ^ -//│ ╔══[ERROR] Member UTC is declared but not defined -//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member now is declared but not defined -//│ ║ l.132: fun now(): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member parse is declared but not defined -//│ ║ l.133: fun parse(s: string): number -//│ ╙── ^^^^^ //│ ╔══[ERROR] trait RegExp cannot be used as a type //│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp //│ ╙── ^^^^^^ @@ -1085,8 +962,8 @@ module Intl { //│ ║ l.144: fun exec(string: string): RegExpExecArray //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.136: trait RegExp() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.136: declare trait RegExp() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.137: fun test(string: string): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.138: let multiline: (false) | (true) @@ -1105,21 +982,12 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.145: } //│ ╙── ^ -//│ ╔══[ERROR] Member test is declared but not defined -//│ ║ l.137: fun test(string: string): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member compile is declared but not defined -//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member exec is declared but not defined -//│ ║ l.144: fun exec(string: string): RegExpExecArray -//│ ╙── ^^^^ //│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type //│ ║ l.146: let Error: ErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.147: trait ErrorConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.147: declare trait ErrorConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.148: let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.149: let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> @@ -1132,8 +1000,8 @@ module Intl { //│ ║ l.152: let EvalError: EvalErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.153: trait EvalErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.153: declare trait EvalErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.154: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.155: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> @@ -1146,8 +1014,8 @@ module Intl { //│ ║ l.158: let RangeError: RangeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.159: trait RangeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.159: declare trait RangeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.160: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.161: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> @@ -1160,8 +1028,8 @@ module Intl { //│ ║ l.164: let ReferenceError: ReferenceErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.165: trait ReferenceErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.165: declare trait ReferenceErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.166: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.167: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> @@ -1174,8 +1042,8 @@ module Intl { //│ ║ l.170: let SyntaxError: SyntaxErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.171: trait SyntaxErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.171: declare trait SyntaxErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.172: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.173: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> @@ -1188,8 +1056,8 @@ module Intl { //│ ║ l.176: let TypeError: TypeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.177: trait TypeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.177: declare trait TypeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.178: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.179: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> @@ -1202,8 +1070,8 @@ module Intl { //│ ║ l.182: let URIError: URIErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.183: trait URIErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.183: declare trait URIErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.184: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.185: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> @@ -1240,8 +1108,8 @@ module Intl { //│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.189: trait ReadonlyArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.189: declare trait ReadonlyArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ @@ -1276,48 +1144,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.206: } //│ ╙── ^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.196: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.199: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.202: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.207: trait ConcatArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.207: declare trait ConcatArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.208: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.209: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> @@ -1328,18 +1157,12 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.212: } //│ ╙── ^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.210: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ╙── ^^^^^ //│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type //│ ║ l.213: let Array: ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.214: trait ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.214: declare trait ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.215: let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.216: let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> @@ -1350,12 +1173,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.219: } //│ ╙── ^ -//│ ╔══[ERROR] Member isArray is declared but not defined -//│ ║ l.217: fun isArray(arg: anything): (false) | (true) -//│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.220: trait TypedPropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.220: declare trait TypedPropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.221: let configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.222: let set: ((T) => unit) | (undefined) @@ -1383,8 +1203,8 @@ module Intl { //│ ║ l.229: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.230: trait ArrayLike() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.230: declare trait ArrayLike() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.231: let length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.232: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> @@ -1440,14 +1260,14 @@ module Intl { //│ ║ l.250: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.251: trait ThisType() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.251: declare trait ThisType() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type //│ ║ l.252: let ArrayBuffer: ArrayBufferConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.253: trait ArrayBufferTypes() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.253: declare trait ArrayBufferTypes() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.254: let ArrayBuffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.255: } @@ -1459,8 +1279,8 @@ module Intl { //│ ║ l.256: type ArrayBufferLike = ArrayBuffer //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.257: trait ArrayBufferConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.257: declare trait ArrayBufferConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.258: let prototype: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.259: let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> @@ -1469,12 +1289,9 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.261: } //│ ╙── ^ -//│ ╔══[ERROR] Member isView is declared but not defined -//│ ║ l.260: fun isView(arg: anything): (false) | (true) -//│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.262: trait ArrayBufferView() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.262: declare trait ArrayBufferView() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.263: let buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.264: let byteLength: number @@ -1487,8 +1304,8 @@ module Intl { //│ ║ l.267: let DataView: DataViewConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.268: trait DataViewConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.268: declare trait DataViewConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.269: let prototype: DataView //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.270: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> @@ -1514,8 +1331,8 @@ module Intl { //│ ║ l.277: fun id"of"(items: MutArray): Int8Array //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.273: trait Int8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.273: declare trait Int8ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.274: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ @@ -1528,12 +1345,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.279: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.277: fun id"of"(items: MutArray): Int8Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type //│ ║ l.281: fun valueOf(): Uint8Array //│ ╙── ^^^^^^^^^^ @@ -1592,8 +1403,8 @@ module Intl { //│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.280: trait Uint8Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.280: declare trait Uint8Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.281: fun valueOf(): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number @@ -1652,72 +1463,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.309: } //│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.281: fun valueOf(): Uint8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.285: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.294: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.299: fun reverse(): Uint8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.304: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1728,8 +1473,8 @@ module Intl { //│ ║ l.314: fun id"of"(items: MutArray): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.310: trait Uint8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.310: declare trait Uint8ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.311: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ @@ -1742,12 +1487,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.316: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint8ClampedArrayConstructor cannot be used as a type //│ ║ l.317: let Uint8ClampedArray: Uint8ClampedArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1767,8 +1506,8 @@ module Intl { //│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray //│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.318: trait Uint8ClampedArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.318: declare trait Uint8ClampedArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.319: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ @@ -1781,12 +1520,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.324: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Int16ArrayConstructor cannot be used as a type //│ ║ l.325: let Int16Array: Int16ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ @@ -1806,8 +1539,8 @@ module Intl { //│ ║ l.330: fun id"of"(items: MutArray): Int16Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.326: trait Int16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.326: declare trait Int16ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.327: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ @@ -1820,12 +1553,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.332: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.330: fun id"of"(items: MutArray): Int16Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint16ArrayConstructor cannot be used as a type //│ ║ l.333: let Uint16Array: Uint16ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ @@ -1845,8 +1572,8 @@ module Intl { //│ ║ l.338: fun id"of"(items: MutArray): Uint16Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.334: trait Uint16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.334: declare trait Uint16ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.335: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ @@ -1859,12 +1586,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.340: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Int32ArrayConstructor cannot be used as a type //│ ║ l.341: let Int32Array: Int32ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ @@ -1884,8 +1605,8 @@ module Intl { //│ ║ l.346: fun id"of"(items: MutArray): Int32Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.342: trait Int32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.342: declare trait Int32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.343: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ @@ -1898,12 +1619,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.348: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.346: fun id"of"(items: MutArray): Int32Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint32ArrayConstructor cannot be used as a type //│ ║ l.349: let Uint32Array: Uint32ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ @@ -1923,8 +1638,8 @@ module Intl { //│ ║ l.354: fun id"of"(items: MutArray): Uint32Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.350: trait Uint32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.350: declare trait Uint32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.351: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ @@ -1937,12 +1652,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.356: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Float32ArrayConstructor cannot be used as a type //│ ║ l.357: let Float32Array: Float32ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ @@ -1962,8 +1671,8 @@ module Intl { //│ ║ l.362: fun id"of"(items: MutArray): Float32Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.358: trait Float32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.358: declare trait Float32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.359: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ @@ -1976,12 +1685,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.364: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.362: fun id"of"(items: MutArray): Float32Array -//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Float64ArrayConstructor cannot be used as a type //│ ║ l.365: let Float64Array: Float64ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ @@ -2001,8 +1704,8 @@ module Intl { //│ ║ l.370: fun id"of"(items: MutArray): Float64Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.366: trait Float64ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.366: declare trait Float64ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.367: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ @@ -2015,12 +1718,6 @@ module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.372: } //│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.370: fun id"of"(items: MutArray): Float64Array -//│ ╙── ^^^^^^ //│ let NaN: number //│ let Infinity: number //│ fun eval: (x: string,) -> anything diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index f60f7c679..d9bba5015 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -2,113 +2,95 @@ :NewDefs :NoJS :AllowTypeErrors -class A() { +declare class A() { fun foo(): unit } -class B() extends A {} -class C() { +declare class B() extends A {} +declare class C() { fun set(x: T): unit fun get(): T } -class D() extends C {} -trait Wu() { +declare class D() extends C {} +declare trait Wu() { let x: (false) | (true) } -class WuWu() extends Wu { +declare class WuWu() extends Wu { let y: (false) | (true) } -trait WuWuWu() extends WuWu { +declare trait WuWuWu() extends WuWu { let z: (false) | (true) } -trait Never() extends WuWuWu { +declare trait Never() extends WuWuWu { fun w(): nothing } -class VG() { +declare class VG() { let x: T } -class Home() extends VG { +declare class Home() extends VG { let y: T } -trait O() { +declare trait O() { fun xx(x: I): I } -class OR() extends O { +declare class OR() extends O { fun xx(x: R): R } -module Five { - class ROTK() { +declare module Five { + declare class ROTK() { let wu: string } - class Y() extends Five.ROTK {} + declare class Y() extends Five.ROTK {} } -class Y() extends Five.ROTK {} -//│ ╔══[ERROR] Member foo is declared but not defined -//│ ║ l.6: fun foo(): unit -//│ ╙── ^^^ +declare class Y() extends Five.ROTK {} //│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) -//│ ║ l.8: class B() extends A {} -//│ ╙── ^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.10: fun set(x: T): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member get is declared but not defined -//│ ║ l.11: fun get(): T -//│ ╙── ^^^ +//│ ║ l.8: declare class B() extends A {} +//│ ╙── ^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.13: class D() extends C {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.13: declare class D() extends C {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.14: trait Wu() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.14: declare trait Wu() { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.15: let x: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.16: } //│ ╙── ^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.17: class WuWu() extends Wu { -//│ ╙── ^^ +//│ ║ l.17: declare class WuWu() extends Wu { +//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.20: trait WuWuWu() extends WuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.20: declare trait WuWuWu() extends WuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: let z: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.22: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait Never() extends WuWuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: declare trait Never() extends WuWuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: fun w(): nothing //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.25: } //│ ╙── ^ -//│ ╔══[ERROR] Member w is declared but not defined -//│ ║ l.24: fun w(): nothing -//│ ╙── ^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.29: class Home() extends VG { -//│ ╙── ^^^^^^^^^^ +//│ ║ l.29: declare class Home() extends VG { +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.32: trait O() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.32: declare trait O() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.33: fun xx(x: I): I //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.34: } //│ ╙── ^ -//│ ╔══[ERROR] Member xx is declared but not defined -//│ ║ l.33: fun xx(x: I): I -//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.35: class OR() extends O { -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member xx is declared but not defined -//│ ║ l.36: fun xx(x: R): R -//│ ╙── ^^ +//│ ║ l.35: declare class OR() extends O { +//│ ╙── ^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.42: class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.42: declare class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.44: class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.44: declare class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ class A() { //│ fun foo: () -> unit //│ } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 5fcb02ab4..58a3cf521 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -2,45 +2,45 @@ :NewDefs :NoJS :AllowTypeErrors -trait IFoo() { +declare trait IFoo() { let a: string fun b(x: number): number fun c(): (false) | (true) fun d(x: string): unit } -trait II() { +declare trait II() { fun test(x: T): number } fun create(): {v: number,} fun get(x: {t: string,}): string -trait IEvent() { +declare trait IEvent() { fun callback(): (number) => unit } -trait SearchFunc() { +declare trait SearchFunc() { let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> } -trait StringArray() { +declare trait StringArray() { let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> } -trait Counter() { +declare trait Counter() { let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> let interval: number fun reset(): unit } -trait Simple() { +declare trait Simple() { let a: number fun b(x: (false) | (true)): string } -trait Simple2() { +declare trait Simple2() { let abc: T } -trait Next() extends Simple {} -trait TTT() { +declare trait Next() extends Simple {} +declare trait TTT() { fun ttt(x: T): T } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.5: trait IFoo() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.5: declare trait IFoo() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.6: let a: string //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.7: fun b(x: number): number @@ -51,52 +51,37 @@ trait TTT() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^ -//│ ╔══[ERROR] Member b is declared but not defined -//│ ║ l.7: fun b(x: number): number -//│ ╙── ^ -//│ ╔══[ERROR] Member c is declared but not defined -//│ ║ l.8: fun c(): (false) | (true) -//│ ╙── ^ -//│ ╔══[ERROR] Member d is declared but not defined -//│ ║ l.9: fun d(x: string): unit -//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: trait II() { -//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.11: declare trait II() { +//│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.12: fun test(x: T): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.13: } //│ ╙── ^ -//│ ╔══[ERROR] Member test is declared but not defined -//│ ║ l.12: fun test(x: T): number -//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: trait IEvent() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.16: declare trait IEvent() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.17: fun callback(): (number) => unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.18: } //│ ╙── ^ -//│ ╔══[ERROR] Member callback is declared but not defined -//│ ║ l.17: fun callback(): (number) => unit -//│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.19: trait SearchFunc() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.19: declare trait SearchFunc() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.20: let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.22: trait StringArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.22: declare trait StringArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.23: let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: trait Counter() { -//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.25: declare trait Counter() { +//│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.26: let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.27: let interval: number @@ -105,41 +90,32 @@ trait TTT() { //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.29: } //│ ╙── ^ -//│ ╔══[ERROR] Member reset is declared but not defined -//│ ║ l.28: fun reset(): unit -//│ ╙── ^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.30: trait Simple() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.30: declare trait Simple() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.31: let a: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.32: fun b(x: (false) | (true)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.33: } //│ ╙── ^ -//│ ╔══[ERROR] Member b is declared but not defined -//│ ║ l.32: fun b(x: (false) | (true)): string -//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: trait Simple2() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.34: declare trait Simple2() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.35: let abc: T //│ ║ ^^^^^^^^^^^^ //│ ║ l.36: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.37: trait Next() extends Simple {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.37: declare trait Next() extends Simple {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.38: trait TTT() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.38: declare trait TTT() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.39: fun ttt(x: T): T //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.40: } //│ ╙── ^ -//│ ╔══[ERROR] Member ttt is declared but not defined -//│ ║ l.39: fun ttt(x: T): T -//│ ╙── ^^^ //│ trait IFoo() //│ trait II[T]() //│ fun create: () -> {v: number} diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 9182f0722..c0dc7eec1 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -5,10 +5,10 @@ fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit fun over(f: ((number) => string) & ((object) => string)): string -trait IA() { +declare trait IA() { let x: number } -trait IB() { +declare trait IB() { let y: number } fun iii(x: (IA) & (IB)): (IA) & (IB) @@ -16,8 +16,8 @@ fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))) fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -class A() {} -class B() {} +declare class A() {} +declare class B() {} fun inter(c: (A) & (B)): (A) & (B) //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.5: fun extend(first: T, second: U): (T) & (U) @@ -47,15 +47,15 @@ fun inter(c: (A) & (B)): (A) & (B) //│ ║ l.7: fun over(f: ((number) => string) & ((object) => string)): string //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait IA() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.8: declare trait IA() { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.9: let x: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: trait IB() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.11: declare trait IB() { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.12: let y: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.13: } diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index 948286e8e..8e1be6c66 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -4,51 +4,42 @@ :AllowTypeErrors fun multi1(x: number): number fun multi3(): unit -class Foo() extends Base {} -trait AnotherBase() { +declare class Foo() extends Base {} +declare trait AnotherBase() { let y: string } -module N { +declare module N { fun f(): unit fun g(): unit fun h(): unit } fun multi2(x: string): string fun multi4(): unit -trait Base() { +declare trait Base() { let a: number } -class AnotherFoo() extends AnotherBase {} +declare class AnotherFoo() extends AnotherBase {} fun multi5(): unit //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: trait Base() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.18: declare trait Base() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.19: let a: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.20: } //│ ╙── ^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.7: class Foo() extends Base {} -//│ ╙── ^^^^ +//│ ║ l.7: declare class Foo() extends Base {} +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait AnotherBase() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.8: declare trait AnotherBase() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.9: let y: string //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.12: fun f(): unit -//│ ╙── ^ -//│ ╔══[ERROR] Member g is declared but not defined -//│ ║ l.13: fun g(): unit -//│ ╙── ^ -//│ ╔══[ERROR] Member h is declared but not defined -//│ ║ l.14: fun h(): unit -//│ ╙── ^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.21: class AnotherFoo() extends AnotherBase {} -//│ ╙── ^^^^^^^^^^^ +//│ ║ l.21: declare class AnotherFoo() extends AnotherBase {} +//│ ╙── ^^^^^^^^^^^ //│ fun multi1: (x: number,) -> number //│ fun multi3: () -> unit //│ class Foo() diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index c9c04a8e1..f3db6082a 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -2,47 +2,41 @@ :NewDefs :NoJS :AllowTypeErrors -module N1 { +declare module N1 { fun f(x: anything): number fun ff(y: anything): number - class C() { + declare class C() { fun f(): unit } - trait I() { + declare trait I() { fun f(): number } - module N2 { + declare module N2 { fun fff(x: (false) | (true)): number fun gg(c: N1.C): N1.C - class BBB() extends N1.C {} + declare class BBB() extends N1.C {} } } -module AA { +declare module AA { fun f(x: anything): string - class C() { + declare class C() { fun f(): unit } - trait I() { + declare trait I() { fun f(): number } - module N2 { + declare module N2 { } } fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.9: fun f(): unit -//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.11: declare trait I() { +//│ ║ ^^^^^^^^^^^ //│ ║ l.12: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.13: } //│ ╙── ^^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.12: fun f(): number -//│ ╙── ^ //│ ╔══[ERROR] Module `N1` is not supported yet. //│ ║ l.16: fun gg(c: N1.C): N1.C //│ ╙── ^^ @@ -50,36 +44,15 @@ fun f2(x: AA.C): AA.C //│ ║ l.16: fun gg(c: N1.C): N1.C //│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.17: class BBB() extends N1.C {} -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member fff is declared but not defined -//│ ║ l.15: fun fff(x: (false) | (true)): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member gg is declared but not defined -//│ ║ l.16: fun gg(c: N1.C): N1.C -//│ ╙── ^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.6: fun f(x: anything): number -//│ ╙── ^ -//│ ╔══[ERROR] Member ff is declared but not defined -//│ ║ l.7: fun ff(y: anything): number -//│ ╙── ^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.23: fun f(): unit -//│ ╙── ^ +//│ ║ l.17: declare class BBB() extends N1.C {} +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.25: declare trait I() { +//│ ║ ^^^^^^^^^^^ //│ ║ l.26: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.27: } //│ ╙── ^^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.26: fun f(): number -//│ ╙── ^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.21: fun f(x: anything): string -//│ ╙── ^ //│ module N1() { //│ class C() { //│ fun f: () -> unit diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index e48826080..0a2a060b0 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -6,25 +6,25 @@ fun buildName(firstName: string, lastName: (string) | (undefined)): string fun buildName2(firstName: string, lastName: (string) | (undefined)): string fun buildName3(firstName: string, lastName: MutArray): string fun buildName4(firstName: string, lastName: MutArray): string -trait SquareConfig() { +declare trait SquareConfig() { let color: (string) | (undefined) let width: (number) | (undefined) } fun did(x: number, f: ((number) => number) | (undefined)): number fun getOrElse(arr: (MutArray) | (undefined)): object -class ABC() {} +declare class ABC() {} fun testABC(abc: (ABC) | (undefined)): unit fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit fun err(msg: ((number, string, )) | (undefined)): unit fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string fun boo(x: ((T) & (U)) | (undefined)): unit -class B() { +declare class B() { let b: T } fun boom(b: (B) | (undefined)): anything //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait SquareConfig() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.9: declare trait SquareConfig() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.10: let color: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.11: let width: (number) | (undefined) diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 2dfd37494..3d39c776d 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -3,24 +3,24 @@ :NoJS :AllowTypeErrors fun f: ((number) => string) & ((string) => string) -class M() { +declare class M() { let foo: ((number) => string) & ((string) => string) } fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) fun g0: ((MutArray) => string) & ((MutArray) => string) fun db: ((number) => MutArray) & ((object) => MutArray) -class N() {} +declare class N() {} fun id: ((M) => unit) & ((N) => unit) fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ -module XX { +declare module XX { fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } -class WWW() { +declare class WWW() { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ @@ -36,12 +36,6 @@ fun baz(): anything /* warning: the overload of function baz is not supported ye //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.19: fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ //│ ╙── ^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.21: fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ -//│ ╙── ^ -//│ ╔══[ERROR] Member F is declared but not defined -//│ ║ l.24: fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ -//│ ╙── ^ //│ fun f: (number | string) -> string //│ class M() { //│ let foo: (number | string) -> string diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 90e4ffbc0..21b8f3d6f 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -13,10 +13,10 @@ fun s2(t: ((false) | (true), (string) | (number), )): (string) | (number) fun ex(x: T, y: U): (T, U, (T) & (U), ) fun foo(x: ((T) & (U), )): unit fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) -class A() { +declare class A() { let x: number } -class B() {} +declare class B() {} fun swap(x: (A, B, )): (B, A, ) //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index dbc3c6690..64afb20da 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -2,44 +2,44 @@ :NewDefs :NoJS :AllowTypeErrors -trait None() { +declare trait None() { let _tag: "None" } -trait Some() { +declare trait Some() { let _tag: "Some" let value: A } type Option = (None) | (Some) type Func = (number) => number type S2 = (string, string, ) -trait I1() {} -trait I2() {} +declare trait I1() {} +declare trait I2() {} type I3 = (I1) & (I2) type StringArray = Array type SomeInterface = {x: number,y: number,} -class ABC() {} +declare class ABC() {} type DEF = ABC type TP = (A, B, C, ) -module NA { +declare module NA { fun fb(b: string): unit type B = string } -class NC() { +declare class NC() { let b: string } type G = ABC let none: {_tag: "None",} fun some(a: A): (None) | (Some) //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.5: trait None() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.5: declare trait None() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.6: let _tag: "None" //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.7: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait Some() { -//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.8: declare trait Some() { +//│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.9: let _tag: "Some" //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.10: let value: A @@ -53,20 +53,17 @@ fun some(a: A): (None) | (Some) //│ ║ l.12: type Option = (None) | (Some) //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.15: trait I1() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.15: declare trait I1() {} +//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: trait I2() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.16: declare trait I2() {} +//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] trait I1 cannot be used as a type //│ ║ l.17: type I3 = (I1) & (I2) //│ ╙── ^^^^ //│ ╔══[ERROR] trait I2 cannot be used as a type //│ ║ l.17: type I3 = (I1) & (I2) //│ ╙── ^^^^ -//│ ╔══[ERROR] Member fb is declared but not defined -//│ ║ l.24: fun fb(b: string): unit -//│ ╙── ^^ //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 8f46f5d18..c53b58743 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -3,26 +3,26 @@ :NoJS :AllowTypeErrors fun inc(x: T): number -class CC() { +declare class CC() { fun print(s: T): unit } fun con(t: T): U -class Printer() { +declare class Printer() { fun print(t: T): unit } fun setStringPrinter(p: Printer): unit fun getStringPrinter(): Printer fun foo(p: Printer, x: T): T fun foo2(p: Printer, x: T): T -class F() { +declare class F() { let x: T fun GG(y: U): T } -trait I() { +declare trait I() { let x: T fun GG(y: U): T } -class FFF() { +declare class FFF() { fun fff(x: T): unit } fun fff(p: FFF, s: string): unit @@ -33,9 +33,6 @@ fun getFFF(): FFF //│ ╔══[ERROR] type identifier not found: T //│ ║ l.5: fun inc(x: T): number //│ ╙── ^ -//│ ╔══[ERROR] Member print is declared but not defined -//│ ║ l.7: fun print(s: T): unit -//│ ╙── ^^^^^ //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.9: fun con(t: T): U //│ ╙── ^ @@ -45,9 +42,6 @@ fun getFFF(): FFF //│ ╔══[ERROR] type identifier not found: U //│ ║ l.9: fun con(t: T): U //│ ╙── ^ -//│ ╔══[ERROR] Member print is declared but not defined -//│ ║ l.11: fun print(t: T): unit -//│ ╙── ^^^^^ //│ ╔══[ERROR] Type parameters here are not yet supported in this position //│ ║ l.15: fun foo(p: Printer, x: T): T //│ ╙── ^ @@ -72,24 +66,15 @@ fun getFFF(): FFF //│ ╔══[ERROR] type identifier not found: T //│ ║ l.16: fun foo2(p: Printer, x: T): T //│ ╙── ^ -//│ ╔══[ERROR] Member GG is declared but not defined -//│ ║ l.19: fun GG(y: U): T -//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.21: trait I() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.21: declare trait I() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.22: let x: T //│ ║ ^^^^^^^^^^ //│ ║ l.23: fun GG(y: U): T //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: } //│ ╙── ^ -//│ ╔══[ERROR] Member GG is declared but not defined -//│ ║ l.23: fun GG(y: U): T -//│ ╙── ^^ -//│ ╔══[ERROR] Member fff is declared but not defined -//│ ║ l.26: fun fff(x: T): unit -//│ ╙── ^^^ //│ fun inc: (x: error,) -> number //│ class CC[T]() { //│ fun print: (s: T,) -> unit diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index c34b6eb86..16777a776 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -6,13 +6,13 @@ let URI: string let URI2: string let foo: number let bar: false -class FooBar() {} +declare class FooBar() {} let fb: FooBar -module ABC { - class DEF() {} +declare module ABC { + declare class DEF() {} } let d: ABC.DEF -module DD { +declare module DD { let foo: number let bar: number } From 823085896f5ca4acb526248f8f1fc70a35a3710b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 25 Apr 2023 16:08:57 +0800 Subject: [PATCH 046/202] WIP: Add export parse in ts2mls --- .../main/scala/ts2mls/TSCompilerInfo.scala | 5 ++ ts2mls/js/src/main/scala/ts2mls/TSData.scala | 2 + .../src/main/scala/ts2mls/TSNamespace.scala | 46 +++++++++++-------- .../src/main/scala/ts2mls/TSSourceFile.scala | 30 ++++++------ .../main/scala/ts2mls/types/Converter.scala | 25 +++++----- ts2mls/js/src/test/diff/Export.mlsi | 38 +++++++++++++++ ts2mls/js/src/test/diff/Heritage.mlsi | 8 ++-- ts2mls/js/src/test/diff/MultiFiles.mlsi | 6 +-- ts2mls/js/src/test/diff/Namespace.mlsi | 20 ++++---- ts2mls/js/src/test/diff/Overload.mlsi | 2 +- ts2mls/js/src/test/diff/Variables.mlsi | 2 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 41 +++++++++-------- ts2mls/js/src/test/typescript/Export.ts | 17 +++++++ 13 files changed, 156 insertions(+), 86 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Export.mlsi create mode 100644 ts2mls/js/src/test/typescript/Export.ts diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 2a06c76bf..5e8a39522 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -21,6 +21,7 @@ object TypeScript { val syntaxKindPrivate = ts.SyntaxKind.PrivateKeyword val syntaxKindProtected = ts.SyntaxKind.ProtectedKeyword val syntaxKindStatic = ts.SyntaxKind.StaticKeyword + val syntaxKindExport = ts.SyntaxKind.ExportKeyword val objectFlagsAnonymous = ts.ObjectFlags.Anonymous val objectFlagsMapped = ts.ObjectFlags.Mapped val symbolFlagsOptional = ts.SymbolFlags.Optional // this flag is only for checking optional members of interfaces @@ -126,6 +127,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isOptionalParameter = checker.isOptionalParameter(node) lazy val isStatic = if (modifiers.isUndefined) false else modifiers.foldLeft(false)((s, t) => t.isStatic) + lazy val isExported = if (modifiers.isUndefined) false + else modifiers.foldLeft(false)((s, t) => t.isExported) lazy val typeNode = TSTypeObject(checker.getTypeFromTypeNode(node)) lazy val typeAtLocation = TSTypeObject(checker.getTypeAtLocation(node)) @@ -151,6 +154,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS else declarations.get(0) lazy val locals = TSSymbolMap(node.locals) + lazy val exports = TSSymbolMap(node.symbol.exports) lazy val returnType = TSTypeObject(checker.getReturnTypeOfSignature(node)) lazy val `type` = TSNodeObject(node.selectDynamic("type")) @@ -176,6 +180,7 @@ class TSTokenObject(token: js.Dynamic)(implicit checker: TSTypeChecker) extends lazy val isPrivate = kind == TypeScript.syntaxKindPrivate lazy val isProtected = kind == TypeScript.syntaxKindProtected lazy val isStatic = kind == TypeScript.syntaxKindStatic + lazy val isExported = kind == TypeScript.syntaxKindExport lazy val typeNode = TSTypeObject(checker.getTypeFromTypeNode(token)) lazy val text = token.text.toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index 7c2ac97a0..6f7e1f1ca 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -68,6 +68,8 @@ class TSSymbolMap(map: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAn def foreach(f: TSSymbolObject => Unit): Unit = if (!isUndefined) map.forEach({(s: js.Dynamic) => f(TSSymbolObject(s))}) + + def contains(name: String): Boolean = map.has(name) } object TSSymbolMap { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 3db8d82a9..521685a75 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -5,32 +5,34 @@ import types._ import mlscript.utils._ class TSNamespace(name: String, parent: Option[TSNamespace]) { - private val subSpace = HashMap[String, TSNamespace]() - private val members = HashMap[String, TSType]() + // name -> (namespace/type, export) + private val subSpace = HashMap[String, (TSNamespace, Boolean)]() + private val members = HashMap[String, (TSType, Boolean)]() // write down the order of members // easier to check the output one by one private val order = ListBuffer.empty[Either[String, String]] - def derive(name: String): TSNamespace = - if (subSpace.contains(name)) subSpace(name) // if the namespace has appeared in another file, just return it + def derive(name: String, exported: Boolean): TSNamespace = + if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it else { val sub = new TSNamespace(name, Some(this)) - subSpace.put(name, sub) + subSpace.put(name, (sub, exported)) order += Left(name) sub } - def put(name: String, tp: TSType): Unit = + def put(name: String, tp: TSType, exported: Boolean): Unit = if (!members.contains(name)) { order += Right(name) - members.put(name, tp) + members.put(name, (tp, exported)) } - else members.update(name, tp) + else members.update(name, (tp, exported)) def get(name: String): TSType = - members.getOrElse(name, - if (!parent.isEmpty) parent.get.get(name) else throw new Exception(s"member $name not found.")) + if (members.contains(name)) members(name)._1 + else if (!parent.isEmpty) parent.get.get(name) + else throw new Exception(s"member $name not found.") def containsMember(name: String, searchParent: Boolean = true): Boolean = if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) @@ -38,24 +40,28 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { case Left(subName) => { - writer.writeln(s"${indent}declare module $subName {") - subSpace(subName).generate(writer, indent + " ") + val ss = subSpace(subName) + val exp = if (ss._2) "export " else "" + writer.writeln(s"${indent}${exp}declare module $subName {") + ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") } case Right(name) => { - val mem = members(name) + val (mem, exp) = members(name) mem match { case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name)(indent)) + writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, name)(indent)) + writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, name)(indent)) - case _: TSClassType => writer.writeln(Converter.convert(mem)(indent)) + writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) + case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) case TSInterfaceType(name, _, _, _) if (name =/= "") => - writer.writeln(Converter.convert(mem)(indent)) - case _: TSTypeAlias => writer.writeln(Converter.convert(mem)(indent)) - case _ => writer.writeln(s"${indent}let $name: ${Converter.convert(mem)("")}") + writer.writeln(Converter.convert(mem, exp)(indent)) + case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) + case _ => + if (exp) writer.writeln(s"${indent}export let $name: ${Converter.convert(mem)("")}") + else writer.writeln(s"${indent}let $name: ${Converter.convert(mem)("")}") } } }) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 131e0aefd..e16afe673 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -12,10 +12,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces - addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName)(global) + addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) else if (!nodeObject.declarationList.isUndefined) { // for variables val decNode = nodeObject.declarationList.declaration - addNodeIntoNamespace(decNode, decNode.symbol.escapedName)(global) + addNodeIntoNamespace(decNode, decNode.symbol.escapedName, decNode.isExported)(global) } } }) @@ -173,15 +173,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType getTypeParameters(node), getHeritageList(node), getConstructorList(node.members)) else TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), getHeritageList(node)) - private def parseNamespaceLocals(map: TSSymbolMap)(implicit ns: TSNamespace) = + private def parseNamespaceLocals(map: TSSymbolMap, exports: TSSymbolMap)(implicit ns: TSNamespace) = map.foreach((sym) => { val node = sym.declaration - if (!node.isToken) - addNodeIntoNamespace(node, sym.escapedName, if (node.isFunctionLike) Some(sym.declarations) else None) + val name = sym.escapedName + if (!node.isToken) // TODO: export variables? + addNodeIntoNamespace(node, name, false /*exports.contains(name)*/, if (node.isFunctionLike) Some(sym.declarations) else None) }) private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = - if (!ns.containsMember(name, false)) ns.put(name, fun) + if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported) else { val old = ns.get(name) val res = old match { @@ -197,12 +198,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case _ => old } - ns.put(name, res) + ns.put(name, res, node.isExported) } // overload functions in a sub-namespace need to provide an overload array // because the namespace merely exports symbols rather than node objects themselves - private def addNodeIntoNamespace(node: TSNodeObject, name: String, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = + private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = if (node.isFunctionLike) overload match { case None => addFunctionIntoNamespace(getFunctionType(node), node, name) @@ -213,20 +214,19 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } } else if (node.isClassDeclaration) - ns.put(name, parseMembers(name, node, true)) + ns.put(name, parseMembers(name, node, true), exported) else if (node.isInterfaceDeclaration) - ns.put(name, parseMembers(name, node, false)) + ns.put(name, parseMembers(name, node, false), exported) else if (node.isTypeAliasDeclaration) - ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node))) + ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node)), exported) else if (node.isObjectLiteral) - ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List())) - else if (node.isVariableDeclaration) - ns.put(name, getMemberType(node)) + ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()), exported) + else if (node.isVariableDeclaration) ns.put(name, getMemberType(node), exported) else if (node.isNamespace) parseNamespace(node) private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = - parseNamespaceLocals(node.locals)(ns.derive(node.symbol.escapedName)) + parseNamespaceLocals(node.locals, node.exports)(ns.derive(node.symbol.escapedName, node.isExported)) } object TSSourceFile { diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 5fc0870f8..84921c5ba 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -25,18 +25,18 @@ object Converter { else name } - def generateFunDeclaration(tsType: TSType, name: String)(implicit indent: String = ""): String = tsType match { + def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" - s"${indent}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + s"${indent}${if (exported) "export " else ""}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name)} ${overload.warning}" - case inter: TSIntersectionType => s"${indent}fun ${name}: ${Converter.convert(inter)}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, exported)} ${overload.warning}" + case inter: TSIntersectionType => s"${indent}${if (exported) "export " else ""}fun ${name}: ${Converter.convert(inter)}" case _ => throw new AssertionError("non-function type is not allowed.") } - def convert(tsType: TSType)(implicit indent: String = ""): String = tsType match { + def convert(tsType: TSType, exported: Boolean = false)(implicit indent: String = ""): String = tsType match { case TSPrimitiveType(typeName) => primitiveName(typeName) case TSReferenceType(name) => name case TSFunctionType(params, res, _) => @@ -51,9 +51,9 @@ object Converter { case TSEnumType => "int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members case TSInterfaceType(name, members, typeVars, parents) => - convertRecord(s"trait $name", members, typeVars, parents, Map(), List())(indent) + convertRecord(s"trait $name", members, typeVars, parents, Map(), List(), exported)(indent) case TSClassType(name, members, statics, typeVars, parents, cons) => - convertRecord(s"class $name", members, typeVars, parents, statics, cons)(indent) + convertRecord(s"class $name", members, typeVars, parents, statics, cons, exported)(indent) case TSSubstitutionType(base, applied) => s"${base}<${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}>" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${name}: ${convert(tp)}" @@ -66,13 +66,13 @@ object Converter { } private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], - parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType])(implicit indent: String) = { + parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType], exported: Boolean)(implicit indent: String) = { val allRecs = members.toList.map((m) => m._2.modifier match { case Public => if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { - case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" - case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" + case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" case _ => s"${indent} let ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members @@ -98,12 +98,13 @@ object Converter { if (constructorList.isEmpty) "()" else s"(${constructorList.map(p => s"${convert(p)("")}").reduceLeft((res, p) => s"$res, $p")})" + val exp = if (exported) "export " else "" val inheritance = if (parents.isEmpty) constructor else parents.foldLeft(s"$constructor extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) - if (typeVars.isEmpty) s"${indent}declare $typeName$inheritance $body" + if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" else - s"${indent}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints + s"${indent}${exp}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi new file mode 100644 index 000000000..a03f5a26e --- /dev/null +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -0,0 +1,38 @@ +:NewParser +:NewDefs +:NoJS +:AllowTypeErrors +export declare module Foo { + export fun Baz(aa: string): IBar + declare trait IBar() { + let a: string + } + declare class Bar() extends IBar { + let a: string + } + let baz: IBar +} +//│ ╔══[ERROR] type identifier not found: IBar +//│ ║ l.6: export fun Baz(aa: string): IBar +//│ ╙── ^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.7: declare trait IBar() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.8: let a: string +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.9: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Cannot inherit from a type alias +//│ ║ l.10: declare class Bar() extends IBar { +//│ ╙── ^^^^ +//│ ╔══[ERROR] trait IBar cannot be used as a type +//│ ║ l.13: let baz: IBar +//│ ╙── ^^^^ +//│ module Foo() { +//│ class Bar() { +//│ let a: string +//│ } +//│ fun Baz: (aa: string,) -> error +//│ trait IBar() +//│ let baz: IBar +//│ } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index d9bba5015..4d5dc5dd2 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -36,10 +36,10 @@ declare class OR() extends O { fun xx(x: R): R } declare module Five { - declare class ROTK() { + export declare class ROTK() { let wu: string } - declare class Y() extends Five.ROTK {} + export declare class Y() extends Five.ROTK {} } declare class Y() extends Five.ROTK {} //│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) @@ -86,8 +86,8 @@ declare class Y() extends Five.ROTK {} //│ ║ l.35: declare class OR() extends O { //│ ╙── ^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.42: declare class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.42: export declare class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] Unsupported parent specification //│ ║ l.44: declare class Y() extends Five.ROTK {} //│ ╙── ^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index 8e1be6c66..cf1ab701b 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -9,9 +9,9 @@ declare trait AnotherBase() { let y: string } declare module N { - fun f(): unit - fun g(): unit - fun h(): unit + export fun f(): unit + export fun g(): unit + export fun h(): unit } fun multi2(x: string): string fun multi4(): unit diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index f3db6082a..ae61c24c1 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -3,29 +3,29 @@ :NoJS :AllowTypeErrors declare module N1 { - fun f(x: anything): number + export fun f(x: anything): number fun ff(y: anything): number - declare class C() { + export declare class C() { fun f(): unit } declare trait I() { fun f(): number } - declare module N2 { - fun fff(x: (false) | (true)): number + export declare module N2 { + export fun fff(x: (false) | (true)): number fun gg(c: N1.C): N1.C declare class BBB() extends N1.C {} } } declare module AA { - fun f(x: anything): string - declare class C() { + export fun f(x: anything): string + export declare class C() { fun f(): unit } - declare trait I() { + export declare trait I() { fun f(): number } - declare module N2 { + export declare module N2 { } } fun f1(x: N1.C): N1.C @@ -47,8 +47,8 @@ fun f2(x: AA.C): AA.C //│ ║ l.17: declare class BBB() extends N1.C {} //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: declare trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.25: export declare trait I() { +//│ ║ ^^^^^^^^^^^ //│ ║ l.26: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.27: } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 3d39c776d..db896bc5f 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -18,7 +18,7 @@ fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) = fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ declare module XX { - fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ + export fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } declare class WWW() { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index 16777a776..daf9912c5 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -9,7 +9,7 @@ let bar: false declare class FooBar() {} let fb: FooBar declare module ABC { - declare class DEF() {} + export declare class DEF() {} } let d: ABC.DEF declare module DD { diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index fca24b7c3..3b9e2500f 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -18,25 +18,26 @@ object TSTypeGenerationTest { private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" private val testsData = List( - (Seq("Array.ts"), "Array.mlsi"), - (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), - (Seq("ClassMember.ts"), "ClassMember.mlsi"), - (Seq("Dec.d.ts"), "Dec.mlsi"), - (Seq("Enum.ts"), "Enum.mlsi"), - (Seq("ES5.d.ts"), "ES5.mlsi"), - (Seq("Heritage.ts"), "Heritage.mlsi"), - (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), - (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), - (Seq("Intersection.ts"), "Intersection.mlsi"), - (Seq("Literal.ts"), "Literal.mlsi"), - (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), - (Seq("Namespace.ts"), "Namespace.mlsi"), - (Seq("Optional.ts"), "Optional.mlsi"), - (Seq("Overload.ts"), "Overload.mlsi"), - (Seq("Tuple.ts"), "Tuple.mlsi"), - (Seq("Type.ts"), "Type.mlsi"), - (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), - (Seq("Union.ts"), "Union.mlsi"), - (Seq("Variables.ts"), "Variables.mlsi"), + // (Seq("Array.ts"), "Array.mlsi"), + // (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), + // (Seq("ClassMember.ts"), "ClassMember.mlsi"), + // (Seq("Dec.d.ts"), "Dec.mlsi"), + // (Seq("Enum.ts"), "Enum.mlsi"), + // (Seq("ES5.d.ts"), "ES5.mlsi"), + (Seq("Export.ts"), "Export.mlsi"), + // (Seq("Heritage.ts"), "Heritage.mlsi"), + // (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), + // (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), + // (Seq("Intersection.ts"), "Intersection.mlsi"), + // (Seq("Literal.ts"), "Literal.mlsi"), + // (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), + // (Seq("Namespace.ts"), "Namespace.mlsi"), + // (Seq("Optional.ts"), "Optional.mlsi"), + // (Seq("Overload.ts"), "Overload.mlsi"), + // (Seq("Tuple.ts"), "Tuple.mlsi"), + // (Seq("Type.ts"), "Type.mlsi"), + // (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), + // (Seq("Union.ts"), "Union.mlsi"), + // (Seq("Variables.ts"), "Variables.mlsi"), ) } diff --git a/ts2mls/js/src/test/typescript/Export.ts b/ts2mls/js/src/test/typescript/Export.ts new file mode 100644 index 000000000..886423153 --- /dev/null +++ b/ts2mls/js/src/test/typescript/Export.ts @@ -0,0 +1,17 @@ +export namespace Foo { + interface IBar { + a: string + } + + export class Bar implements IBar { + a = "bar" + } + + export function Baz(aa: string): IBar { + return { + a: aa + } + } + + export const baz = Baz("baz") +} From 27df8d4a1c5d4d01141c174f9ddaf414b9abc679 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 25 Apr 2023 16:32:04 +0800 Subject: [PATCH 047/202] Remove unexported variables and functions, and fix nested exported types --- .../src/main/scala/ts2mls/TSNamespace.scala | 25 ++++----- .../js/src/main/scala/ts2mls/TSProgram.scala | 6 +-- .../src/main/scala/ts2mls/TSSourceFile.scala | 4 +- .../main/scala/ts2mls/types/Converter.scala | 12 ++--- ts2mls/js/src/test/diff/ES5.mlsi | 54 +++++++++---------- ts2mls/js/src/test/diff/Export.mlsi | 12 ++--- ts2mls/js/src/test/diff/MultiFiles.mlsi | 6 +-- ts2mls/js/src/test/diff/Namespace.mlsi | 30 ++++------- ts2mls/js/src/test/diff/Overload.mlsi | 2 +- ts2mls/js/src/test/diff/Type.mlsi | 12 ++--- ts2mls/js/src/test/diff/Variables.mlsi | 2 - .../scala/ts2mls/TSTypeGenerationTests.scala | 42 +++++++-------- 12 files changed, 97 insertions(+), 110 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 521685a75..fb38b60d1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -4,7 +4,9 @@ import scala.collection.mutable.{HashMap, ListBuffer} import types._ import mlscript.utils._ -class TSNamespace(name: String, parent: Option[TSNamespace]) { +// even though we don't use `export` keywords for some top-level variables/functions +// we still want to keep them (e.g., es5.d.ts built-in) +class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: Boolean) { // name -> (namespace/type, export) private val subSpace = HashMap[String, (TSNamespace, Boolean)]() private val members = HashMap[String, (TSType, Boolean)]() @@ -16,7 +18,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def derive(name: String, exported: Boolean): TSNamespace = if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it else { - val sub = new TSNamespace(name, Some(this)) + val sub = new TSNamespace(name, Some(this), false) // not a top level module! subSpace.put(name, (sub, exported)) order += Left(name) sub @@ -49,24 +51,23 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { case Right(name) => { val (mem, exp) = members(name) mem match { - case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) - case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) - case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) + case inter: TSIntersectionType if (exp || keepUnexportedVars) => // overloaded functions + writer.writeln(Converter.generateFunDeclaration(inter, name)(indent)) + case f: TSFunctionType if (exp || keepUnexportedVars) => + writer.writeln(Converter.generateFunDeclaration(f, name)(indent)) + case overload: TSIgnoredOverload if (exp || keepUnexportedVars) => + writer.writeln(Converter.generateFunDeclaration(overload, name)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) case TSInterfaceType(name, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) - case _ => - if (exp) writer.writeln(s"${indent}export let $name: ${Converter.convert(mem)("")}") - else writer.writeln(s"${indent}let $name: ${Converter.convert(mem)("")}") + case _ if (exp || keepUnexportedVars) => writer.writeln(s"${indent}let $name: ${Converter.convert(mem)("")}") + case _ => () // if a variable/function is not exported, there is no need to add it into the interface file. } } }) } object TSNamespace { - def apply() = new TSNamespace("", None) // global namespace + def apply(keepUnexportedVars: Boolean) = new TSNamespace("", None, keepUnexportedVars) // global namespace } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 631e08df6..7d434af72 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -4,13 +4,13 @@ import scala.scalajs.js import js.DynamicImplicits._ import ts2mls.types._ -class TSProgram(filenames: Seq[String]) { +class TSProgram(filenames: Seq[String], keepUnexportedVars: Boolean) { private val program = TypeScript.createProgram(filenames) // check if files exist filenames.foreach((fn) => if (!program.fileExists(fn)) throw new Exception(s"file ${fn} doesn't exist.")) - val globalNamespace = TSNamespace() + val globalNamespace = TSNamespace(keepUnexportedVars) implicit val checker = TSTypeChecker(program.getTypeChecker()) filenames.foreach(filename => TSSourceFile(program.getSourceFile(filename), globalNamespace)) @@ -19,5 +19,5 @@ class TSProgram(filenames: Seq[String]) { } object TSProgram { - def apply(filenames: Seq[String]) = new TSProgram(filenames) + def apply(filenames: Seq[String], keepUnexportedVars: Boolean) = new TSProgram(filenames, keepUnexportedVars) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index e16afe673..407a1a664 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -177,8 +177,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType map.foreach((sym) => { val node = sym.declaration val name = sym.escapedName - if (!node.isToken) // TODO: export variables? - addNodeIntoNamespace(node, name, false /*exports.contains(name)*/, if (node.isFunctionLike) Some(sym.declarations) else None) + if (!node.isToken) + addNodeIntoNamespace(node, name, exports.contains(name), if (node.isFunctionLike) Some(sym.declarations) else None) }) private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 84921c5ba..3bf028f67 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -25,14 +25,14 @@ object Converter { else name } - def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { + def generateFunDeclaration(tsType: TSType, name: String)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" - s"${indent}${if (exported) "export " else ""}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + s"${indent}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, exported)} ${overload.warning}" - case inter: TSIntersectionType => s"${indent}${if (exported) "export " else ""}fun ${name}: ${Converter.convert(inter)}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name)} ${overload.warning}" + case inter: TSIntersectionType => s"${indent}fun ${name}: ${Converter.convert(inter)}" case _ => throw new AssertionError("non-function type is not allowed.") } @@ -71,8 +71,8 @@ object Converter { case Public => if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { - case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" - case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" + case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" case _ => s"${indent} let ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 0e80ef7d5..8deaaf97d 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -371,7 +371,7 @@ declare trait Float64ArrayConstructor() { let BYTES_PER_ELEMENT: number } declare module Intl { - declare trait CollatorOptions() { + export declare trait CollatorOptions() { let sensitivity: (string) | (undefined) let ignorePunctuation: ((false) | (true)) | (undefined) let usage: (string) | (undefined) @@ -379,7 +379,7 @@ declare module Intl { let numeric: ((false) | (true)) | (undefined) let caseFirst: (string) | (undefined) } - declare trait ResolvedCollatorOptions() { + export declare trait ResolvedCollatorOptions() { let sensitivity: string let ignorePunctuation: (false) | (true) let usage: string @@ -388,11 +388,11 @@ declare module Intl { let caseFirst: string let collation: string } - declare trait Collator() { + export declare trait Collator() { fun compare(x: string, y: string): number fun resolvedOptions(): Intl.ResolvedCollatorOptions } - declare trait NumberFormatOptions() { + export declare trait NumberFormatOptions() { let minimumSignificantDigits: (number) | (undefined) let useGrouping: ((false) | (true)) | (undefined) let style: (string) | (undefined) @@ -404,7 +404,7 @@ declare module Intl { let maximumSignificantDigits: (number) | (undefined) let minimumFractionDigits: (number) | (undefined) } - declare trait ResolvedNumberFormatOptions() { + export declare trait ResolvedNumberFormatOptions() { let numberingSystem: string let minimumSignificantDigits: (number) | (undefined) let useGrouping: (false) | (true) @@ -416,11 +416,11 @@ declare module Intl { let maximumSignificantDigits: (number) | (undefined) let minimumFractionDigits: number } - declare trait NumberFormat() { + export declare trait NumberFormat() { fun format(value: number): string fun resolvedOptions(): Intl.ResolvedNumberFormatOptions } - declare trait DateTimeFormatOptions() { + export declare trait DateTimeFormatOptions() { let minute: ((string) | (string)) | (undefined) let year: ((string) | (string)) | (undefined) let hour: ((string) | (string)) | (undefined) @@ -435,7 +435,7 @@ declare module Intl { let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) let era: (((string) | (string)) | (string)) | (undefined) } - declare trait ResolvedDateTimeFormatOptions() { + export declare trait ResolvedDateTimeFormatOptions() { let numberingSystem: string let minute: (string) | (undefined) let year: (string) | (undefined) @@ -451,7 +451,7 @@ declare module Intl { let timeZoneName: (string) | (undefined) let era: (string) | (undefined) } - declare trait DateTimeFormat() { + export declare trait DateTimeFormat() { fun format(date: ((number) | (Date)) | (undefined)): string fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } @@ -647,8 +647,8 @@ declare module Intl { //│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.374: declare trait CollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.374: export declare trait CollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.375: let sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.376: let ignorePunctuation: ((false) | (true)) | (undefined) @@ -664,8 +664,8 @@ declare module Intl { //│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.382: declare trait ResolvedCollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.382: export declare trait ResolvedCollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.383: let sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.384: let ignorePunctuation: (false) | (true) @@ -686,8 +686,8 @@ declare module Intl { //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.391: declare trait Collator() { -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.391: export declare trait Collator() { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.392: fun compare(x: string, y: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions @@ -695,8 +695,8 @@ declare module Intl { //│ ║ l.394: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: declare trait NumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.395: export declare trait NumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.396: let minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.397: let useGrouping: ((false) | (true)) | (undefined) @@ -720,8 +720,8 @@ declare module Intl { //│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.407: declare trait ResolvedNumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.407: export declare trait ResolvedNumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.408: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.409: let minimumSignificantDigits: (number) | (undefined) @@ -748,8 +748,8 @@ declare module Intl { //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.419: declare trait NumberFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.419: export declare trait NumberFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.420: fun format(value: number): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions @@ -757,8 +757,8 @@ declare module Intl { //│ ║ l.422: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.423: declare trait DateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.423: export declare trait DateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.424: let minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.425: let year: ((string) | (string)) | (undefined) @@ -788,8 +788,8 @@ declare module Intl { //│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.438: declare trait ResolvedDateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.438: export declare trait ResolvedDateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.439: let numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.440: let minute: (string) | (undefined) @@ -827,8 +827,8 @@ declare module Intl { //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.454: declare trait DateTimeFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.454: export declare trait DateTimeFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index a03f5a26e..e7dc5425e 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -3,18 +3,18 @@ :NoJS :AllowTypeErrors export declare module Foo { - export fun Baz(aa: string): IBar + fun Baz(aa: string): IBar declare trait IBar() { let a: string } - declare class Bar() extends IBar { + export declare class Bar() extends IBar { let a: string } let baz: IBar } //│ ╔══[ERROR] type identifier not found: IBar -//│ ║ l.6: export fun Baz(aa: string): IBar -//│ ╙── ^^^^ +//│ ║ l.6: fun Baz(aa: string): IBar +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.7: declare trait IBar() { //│ ║ ^^^^^^^^^^^^^^ @@ -23,8 +23,8 @@ export declare module Foo { //│ ║ l.9: } //│ ╙── ^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.10: declare class Bar() extends IBar { -//│ ╙── ^^^^ +//│ ║ l.10: export declare class Bar() extends IBar { +//│ ╙── ^^^^ //│ ╔══[ERROR] trait IBar cannot be used as a type //│ ║ l.13: let baz: IBar //│ ╙── ^^^^ diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index cf1ab701b..8e1be6c66 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -9,9 +9,9 @@ declare trait AnotherBase() { let y: string } declare module N { - export fun f(): unit - export fun g(): unit - export fun h(): unit + fun f(): unit + fun g(): unit + fun h(): unit } fun multi2(x: string): string fun multi4(): unit diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index ae61c24c1..8c79672da 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -3,8 +3,7 @@ :NoJS :AllowTypeErrors declare module N1 { - export fun f(x: anything): number - fun ff(y: anything): number + fun f(x: anything): number export declare class C() { fun f(): unit } @@ -12,13 +11,12 @@ declare module N1 { fun f(): number } export declare module N2 { - export fun fff(x: (false) | (true)): number - fun gg(c: N1.C): N1.C + fun fff(x: (false) | (true)): number declare class BBB() extends N1.C {} } } declare module AA { - export fun f(x: anything): string + fun f(x: anything): string export declare class C() { fun f(): unit } @@ -31,27 +29,21 @@ declare module AA { fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: declare trait I() { +//│ ║ l.10: declare trait I() { //│ ║ ^^^^^^^^^^^ -//│ ║ l.12: fun f(): number +//│ ║ l.11: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.13: } +//│ ║ l.12: } //│ ╙── ^^^ -//│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.16: fun gg(c: N1.C): N1.C -//│ ╙── ^^ -//│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.16: fun gg(c: N1.C): N1.C -//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.17: declare class BBB() extends N1.C {} +//│ ║ l.15: declare class BBB() extends N1.C {} //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: export declare trait I() { +//│ ║ l.23: export declare trait I() { //│ ║ ^^^^^^^^^^^ -//│ ║ l.26: fun f(): number +//│ ║ l.24: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: } +//│ ║ l.25: } //│ ╙── ^^^ //│ module N1() { //│ class C() { @@ -61,10 +53,8 @@ fun f2(x: AA.C): AA.C //│ module N2() { //│ class BBB() //│ fun fff: (x: bool,) -> number -//│ fun gg: (c: error,) -> error //│ } //│ fun f: (x: anything,) -> number -//│ fun ff: (y: anything,) -> number //│ } //│ module AA() { //│ class C() { diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index db896bc5f..3d39c776d 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -18,7 +18,7 @@ fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) = fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ declare module XX { - export fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ + fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } declare class WWW() { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 64afb20da..9add306b6 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -21,7 +21,6 @@ declare class ABC() {} type DEF = ABC type TP = (A, B, C, ) declare module NA { - fun fb(b: string): unit type B = string } declare class NC() { @@ -65,19 +64,19 @@ fun some(a: A): (None) | (Some) //│ ║ l.17: type I3 = (I1) & (I2) //│ ╙── ^^^^ //│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ║ l.31: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ ╔══[ERROR] type identifier not found: A -//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ║ l.31: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ ╔══[ERROR] trait None cannot be used as a type -//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ║ l.31: fun some(a: A): (None) | (Some) //│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Some cannot be used as a type -//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ║ l.31: fun some(a: A): (None) | (Some) //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: A -//│ ║ l.32: fun some(a: A): (None) | (Some) +//│ ║ l.31: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ trait None() //│ trait Some[A]() @@ -94,7 +93,6 @@ fun some(a: A): (None) | (Some) //│ type TP[A, B, C] = (A, B, C,) //│ module NA() { //│ type B = string -//│ fun fb: (b: string,) -> unit //│ } //│ class NC() { //│ let b: string diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index daf9912c5..a20bba14e 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -14,7 +14,6 @@ declare module ABC { let d: ABC.DEF declare module DD { let foo: number - let bar: number } //│ let URI: string //│ let URI2: string @@ -27,6 +26,5 @@ declare module DD { //│ } //│ let d: DEF //│ module DD() { -//│ let bar: number //│ let foo: number //│ } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 3b9e2500f..7dac66011 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -6,7 +6,7 @@ class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ testsData.foreach((data) => test(data._2) { - val program = TSProgram(tsPath(data._1)) + val program = TSProgram(tsPath(data._1), true) var writer = JSWriter(diffPath(data._2)) program.generate(writer) writer.close() @@ -18,26 +18,26 @@ object TSTypeGenerationTest { private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" private val testsData = List( - // (Seq("Array.ts"), "Array.mlsi"), - // (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), - // (Seq("ClassMember.ts"), "ClassMember.mlsi"), - // (Seq("Dec.d.ts"), "Dec.mlsi"), - // (Seq("Enum.ts"), "Enum.mlsi"), - // (Seq("ES5.d.ts"), "ES5.mlsi"), + (Seq("Array.ts"), "Array.mlsi"), + (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), + (Seq("ClassMember.ts"), "ClassMember.mlsi"), + (Seq("Dec.d.ts"), "Dec.mlsi"), + (Seq("Enum.ts"), "Enum.mlsi"), + (Seq("ES5.d.ts"), "ES5.mlsi"), (Seq("Export.ts"), "Export.mlsi"), - // (Seq("Heritage.ts"), "Heritage.mlsi"), - // (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), - // (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), - // (Seq("Intersection.ts"), "Intersection.mlsi"), - // (Seq("Literal.ts"), "Literal.mlsi"), - // (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), - // (Seq("Namespace.ts"), "Namespace.mlsi"), - // (Seq("Optional.ts"), "Optional.mlsi"), - // (Seq("Overload.ts"), "Overload.mlsi"), - // (Seq("Tuple.ts"), "Tuple.mlsi"), - // (Seq("Type.ts"), "Type.mlsi"), - // (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), - // (Seq("Union.ts"), "Union.mlsi"), - // (Seq("Variables.ts"), "Variables.mlsi"), + (Seq("Heritage.ts"), "Heritage.mlsi"), + (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), + (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), + (Seq("Intersection.ts"), "Intersection.mlsi"), + (Seq("Literal.ts"), "Literal.mlsi"), + (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), + (Seq("Namespace.ts"), "Namespace.mlsi"), + (Seq("Optional.ts"), "Optional.mlsi"), + (Seq("Overload.ts"), "Overload.mlsi"), + (Seq("Tuple.ts"), "Tuple.mlsi"), + (Seq("Type.ts"), "Type.mlsi"), + (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), + (Seq("Union.ts"), "Union.mlsi"), + (Seq("Variables.ts"), "Variables.mlsi"), ) } From eb287d8b0f5beaa9143bcffa74d14821b15a54c8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 27 Apr 2023 09:17:42 +0800 Subject: [PATCH 048/202] Update helpers --- shared/src/main/scala/mlscript/helpers.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index 49a5fb1e1..0943abbac 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -391,7 +391,8 @@ trait NuDeclImpl extends Located { self: NuDecl => val exportLoc: Opt[Loc] def isDecl: Bool = declareLoc.nonEmpty def declStr: Str = if (isDecl) "declare " else "" - def isExported: Bool = isDecl || exportLoc.isDefined + def isExported: Bool = exportLoc.isDefined + def exportStr: Str = if (isExported) "export " else "" val nameVar: Var = self match { case td: NuTypeDef => td.nme.toVar case fd: NuFunDef => fd.nme From c377401a3534e37040c8564a7034a983c929fce4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 27 Apr 2023 09:40:50 +0800 Subject: [PATCH 049/202] Use val in ts2mls --- .../src/main/scala/mlscript/NewParser.scala | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 21 +- .../main/scala/ts2mls/types/Converter.scala | 10 +- ts2mls/js/src/test/diff/Array.mlsi | 6 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 6 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 4 +- ts2mls/js/src/test/diff/Dec.mlsi | 6 +- ts2mls/js/src/test/diff/ES5.mlsi | 870 +++++++++--------- ts2mls/js/src/test/diff/Export.mlsi | 12 +- ts2mls/js/src/test/diff/Heritage.mlsi | 18 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 28 +- ts2mls/js/src/test/diff/Intersection.mlsi | 8 +- ts2mls/js/src/test/diff/Literal.mlsi | 4 +- ts2mls/js/src/test/diff/MultiFiles.mlsi | 10 +- ts2mls/js/src/test/diff/Namespace.mlsi | 28 +- ts2mls/js/src/test/diff/Optional.mlsi | 10 +- ts2mls/js/src/test/diff/Overload.mlsi | 4 +- ts2mls/js/src/test/diff/Tuple.mlsi | 2 +- ts2mls/js/src/test/diff/Type.mlsi | 30 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 6 +- ts2mls/js/src/test/diff/Variables.mlsi | 20 +- 21 files changed, 560 insertions(+), 545 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 71a85e004..afa59dbe5 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -403,7 +403,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case ModifierSet(mods, (KEYWORD(kwStr @ ("fun" | "val" | "let")), l0) :: c) => // TODO support rec? consume val (isDecl, mods2) = mods.handle("declare") - val ( isExported, mods3) = mods2.handle("export") + val (isExported, mods3) = mods2.handle("export") mods3.done val isLetRec = yeetSpaces match { case (KEYWORD("rec"), l1) :: _ if kwStr === "let" => diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index fb38b60d1..d49b3d161 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -39,30 +39,31 @@ class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: def containsMember(name: String, searchParent: Boolean = true): Boolean = if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) + + private def expStr(exp: Boolean) = if (exp || keepUnexportedVars) "export " else "" + def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { case Left(subName) => { val ss = subSpace(subName) - val exp = if (ss._2) "export " else "" - writer.writeln(s"${indent}${exp}declare module $subName {") + writer.writeln(s"${indent}${expStr(ss._2)}declare module $subName {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") } case Right(name) => { val (mem, exp) = members(name) mem match { - case inter: TSIntersectionType if (exp || keepUnexportedVars) => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name)(indent)) - case f: TSFunctionType if (exp || keepUnexportedVars) => - writer.writeln(Converter.generateFunDeclaration(f, name)(indent)) - case overload: TSIgnoredOverload if (exp || keepUnexportedVars) => - writer.writeln(Converter.generateFunDeclaration(overload, name)(indent)) + case inter: TSIntersectionType => // overloaded functions + writer.writeln(Converter.generateFunDeclaration(inter, name, exp || keepUnexportedVars)(indent)) + case f: TSFunctionType => + writer.writeln(Converter.generateFunDeclaration(f, name, exp || keepUnexportedVars)(indent)) + case overload: TSIgnoredOverload => + writer.writeln(Converter.generateFunDeclaration(overload, name, exp || keepUnexportedVars)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) case TSInterfaceType(name, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) - case _ if (exp || keepUnexportedVars) => writer.writeln(s"${indent}let $name: ${Converter.convert(mem)("")}") - case _ => () // if a variable/function is not exported, there is no need to add it into the interface file. + case _ => writer.writeln(s"${indent}${expStr(exp || keepUnexportedVars)}val $name: ${Converter.convert(mem)("")}") } } }) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 3bf028f67..945e1a816 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -25,13 +25,13 @@ object Converter { else name } - def generateFunDeclaration(tsType: TSType, name: String)(implicit indent: String = ""): String = tsType match { + def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" s"${indent}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name)} ${overload.warning}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, false)} ${overload.warning}" case inter: TSIntersectionType => s"${indent}fun ${name}: ${Converter.convert(inter)}" case _ => throw new AssertionError("non-function type is not allowed.") } @@ -71,9 +71,9 @@ object Converter { case Public => if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { - case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" - case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1)(indent + " ")}\n" - case _ => s"${indent} let ${escapeIdent(m._1)}: ${convert(m._2)}\n" + case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _ => s"${indent} val ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members }) ::: diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index f31874727..e4c19d0b3 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -8,7 +8,7 @@ fun first2(fs: MutArray<(number) => number>): (number) => number fun doEs(e: MutArray): MutArray declare class C() {} declare trait I() { - let i: number + val i: number } fun doCs(c: MutArray): MutArray fun doIs(i: MutArray): MutArray @@ -17,14 +17,14 @@ fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> fun translate(x: MutArray): MutArray fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> declare class Temp() { - let x: T + val x: T } fun ta(ts: MutArray>): MutArray> fun tat(ts: MutArray>): MutArray> //│ ╔══[ERROR] traits are not yet supported //│ ║ l.10: declare trait I() { //│ ║ ^^^^^^^^^^^ -//│ ║ l.11: let i: number +//│ ║ l.11: val i: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.12: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 26bdfa103..7bc0f66f2 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -17,12 +17,12 @@ fun create(): object fun pa(x: number): number fun wtf(x: anything): unit declare class Foooooo() { - let ooooooo: number + val ooooooo: number } fun inn(f: Foooooo): unit fun out1(): Foooooo declare trait Barrrrrrrrr() { - let rrrrrrr: number + val rrrrrrr: number } fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr @@ -32,7 +32,7 @@ fun out2(): Barrrrrrrrr //│ ╔══[ERROR] traits are not yet supported //│ ║ l.24: declare trait Barrrrrrrrr() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: let rrrrrrr: number +//│ ║ l.25: val rrrrrrr: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.26: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 5aff4c680..173695a1b 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -3,7 +3,7 @@ :NoJS :AllowTypeErrors declare class Student(s: string, age: number) { - let name: string + val name: string fun isFriend(other: Student): (false) | (true) fun addScore(sub: string, score: number): unit fun getID(): number @@ -16,7 +16,7 @@ declare class EZ() { } declare class Outer() { declare class Inner() { - let a: number + val a: number } } declare class TTT() { diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 52c4b6b67..9c78ed209 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -5,17 +5,17 @@ fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string declare trait Get() { - let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> + val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } declare class Person(name: string, age: number) { fun getName(id: number): string } -declare module OOO { +export declare module OOO { } //│ ╔══[ERROR] traits are not yet supported //│ ║ l.7: declare trait Get() { //│ ║ ^^^^^^^^^^^^^ -//│ ║ l.8: let __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> +//│ ║ l.8: val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.9: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 8deaaf97d..7e74bfd12 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -2,8 +2,8 @@ :NewDefs :NoJS :AllowTypeErrors -let NaN: number -let Infinity: number +export val NaN: number +export val Infinity: number fun eval(x: string): anything fun parseInt(string: string, radix: (number) | (undefined)): number fun parseFloat(string: string): number @@ -21,48 +21,48 @@ declare trait Symbol() { } type PropertyKey = ((string) | (number)) | (Symbol) declare trait PropertyDescriptor() { - let configurable: ((false) | (true)) | (undefined) - let set: ((anything) => unit) | (undefined) - let enumerable: ((false) | (true)) | (undefined) - let get: (unit => anything) | (undefined) - let writable: ((false) | (true)) | (undefined) - let value: (anything) | (undefined) + val configurable: ((false) | (true)) | (undefined) + val set: ((anything) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (unit => anything) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (anything) | (undefined) } declare trait PropertyDescriptorMap() { - let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> + val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } declare trait Object() { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) fun valueOf(): Object fun toLocaleString(): string - let constructor: Function + val constructor: Function fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } declare trait ObjectConstructor() { - let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> + val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> fun getOwnPropertyNames(o: anything): MutArray fun isFrozen(o: anything): (false) | (true) fun getPrototypeOf(o: anything): anything fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T - let prototype: Object + val prototype: Object fun isSealed(o: anything): (false) | (true) fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T fun preventExtensions(o: T): T - let create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) + val create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ - let __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> + val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor fun seal(o: T): T fun keys(o: object): MutArray fun isExtensible(o: anything): (false) | (true) } -let Function: FunctionConstructor +export val Function: FunctionConstructor declare trait FunctionConstructor() { - let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> - let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> - let prototype: Function + val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> + val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> + val prototype: Function } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> @@ -77,159 +77,159 @@ declare trait NewableFunction() extends Function { fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } declare trait IArguments() { - let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> - let length: number - let callee: Function + val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> + val length: number + val callee: Function } declare trait String() { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } declare trait StringConstructor() { - let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> - let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> - let prototype: String + val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> + val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> + val prototype: String fun fromCharCode(codes: MutArray): string } -let Boolean: BooleanConstructor +export val Boolean: BooleanConstructor declare trait BooleanConstructor() { - let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> - let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> - let prototype: Boolean + val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> + val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> + val prototype: Boolean } declare trait Number() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } declare trait NumberConstructor() { - let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> - let NaN: number - let MIN_VALUE: number - let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> - let NEGATIVE_INFINITY: number - let POSITIVE_INFINITY: number - let MAX_VALUE: number - let prototype: Number + val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> + val NaN: number + val MIN_VALUE: number + val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> + val NEGATIVE_INFINITY: number + val POSITIVE_INFINITY: number + val MAX_VALUE: number + val prototype: Number } declare trait TemplateStringsArray() extends ReadonlyArray { - let raw: ReadonlyArray + val raw: ReadonlyArray } declare trait ImportMeta() {} declare trait ImportCallOptions() { - let assert: (ImportAssertions) | (undefined) + val assert: (ImportAssertions) | (undefined) } declare trait ImportAssertions() { - let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> + val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } -let Math: Math +export val Math: Math declare trait Date() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } declare trait DateConstructor() { - let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> + val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number - let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> + val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> fun now(): number fun parse(s: string): number - let prototype: Date + val prototype: Date } declare trait RegExp() { fun test(string: string): (false) | (true) - let multiline: (false) | (true) - let source: string + val multiline: (false) | (true) + val source: string fun compile(pattern: string, flags: (string) | (undefined)): RegExp - let global: (false) | (true) - let lastIndex: number - let ignoreCase: (false) | (true) + val global: (false) | (true) + val lastIndex: number + val ignoreCase: (false) | (true) fun exec(string: string): RegExpExecArray } -let Error: ErrorConstructor +export val Error: ErrorConstructor declare trait ErrorConstructor() { - let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> - let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> - let prototype: Error + val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> + val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> + val prototype: Error } -let EvalError: EvalErrorConstructor +export val EvalError: EvalErrorConstructor declare trait EvalErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> - let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> - let prototype: EvalError + val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> + val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> + val prototype: EvalError } -let RangeError: RangeErrorConstructor +export val RangeError: RangeErrorConstructor declare trait RangeErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> - let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> - let prototype: RangeError + val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> + val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> + val prototype: RangeError } -let ReferenceError: ReferenceErrorConstructor +export val ReferenceError: ReferenceErrorConstructor declare trait ReferenceErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> - let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> - let prototype: ReferenceError + val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> + val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> + val prototype: ReferenceError } -let SyntaxError: SyntaxErrorConstructor +export val SyntaxError: SyntaxErrorConstructor declare trait SyntaxErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> - let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> - let prototype: SyntaxError + val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> + val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> + val prototype: SyntaxError } -let TypeError: TypeErrorConstructor +export val TypeError: TypeErrorConstructor declare trait TypeErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> - let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> - let prototype: TypeError + val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> + val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> + val prototype: TypeError } -let URIError: URIErrorConstructor +export val URIError: URIErrorConstructor declare trait URIErrorConstructor() extends ErrorConstructor { - let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> - let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> - let prototype: URIError + val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> + val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> + val prototype: URIError } -let JSON: JSON +export val JSON: JSON declare trait ReadonlyArray() { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun join(separator: (string) | (undefined)): string fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray - let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) + val concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) fun toLocaleString(): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string - let length: number + val length: number fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number } declare trait ConcatArray() { - let length: number - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> + val length: number + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } -let Array: ArrayConstructor +export val Array: ArrayConstructor declare trait ArrayConstructor() { - let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> - let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> + val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> + val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) - let prototype: MutArray + val prototype: MutArray } declare trait TypedPropertyDescriptor() { - let configurable: ((false) | (true)) | (undefined) - let set: ((T) => unit) | (undefined) - let enumerable: ((false) | (true)) | (undefined) - let get: (unit => T) | (undefined) - let writable: ((false) | (true)) | (undefined) - let value: (T) | (undefined) + val configurable: ((false) | (true)) | (undefined) + val set: ((T) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (unit => T) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (T) | (undefined) } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> declare trait ArrayLike() { - let length: number - let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> + val length: number + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> @@ -249,33 +249,33 @@ type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5. type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> declare trait ThisType() {} -let ArrayBuffer: ArrayBufferConstructor +export val ArrayBuffer: ArrayBufferConstructor declare trait ArrayBufferTypes() { - let ArrayBuffer: ArrayBuffer + val ArrayBuffer: ArrayBuffer } type ArrayBufferLike = ArrayBuffer declare trait ArrayBufferConstructor() { - let prototype: ArrayBuffer - let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> + val prototype: ArrayBuffer + val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } declare trait ArrayBufferView() { - let buffer: ArrayBuffer - let byteLength: number - let byteOffset: number + val buffer: ArrayBuffer + val byteLength: number + val byteOffset: number } -let DataView: DataViewConstructor +export val DataView: DataViewConstructor declare trait DataViewConstructor() { - let prototype: DataView - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> + val prototype: DataView + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } -let Int8Array: Int8ArrayConstructor +export val Int8Array: Int8ArrayConstructor declare trait Int8ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ - let prototype: Int8Array + val prototype: Int8Array fun id"of"(items: MutArray): Int8Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } declare trait Uint8Array() { fun valueOf(): Uint8Array @@ -283,173 +283,173 @@ declare trait Uint8Array() { fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike, offset: (number) | (undefined)): unit fun toLocaleString(): string - let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> + val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array fun join(separator: (string) | (undefined)): string fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit - let buffer: ArrayBuffer + val buffer: ArrayBuffer fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number fun reverse(): Uint8Array fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array - let byteLength: number + val byteLength: number fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): string - let length: number + val length: number fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - let byteOffset: number + val byteOffset: number } declare trait Uint8ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ - let prototype: Uint8Array + val prototype: Uint8Array fun id"of"(items: MutArray): Uint8Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Uint8ClampedArray: Uint8ClampedArrayConstructor +export val Uint8ClampedArray: Uint8ClampedArrayConstructor declare trait Uint8ClampedArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ - let prototype: Uint8ClampedArray + val prototype: Uint8ClampedArray fun id"of"(items: MutArray): Uint8ClampedArray - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Int16Array: Int16ArrayConstructor +export val Int16Array: Int16ArrayConstructor declare trait Int16ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ - let prototype: Int16Array + val prototype: Int16Array fun id"of"(items: MutArray): Int16Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Uint16Array: Uint16ArrayConstructor +export val Uint16Array: Uint16ArrayConstructor declare trait Uint16ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ - let prototype: Uint16Array + val prototype: Uint16Array fun id"of"(items: MutArray): Uint16Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Int32Array: Int32ArrayConstructor +export val Int32Array: Int32ArrayConstructor declare trait Int32ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ - let prototype: Int32Array + val prototype: Int32Array fun id"of"(items: MutArray): Int32Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Uint32Array: Uint32ArrayConstructor +export val Uint32Array: Uint32ArrayConstructor declare trait Uint32ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ - let prototype: Uint32Array + val prototype: Uint32Array fun id"of"(items: MutArray): Uint32Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Float32Array: Float32ArrayConstructor +export val Float32Array: Float32ArrayConstructor declare trait Float32ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ - let prototype: Float32Array + val prototype: Float32Array fun id"of"(items: MutArray): Float32Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -let Float64Array: Float64ArrayConstructor +export val Float64Array: Float64ArrayConstructor declare trait Float64ArrayConstructor() { - let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ - let prototype: Float64Array + val prototype: Float64Array fun id"of"(items: MutArray): Float64Array - let BYTES_PER_ELEMENT: number + val BYTES_PER_ELEMENT: number } -declare module Intl { +export declare module Intl { export declare trait CollatorOptions() { - let sensitivity: (string) | (undefined) - let ignorePunctuation: ((false) | (true)) | (undefined) - let usage: (string) | (undefined) - let localeMatcher: (string) | (undefined) - let numeric: ((false) | (true)) | (undefined) - let caseFirst: (string) | (undefined) + val sensitivity: (string) | (undefined) + val ignorePunctuation: ((false) | (true)) | (undefined) + val usage: (string) | (undefined) + val localeMatcher: (string) | (undefined) + val numeric: ((false) | (true)) | (undefined) + val caseFirst: (string) | (undefined) } export declare trait ResolvedCollatorOptions() { - let sensitivity: string - let ignorePunctuation: (false) | (true) - let usage: string - let locale: string - let numeric: (false) | (true) - let caseFirst: string - let collation: string + val sensitivity: string + val ignorePunctuation: (false) | (true) + val usage: string + val locale: string + val numeric: (false) | (true) + val caseFirst: string + val collation: string } export declare trait Collator() { fun compare(x: string, y: string): number fun resolvedOptions(): Intl.ResolvedCollatorOptions } export declare trait NumberFormatOptions() { - let minimumSignificantDigits: (number) | (undefined) - let useGrouping: ((false) | (true)) | (undefined) - let style: (string) | (undefined) - let localeMatcher: (string) | (undefined) - let currency: (string) | (undefined) - let minimumIntegerDigits: (number) | (undefined) - let maximumFractionDigits: (number) | (undefined) - let currencySign: (string) | (undefined) - let maximumSignificantDigits: (number) | (undefined) - let minimumFractionDigits: (number) | (undefined) + val minimumSignificantDigits: (number) | (undefined) + val useGrouping: ((false) | (true)) | (undefined) + val style: (string) | (undefined) + val localeMatcher: (string) | (undefined) + val currency: (string) | (undefined) + val minimumIntegerDigits: (number) | (undefined) + val maximumFractionDigits: (number) | (undefined) + val currencySign: (string) | (undefined) + val maximumSignificantDigits: (number) | (undefined) + val minimumFractionDigits: (number) | (undefined) } export declare trait ResolvedNumberFormatOptions() { - let numberingSystem: string - let minimumSignificantDigits: (number) | (undefined) - let useGrouping: (false) | (true) - let style: string - let locale: string - let currency: (string) | (undefined) - let minimumIntegerDigits: number - let maximumFractionDigits: number - let maximumSignificantDigits: (number) | (undefined) - let minimumFractionDigits: number + val numberingSystem: string + val minimumSignificantDigits: (number) | (undefined) + val useGrouping: (false) | (true) + val style: string + val locale: string + val currency: (string) | (undefined) + val minimumIntegerDigits: number + val maximumFractionDigits: number + val maximumSignificantDigits: (number) | (undefined) + val minimumFractionDigits: number } export declare trait NumberFormat() { fun format(value: number): string fun resolvedOptions(): Intl.ResolvedNumberFormatOptions } export declare trait DateTimeFormatOptions() { - let minute: ((string) | (string)) | (undefined) - let year: ((string) | (string)) | (undefined) - let hour: ((string) | (string)) | (undefined) - let hour12: ((false) | (true)) | (undefined) - let weekday: (((string) | (string)) | (string)) | (undefined) - let formatMatcher: ((string) | (string)) | (undefined) - let day: ((string) | (string)) | (undefined) - let timeZone: (string) | (undefined) - let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) - let second: ((string) | (string)) | (undefined) - let localeMatcher: ((string) | (string)) | (undefined) - let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) - let era: (((string) | (string)) | (string)) | (undefined) + val minute: ((string) | (string)) | (undefined) + val year: ((string) | (string)) | (undefined) + val hour: ((string) | (string)) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (((string) | (string)) | (string)) | (undefined) + val formatMatcher: ((string) | (string)) | (undefined) + val day: ((string) | (string)) | (undefined) + val timeZone: (string) | (undefined) + val month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) + val second: ((string) | (string)) | (undefined) + val localeMatcher: ((string) | (string)) | (undefined) + val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) + val era: (((string) | (string)) | (string)) | (undefined) } export declare trait ResolvedDateTimeFormatOptions() { - let numberingSystem: string - let minute: (string) | (undefined) - let year: (string) | (undefined) - let hour: (string) | (undefined) - let second: (string) | (undefined) - let hour12: ((false) | (true)) | (undefined) - let weekday: (string) | (undefined) - let day: (string) | (undefined) - let timeZone: string - let month: (string) | (undefined) - let locale: string - let calendar: string - let timeZoneName: (string) | (undefined) - let era: (string) | (undefined) + val numberingSystem: string + val minute: (string) | (undefined) + val year: (string) | (undefined) + val hour: (string) | (undefined) + val second: (string) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (string) | (undefined) + val day: (string) | (undefined) + val timeZone: string + val month: (string) | (undefined) + val locale: string + val calendar: string + val timeZoneName: (string) | (undefined) + val era: (string) | (undefined) } export declare trait DateTimeFormat() { fun format(date: ((number) | (Date)) | (undefined)): string @@ -474,24 +474,24 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.23: declare trait PropertyDescriptor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: let configurable: ((false) | (true)) | (undefined) +//│ ║ l.24: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: let set: ((anything) => unit) | (undefined) +//│ ║ l.25: val set: ((anything) => unit) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.26: let enumerable: ((false) | (true)) | (undefined) +//│ ║ l.26: val enumerable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: let get: (unit => anything) | (undefined) +//│ ║ l.27: val get: (unit => anything) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.28: let writable: ((false) | (true)) | (undefined) +//│ ║ l.28: val writable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.29: let value: (anything) | (undefined) +//│ ║ l.29: val value: (anything) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.30: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.31: declare trait PropertyDescriptorMap() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.32: let __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> +//│ ║ l.32: val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.33: } //│ ╙── ^ @@ -518,7 +518,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.38: fun toLocaleString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.39: let constructor: Function +//│ ║ l.39: val constructor: Function //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -559,7 +559,7 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.43: declare trait ObjectConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.44: let __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> +//│ ║ l.44: val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -569,7 +569,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.49: let prototype: Object +//│ ║ l.49: val prototype: Object //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.50: fun isSealed(o: anything): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -577,11 +577,11 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.52: fun preventExtensions(o: T): T //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.53: let create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) +//│ ║ l.53: val create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.55: let __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> +//│ ║ l.55: val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -594,16 +594,16 @@ declare module Intl { //│ ║ l.60: } //│ ╙── ^ //│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type -//│ ║ l.61: let Function: FunctionConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.61: export val Function: FunctionConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.62: declare trait FunctionConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.63: let __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> +//│ ║ l.63: val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.64: let __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> +//│ ║ l.64: val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.65: let prototype: Function +//│ ║ l.65: val prototype: Function //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.66: } //│ ╙── ^ @@ -638,47 +638,47 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.79: declare trait IArguments() { //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.80: let __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> +//│ ║ l.80: val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.81: let length: number +//│ ║ l.81: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.82: let callee: Function +//│ ║ l.82: val callee: Function //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.374: export declare trait CollatorOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.375: let sensitivity: (string) | (undefined) +//│ ║ l.375: val sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.376: let ignorePunctuation: ((false) | (true)) | (undefined) +//│ ║ l.376: val ignorePunctuation: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.377: let usage: (string) | (undefined) +//│ ║ l.377: val usage: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.378: let localeMatcher: (string) | (undefined) +//│ ║ l.378: val localeMatcher: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.379: let numeric: ((false) | (true)) | (undefined) +//│ ║ l.379: val numeric: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.380: let caseFirst: (string) | (undefined) +//│ ║ l.380: val caseFirst: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.382: export declare trait ResolvedCollatorOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.383: let sensitivity: string +//│ ║ l.383: val sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.384: let ignorePunctuation: (false) | (true) +//│ ║ l.384: val ignorePunctuation: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.385: let usage: string +//│ ║ l.385: val usage: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.386: let locale: string +//│ ║ l.386: val locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.387: let numeric: (false) | (true) +//│ ║ l.387: val numeric: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.388: let caseFirst: string +//│ ║ l.388: val caseFirst: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.389: let collation: string +//│ ║ l.389: val collation: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.390: } //│ ╙── ^^^ @@ -697,50 +697,50 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.395: export declare trait NumberFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.396: let minimumSignificantDigits: (number) | (undefined) +//│ ║ l.396: val minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.397: let useGrouping: ((false) | (true)) | (undefined) +//│ ║ l.397: val useGrouping: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.398: let style: (string) | (undefined) +//│ ║ l.398: val style: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.399: let localeMatcher: (string) | (undefined) +//│ ║ l.399: val localeMatcher: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.400: let currency: (string) | (undefined) +//│ ║ l.400: val currency: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.401: let minimumIntegerDigits: (number) | (undefined) +//│ ║ l.401: val minimumIntegerDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.402: let maximumFractionDigits: (number) | (undefined) +//│ ║ l.402: val maximumFractionDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.403: let currencySign: (string) | (undefined) +//│ ║ l.403: val currencySign: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.404: let maximumSignificantDigits: (number) | (undefined) +//│ ║ l.404: val maximumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.405: let minimumFractionDigits: (number) | (undefined) +//│ ║ l.405: val minimumFractionDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.407: export declare trait ResolvedNumberFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.408: let numberingSystem: string +//│ ║ l.408: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.409: let minimumSignificantDigits: (number) | (undefined) +//│ ║ l.409: val minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.410: let useGrouping: (false) | (true) +//│ ║ l.410: val useGrouping: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.411: let style: string +//│ ║ l.411: val style: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.412: let locale: string +//│ ║ l.412: val locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.413: let currency: (string) | (undefined) +//│ ║ l.413: val currency: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.414: let minimumIntegerDigits: number +//│ ║ l.414: val minimumIntegerDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.415: let maximumFractionDigits: number +//│ ║ l.415: val maximumFractionDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.416: let maximumSignificantDigits: (number) | (undefined) +//│ ║ l.416: val maximumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.417: let minimumFractionDigits: number +//│ ║ l.417: val minimumFractionDigits: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.418: } //│ ╙── ^^^ @@ -759,64 +759,64 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.423: export declare trait DateTimeFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.424: let minute: ((string) | (string)) | (undefined) +//│ ║ l.424: val minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.425: let year: ((string) | (string)) | (undefined) +//│ ║ l.425: val year: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.426: let hour: ((string) | (string)) | (undefined) +//│ ║ l.426: val hour: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.427: let hour12: ((false) | (true)) | (undefined) +//│ ║ l.427: val hour12: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.428: let weekday: (((string) | (string)) | (string)) | (undefined) +//│ ║ l.428: val weekday: (((string) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.429: let formatMatcher: ((string) | (string)) | (undefined) +//│ ║ l.429: val formatMatcher: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.430: let day: ((string) | (string)) | (undefined) +//│ ║ l.430: val day: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.431: let timeZone: (string) | (undefined) +//│ ║ l.431: val timeZone: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.432: let month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ l.432: val month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.433: let second: ((string) | (string)) | (undefined) +//│ ║ l.433: val second: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.434: let localeMatcher: ((string) | (string)) | (undefined) +//│ ║ l.434: val localeMatcher: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.435: let timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) +//│ ║ l.435: val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.436: let era: (((string) | (string)) | (string)) | (undefined) +//│ ║ l.436: val era: (((string) | (string)) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.438: export declare trait ResolvedDateTimeFormatOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.439: let numberingSystem: string +//│ ║ l.439: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.440: let minute: (string) | (undefined) +//│ ║ l.440: val minute: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.441: let year: (string) | (undefined) +//│ ║ l.441: val year: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.442: let hour: (string) | (undefined) +//│ ║ l.442: val hour: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.443: let second: (string) | (undefined) +//│ ║ l.443: val second: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.444: let hour12: ((false) | (true)) | (undefined) +//│ ║ l.444: val hour12: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.445: let weekday: (string) | (undefined) +//│ ║ l.445: val weekday: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.446: let day: (string) | (undefined) +//│ ║ l.446: val day: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.447: let timeZone: string +//│ ║ l.447: val timeZone: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.448: let month: (string) | (undefined) +//│ ║ l.448: val month: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.449: let locale: string +//│ ║ l.449: val locale: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.450: let calendar: string +//│ ║ l.450: val calendar: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.451: let timeZoneName: (string) | (undefined) +//│ ║ l.451: val timeZoneName: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.452: let era: (string) | (undefined) +//│ ║ l.452: val era: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.453: } //│ ╙── ^^^ @@ -845,27 +845,27 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.87: declare trait StringConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.88: let __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> +//│ ║ l.88: val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.89: let __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> +//│ ║ l.89: val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.90: let prototype: String +//│ ║ l.90: val prototype: String //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.91: fun fromCharCode(codes: MutArray): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.92: } //│ ╙── ^ //│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type -//│ ║ l.93: let Boolean: BooleanConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ║ l.93: export val Boolean: BooleanConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.94: declare trait BooleanConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.95: let __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> +//│ ║ l.95: val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.96: let __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> +//│ ║ l.96: val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.97: let prototype: Boolean +//│ ║ l.97: val prototype: Boolean //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.98: } //│ ╙── ^ @@ -879,28 +879,28 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.102: declare trait NumberConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.103: let __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> +//│ ║ l.103: val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.104: let NaN: number +//│ ║ l.104: val NaN: number //│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.105: let MIN_VALUE: number +//│ ║ l.105: val MIN_VALUE: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.106: let __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> +//│ ║ l.106: val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.107: let NEGATIVE_INFINITY: number +//│ ║ l.107: val NEGATIVE_INFINITY: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.108: let POSITIVE_INFINITY: number +//│ ║ l.108: val POSITIVE_INFINITY: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.109: let MAX_VALUE: number +//│ ║ l.109: val MAX_VALUE: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.110: let prototype: Number +//│ ║ l.110: val prototype: Number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.111: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.112: declare trait TemplateStringsArray() extends ReadonlyArray { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.113: let raw: ReadonlyArray +//│ ║ l.113: val raw: ReadonlyArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.114: } //│ ╙── ^ @@ -910,23 +910,23 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.116: declare trait ImportCallOptions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.117: let assert: (ImportAssertions) | (undefined) +//│ ║ l.117: val assert: (ImportAssertions) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.118: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.119: declare trait ImportAssertions() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.120: let __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> +//│ ║ l.120: val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.121: } //│ ╙── ^ //│ ╔══[ERROR] function Math cannot be used as a type -//│ ║ l.122: let Math: Math -//│ ╙── ^^^^ +//│ ║ l.122: export val Math: Math +//│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: Math -//│ ║ l.122: let Math: Math -//│ ╙── ^^^^ +//│ ║ l.122: export val Math: Math +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.123: declare trait Date() { //│ ║ ^^^^^^^^^^^^^^ @@ -941,17 +941,17 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.128: declare trait DateConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.129: let __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> +//│ ║ l.129: val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.131: let __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> +//│ ║ l.131: val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.132: fun now(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.133: fun parse(s: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.134: let prototype: Date +//│ ║ l.134: val prototype: Date //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.135: } //│ ╙── ^ @@ -966,126 +966,126 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.137: fun test(string: string): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.138: let multiline: (false) | (true) +//│ ║ l.138: val multiline: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.139: let source: string +//│ ║ l.139: val source: string //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.141: let global: (false) | (true) +//│ ║ l.141: val global: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.142: let lastIndex: number +//│ ║ l.142: val lastIndex: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.143: let ignoreCase: (false) | (true) +//│ ║ l.143: val ignoreCase: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.144: fun exec(string: string): RegExpExecArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.145: } //│ ╙── ^ //│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type -//│ ║ l.146: let Error: ErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ║ l.146: export val Error: ErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.147: declare trait ErrorConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.148: let __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> +//│ ║ l.148: val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.149: let __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> +//│ ║ l.149: val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.150: let prototype: Error +//│ ║ l.150: val prototype: Error //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.151: } //│ ╙── ^ //│ ╔══[ERROR] trait EvalErrorConstructor cannot be used as a type -//│ ║ l.152: let EvalError: EvalErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.152: export val EvalError: EvalErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.153: declare trait EvalErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.154: let __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> +//│ ║ l.154: val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.155: let __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> +//│ ║ l.155: val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.156: let prototype: EvalError +//│ ║ l.156: val prototype: EvalError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.157: } //│ ╙── ^ //│ ╔══[ERROR] trait RangeErrorConstructor cannot be used as a type -//│ ║ l.158: let RangeError: RangeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.158: export val RangeError: RangeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.159: declare trait RangeErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.160: let __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> +//│ ║ l.160: val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.161: let __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> +//│ ║ l.161: val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.162: let prototype: RangeError +//│ ║ l.162: val prototype: RangeError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.163: } //│ ╙── ^ //│ ╔══[ERROR] trait ReferenceErrorConstructor cannot be used as a type -//│ ║ l.164: let ReferenceError: ReferenceErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.164: export val ReferenceError: ReferenceErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.165: declare trait ReferenceErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.166: let __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> +//│ ║ l.166: val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.167: let __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> +//│ ║ l.167: val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.168: let prototype: ReferenceError +//│ ║ l.168: val prototype: ReferenceError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.169: } //│ ╙── ^ //│ ╔══[ERROR] trait SyntaxErrorConstructor cannot be used as a type -//│ ║ l.170: let SyntaxError: SyntaxErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.170: export val SyntaxError: SyntaxErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.171: declare trait SyntaxErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.172: let __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> +//│ ║ l.172: val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.173: let __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> +//│ ║ l.173: val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.174: let prototype: SyntaxError +//│ ║ l.174: val prototype: SyntaxError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.175: } //│ ╙── ^ //│ ╔══[ERROR] trait TypeErrorConstructor cannot be used as a type -//│ ║ l.176: let TypeError: TypeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.176: export val TypeError: TypeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.177: declare trait TypeErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.178: let __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> +//│ ║ l.178: val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.179: let __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> +//│ ║ l.179: val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.180: let prototype: TypeError +//│ ║ l.180: val prototype: TypeError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.181: } //│ ╙── ^ //│ ╔══[ERROR] trait URIErrorConstructor cannot be used as a type -//│ ║ l.182: let URIError: URIErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.182: export val URIError: URIErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.183: declare trait URIErrorConstructor() extends ErrorConstructor { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.184: let __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> +//│ ║ l.184: val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.185: let __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> +//│ ║ l.185: val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.186: let prototype: URIError +//│ ║ l.186: val prototype: URIError //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.187: } //│ ╙── ^ //│ ╔══[ERROR] function JSON cannot be used as a type -//│ ║ l.188: let JSON: JSON -//│ ╙── ^^^^ +//│ ║ l.188: export val JSON: JSON +//│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: JSON -//│ ║ l.188: let JSON: JSON -//│ ╙── ^^^^ +//│ ║ l.188: export val JSON: JSON +//│ ╙── ^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type //│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ @@ -1118,7 +1118,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.194: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> +//│ ║ l.194: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1126,7 +1126,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.198: let concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) +//│ ║ l.198: val concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.199: fun toLocaleString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1136,7 +1136,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.202: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.203: let length: number +//│ ║ l.203: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1147,9 +1147,9 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.207: declare trait ConcatArray() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.208: let length: number +//│ ║ l.208: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.209: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> +//│ ║ l.209: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.210: fun join(separator: (string) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1158,35 +1158,35 @@ declare module Intl { //│ ║ l.212: } //│ ╙── ^ //│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type -//│ ║ l.213: let Array: ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ║ l.213: export val Array: ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.214: declare trait ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.215: let __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> +//│ ║ l.215: val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.216: let __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> +//│ ║ l.216: val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.217: fun isArray(arg: anything): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.218: let prototype: MutArray +//│ ║ l.218: val prototype: MutArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.219: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.220: declare trait TypedPropertyDescriptor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.221: let configurable: ((false) | (true)) | (undefined) +//│ ║ l.221: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.222: let set: ((T) => unit) | (undefined) +//│ ║ l.222: val set: ((T) => unit) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.223: let enumerable: ((false) | (true)) | (undefined) +//│ ║ l.223: val enumerable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.224: let get: (unit => T) | (undefined) +//│ ║ l.224: val get: (unit => T) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.225: let writable: ((false) | (true)) | (undefined) +//│ ║ l.225: val writable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.226: let value: (T) | (undefined) +//│ ║ l.226: val value: (T) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.227: } //│ ╙── ^ @@ -1205,9 +1205,9 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.230: declare trait ArrayLike() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.231: let length: number +//│ ║ l.231: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.232: let __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> +//│ ║ l.232: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.233: } //│ ╙── ^ @@ -1263,12 +1263,12 @@ declare module Intl { //│ ║ l.251: declare trait ThisType() {} //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type -//│ ║ l.252: let ArrayBuffer: ArrayBufferConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.252: export val ArrayBuffer: ArrayBufferConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.253: declare trait ArrayBufferTypes() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.254: let ArrayBuffer: ArrayBuffer +//│ ║ l.254: val ArrayBuffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.255: } //│ ╙── ^ @@ -1281,9 +1281,9 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.257: declare trait ArrayBufferConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.258: let prototype: ArrayBuffer +//│ ║ l.258: val prototype: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.259: let __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> +//│ ║ l.259: val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.260: fun isView(arg: anything): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1292,29 +1292,29 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.262: declare trait ArrayBufferView() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.263: let buffer: ArrayBuffer +//│ ║ l.263: val buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.264: let byteLength: number +//│ ║ l.264: val byteLength: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.265: let byteOffset: number +//│ ║ l.265: val byteOffset: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.266: } //│ ╙── ^ //│ ╔══[ERROR] trait DataViewConstructor cannot be used as a type -//│ ║ l.267: let DataView: DataViewConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.267: export val DataView: DataViewConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.268: declare trait DataViewConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.269: let prototype: DataView +//│ ║ l.269: val prototype: DataView //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.270: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> +//│ ║ l.270: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.271: } //│ ╙── ^ //│ ╔══[ERROR] trait Int8ArrayConstructor cannot be used as a type -//│ ║ l.272: let Int8Array: Int8ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.272: export val Int8Array: Int8ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1333,15 +1333,15 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.273: declare trait Int8ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.274: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> +//│ ║ l.274: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.276: let prototype: Int8Array +//│ ║ l.276: val prototype: Int8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.277: fun id"of"(items: MutArray): Int8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.278: let BYTES_PER_ELEMENT: number +//│ ║ l.278: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.279: } //│ ╙── ^ @@ -1415,7 +1415,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.285: fun toLocaleString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.286: let __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> +//│ ║ l.286: val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1423,7 +1423,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.290: let BYTES_PER_ELEMENT: number +//│ ║ l.290: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1437,7 +1437,7 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.297: let buffer: ArrayBuffer +//│ ║ l.297: val buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1447,19 +1447,19 @@ declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.302: let byteLength: number +//│ ║ l.302: val byteLength: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.304: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.305: let length: number +//│ ║ l.305: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.308: let byteOffset: number +//│ ║ l.308: val byteOffset: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.309: } //│ ╙── ^ @@ -1475,21 +1475,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.310: declare trait Uint8ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.311: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> +//│ ║ l.311: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.313: let prototype: Uint8Array +//│ ║ l.313: val prototype: Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.314: fun id"of"(items: MutArray): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.315: let BYTES_PER_ELEMENT: number +//│ ║ l.315: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.316: } //│ ╙── ^ //│ ╔══[ERROR] trait Uint8ClampedArrayConstructor cannot be used as a type -//│ ║ l.317: let Uint8ClampedArray: Uint8ClampedArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.317: export val Uint8ClampedArray: Uint8ClampedArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1508,21 +1508,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.318: declare trait Uint8ClampedArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.319: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> +//│ ║ l.319: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.321: let prototype: Uint8ClampedArray +//│ ║ l.321: val prototype: Uint8ClampedArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.323: let BYTES_PER_ELEMENT: number +//│ ║ l.323: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.324: } //│ ╙── ^ //│ ╔══[ERROR] trait Int16ArrayConstructor cannot be used as a type -//│ ║ l.325: let Int16Array: Int16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.325: export val Int16Array: Int16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1541,21 +1541,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.326: declare trait Int16ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.327: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> +//│ ║ l.327: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.329: let prototype: Int16Array +//│ ║ l.329: val prototype: Int16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.330: fun id"of"(items: MutArray): Int16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.331: let BYTES_PER_ELEMENT: number +//│ ║ l.331: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.332: } //│ ╙── ^ //│ ╔══[ERROR] trait Uint16ArrayConstructor cannot be used as a type -//│ ║ l.333: let Uint16Array: Uint16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.333: export val Uint16Array: Uint16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1574,21 +1574,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.334: declare trait Uint16ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.335: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> +//│ ║ l.335: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.337: let prototype: Uint16Array +//│ ║ l.337: val prototype: Uint16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.338: fun id"of"(items: MutArray): Uint16Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.339: let BYTES_PER_ELEMENT: number +//│ ║ l.339: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.340: } //│ ╙── ^ //│ ╔══[ERROR] trait Int32ArrayConstructor cannot be used as a type -//│ ║ l.341: let Int32Array: Int32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.341: export val Int32Array: Int32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1607,21 +1607,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.342: declare trait Int32ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.343: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> +//│ ║ l.343: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.345: let prototype: Int32Array +//│ ║ l.345: val prototype: Int32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.346: fun id"of"(items: MutArray): Int32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.347: let BYTES_PER_ELEMENT: number +//│ ║ l.347: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.348: } //│ ╙── ^ //│ ╔══[ERROR] trait Uint32ArrayConstructor cannot be used as a type -//│ ║ l.349: let Uint32Array: Uint32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.349: export val Uint32Array: Uint32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1640,21 +1640,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.350: declare trait Uint32ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.351: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> +//│ ║ l.351: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.353: let prototype: Uint32Array +//│ ║ l.353: val prototype: Uint32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.354: fun id"of"(items: MutArray): Uint32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.355: let BYTES_PER_ELEMENT: number +//│ ║ l.355: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.356: } //│ ╙── ^ //│ ╔══[ERROR] trait Float32ArrayConstructor cannot be used as a type -//│ ║ l.357: let Float32Array: Float32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.357: export val Float32Array: Float32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1673,21 +1673,21 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.358: declare trait Float32ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.359: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> +//│ ║ l.359: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.361: let prototype: Float32Array +//│ ║ l.361: val prototype: Float32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.362: fun id"of"(items: MutArray): Float32Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.363: let BYTES_PER_ELEMENT: number +//│ ║ l.363: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.364: } //│ ╙── ^ //│ ╔══[ERROR] trait Float64ArrayConstructor cannot be used as a type -//│ ║ l.365: let Float64Array: Float64ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.365: export val Float64Array: Float64ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1706,15 +1706,15 @@ declare module Intl { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.366: declare trait Float64ArrayConstructor() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.367: let __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> +//│ ║ l.367: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.369: let prototype: Float64Array +//│ ║ l.369: val prototype: Float64Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.370: fun id"of"(items: MutArray): Float64Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.371: let BYTES_PER_ELEMENT: number +//│ ║ l.371: val BYTES_PER_ELEMENT: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.372: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index e7dc5425e..c4dbb2e83 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -5,12 +5,12 @@ export declare module Foo { fun Baz(aa: string): IBar declare trait IBar() { - let a: string + val a: string } export declare class Bar() extends IBar { - let a: string + val a: string } - let baz: IBar + export val baz: IBar } //│ ╔══[ERROR] type identifier not found: IBar //│ ║ l.6: fun Baz(aa: string): IBar @@ -18,7 +18,7 @@ export declare module Foo { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.7: declare trait IBar() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.8: let a: string +//│ ║ l.8: val a: string //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.9: } //│ ╙── ^^^ @@ -26,8 +26,8 @@ export declare module Foo { //│ ║ l.10: export declare class Bar() extends IBar { //│ ╙── ^^^^ //│ ╔══[ERROR] trait IBar cannot be used as a type -//│ ║ l.13: let baz: IBar -//│ ╙── ^^^^ +//│ ║ l.13: export val baz: IBar +//│ ╙── ^^^^ //│ module Foo() { //│ class Bar() { //│ let a: string diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 4d5dc5dd2..03bce3935 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -12,22 +12,22 @@ declare class C() { } declare class D() extends C {} declare trait Wu() { - let x: (false) | (true) + val x: (false) | (true) } declare class WuWu() extends Wu { - let y: (false) | (true) + val y: (false) | (true) } declare trait WuWuWu() extends WuWu { - let z: (false) | (true) + val z: (false) | (true) } declare trait Never() extends WuWuWu { fun w(): nothing } declare class VG() { - let x: T + val x: T } declare class Home() extends VG { - let y: T + val y: T } declare trait O() { fun xx(x: I): I @@ -35,9 +35,9 @@ declare trait O() { declare class OR() extends O { fun xx(x: R): R } -declare module Five { +export declare module Five { export declare class ROTK() { - let wu: string + val wu: string } export declare class Y() extends Five.ROTK {} } @@ -51,7 +51,7 @@ declare class Y() extends Five.ROTK {} //│ ╔══[ERROR] traits are not yet supported //│ ║ l.14: declare trait Wu() { //│ ║ ^^^^^^^^^^^^ -//│ ║ l.15: let x: (false) | (true) +//│ ║ l.15: val x: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.16: } //│ ╙── ^ @@ -61,7 +61,7 @@ declare class Y() extends Five.ROTK {} //│ ╔══[ERROR] traits are not yet supported //│ ║ l.20: declare trait WuWuWu() extends WuWu { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.21: let z: (false) | (true) +//│ ║ l.21: val z: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.22: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 58a3cf521..ed33c6a2b 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -3,7 +3,7 @@ :NoJS :AllowTypeErrors declare trait IFoo() { - let a: string + val a: string fun b(x: number): number fun c(): (false) | (true) fun d(x: string): unit @@ -17,22 +17,22 @@ declare trait IEvent() { fun callback(): (number) => unit } declare trait SearchFunc() { - let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> + val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> } declare trait StringArray() { - let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> + val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> } declare trait Counter() { - let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> - let interval: number + val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> + val interval: number fun reset(): unit } declare trait Simple() { - let a: number + val a: number fun b(x: (false) | (true)): string } declare trait Simple2() { - let abc: T + val abc: T } declare trait Next() extends Simple {} declare trait TTT() { @@ -41,7 +41,7 @@ declare trait TTT() { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.5: declare trait IFoo() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.6: let a: string +//│ ║ l.6: val a: string //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.7: fun b(x: number): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,23 +68,23 @@ declare trait TTT() { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.19: declare trait SearchFunc() { //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.20: let __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> +//│ ║ l.20: val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.22: declare trait StringArray() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.23: let __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> +//│ ║ l.23: val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.25: declare trait Counter() { //│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.26: let __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> +//│ ║ l.26: val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: let interval: number +//│ ║ l.27: val interval: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.28: fun reset(): unit //│ ║ ^^^^^^^^^^^^^^^^^^^ @@ -93,7 +93,7 @@ declare trait TTT() { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.30: declare trait Simple() { //│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.31: let a: number +//│ ║ l.31: val a: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.32: fun b(x: (false) | (true)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -102,7 +102,7 @@ declare trait TTT() { //│ ╔══[ERROR] traits are not yet supported //│ ║ l.34: declare trait Simple2() { //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.35: let abc: T +//│ ║ l.35: val abc: T //│ ║ ^^^^^^^^^^^^ //│ ║ l.36: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index c0dc7eec1..63e47908a 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -6,10 +6,10 @@ fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit fun over(f: ((number) => string) & ((object) => string)): string declare trait IA() { - let x: number + val x: number } declare trait IB() { - let y: number + val y: number } fun iii(x: (IA) & (IB)): (IA) & (IB) fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) @@ -49,14 +49,14 @@ fun inter(c: (A) & (B)): (A) & (B) //│ ╔══[ERROR] traits are not yet supported //│ ║ l.8: declare trait IA() { //│ ║ ^^^^^^^^^^^^ -//│ ║ l.9: let x: number +//│ ║ l.9: val x: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.11: declare trait IB() { //│ ║ ^^^^^^^^^^^^ -//│ ║ l.12: let y: number +//│ ║ l.12: val y: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.13: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/Literal.mlsi b/ts2mls/js/src/test/diff/Literal.mlsi index 613f6b627..d9c83d2fd 100644 --- a/ts2mls/js/src/test/diff/Literal.mlsi +++ b/ts2mls/js/src/test/diff/Literal.mlsi @@ -2,8 +2,8 @@ :NewDefs :NoJS :AllowTypeErrors -let a: {a: "A",b: "B",} -let num: {y: 114,} +export val a: {a: "A",b: "B",} +export val num: {y: 114,} fun foo(x: {xx: "X",}): {yy: "Y",} //│ let a: {a: "A", b: "B"} //│ let num: {y: 114} diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi index 8e1be6c66..566cd5e56 100644 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ b/ts2mls/js/src/test/diff/MultiFiles.mlsi @@ -6,9 +6,9 @@ fun multi1(x: number): number fun multi3(): unit declare class Foo() extends Base {} declare trait AnotherBase() { - let y: string + val y: string } -declare module N { +export declare module N { fun f(): unit fun g(): unit fun h(): unit @@ -16,14 +16,14 @@ declare module N { fun multi2(x: string): string fun multi4(): unit declare trait Base() { - let a: number + val a: number } declare class AnotherFoo() extends AnotherBase {} fun multi5(): unit //│ ╔══[ERROR] traits are not yet supported //│ ║ l.18: declare trait Base() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.19: let a: number +//│ ║ l.19: val a: number //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.20: } //│ ╙── ^ @@ -33,7 +33,7 @@ fun multi5(): unit //│ ╔══[ERROR] traits are not yet supported //│ ║ l.8: declare trait AnotherBase() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.9: let y: string +//│ ║ l.9: val y: string //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 8c79672da..fbe392a2c 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -2,8 +2,9 @@ :NewDefs :NoJS :AllowTypeErrors -declare module N1 { +export declare module N1 { fun f(x: anything): number + fun ff(y: anything): number export declare class C() { fun f(): unit } @@ -12,10 +13,11 @@ declare module N1 { } export declare module N2 { fun fff(x: (false) | (true)): number + fun gg(c: N1.C): N1.C declare class BBB() extends N1.C {} } } -declare module AA { +export declare module AA { fun f(x: anything): string export declare class C() { fun f(): unit @@ -29,21 +31,27 @@ declare module AA { fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.10: declare trait I() { +//│ ║ l.11: declare trait I() { //│ ║ ^^^^^^^^^^^ -//│ ║ l.11: fun f(): number +//│ ║ l.12: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.12: } +//│ ║ l.13: } //│ ╙── ^^^ +//│ ╔══[ERROR] Module `N1` is not supported yet. +//│ ║ l.16: fun gg(c: N1.C): N1.C +//│ ╙── ^^ +//│ ╔══[ERROR] Module `N1` is not supported yet. +//│ ║ l.16: fun gg(c: N1.C): N1.C +//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.15: declare class BBB() extends N1.C {} +//│ ║ l.17: declare class BBB() extends N1.C {} //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: export declare trait I() { +//│ ║ l.25: export declare trait I() { //│ ║ ^^^^^^^^^^^ -//│ ║ l.24: fun f(): number +//│ ║ l.26: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: } +//│ ║ l.27: } //│ ╙── ^^^ //│ module N1() { //│ class C() { @@ -53,8 +61,10 @@ fun f2(x: AA.C): AA.C //│ module N2() { //│ class BBB() //│ fun fff: (x: bool,) -> number +//│ fun gg: (c: error,) -> error //│ } //│ fun f: (x: anything,) -> number +//│ fun ff: (y: anything,) -> number //│ } //│ module AA() { //│ class C() { diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 0a2a060b0..9da24354d 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -7,8 +7,8 @@ fun buildName2(firstName: string, lastName: (string) | (undefined)): string fun buildName3(firstName: string, lastName: MutArray): string fun buildName4(firstName: string, lastName: MutArray): string declare trait SquareConfig() { - let color: (string) | (undefined) - let width: (number) | (undefined) + val color: (string) | (undefined) + val width: (number) | (undefined) } fun did(x: number, f: ((number) => number) | (undefined)): number fun getOrElse(arr: (MutArray) | (undefined)): object @@ -19,15 +19,15 @@ fun err(msg: ((number, string, )) | (undefined)): unit fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string fun boo(x: ((T) & (U)) | (undefined)): unit declare class B() { - let b: T + val b: T } fun boom(b: (B) | (undefined)): anything //│ ╔══[ERROR] traits are not yet supported //│ ║ l.9: declare trait SquareConfig() { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: let color: (string) | (undefined) +//│ ║ l.10: val color: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: let width: (number) | (undefined) +//│ ║ l.11: val width: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.12: } //│ ╙── ^ diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 3d39c776d..d799f20fc 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -4,7 +4,7 @@ :AllowTypeErrors fun f: ((number) => string) & ((string) => string) declare class M() { - let foo: ((number) => string) & ((string) => string) + val foo: ((number) => string) & ((string) => string) } fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) @@ -17,7 +17,7 @@ fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ -declare module XX { +export declare module XX { fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } declare class WWW() { diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 21b8f3d6f..c371c8337 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -14,7 +14,7 @@ fun ex(x: T, y: U): (T, U, (T) & (U), ) fun foo(x: ((T) & (U), )): unit fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) declare class A() { - let x: number + val x: number } declare class B() {} fun swap(x: (A, B, )): (B, A, ) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 9add306b6..d2e49c839 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -3,11 +3,11 @@ :NoJS :AllowTypeErrors declare trait None() { - let _tag: "None" + val _tag: "None" } declare trait Some() { - let _tag: "Some" - let value: A + val _tag: "Some" + val value: A } type Option = (None) | (Some) type Func = (number) => number @@ -20,28 +20,29 @@ type SomeInterface = {x: number,y: number,} declare class ABC() {} type DEF = ABC type TP = (A, B, C, ) -declare module NA { +export declare module NA { + fun fb(b: string): unit type B = string } declare class NC() { - let b: string + val b: string } type G = ABC -let none: {_tag: "None",} +export val none: {_tag: "None",} fun some(a: A): (None) | (Some) //│ ╔══[ERROR] traits are not yet supported //│ ║ l.5: declare trait None() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.6: let _tag: "None" +//│ ║ l.6: val _tag: "None" //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.7: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported //│ ║ l.8: declare trait Some() { //│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.9: let _tag: "Some" +//│ ║ l.9: val _tag: "Some" //│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: let value: A +//│ ║ l.10: val value: A //│ ║ ^^^^^^^^^^^^^^ //│ ║ l.11: } //│ ╙── ^ @@ -64,19 +65,19 @@ fun some(a: A): (None) | (Some) //│ ║ l.17: type I3 = (I1) & (I2) //│ ╙── ^^^^ //│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.31: fun some(a: A): (None) | (Some) +//│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ ╔══[ERROR] type identifier not found: A -//│ ║ l.31: fun some(a: A): (None) | (Some) +//│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ ╔══[ERROR] trait None cannot be used as a type -//│ ║ l.31: fun some(a: A): (None) | (Some) +//│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Some cannot be used as a type -//│ ║ l.31: fun some(a: A): (None) | (Some) +//│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: A -//│ ║ l.31: fun some(a: A): (None) | (Some) +//│ ║ l.32: fun some(a: A): (None) | (Some) //│ ╙── ^ //│ trait None() //│ trait Some[A]() @@ -93,6 +94,7 @@ fun some(a: A): (None) | (Some) //│ type TP[A, B, C] = (A, B, C,) //│ module NA() { //│ type B = string +//│ fun fb: (b: string,) -> unit //│ } //│ class NC() { //│ let b: string diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index c53b58743..e04d6ba11 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -15,11 +15,11 @@ fun getStringPrinter(): Printer fun foo(p: Printer, x: T): T fun foo2(p: Printer, x: T): T declare class F() { - let x: T + val x: T fun GG(y: U): T } declare trait I() { - let x: T + val x: T fun GG(y: U): T } declare class FFF() { @@ -69,7 +69,7 @@ fun getFFF(): FFF //│ ╔══[ERROR] traits are not yet supported //│ ║ l.21: declare trait I() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.22: let x: T +//│ ║ l.22: val x: T //│ ║ ^^^^^^^^^^ //│ ║ l.23: fun GG(y: U): T //│ ║ ^^^^^^^^^^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index a20bba14e..ac49f113e 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -2,18 +2,19 @@ :NewDefs :NoJS :AllowTypeErrors -let URI: string -let URI2: string -let foo: number -let bar: false +export val URI: string +export val URI2: string +export val foo: number +export val bar: false declare class FooBar() {} -let fb: FooBar -declare module ABC { +export val fb: FooBar +export declare module ABC { export declare class DEF() {} } -let d: ABC.DEF -declare module DD { - let foo: number +export val d: ABC.DEF +export declare module DD { + export val foo: number + val bar: number } //│ let URI: string //│ let URI2: string @@ -26,5 +27,6 @@ declare module DD { //│ } //│ let d: DEF //│ module DD() { +//│ let bar: number //│ let foo: number //│ } From 11c3be5b5da485f1a9b4f89478dd845da1ef1d04 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 28 Apr 2023 09:28:40 +0800 Subject: [PATCH 050/202] Merge from new-defs --- .../main/scala/mlscript/codegen/Codegen.scala | 8 +- .../src/test/diff/codegen/ConstructorStmt.mls | 2 +- .../src/test/diff/codegen/FieldOverride.mls | 131 ++++++++++++++++++ shared/src/test/diff/codegen/Mixin.mls | 4 +- shared/src/test/diff/codegen/Nested.mls | 12 +- shared/src/test/diff/codegen/Super.mls | 2 +- 6 files changed, 145 insertions(+), 14 deletions(-) create mode 100644 shared/src/test/diff/codegen/FieldOverride.mls diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index 54b1fedae..bf5b0e60b 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -854,10 +854,10 @@ final case class JSClassNewDecl( if (s.isEmpty) s"${p._1}" else s"${p._1}, $s") nestedTypes.foreach(t => buffer += s" #$t;") - if (!privateMem.isEmpty) { - privateMem.foreach(f => buffer += s" #${f};") - privateMem.foreach(f => buffer += s" get ${f}() { return this.#${f}; }") - } + privateMem.distinct.foreach(f => { + buffer += s" #${f};" + buffer += s" get ${f}() { return this.#${f}; }" + }) buffer += s" constructor($params) {" if (`extends`.isDefined) { val sf = superFields.iterator.zipWithIndex.foldLeft("")((res, p) => diff --git a/shared/src/test/diff/codegen/ConstructorStmt.mls b/shared/src/test/diff/codegen/ConstructorStmt.mls index b910fd293..527ea98f1 100644 --- a/shared/src/test/diff/codegen/ConstructorStmt.mls +++ b/shared/src/test/diff/codegen/ConstructorStmt.mls @@ -212,8 +212,8 @@ class Baz { //│ if (this.#Baz === undefined) { //│ class Baz { //│ #x; -//│ #y; //│ get x() { return this.#x; } +//│ #y; //│ get y() { return this.#y; } //│ constructor() { //│ this.#x = 123; diff --git a/shared/src/test/diff/codegen/FieldOverride.mls b/shared/src/test/diff/codegen/FieldOverride.mls new file mode 100644 index 000000000..4de74414b --- /dev/null +++ b/shared/src/test/diff/codegen/FieldOverride.mls @@ -0,0 +1,131 @@ +:NewParser +:NewDefs + +:js +class C(a: int) { let a = 1 } +//│ class C(a: int) { +//│ let a: 1 +//│ } +//│ // Prelude +//│ let res; +//│ class TypingUnit { +//│ #C; +//│ constructor() { +//│ } +//│ get C() { +//│ const outer = this; +//│ if (this.#C === undefined) { +//│ class C { +//│ #a; +//│ get a() { return this.#a; } +//│ constructor(a) { +//│ this.#a = a; +//│ this.#a = 1; +//│ const a1 = this.#a; +//│ } +//│ }; +//│ this.#C = ((a) => new C(a)); +//│ this.#C.class = C; +//│ } +//│ return this.#C; +//│ } +//│ } +//│ const typing_unit = new TypingUnit; +//│ globalThis.C = typing_unit.C; +//│ // End of generated code + +// should return 1 +let a = C(2) +a.a +//│ let a: C +//│ 1 +//│ a +//│ = C {} +//│ res +//│ = 1 + +:js +class C2(a: int, b: int) { + let a = b + 1 + let b = a + 1 +} +//│ class C2(a: int, b: int) { +//│ let a: int +//│ let b: int +//│ } +//│ // Prelude +//│ class TypingUnit2 { +//│ #C2; +//│ constructor() { +//│ } +//│ get C2() { +//│ const outer = this; +//│ if (this.#C2 === undefined) { +//│ class C2 { +//│ #a; +//│ get a() { return this.#a; } +//│ #b; +//│ get b() { return this.#b; } +//│ constructor(a, b) { +//│ this.#a = a; +//│ this.#b = b; +//│ this.#a = b + 1; +//│ const a1 = this.#a; +//│ this.#b = a1 + 1; +//│ const b1 = this.#b; +//│ } +//│ }; +//│ this.#C2 = ((a, b) => new C2(a, b)); +//│ this.#C2.class = C2; +//│ } +//│ return this.#C2; +//│ } +//│ } +//│ const typing_unit2 = new TypingUnit2; +//│ globalThis.C2 = typing_unit2.C2; +//│ // End of generated code + +let c2 = C2(1, 2) +c2.a +c2.b +//│ let c2: C2 +//│ int +//│ c2 +//│ = C2 {} +//│ res +//│ = 3 +//│ res +//│ = 4 + +class C3(a: int) { + let a = 42 + class C4(a: int) { + let a = 44 + } +} +//│ class C3(a: int) { +//│ class C4(a: int) { +//│ let a: 44 +//│ } +//│ let a: 42 +//│ } + +:e +let c3 = C3(1) +let c4 = c3.C4(2) +c3.a +c4.a +//│ ╔══[ERROR] access to class member not yet supported +//│ ║ l.115: let c4 = c3.C4(2) +//│ ╙── ^^^ +//│ let c3: C3 +//│ let c4: error +//│ error +//│ c3 +//│ = C3 {} +//│ c4 +//│ = C4 {} +//│ res +//│ = 42 +//│ res +//│ = 44 diff --git a/shared/src/test/diff/codegen/Mixin.mls b/shared/src/test/diff/codegen/Mixin.mls index b72e833b5..e51cb76fd 100644 --- a/shared/src/test/diff/codegen/Mixin.mls +++ b/shared/src/test/diff/codegen/Mixin.mls @@ -19,8 +19,8 @@ class Lit(n: int) //│ if (this.#Add === undefined) { //│ class Add { //│ #lhs; -//│ #rhs; //│ get lhs() { return this.#lhs; } +//│ #rhs; //│ get rhs() { return this.#rhs; } //│ constructor(lhs, rhs) { //│ this.#lhs = lhs; @@ -66,8 +66,8 @@ class Lit(n: int) //│ │ │ if (this.#Add === undefined) { //│ │ │ class Add { //│ │ │ #lhs; -//│ │ │ #rhs; //│ │ │ get lhs() { return this.#lhs; } +//│ │ │ #rhs; //│ │ │ get rhs() { return this.#rhs; } //│ │ │ constructor(lhs, rhs) { //│ │ │ this.#lhs = lhs; diff --git a/shared/src/test/diff/codegen/Nested.mls b/shared/src/test/diff/codegen/Nested.mls index c707d2d08..b47e15c78 100644 --- a/shared/src/test/diff/codegen/Nested.mls +++ b/shared/src/test/diff/codegen/Nested.mls @@ -582,8 +582,8 @@ module H { //│ if (this.#J === undefined) { //│ class J { //│ #x; -//│ #i; //│ get x() { return this.#x; } +//│ #i; //│ get i() { return this.#i; } //│ constructor(x) { //│ this.#x = x; @@ -666,8 +666,8 @@ ij.incY //│ class I { //│ #J; //│ #x; -//│ #y; //│ get x() { return this.#x; } +//│ #y; //│ get y() { return this.#y; } //│ constructor(x) { //│ this.#x = x; @@ -679,8 +679,8 @@ ij.incY //│ if (this.#J === undefined) { //│ class J { //│ #x; -//│ #y; //│ get x() { return this.#x; } +//│ #y; //│ get y() { return this.#y; } //│ constructor(x) { //│ this.#x = x; @@ -1125,8 +1125,8 @@ I(1).J(3).a //│ class I { //│ #J; //│ #x; -//│ #y; //│ get x() { return this.#x; } +//│ #y; //│ get y() { return this.#y; } //│ constructor(x) { //│ this.#x = x; @@ -1138,8 +1138,8 @@ I(1).J(3).a //│ if (this.#J === undefined) { //│ class J { //│ #z; -//│ #a; //│ get z() { return this.#z; } +//│ #a; //│ get a() { return this.#a; } //│ constructor(z) { //│ this.#z = z; @@ -1378,8 +1378,8 @@ class Outer1(outer: int) { //│ if (this.#Outer2 === undefined) { //│ class Outer2 { //│ #x; -//│ #outer; //│ get x() { return this.#x; } +//│ #outer; //│ get outer() { return this.#outer; } //│ constructor(x) { //│ this.#x = x; diff --git a/shared/src/test/diff/codegen/Super.mls b/shared/src/test/diff/codegen/Super.mls index 5cac01cd9..aa500a3b7 100644 --- a/shared/src/test/diff/codegen/Super.mls +++ b/shared/src/test/diff/codegen/Super.mls @@ -50,8 +50,8 @@ mixin Foo1 { //│ const outer = this; //│ return (class Foo1 extends base { //│ #foo0; -//│ #foo1; //│ get foo0() { return this.#foo0; } +//│ #foo1; //│ get foo1() { return this.#foo1; } //│ constructor(...rest) { //│ super(...rest); From 261a24aa35a6f413314f3f4f0f58c72a099c4024 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 28 Apr 2023 10:43:02 +0800 Subject: [PATCH 051/202] WIP: Remove old invalid module test --- ts2mls/js/src/test/diff/MultiFiles.mlsi | 56 ------------------- .../scala/ts2mls/TSTypeGenerationTests.scala | 3 +- ts2mls/js/src/test/typescript/Multi1.ts | 15 ----- ts2mls/js/src/test/typescript/Multi2.ts | 17 ------ ts2mls/js/src/test/typescript/Multi3.ts | 7 --- 5 files changed, 1 insertion(+), 97 deletions(-) delete mode 100644 ts2mls/js/src/test/diff/MultiFiles.mlsi delete mode 100644 ts2mls/js/src/test/typescript/Multi1.ts delete mode 100644 ts2mls/js/src/test/typescript/Multi2.ts delete mode 100644 ts2mls/js/src/test/typescript/Multi3.ts diff --git a/ts2mls/js/src/test/diff/MultiFiles.mlsi b/ts2mls/js/src/test/diff/MultiFiles.mlsi deleted file mode 100644 index 566cd5e56..000000000 --- a/ts2mls/js/src/test/diff/MultiFiles.mlsi +++ /dev/null @@ -1,56 +0,0 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors -fun multi1(x: number): number -fun multi3(): unit -declare class Foo() extends Base {} -declare trait AnotherBase() { - val y: string -} -export declare module N { - fun f(): unit - fun g(): unit - fun h(): unit -} -fun multi2(x: string): string -fun multi4(): unit -declare trait Base() { - val a: number -} -declare class AnotherFoo() extends AnotherBase {} -fun multi5(): unit -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: declare trait Base() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.19: val a: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.20: } -//│ ╙── ^ -//│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.7: declare class Foo() extends Base {} -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: declare trait AnotherBase() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.9: val y: string -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.10: } -//│ ╙── ^ -//│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.21: declare class AnotherFoo() extends AnotherBase {} -//│ ╙── ^^^^^^^^^^^ -//│ fun multi1: (x: number,) -> number -//│ fun multi3: () -> unit -//│ class Foo() -//│ trait AnotherBase() -//│ module N() { -//│ fun f: () -> unit -//│ fun g: () -> unit -//│ fun h: () -> unit -//│ } -//│ fun multi2: (x: string,) -> string -//│ fun multi4: () -> unit -//│ trait Base() -//│ class AnotherFoo() -//│ fun multi5: () -> unit diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 7dac66011..d43f90142 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -4,7 +4,7 @@ import org.scalatest.funsuite.AnyFunSuite class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ - + testsData.foreach((data) => test(data._2) { val program = TSProgram(tsPath(data._1), true) var writer = JSWriter(diffPath(data._2)) @@ -30,7 +30,6 @@ object TSTypeGenerationTest { (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), (Seq("Intersection.ts"), "Intersection.mlsi"), (Seq("Literal.ts"), "Literal.mlsi"), - (Seq("Multi1.ts", "Multi2.ts", "Multi3.ts"), "MultiFiles.mlsi"), (Seq("Namespace.ts"), "Namespace.mlsi"), (Seq("Optional.ts"), "Optional.mlsi"), (Seq("Overload.ts"), "Overload.mlsi"), diff --git a/ts2mls/js/src/test/typescript/Multi1.ts b/ts2mls/js/src/test/typescript/Multi1.ts deleted file mode 100644 index d36fc248b..000000000 --- a/ts2mls/js/src/test/typescript/Multi1.ts +++ /dev/null @@ -1,15 +0,0 @@ -function multi1(x: number) { - return x; -} - -function multi3() {} - -class Foo extends Base {} - -interface AnotherBase { - y: string -} - -namespace N { - export function f() {} -} diff --git a/ts2mls/js/src/test/typescript/Multi2.ts b/ts2mls/js/src/test/typescript/Multi2.ts deleted file mode 100644 index 2a8ce088c..000000000 --- a/ts2mls/js/src/test/typescript/Multi2.ts +++ /dev/null @@ -1,17 +0,0 @@ -function multi2(x: string) { - return x; -} - -function multi4() { - multi3() -} - -interface Base { - a: number -} - -class AnotherFoo extends AnotherBase {} - -namespace N { - export function g() {} -} diff --git a/ts2mls/js/src/test/typescript/Multi3.ts b/ts2mls/js/src/test/typescript/Multi3.ts deleted file mode 100644 index 0807a9fcc..000000000 --- a/ts2mls/js/src/test/typescript/Multi3.ts +++ /dev/null @@ -1,7 +0,0 @@ -function multi5() { - console.log("wuwuwu") -} - -namespace N { - export function h() {} -} From f5816da2c022149b677e95a9d4e09cc67ce333ac Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 28 Apr 2023 11:18:09 +0800 Subject: [PATCH 052/202] WIP: Generate top-level modules --- .../src/main/scala/ts2mls/TSNamespace.scala | 20 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 35 +- .../main/scala/ts2mls/types/Converter.scala | 4 +- ts2mls/js/src/test/diff/Array.mlsi | 147 ++-- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 126 +-- ts2mls/js/src/test/diff/ClassMember.mlsi | 101 ++- ts2mls/js/src/test/diff/Dec.mlsi | 49 +- ts2mls/js/src/test/diff/ES5.mlsi | 791 ++++++++++++------ ts2mls/js/src/test/diff/Enum.mlsi | 16 +- ts2mls/js/src/test/diff/Export.mlsi | 59 +- ts2mls/js/src/test/diff/Heritage.mlsi | 232 ++--- ts2mls/js/src/test/diff/HighOrderFunc.mlsi | 16 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 258 +++--- ts2mls/js/src/test/diff/Intersection.mlsi | 264 ++---- ts2mls/js/src/test/diff/Literal.mlsi | 16 +- ts2mls/js/src/test/diff/Namespace.mlsi | 153 ++-- ts2mls/js/src/test/diff/Optional.mlsi | 121 +-- ts2mls/js/src/test/diff/Overload.mlsi | 115 +-- ts2mls/js/src/test/diff/Tuple.mlsi | 106 +-- ts2mls/js/src/test/diff/Type.mlsi | 178 ++-- ts2mls/js/src/test/diff/TypeParameter.mlsi | 182 ++-- ts2mls/js/src/test/diff/Union.mlsi | 47 +- ts2mls/js/src/test/diff/Variables.mlsi | 54 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 48 +- ts2mls/js/src/test/typescript/Namespace.ts | 15 +- 25 files changed, 1736 insertions(+), 1417 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index d49b3d161..99129f9bc 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -4,9 +4,7 @@ import scala.collection.mutable.{HashMap, ListBuffer} import types._ import mlscript.utils._ -// even though we don't use `export` keywords for some top-level variables/functions -// we still want to keep them (e.g., es5.d.ts built-in) -class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: Boolean) { +class TSNamespace(name: String, parent: Option[TSNamespace]) { // name -> (namespace/type, export) private val subSpace = HashMap[String, (TSNamespace, Boolean)]() private val members = HashMap[String, (TSType, Boolean)]() @@ -18,7 +16,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: def derive(name: String, exported: Boolean): TSNamespace = if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it else { - val sub = new TSNamespace(name, Some(this), false) // not a top level module! + val sub = new TSNamespace(name, Some(this)) // not a top level module! subSpace.put(name, (sub, exported)) order += Left(name) sub @@ -40,13 +38,13 @@ class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) - private def expStr(exp: Boolean) = if (exp || keepUnexportedVars) "export " else "" + private def expStr(exp: Boolean) = if (exp) "export " else "" def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { case Left(subName) => { val ss = subSpace(subName) - writer.writeln(s"${indent}${expStr(ss._2)}declare module $subName {") + writer.writeln(s"${indent}${expStr(ss._2)}module $subName {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") } @@ -54,21 +52,21 @@ class TSNamespace(name: String, parent: Option[TSNamespace], keepUnexportedVars: val (mem, exp) = members(name) mem match { case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name, exp || keepUnexportedVars)(indent)) + writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, name, exp || keepUnexportedVars)(indent)) + writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, name, exp || keepUnexportedVars)(indent)) + writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) case TSInterfaceType(name, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) - case _ => writer.writeln(s"${indent}${expStr(exp || keepUnexportedVars)}val $name: ${Converter.convert(mem)("")}") + case _ => writer.writeln(s"${indent}${expStr(exp)}val $name: ${Converter.convert(mem)("")}") } } }) } object TSNamespace { - def apply(keepUnexportedVars: Boolean) = new TSNamespace("", None, keepUnexportedVars) // global namespace + def apply() = new TSNamespace("", None) // global namespace } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 7d434af72..566c58a51 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -4,20 +4,39 @@ import scala.scalajs.js import js.DynamicImplicits._ import ts2mls.types._ -class TSProgram(filenames: Seq[String], keepUnexportedVars: Boolean) { - private val program = TypeScript.createProgram(filenames) +// for general ts, we still consider that there is a top-level module +// and in mls we will import ts file like this: +// import * as TopLevelModuleName from "filename" +// for es5.d.ts, we only need to translate everything +// and it will be imported without top-level module before we compile other files +class TSProgram(filename: String, uesTopLevelModule: Boolean) { + private val program = TypeScript.createProgram(Seq(filename)) - // check if files exist - filenames.foreach((fn) => if (!program.fileExists(fn)) throw new Exception(s"file ${fn} doesn't exist.")) + // check if file exists + if (!program.fileExists(filename)) throw new Exception(s"file ${filename} doesn't exist.") - val globalNamespace = TSNamespace(keepUnexportedVars) + val globalNamespace = TSNamespace() + // TODO: support multi-files correctly. implicit val checker = TSTypeChecker(program.getTypeChecker()) - filenames.foreach(filename => TSSourceFile(program.getSourceFile(filename), globalNamespace)) + TSSourceFile(program.getSourceFile(filename), globalNamespace) - def generate(writer: JSWriter): Unit = globalNamespace.generate(writer, "") + def generate(writer: JSWriter): Unit = + if (!uesTopLevelModule) globalNamespace.generate(writer, "") + else { + import TSProgram._ + writer.writeln(s"export declare module ${getModuleName(filename)} {") + globalNamespace.generate(writer, " ") + writer.writeln("}") + } } object TSProgram { - def apply(filenames: Seq[String], keepUnexportedVars: Boolean) = new TSProgram(filenames, keepUnexportedVars) + def apply(filename: String, uesTopLevelModule: Boolean) = new TSProgram(filename, uesTopLevelModule) + + private def getModuleName(filename: String): String = + if (filename.lastIndexOf('.') > -1) + getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'))) + else + filename.substring(filename.lastIndexOf('/') + 1) } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 945e1a816..4f57cc66c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -102,9 +102,9 @@ object Converter { val inheritance = if (parents.isEmpty) constructor else parents.foldLeft(s"$constructor extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) - if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" + if (typeVars.isEmpty) s"${indent}${exp}$typeName$inheritance $body" else - s"${indent}${exp}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints + s"${indent}${exp}$typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index e4c19d0b3..f76450b0c 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -2,85 +2,74 @@ :NewDefs :NoJS :AllowTypeErrors -fun first(x: MutArray): string -fun getZero3(): MutArray -fun first2(fs: MutArray<(number) => number>): (number) => number -fun doEs(e: MutArray): MutArray -declare class C() {} -declare trait I() { - val i: number +export declare module Array { + fun first(x: MutArray): string + fun getZero3(): MutArray + fun first2(fs: MutArray<(number) => number>): (number) => number + fun doEs(e: MutArray): MutArray + class C() {} + trait I() { + val i: number + } + fun doCs(c: MutArray): MutArray + fun doIs(i: MutArray): MutArray + fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> + fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> + fun translate(x: MutArray): MutArray + fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> + class Temp() { + val x: T + } + fun ta(ts: MutArray>): MutArray> + fun tat(ts: MutArray>): MutArray> } -fun doCs(c: MutArray): MutArray -fun doIs(i: MutArray): MutArray -fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> -fun translate(x: MutArray): MutArray -fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> -declare class Temp() { - val x: T -} -fun ta(ts: MutArray>): MutArray> -fun tat(ts: MutArray>): MutArray> +//│ ╔══[ERROR] type identifier not found: C +//│ ║ l.14: fun doCs(c: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: C +//│ ║ l.14: fun doCs(c: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: I +//│ ║ l.15: fun doIs(i: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: I +//│ ║ l.15: fun doIs(i: MutArray): MutArray +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: Temp +//│ ║ l.23: fun ta(ts: MutArray>): MutArray> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Temp +//│ ║ l.23: fun ta(ts: MutArray>): MutArray> +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Temp +//│ ║ l.24: fun tat(ts: MutArray>): MutArray> +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: Temp +//│ ║ l.24: fun tat(ts: MutArray>): MutArray> +//│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.10: declare trait I() { -//│ ║ ^^^^^^^^^^^ -//│ ║ l.11: val i: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.12: } -//│ ╙── ^ -//│ ╔══[ERROR] trait I cannot be used as a type -//│ ║ l.14: fun doIs(i: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] trait I cannot be used as a type -//│ ║ l.14: fun doIs(i: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> -//│ ╙── ^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.17: fun translate(x: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.17: fun translate(x: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.17: fun translate(x: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.23: fun tat(ts: MutArray>): MutArray> -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.23: fun tat(ts: MutArray>): MutArray> -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.23: fun tat(ts: MutArray>): MutArray> -//│ ╙── ^ -//│ fun first: (x: MutArray[string],) -> string -//│ fun getZero3: () -> MutArray[number] -//│ fun first2: (fs: MutArray[number -> number],) -> number -> number -//│ fun doEs: (e: MutArray[int],) -> MutArray[int] -//│ class C() -//│ trait I() -//│ fun doCs: (c: MutArray[C],) -> MutArray[C] -//│ fun doIs: (i: MutArray[I],) -> MutArray[I] -//│ fun inter: (x: MutArray[error],) -> MutArray[error] -//│ fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)] -//│ fun translate: (x: MutArray[error],) -> MutArray[error] -//│ fun uu: (x: MutArray[false | number | true],) -> MutArray[false | number | true] -//│ class Temp[T]() { -//│ let x: T +//│ ║ l.11: trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.12: val i: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.13: } +//│ ╙── ^^^ +//│ module Array() { +//│ class C() +//│ trait I() +//│ class Temp[T]() { +//│ let x: T +//│ } +//│ fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)] +//│ fun doCs: (c: MutArray[error],) -> MutArray[error] +//│ fun doEs: (e: MutArray[int],) -> MutArray[int] +//│ fun doIs: (i: MutArray[error],) -> MutArray[error] +//│ fun first: (x: MutArray[string],) -> string +//│ fun first2: (fs: MutArray[number -> number],) -> number -> number +//│ fun getZero3: () -> MutArray[number] +//│ fun inter: forall 'U. (x: MutArray['U],) -> MutArray['U] +//│ fun ta: (ts: MutArray[error],) -> MutArray[error] +//│ fun tat: (ts: MutArray[error],) -> MutArray[error] +//│ fun translate: forall 'U0 'T. (x: MutArray['T],) -> MutArray['U0] +//│ fun uu: (x: MutArray[false | number | true],) -> MutArray[false | number | true] //│ } -//│ fun ta: (ts: MutArray[Temp[bool]],) -> MutArray[Temp[bool]] -//│ fun tat: (ts: MutArray[Temp[error]],) -> MutArray[Temp[error]] diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 7bc0f66f2..58be982e1 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -2,65 +2,75 @@ :NewDefs :NoJS :AllowTypeErrors -fun hello(): unit -fun add(x: number, y: number): number -fun sub(x: number, y: number): number -fun foo(): number -fun id(x: anything): anything -fun odd(x: number): (false) | (true) -fun isnull(x: anything): (false) | (true) -fun bar(): anything -fun nu(n: null): null -fun un(n: undefined): undefined -fun fail(): nothing -fun create(): object -fun pa(x: number): number -fun wtf(x: anything): unit -declare class Foooooo() { - val ooooooo: number +export declare module BasicFunctions { + fun hello(): unit + fun add(x: number, y: number): number + fun sub(x: number, y: number): number + fun foo(): number + fun id(x: anything): anything + fun odd(x: number): (false) | (true) + fun isnull(x: anything): (false) | (true) + fun bar(): anything + fun nu(n: null): null + fun un(n: undefined): undefined + fun fail(): nothing + fun create(): object + fun pa(x: number): number + fun wtf(x: anything): unit + class Foooooo() { + val ooooooo: number + } + fun inn(f: Foooooo): unit + fun out1(): Foooooo + trait Barrrrrrrrr() { + val rrrrrrr: number + } + fun inn2(b: Barrrrrrrrr): unit + fun out2(): Barrrrrrrrr } -fun inn(f: Foooooo): unit -fun out1(): Foooooo -declare trait Barrrrrrrrr() { - val rrrrrrr: number -} -fun inn2(b: Barrrrrrrrr): unit -fun out2(): Barrrrrrrrr //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.16: fun create(): object -//│ ╙── ^^^^^^ +//│ ║ l.17: fun create(): object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: Foooooo +//│ ║ l.23: fun inn(f: Foooooo): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Foooooo +//│ ║ l.24: fun out1(): Foooooo +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Barrrrrrrrr +//│ ║ l.28: fun inn2(b: Barrrrrrrrr): unit +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Barrrrrrrrr +//│ ║ l.29: fun out2(): Barrrrrrrrr +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.24: declare trait Barrrrrrrrr() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: val rrrrrrr: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.26: } -//│ ╙── ^ -//│ ╔══[ERROR] trait Barrrrrrrrr cannot be used as a type -//│ ║ l.27: fun inn2(b: Barrrrrrrrr): unit -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait Barrrrrrrrr cannot be used as a type -//│ ║ l.28: fun out2(): Barrrrrrrrr -//│ ╙── ^^^^^^^^^^^ -//│ fun hello: () -> unit -//│ fun add: (x: number, y: number,) -> number -//│ fun sub: (x: number, y: number,) -> number -//│ fun foo: () -> number -//│ fun id: (x: anything,) -> anything -//│ fun odd: (x: number,) -> bool -//│ fun isnull: (x: anything,) -> bool -//│ fun bar: () -> anything -//│ fun nu: (n: null,) -> null -//│ fun un: (n: undefined,) -> undefined -//│ fun fail: () -> nothing -//│ fun create: () -> error -//│ fun pa: (x: number,) -> number -//│ fun wtf: (x: anything,) -> unit -//│ class Foooooo() { -//│ let ooooooo: number +//│ ║ l.25: trait Barrrrrrrrr() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.26: val rrrrrrr: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.27: } +//│ ╙── ^^^ +//│ module BasicFunctions() { +//│ trait Barrrrrrrrr() +//│ class Foooooo() { +//│ let ooooooo: number +//│ } +//│ fun add: (x: number, y: number,) -> number +//│ fun bar: () -> anything +//│ fun create: () -> error +//│ fun fail: () -> nothing +//│ fun foo: () -> number +//│ fun hello: () -> unit +//│ fun id: (x: anything,) -> anything +//│ fun inn: (f: error,) -> unit +//│ fun inn2: (b: error,) -> unit +//│ fun isnull: (x: anything,) -> bool +//│ fun nu: (n: null,) -> null +//│ fun odd: (x: number,) -> bool +//│ fun out1: () -> error +//│ fun out2: () -> error +//│ fun pa: (x: number,) -> number +//│ fun sub: (x: number, y: number,) -> number +//│ fun un: (n: undefined,) -> undefined +//│ fun wtf: (x: anything,) -> unit //│ } -//│ fun inn: (f: Foooooo,) -> unit -//│ fun out1: () -> Foooooo -//│ trait Barrrrrrrrr() -//│ fun inn2: (b: Barrrrrrrrr,) -> unit -//│ fun out2: () -> Barrrrrrrrr diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 173695a1b..adf37dc69 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -2,45 +2,70 @@ :NewDefs :NoJS :AllowTypeErrors -declare class Student(s: string, age: number) { - val name: string - fun isFriend(other: Student): (false) | (true) - fun addScore(sub: string, score: number): unit - fun getID(): number -} -declare class Foo() { - fun bar(x: T): unit -} -declare class EZ() { - fun inc(x: number): number -} -declare class Outer() { - declare class Inner() { - val a: number +export declare module ClassMember { + class Student(s: string, age: number) { + val name: string + fun isFriend(other: Student): (false) | (true) + fun addScore(sub: string, score: number): unit + fun getID(): number + } + class Foo() { + fun bar(x: T): unit + } + class EZ() { + fun inc(x: number): number + } + class Outer() { + class Inner() { + val a: number + } + } + class TTT() { + fun ttt(x: T): T + fun ttt2(x: T): T } } -declare class TTT() { - fun ttt(x: T): T - fun ttt2(x: T): T -} -//│ class Student(s: string, age: number) { -//│ fun addScore: (sub: string, score: number,) -> unit -//│ fun getID: () -> number -//│ fun isFriend: (other: Student,) -> bool -//│ let name: string -//│ } -//│ class Foo[T]() { -//│ fun bar: (x: T,) -> unit -//│ } -//│ class EZ() { -//│ fun inc: (x: number,) -> number -//│ } -//│ class Outer() { -//│ class Inner() { -//│ let a: number +//│ ╔══[ERROR] Member isFriend is declared but not defined +//│ ║ l.8: fun isFriend(other: Student): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member addScore is declared but not defined +//│ ║ l.9: fun addScore(sub: string, score: number): unit +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member getID is declared but not defined +//│ ║ l.10: fun getID(): number +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member bar is declared but not defined +//│ ║ l.13: fun bar(x: T): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member inc is declared but not defined +//│ ║ l.16: fun inc(x: number): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member ttt is declared but not defined +//│ ║ l.24: fun ttt(x: T): T +//│ ╙── ^^^ +//│ ╔══[ERROR] Member ttt2 is declared but not defined +//│ ║ l.25: fun ttt2(x: T): T +//│ ╙── ^^^^ +//│ module ClassMember() { +//│ class EZ() { +//│ fun inc: (x: number,) -> number +//│ } +//│ class Foo[T]() { +//│ fun bar: (x: T,) -> unit +//│ } +//│ class Outer() { +//│ class Inner() { +//│ let a: number +//│ } +//│ } +//│ class Student(s: string, age: number) { +//│ fun addScore: (sub: string, score: number,) -> unit +//│ fun getID: () -> number +//│ fun isFriend: (other: Student,) -> bool +//│ let name: string +//│ } +//│ class TTT[T]() { +//│ fun ttt: (x: T,) -> T +//│ fun ttt2: (x: T,) -> T //│ } -//│ } -//│ class TTT[T]() { -//│ fun ttt: (x: T,) -> T -//│ fun ttt2: (x: T,) -> T //│ } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 9c78ed209..e0eac5c8e 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -2,27 +2,34 @@ :NewDefs :NoJS :AllowTypeErrors -fun getName(id: (string) | (number)): string -fun render(callback: (unit => unit) | (undefined)): string -declare trait Get() { - val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> -} -declare class Person(name: string, age: number) { - fun getName(id: number): string -} -export declare module OOO { +export declare module Dec { + fun getName(id: (string) | (number)): string + fun render(callback: (unit => unit) | (undefined)): string + trait Get() { + val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> + } + class Person(name: string, age: number) { + fun getName(id: number): string + } + module OOO { + } } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.7: declare trait Get() { -//│ ║ ^^^^^^^^^^^^^ -//│ ║ l.8: val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.9: } -//│ ╙── ^ -//│ fun getName: (id: number | string,) -> string -//│ fun render: (callback: unit -> unit | undefined,) -> string -//│ trait Get() -//│ class Person(name: string, age: number) { -//│ fun getName: (id: number,) -> string +//│ ║ l.8: trait Get() { +//│ ║ ^^^^^^^^^^^^^ +//│ ║ l.9: val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member getName is declared but not defined +//│ ║ l.12: fun getName(id: number): string +//│ ╙── ^^^^^^^ +//│ module Dec() { +//│ trait Get() +//│ module OOO() +//│ class Person(name: string, age: number) { +//│ fun getName: (id: number,) -> string +//│ } +//│ fun getName: (id: number | string,) -> string +//│ fun render: (callback: unit -> unit | undefined,) -> string //│ } -//│ module OOO() diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 7e74bfd12..323be3ab9 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -2,8 +2,8 @@ :NewDefs :NoJS :AllowTypeErrors -export val NaN: number -export val Infinity: number +val NaN: number +val Infinity: number fun eval(x: string): anything fun parseInt(string: string, radix: (number) | (undefined)): number fun parseFloat(string: string): number @@ -15,12 +15,12 @@ fun encodeURI(uri: string): string fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string fun escape(string: string): string fun unescape(string: string): string -declare trait Symbol() { +trait Symbol() { fun toString(): string fun valueOf(): Symbol } type PropertyKey = ((string) | (number)) | (Symbol) -declare trait PropertyDescriptor() { +trait PropertyDescriptor() { val configurable: ((false) | (true)) | (undefined) val set: ((anything) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -28,10 +28,10 @@ declare trait PropertyDescriptor() { val writable: ((false) | (true)) | (undefined) val value: (anything) | (undefined) } -declare trait PropertyDescriptorMap() { +trait PropertyDescriptorMap() { val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } -declare trait Object() { +trait Object() { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) fun valueOf(): Object @@ -40,7 +40,7 @@ declare trait Object() { fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } -declare trait ObjectConstructor() { +trait ObjectConstructor() { val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> fun getOwnPropertyNames(o: anything): MutArray fun isFrozen(o: anything): (false) | (true) @@ -58,48 +58,48 @@ declare trait ObjectConstructor() { fun keys(o: object): MutArray fun isExtensible(o: anything): (false) | (true) } -export val Function: FunctionConstructor -declare trait FunctionConstructor() { +val Function: FunctionConstructor +trait FunctionConstructor() { val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> val prototype: Function } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -declare trait CallableFunction() extends Function { +trait CallableFunction() extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -declare trait NewableFunction() extends Function { +trait NewableFunction() extends Function { fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): unit fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -declare trait IArguments() { +trait IArguments() { val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> val length: number val callee: Function } -declare trait String() { +trait String() { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } -declare trait StringConstructor() { +trait StringConstructor() { val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> val prototype: String fun fromCharCode(codes: MutArray): string } -export val Boolean: BooleanConstructor -declare trait BooleanConstructor() { +val Boolean: BooleanConstructor +trait BooleanConstructor() { val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> val prototype: Boolean } -declare trait Number() { +trait Number() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } -declare trait NumberConstructor() { +trait NumberConstructor() { val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> val NaN: number val MIN_VALUE: number @@ -109,23 +109,23 @@ declare trait NumberConstructor() { val MAX_VALUE: number val prototype: Number } -declare trait TemplateStringsArray() extends ReadonlyArray { +trait TemplateStringsArray() extends ReadonlyArray { val raw: ReadonlyArray } -declare trait ImportMeta() {} -declare trait ImportCallOptions() { +trait ImportMeta() {} +trait ImportCallOptions() { val assert: (ImportAssertions) | (undefined) } -declare trait ImportAssertions() { +trait ImportAssertions() { val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } -export val Math: Math -declare trait Date() { +val Math: Math +trait Date() { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } -declare trait DateConstructor() { +trait DateConstructor() { val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> @@ -133,7 +133,7 @@ declare trait DateConstructor() { fun parse(s: string): number val prototype: Date } -declare trait RegExp() { +trait RegExp() { fun test(string: string): (false) | (true) val multiline: (false) | (true) val source: string @@ -143,50 +143,50 @@ declare trait RegExp() { val ignoreCase: (false) | (true) fun exec(string: string): RegExpExecArray } -export val Error: ErrorConstructor -declare trait ErrorConstructor() { +val Error: ErrorConstructor +trait ErrorConstructor() { val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> val prototype: Error } -export val EvalError: EvalErrorConstructor -declare trait EvalErrorConstructor() extends ErrorConstructor { +val EvalError: EvalErrorConstructor +trait EvalErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> val prototype: EvalError } -export val RangeError: RangeErrorConstructor -declare trait RangeErrorConstructor() extends ErrorConstructor { +val RangeError: RangeErrorConstructor +trait RangeErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> val prototype: RangeError } -export val ReferenceError: ReferenceErrorConstructor -declare trait ReferenceErrorConstructor() extends ErrorConstructor { +val ReferenceError: ReferenceErrorConstructor +trait ReferenceErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> val prototype: ReferenceError } -export val SyntaxError: SyntaxErrorConstructor -declare trait SyntaxErrorConstructor() extends ErrorConstructor { +val SyntaxError: SyntaxErrorConstructor +trait SyntaxErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> val prototype: SyntaxError } -export val TypeError: TypeErrorConstructor -declare trait TypeErrorConstructor() extends ErrorConstructor { +val TypeError: TypeErrorConstructor +trait TypeErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> val prototype: TypeError } -export val URIError: URIErrorConstructor -declare trait URIErrorConstructor() extends ErrorConstructor { +val URIError: URIErrorConstructor +trait URIErrorConstructor() extends ErrorConstructor { val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> val prototype: URIError } -export val JSON: JSON -declare trait ReadonlyArray() { +val JSON: JSON +trait ReadonlyArray() { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit @@ -204,20 +204,20 @@ declare trait ReadonlyArray() { fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number } -declare trait ConcatArray() { +trait ConcatArray() { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } -export val Array: ArrayConstructor -declare trait ArrayConstructor() { +val Array: ArrayConstructor +trait ArrayConstructor() { val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) val prototype: MutArray } -declare trait TypedPropertyDescriptor() { +trait TypedPropertyDescriptor() { val configurable: ((false) | (true)) | (undefined) val set: ((T) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -227,7 +227,7 @@ declare trait TypedPropertyDescriptor() { } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -declare trait ArrayLike() { +trait ArrayLike() { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } @@ -248,36 +248,36 @@ type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5. type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -declare trait ThisType() {} -export val ArrayBuffer: ArrayBufferConstructor -declare trait ArrayBufferTypes() { +trait ThisType() {} +val ArrayBuffer: ArrayBufferConstructor +trait ArrayBufferTypes() { val ArrayBuffer: ArrayBuffer } type ArrayBufferLike = ArrayBuffer -declare trait ArrayBufferConstructor() { +trait ArrayBufferConstructor() { val prototype: ArrayBuffer val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } -declare trait ArrayBufferView() { +trait ArrayBufferView() { val buffer: ArrayBuffer val byteLength: number val byteOffset: number } -export val DataView: DataViewConstructor -declare trait DataViewConstructor() { +val DataView: DataViewConstructor +trait DataViewConstructor() { val prototype: DataView val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } -export val Int8Array: Int8ArrayConstructor -declare trait Int8ArrayConstructor() { +val Int8Array: Int8ArrayConstructor +trait Int8ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array fun id"of"(items: MutArray): Int8Array val BYTES_PER_ELEMENT: number } -declare trait Uint8Array() { +trait Uint8Array() { fun valueOf(): Uint8Array fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -307,71 +307,71 @@ declare trait Uint8Array() { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number val byteOffset: number } -declare trait Uint8ArrayConstructor() { +trait Uint8ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array fun id"of"(items: MutArray): Uint8Array val BYTES_PER_ELEMENT: number } -export val Uint8ClampedArray: Uint8ClampedArrayConstructor -declare trait Uint8ClampedArrayConstructor() { +val Uint8ClampedArray: Uint8ClampedArrayConstructor +trait Uint8ClampedArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray fun id"of"(items: MutArray): Uint8ClampedArray val BYTES_PER_ELEMENT: number } -export val Int16Array: Int16ArrayConstructor -declare trait Int16ArrayConstructor() { +val Int16Array: Int16ArrayConstructor +trait Int16ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array fun id"of"(items: MutArray): Int16Array val BYTES_PER_ELEMENT: number } -export val Uint16Array: Uint16ArrayConstructor -declare trait Uint16ArrayConstructor() { +val Uint16Array: Uint16ArrayConstructor +trait Uint16ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array fun id"of"(items: MutArray): Uint16Array val BYTES_PER_ELEMENT: number } -export val Int32Array: Int32ArrayConstructor -declare trait Int32ArrayConstructor() { +val Int32Array: Int32ArrayConstructor +trait Int32ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array fun id"of"(items: MutArray): Int32Array val BYTES_PER_ELEMENT: number } -export val Uint32Array: Uint32ArrayConstructor -declare trait Uint32ArrayConstructor() { +val Uint32Array: Uint32ArrayConstructor +trait Uint32ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array fun id"of"(items: MutArray): Uint32Array val BYTES_PER_ELEMENT: number } -export val Float32Array: Float32ArrayConstructor -declare trait Float32ArrayConstructor() { +val Float32Array: Float32ArrayConstructor +trait Float32ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array fun id"of"(items: MutArray): Float32Array val BYTES_PER_ELEMENT: number } -export val Float64Array: Float64ArrayConstructor -declare trait Float64ArrayConstructor() { +val Float64Array: Float64ArrayConstructor +trait Float64ArrayConstructor() { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array fun id"of"(items: MutArray): Float64Array val BYTES_PER_ELEMENT: number } -export declare module Intl { - export declare trait CollatorOptions() { +module Intl { + export trait CollatorOptions() { val sensitivity: (string) | (undefined) val ignorePunctuation: ((false) | (true)) | (undefined) val usage: (string) | (undefined) @@ -379,7 +379,7 @@ export declare module Intl { val numeric: ((false) | (true)) | (undefined) val caseFirst: (string) | (undefined) } - export declare trait ResolvedCollatorOptions() { + export trait ResolvedCollatorOptions() { val sensitivity: string val ignorePunctuation: (false) | (true) val usage: string @@ -388,11 +388,11 @@ export declare module Intl { val caseFirst: string val collation: string } - export declare trait Collator() { + export trait Collator() { fun compare(x: string, y: string): number fun resolvedOptions(): Intl.ResolvedCollatorOptions } - export declare trait NumberFormatOptions() { + export trait NumberFormatOptions() { val minimumSignificantDigits: (number) | (undefined) val useGrouping: ((false) | (true)) | (undefined) val style: (string) | (undefined) @@ -404,7 +404,7 @@ export declare module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: (number) | (undefined) } - export declare trait ResolvedNumberFormatOptions() { + export trait ResolvedNumberFormatOptions() { val numberingSystem: string val minimumSignificantDigits: (number) | (undefined) val useGrouping: (false) | (true) @@ -416,11 +416,11 @@ export declare module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: number } - export declare trait NumberFormat() { + export trait NumberFormat() { fun format(value: number): string fun resolvedOptions(): Intl.ResolvedNumberFormatOptions } - export declare trait DateTimeFormatOptions() { + export trait DateTimeFormatOptions() { val minute: ((string) | (string)) | (undefined) val year: ((string) | (string)) | (undefined) val hour: ((string) | (string)) | (undefined) @@ -435,7 +435,7 @@ export declare module Intl { val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) val era: (((string) | (string)) | (string)) | (undefined) } - export declare trait ResolvedDateTimeFormatOptions() { + export trait ResolvedDateTimeFormatOptions() { val numberingSystem: string val minute: (string) | (undefined) val year: (string) | (undefined) @@ -451,7 +451,7 @@ export declare module Intl { val timeZoneName: (string) | (undefined) val era: (string) | (undefined) } - export declare trait DateTimeFormat() { + export trait DateTimeFormat() { fun format(date: ((number) | (Date)) | (undefined)): string fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } @@ -460,20 +460,26 @@ export declare module Intl { //│ ║ l.20: fun valueOf(): Symbol //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: declare trait Symbol() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.18: trait Symbol() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.19: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.20: fun valueOf(): Symbol //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.21: } //│ ╙── ^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.19: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.20: fun valueOf(): Symbol +//│ ╙── ^^^^^^^ //│ ╔══[ERROR] trait Symbol cannot be used as a type //│ ║ l.22: type PropertyKey = ((string) | (number)) | (Symbol) //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: declare trait PropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: trait PropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: val set: ((anything) => unit) | (undefined) @@ -489,8 +495,8 @@ export declare module Intl { //│ ║ l.30: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: declare trait PropertyDescriptorMap() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.31: trait PropertyDescriptorMap() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.32: val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.33: } @@ -508,8 +514,8 @@ export declare module Intl { //│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: declare trait Object() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.34: trait Object() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) @@ -526,6 +532,24 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.42: } //│ ╙── ^ +//│ ╔══[ERROR] Member hasOwnProperty is declared but not defined +//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member propertyIsEnumerable is declared but not defined +//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.37: fun valueOf(): Object +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.38: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isPrototypeOf is declared but not defined +//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.41: fun toString(): string +//│ ╙── ^^^^^^^^ //│ ╔══[ERROR] trait Symbol cannot be used as a type //│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T //│ ╙── ^^^^^^^^ @@ -557,8 +581,8 @@ export declare module Intl { //│ ║ l.58: fun keys(o: object): MutArray //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.43: declare trait ObjectConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.43: trait ObjectConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.44: val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray @@ -593,12 +617,48 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.60: } //│ ╙── ^ +//│ ╔══[ERROR] Member getOwnPropertyNames is declared but not defined +//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isFrozen is declared but not defined +//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member getPrototypeOf is declared but not defined +//│ ║ l.47: fun getPrototypeOf(o: anything): anything +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member defineProperty is declared but not defined +//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member isSealed is declared but not defined +//│ ║ l.50: fun isSealed(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member defineProperties is declared but not defined +//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member preventExtensions is declared but not defined +//│ ║ l.52: fun preventExtensions(o: T): T +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member freeze is declared but not defined +//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member getOwnPropertyDescriptor is declared but not defined +//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member seal is declared but not defined +//│ ║ l.57: fun seal(o: T): T +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member keys is declared but not defined +//│ ║ l.58: fun keys(o: object): MutArray +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member isExtensible is declared but not defined +//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type -//│ ║ l.61: export val Function: FunctionConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.61: val Function: FunctionConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.62: declare trait FunctionConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.62: trait FunctionConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.63: val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.64: val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> @@ -614,8 +674,8 @@ export declare module Intl { //│ ║ l.68: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.69: declare trait CallableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.69: trait CallableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.71: fun call(thisArg: T, args: A): R @@ -624,9 +684,18 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.73: } //│ ╙── ^ +//│ ╔══[ERROR] Member apply is declared but not defined +//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member call is declared but not defined +//│ ║ l.71: fun call(thisArg: T, args: A): R +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member bind is declared but not defined +//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.74: declare trait NewableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.74: trait NewableFunction() extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.76: fun call(thisArg: T, args: A): unit @@ -635,9 +704,18 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.78: } //│ ╙── ^ +//│ ╔══[ERROR] Member apply is declared but not defined +//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member call is declared but not defined +//│ ║ l.76: fun call(thisArg: T, args: A): unit +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member bind is declared but not defined +//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.79: declare trait IArguments() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.79: trait IArguments() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.80: val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.81: val length: number @@ -647,8 +725,8 @@ export declare module Intl { //│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.374: export declare trait CollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.374: export trait CollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.375: val sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.376: val ignorePunctuation: ((false) | (true)) | (undefined) @@ -664,8 +742,8 @@ export declare module Intl { //│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.382: export declare trait ResolvedCollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.382: export trait ResolvedCollatorOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.383: val sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.384: val ignorePunctuation: (false) | (true) @@ -686,17 +764,23 @@ export declare module Intl { //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.391: export declare trait Collator() { -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.391: export trait Collator() { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.392: fun compare(x: string, y: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.394: } //│ ╙── ^^^ +//│ ╔══[ERROR] Member compare is declared but not defined +//│ ║ l.392: fun compare(x: string, y: string): number +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions +//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: export declare trait NumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.395: export trait NumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.396: val minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.397: val useGrouping: ((false) | (true)) | (undefined) @@ -720,8 +804,8 @@ export declare module Intl { //│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.407: export declare trait ResolvedNumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.407: export trait ResolvedNumberFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.408: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.409: val minimumSignificantDigits: (number) | (undefined) @@ -748,17 +832,23 @@ export declare module Intl { //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.419: export declare trait NumberFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.419: export trait NumberFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.420: fun format(value: number): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.422: } //│ ╙── ^^^ +//│ ╔══[ERROR] Member format is declared but not defined +//│ ║ l.420: fun format(value: number): string +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.423: export declare trait DateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.423: export trait DateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.424: val minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.425: val year: ((string) | (string)) | (undefined) @@ -788,8 +878,8 @@ export declare module Intl { //│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.438: export declare trait ResolvedDateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.438: export trait ResolvedDateTimeFormatOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.439: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.440: val minute: (string) | (undefined) @@ -827,24 +917,33 @@ export declare module Intl { //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.454: export declare trait DateTimeFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.454: export trait DateTimeFormat() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.457: } //│ ╙── ^^^ +//│ ╔══[ERROR] Member format is declared but not defined +//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member resolvedOptions is declared but not defined +//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions +//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.84: declare trait String() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.84: trait String() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.86: } //│ ╙── ^ +//│ ╔══[ERROR] Member localeCompare is declared but not defined +//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number +//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.87: declare trait StringConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.87: trait StringConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.88: val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.89: val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> @@ -855,12 +954,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.92: } //│ ╙── ^ +//│ ╔══[ERROR] Member fromCharCode is declared but not defined +//│ ║ l.91: fun fromCharCode(codes: MutArray): string +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type -//│ ║ l.93: export val Boolean: BooleanConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ║ l.93: val Boolean: BooleanConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: declare trait BooleanConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.94: trait BooleanConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.95: val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.96: val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> @@ -870,15 +972,18 @@ export declare module Intl { //│ ║ l.98: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.99: declare trait Number() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.99: trait Number() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.101: } //│ ╙── ^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.102: declare trait NumberConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.102: trait NumberConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.103: val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.104: val NaN: number @@ -898,38 +1003,38 @@ export declare module Intl { //│ ║ l.111: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.112: declare trait TemplateStringsArray() extends ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.112: trait TemplateStringsArray() extends ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.113: val raw: ReadonlyArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.114: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.115: declare trait ImportMeta() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.115: trait ImportMeta() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.116: declare trait ImportCallOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.116: trait ImportCallOptions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.117: val assert: (ImportAssertions) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.118: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.119: declare trait ImportAssertions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.119: trait ImportAssertions() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.120: val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.121: } //│ ╙── ^ //│ ╔══[ERROR] function Math cannot be used as a type -//│ ║ l.122: export val Math: Math -//│ ╙── ^^^^ +//│ ║ l.122: val Math: Math +//│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: Math -//│ ║ l.122: export val Math: Math -//│ ╙── ^^^^ +//│ ║ l.122: val Math: Math +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.123: declare trait Date() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.123: trait Date() { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string @@ -938,9 +1043,18 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.127: } //│ ╙── ^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toLocaleDateString is declared but not defined +//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member toLocaleTimeString is declared but not defined +//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string +//│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.128: declare trait DateConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.128: trait DateConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.129: val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number @@ -955,6 +1069,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.135: } //│ ╙── ^ +//│ ╔══[ERROR] Member UTC is declared but not defined +//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member now is declared but not defined +//│ ║ l.132: fun now(): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member parse is declared but not defined +//│ ║ l.133: fun parse(s: string): number +//│ ╙── ^^^^^ //│ ╔══[ERROR] trait RegExp cannot be used as a type //│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp //│ ╙── ^^^^^^ @@ -962,8 +1085,8 @@ export declare module Intl { //│ ║ l.144: fun exec(string: string): RegExpExecArray //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.136: declare trait RegExp() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.136: trait RegExp() { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.137: fun test(string: string): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.138: val multiline: (false) | (true) @@ -982,12 +1105,21 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.145: } //│ ╙── ^ +//│ ╔══[ERROR] Member test is declared but not defined +//│ ║ l.137: fun test(string: string): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member compile is declared but not defined +//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member exec is declared but not defined +//│ ║ l.144: fun exec(string: string): RegExpExecArray +//│ ╙── ^^^^ //│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type -//│ ║ l.146: export val Error: ErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ║ l.146: val Error: ErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.147: declare trait ErrorConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.147: trait ErrorConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.148: val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.149: val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> @@ -997,11 +1129,11 @@ export declare module Intl { //│ ║ l.151: } //│ ╙── ^ //│ ╔══[ERROR] trait EvalErrorConstructor cannot be used as a type -//│ ║ l.152: export val EvalError: EvalErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.152: val EvalError: EvalErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.153: declare trait EvalErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.153: trait EvalErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.154: val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.155: val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> @@ -1011,11 +1143,11 @@ export declare module Intl { //│ ║ l.157: } //│ ╙── ^ //│ ╔══[ERROR] trait RangeErrorConstructor cannot be used as a type -//│ ║ l.158: export val RangeError: RangeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.158: val RangeError: RangeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.159: declare trait RangeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.159: trait RangeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.160: val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.161: val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> @@ -1025,11 +1157,11 @@ export declare module Intl { //│ ║ l.163: } //│ ╙── ^ //│ ╔══[ERROR] trait ReferenceErrorConstructor cannot be used as a type -//│ ║ l.164: export val ReferenceError: ReferenceErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.164: val ReferenceError: ReferenceErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.165: declare trait ReferenceErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.165: trait ReferenceErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.166: val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.167: val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> @@ -1039,11 +1171,11 @@ export declare module Intl { //│ ║ l.169: } //│ ╙── ^ //│ ╔══[ERROR] trait SyntaxErrorConstructor cannot be used as a type -//│ ║ l.170: export val SyntaxError: SyntaxErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.170: val SyntaxError: SyntaxErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.171: declare trait SyntaxErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.171: trait SyntaxErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.172: val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.173: val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> @@ -1053,11 +1185,11 @@ export declare module Intl { //│ ║ l.175: } //│ ╙── ^ //│ ╔══[ERROR] trait TypeErrorConstructor cannot be used as a type -//│ ║ l.176: export val TypeError: TypeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.176: val TypeError: TypeErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.177: declare trait TypeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.177: trait TypeErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.178: val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.179: val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> @@ -1067,11 +1199,11 @@ export declare module Intl { //│ ║ l.181: } //│ ╙── ^ //│ ╔══[ERROR] trait URIErrorConstructor cannot be used as a type -//│ ║ l.182: export val URIError: URIErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.182: val URIError: URIErrorConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.183: declare trait URIErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.183: trait URIErrorConstructor() extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.184: val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.185: val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> @@ -1081,11 +1213,11 @@ export declare module Intl { //│ ║ l.187: } //│ ╙── ^ //│ ╔══[ERROR] function JSON cannot be used as a type -//│ ║ l.188: export val JSON: JSON -//│ ╙── ^^^^ +//│ ║ l.188: val JSON: JSON +//│ ╙── ^^^^ //│ ╔══[ERROR] type identifier not found: JSON -//│ ║ l.188: export val JSON: JSON -//│ ╙── ^^^^ +//│ ║ l.188: val JSON: JSON +//│ ╙── ^^^^ //│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type //│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ //│ ╙── ^^^^^^^^^^^^^^^^^^ @@ -1108,8 +1240,8 @@ export declare module Intl { //│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.189: declare trait ReadonlyArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.189: trait ReadonlyArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ @@ -1144,9 +1276,48 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.206: } //│ ╙── ^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.196: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.199: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.202: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.207: declare trait ConcatArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.207: trait ConcatArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.208: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.209: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> @@ -1157,12 +1328,18 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.212: } //│ ╙── ^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.210: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray +//│ ╙── ^^^^^ //│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type -//│ ║ l.213: export val Array: ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ║ l.213: val Array: ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.214: declare trait ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.214: trait ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.215: val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.216: val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> @@ -1173,9 +1350,12 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.219: } //│ ╙── ^ +//│ ╔══[ERROR] Member isArray is declared but not defined +//│ ║ l.217: fun isArray(arg: anything): (false) | (true) +//│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.220: declare trait TypedPropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.220: trait TypedPropertyDescriptor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.221: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.222: val set: ((T) => unit) | (undefined) @@ -1203,8 +1383,8 @@ export declare module Intl { //│ ║ l.229: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.230: declare trait ArrayLike() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.230: trait ArrayLike() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.231: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.232: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> @@ -1260,14 +1440,14 @@ export declare module Intl { //│ ║ l.250: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.251: declare trait ThisType() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.251: trait ThisType() {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type -//│ ║ l.252: export val ArrayBuffer: ArrayBufferConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.252: val ArrayBuffer: ArrayBufferConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.253: declare trait ArrayBufferTypes() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.253: trait ArrayBufferTypes() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.254: val ArrayBuffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.255: } @@ -1279,8 +1459,8 @@ export declare module Intl { //│ ║ l.256: type ArrayBufferLike = ArrayBuffer //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.257: declare trait ArrayBufferConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.257: trait ArrayBufferConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.258: val prototype: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.259: val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> @@ -1289,9 +1469,12 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.261: } //│ ╙── ^ +//│ ╔══[ERROR] Member isView is declared but not defined +//│ ║ l.260: fun isView(arg: anything): (false) | (true) +//│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.262: declare trait ArrayBufferView() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.262: trait ArrayBufferView() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.263: val buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.264: val byteLength: number @@ -1301,11 +1484,11 @@ export declare module Intl { //│ ║ l.266: } //│ ╙── ^ //│ ╔══[ERROR] trait DataViewConstructor cannot be used as a type -//│ ║ l.267: export val DataView: DataViewConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.267: val DataView: DataViewConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.268: declare trait DataViewConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.268: trait DataViewConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.269: val prototype: DataView //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.270: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> @@ -1313,8 +1496,8 @@ export declare module Intl { //│ ║ l.271: } //│ ╙── ^ //│ ╔══[ERROR] trait Int8ArrayConstructor cannot be used as a type -//│ ║ l.272: export val Int8Array: Int8ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.272: val Int8Array: Int8ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1331,8 +1514,8 @@ export declare module Intl { //│ ║ l.277: fun id"of"(items: MutArray): Int8Array //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.273: declare trait Int8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.273: trait Int8ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.274: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ @@ -1345,6 +1528,12 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.279: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.277: fun id"of"(items: MutArray): Int8Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint8Array cannot be used as a type //│ ║ l.281: fun valueOf(): Uint8Array //│ ╙── ^^^^^^^^^^ @@ -1403,8 +1592,8 @@ export declare module Intl { //│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.280: declare trait Uint8Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.280: trait Uint8Array() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.281: fun valueOf(): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number @@ -1463,6 +1652,72 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.309: } //│ ╙── ^ +//│ ╔══[ERROR] Member valueOf is declared but not defined +//│ ║ l.281: fun valueOf(): Uint8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member lastIndexOf is declared but not defined +//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member every is declared but not defined +//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member toLocaleString is declared but not defined +//│ ║ l.285: fun toLocaleString(): string +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member reduceRight is declared but not defined +//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member fill is declared but not defined +//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member sort is declared but not defined +//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member copyWithin is declared but not defined +//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Member find is declared but not defined +//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member subarray is declared but not defined +//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member join is declared but not defined +//│ ║ l.294: fun join(separator: (string) | (undefined)): string +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member map is declared but not defined +//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^ +//│ ╔══[ERROR] Member forEach is declared but not defined +//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member findIndex is declared but not defined +//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Member reverse is declared but not defined +//│ ║ l.299: fun reverse(): Uint8Array +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Member filter is declared but not defined +//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member slice is declared but not defined +//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member reduce is declared but not defined +//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Member toString is declared but not defined +//│ ║ l.304: fun toString(): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member some is declared but not defined +//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member indexOf is declared but not defined +//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number +//│ ╙── ^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1473,8 +1728,8 @@ export declare module Intl { //│ ║ l.314: fun id"of"(items: MutArray): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.310: declare trait Uint8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.310: trait Uint8ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.311: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ @@ -1487,9 +1742,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.316: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint8ClampedArrayConstructor cannot be used as a type -//│ ║ l.317: export val Uint8ClampedArray: Uint8ClampedArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.317: val Uint8ClampedArray: Uint8ClampedArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1506,8 +1767,8 @@ export declare module Intl { //│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray //│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.318: declare trait Uint8ClampedArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.318: trait Uint8ClampedArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.319: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ @@ -1520,9 +1781,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.324: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Int16ArrayConstructor cannot be used as a type -//│ ║ l.325: export val Int16Array: Int16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.325: val Int16Array: Int16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1539,8 +1806,8 @@ export declare module Intl { //│ ║ l.330: fun id"of"(items: MutArray): Int16Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.326: declare trait Int16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.326: trait Int16ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.327: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ @@ -1553,9 +1820,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.332: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.330: fun id"of"(items: MutArray): Int16Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint16ArrayConstructor cannot be used as a type -//│ ║ l.333: export val Uint16Array: Uint16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.333: val Uint16Array: Uint16ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1572,8 +1845,8 @@ export declare module Intl { //│ ║ l.338: fun id"of"(items: MutArray): Uint16Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.334: declare trait Uint16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.334: trait Uint16ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.335: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ @@ -1586,9 +1859,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.340: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Int32ArrayConstructor cannot be used as a type -//│ ║ l.341: export val Int32Array: Int32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.341: val Int32Array: Int32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1605,8 +1884,8 @@ export declare module Intl { //│ ║ l.346: fun id"of"(items: MutArray): Int32Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.342: declare trait Int32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.342: trait Int32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.343: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ @@ -1619,9 +1898,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.348: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.346: fun id"of"(items: MutArray): Int32Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Uint32ArrayConstructor cannot be used as a type -//│ ║ l.349: export val Uint32Array: Uint32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.349: val Uint32Array: Uint32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1638,8 +1923,8 @@ export declare module Intl { //│ ║ l.354: fun id"of"(items: MutArray): Uint32Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.350: declare trait Uint32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.350: trait Uint32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.351: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ @@ -1652,9 +1937,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.356: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Float32ArrayConstructor cannot be used as a type -//│ ║ l.357: export val Float32Array: Float32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.357: val Float32Array: Float32ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1671,8 +1962,8 @@ export declare module Intl { //│ ║ l.362: fun id"of"(items: MutArray): Float32Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.358: declare trait Float32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.358: trait Float32ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.359: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ @@ -1685,9 +1976,15 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.364: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.362: fun id"of"(items: MutArray): Float32Array +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Float64ArrayConstructor cannot be used as a type -//│ ║ l.365: export val Float64Array: Float64ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.365: val Float64Array: Float64ArrayConstructor +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayLike cannot be used as a type //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ //│ ╙── ^^^^^^^^^^^^ @@ -1704,8 +2001,8 @@ export declare module Intl { //│ ║ l.370: fun id"of"(items: MutArray): Float64Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.366: declare trait Float64ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.366: trait Float64ArrayConstructor() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.367: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ @@ -1718,6 +2015,12 @@ export declare module Intl { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.372: } //│ ╙── ^ +//│ ╔══[ERROR] Member from is declared but not defined +//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member of is declared but not defined +//│ ║ l.370: fun id"of"(items: MutArray): Float64Array +//│ ╙── ^^^^^^ //│ let NaN: number //│ let Infinity: number //│ fun eval: (x: string,) -> anything diff --git a/ts2mls/js/src/test/diff/Enum.mlsi b/ts2mls/js/src/test/diff/Enum.mlsi index c63abc820..ed385f980 100644 --- a/ts2mls/js/src/test/diff/Enum.mlsi +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -2,9 +2,13 @@ :NewDefs :NoJS :AllowTypeErrors -fun pass(c: int): (false) | (true) -fun stop(): int -fun g(x: int): int -//│ fun pass: (c: int,) -> bool -//│ fun stop: () -> int -//│ fun g: (x: int,) -> int +export declare module Enum { + fun pass(c: int): (false) | (true) + fun stop(): int + fun g(x: int): int +} +//│ module Enum() { +//│ fun g: (x: int,) -> int +//│ fun pass: (c: int,) -> bool +//│ fun stop: () -> int +//│ } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index c4dbb2e83..f66f00a66 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -2,37 +2,44 @@ :NewDefs :NoJS :AllowTypeErrors -export declare module Foo { - fun Baz(aa: string): IBar - declare trait IBar() { - val a: string +export declare module Export { + export module Foo { + fun Baz(aa: string): IBar + trait IBar() { + val a: string + } + export class Bar() extends IBar { + val a: string + } + export val baz: IBar } - export declare class Bar() extends IBar { - val a: string - } - export val baz: IBar } //│ ╔══[ERROR] type identifier not found: IBar -//│ ║ l.6: fun Baz(aa: string): IBar -//│ ╙── ^^^^ +//│ ║ l.7: fun Baz(aa: string): IBar +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.7: declare trait IBar() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.8: val a: string -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.9: } -//│ ╙── ^^^ +//│ ║ l.8: trait IBar() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.9: val a: string +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: } +//│ ╙── ^^^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.10: export declare class Bar() extends IBar { -//│ ╙── ^^^^ +//│ ║ l.11: export class Bar() extends IBar { +//│ ╙── ^^^^ //│ ╔══[ERROR] trait IBar cannot be used as a type -//│ ║ l.13: export val baz: IBar -//│ ╙── ^^^^ -//│ module Foo() { -//│ class Bar() { -//│ let a: string +//│ ║ l.14: export val baz: IBar +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member Baz is declared but not defined +//│ ║ l.7: fun Baz(aa: string): IBar +//│ ╙── ^^^ +//│ module Export() { +//│ module Foo() { +//│ class Bar() { +//│ let a: string +//│ } +//│ fun Baz: (aa: string,) -> error +//│ trait IBar() +//│ let baz: IBar //│ } -//│ fun Baz: (aa: string,) -> error -//│ trait IBar() -//│ let baz: IBar //│ } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 03bce3935..362233434 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -2,124 +2,146 @@ :NewDefs :NoJS :AllowTypeErrors -declare class A() { - fun foo(): unit -} -declare class B() extends A {} -declare class C() { - fun set(x: T): unit - fun get(): T -} -declare class D() extends C {} -declare trait Wu() { - val x: (false) | (true) -} -declare class WuWu() extends Wu { - val y: (false) | (true) -} -declare trait WuWuWu() extends WuWu { - val z: (false) | (true) -} -declare trait Never() extends WuWuWu { - fun w(): nothing -} -declare class VG() { - val x: T -} -declare class Home() extends VG { - val y: T -} -declare trait O() { - fun xx(x: I): I -} -declare class OR() extends O { - fun xx(x: R): R -} -export declare module Five { - export declare class ROTK() { - val wu: string +export declare module Heritage { + class A() { + fun foo(): unit + } + class B() extends A {} + class C() { + fun set(x: T): unit + fun get(): T + } + class D() extends C {} + trait Wu() { + val x: (false) | (true) + } + class WuWu() extends Wu { + val y: (false) | (true) + } + trait WuWuWu() extends WuWu { + val z: (false) | (true) + } + trait Never() extends WuWuWu { + fun w(): nothing + } + class VG() { + val x: T } - export declare class Y() extends Five.ROTK {} + class Home() extends VG { + val y: T + } + trait O() { + fun xx(x: I): I + } + class OR() extends O { + fun xx(x: R): R + } + module Five { + export class ROTK() { + val wu: string + } + export class Y() extends Five.ROTK {} + } + class Y() extends Five.ROTK {} } -declare class Y() extends Five.ROTK {} +//│ ╔══[ERROR] Member foo is declared but not defined +//│ ║ l.7: fun foo(): unit +//│ ╙── ^^^ //│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) -//│ ║ l.8: declare class B() extends A {} -//│ ╙── ^ +//│ ║ l.9: class B() extends A {} +//│ ╙── ^ +//│ ╔══[ERROR] Member set is declared but not defined +//│ ║ l.11: fun set(x: T): unit +//│ ╙── ^^^ +//│ ╔══[ERROR] Member get is declared but not defined +//│ ║ l.12: fun get(): T +//│ ╙── ^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.13: declare class D() extends C {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.14: class D() extends C {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.14: declare trait Wu() { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.15: val x: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.16: } -//│ ╙── ^ +//│ ║ l.15: trait Wu() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.16: val x: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.17: } +//│ ╙── ^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.17: declare class WuWu() extends Wu { -//│ ╙── ^^ +//│ ║ l.18: class WuWu() extends Wu { +//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.20: declare trait WuWuWu() extends WuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.21: val z: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.22: } -//│ ╙── ^ +//│ ║ l.21: trait WuWuWu() extends WuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.22: val z: (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: declare trait Never() extends WuWuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: fun w(): nothing -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: } -//│ ╙── ^ +//│ ║ l.24: trait Never() extends WuWuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: fun w(): nothing +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.26: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member w is declared but not defined +//│ ║ l.25: fun w(): nothing +//│ ╙── ^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.29: declare class Home() extends VG { -//│ ╙── ^^^^^^^^^^ +//│ ║ l.30: class Home() extends VG { +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.32: declare trait O() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.33: fun xx(x: I): I -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.34: } -//│ ╙── ^ +//│ ║ l.33: trait O() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.34: fun xx(x: I): I +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.35: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member xx is declared but not defined +//│ ║ l.34: fun xx(x: I): I +//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.35: declare class OR() extends O { -//│ ╙── ^^^^ +//│ ║ l.36: class OR() extends O { +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member xx is declared but not defined +//│ ║ l.37: fun xx(x: R): R +//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.42: export declare class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.43: export class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.44: declare class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ -//│ class A() { -//│ fun foo: () -> unit -//│ } -//│ class B() -//│ class C[T]() { -//│ fun get: () -> T -//│ fun set: (x: T,) -> unit -//│ } -//│ class D() -//│ trait Wu() -//│ class WuWu() { -//│ let y: bool -//│ } -//│ trait WuWuWu() -//│ trait Never() -//│ class VG[T]() { -//│ let x: T -//│ } -//│ class Home[T]() { -//│ let y: T -//│ } -//│ trait O[I]() -//│ class OR[R]() { -//│ fun xx: (x: R,) -> R -//│ } -//│ module Five() { -//│ class ROTK() { -//│ let wu: string +//│ ║ l.45: class Y() extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ +//│ module Heritage() { +//│ class A() { +//│ fun foo: () -> unit +//│ } +//│ class B() +//│ class C[T]() { +//│ fun get: () -> T +//│ fun set: (x: T,) -> unit +//│ } +//│ class D() +//│ module Five() { +//│ class ROTK() { +//│ let wu: string +//│ } +//│ class Y() +//│ } +//│ class Home[T]() { +//│ let y: T +//│ } +//│ trait Never() +//│ trait O[I]() +//│ class OR[R]() { +//│ fun xx: (x: R,) -> R +//│ } +//│ class VG[T]() { +//│ let x: T +//│ } +//│ trait Wu() +//│ class WuWu() { +//│ let y: bool //│ } +//│ trait WuWuWu() //│ class Y() //│ } -//│ class Y() diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi index 9d5f46317..292fdcd00 100644 --- a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi +++ b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi @@ -2,9 +2,13 @@ :NewDefs :NoJS :AllowTypeErrors -fun h1(inc: (number) => number, num: number): number -fun h2(hint: string): unit => string -fun h3(f: (number) => number, g: (number) => number): (number) => number -//│ fun h1: (inc: number -> number, num: number,) -> number -//│ fun h2: (hint: string,) -> unit -> string -//│ fun h3: (f: number -> number, g: number -> number,) -> number -> number +export declare module HighOrderFunc { + fun h1(inc: (number) => number, num: number): number + fun h2(hint: string): unit => string + fun h3(f: (number) => number, g: (number) => number): (number) => number +} +//│ module HighOrderFunc() { +//│ fun h1: (inc: number -> number, num: number,) -> number +//│ fun h2: (hint: string,) -> unit -> string +//│ fun h3: (f: number -> number, g: number -> number,) -> number -> number +//│ } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index ed33c6a2b..15718224e 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -2,129 +2,157 @@ :NewDefs :NoJS :AllowTypeErrors -declare trait IFoo() { - val a: string - fun b(x: number): number - fun c(): (false) | (true) - fun d(x: string): unit -} -declare trait II() { - fun test(x: T): number -} -fun create(): {v: number,} -fun get(x: {t: string,}): string -declare trait IEvent() { - fun callback(): (number) => unit -} -declare trait SearchFunc() { - val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> -} -declare trait StringArray() { - val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> -} -declare trait Counter() { - val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> - val interval: number - fun reset(): unit -} -declare trait Simple() { - val a: number - fun b(x: (false) | (true)): string -} -declare trait Simple2() { - val abc: T -} -declare trait Next() extends Simple {} -declare trait TTT() { - fun ttt(x: T): T +export declare module InterfaceMember { + trait IFoo() { + val a: string + fun b(x: number): number + fun c(): (false) | (true) + fun d(x: string): unit + } + trait II() { + fun test(x: T): number + } + fun create(): {v: number,} + fun get(x: {t: string,}): string + trait IEvent() { + fun callback(): (number) => unit + } + trait SearchFunc() { + val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> + } + trait StringArray() { + val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> + } + trait Counter() { + val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> + val interval: number + fun reset(): unit + } + trait Simple() { + val a: number + fun b(x: (false) | (true)): string + } + trait Simple2() { + val abc: T + } + trait Next() extends Simple {} + trait TTT() { + fun ttt(x: T): T + } } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.5: declare trait IFoo() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.6: val a: string -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.7: fun b(x: number): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.8: fun c(): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.9: fun d(x: string): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: } -//│ ╙── ^ +//│ ║ l.6: trait IFoo() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.7: val a: string +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.8: fun b(x: number): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.9: fun c(): (false) | (true) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: fun d(x: string): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.11: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member b is declared but not defined +//│ ║ l.8: fun b(x: number): number +//│ ╙── ^ +//│ ╔══[ERROR] Member c is declared but not defined +//│ ║ l.9: fun c(): (false) | (true) +//│ ╙── ^ +//│ ╔══[ERROR] Member d is declared but not defined +//│ ║ l.10: fun d(x: string): unit +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: declare trait II() { -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.12: fun test(x: T): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.13: } -//│ ╙── ^ +//│ ║ l.12: trait II() { +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.13: fun test(x: T): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.14: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member test is declared but not defined +//│ ║ l.13: fun test(x: T): number +//│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: declare trait IEvent() { -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.17: fun callback(): (number) => unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.18: } -//│ ╙── ^ +//│ ║ l.17: trait IEvent() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.18: fun callback(): (number) => unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.19: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member callback is declared but not defined +//│ ║ l.18: fun callback(): (number) => unit +//│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.19: declare trait SearchFunc() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.20: val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.21: } -//│ ╙── ^ +//│ ║ l.20: trait SearchFunc() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.21: val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.22: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.22: declare trait StringArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.23: val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: } -//│ ╙── ^ +//│ ║ l.23: trait StringArray() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: declare trait Counter() { -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.26: val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: val interval: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.28: fun reset(): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.29: } -//│ ╙── ^ +//│ ║ l.26: trait Counter() { +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.27: val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.28: val interval: number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.29: fun reset(): unit +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.30: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member reset is declared but not defined +//│ ║ l.29: fun reset(): unit +//│ ╙── ^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.30: declare trait Simple() { -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.31: val a: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.32: fun b(x: (false) | (true)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.33: } -//│ ╙── ^ +//│ ║ l.31: trait Simple() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.32: val a: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.33: fun b(x: (false) | (true)): string +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.34: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member b is declared but not defined +//│ ║ l.33: fun b(x: (false) | (true)): string +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: declare trait Simple2() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.35: val abc: T -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.36: } -//│ ╙── ^ +//│ ║ l.35: trait Simple2() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.36: val abc: T +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.37: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.37: declare trait Next() extends Simple {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.38: trait Next() extends Simple {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.38: declare trait TTT() { -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.39: fun ttt(x: T): T -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.40: } -//│ ╙── ^ -//│ trait IFoo() -//│ trait II[T]() -//│ fun create: () -> {v: number} -//│ fun get: (x: {t: string},) -> string -//│ trait IEvent() -//│ trait SearchFunc() -//│ trait StringArray() -//│ trait Counter() -//│ trait Simple() -//│ trait Simple2[T]() -//│ trait Next() -//│ trait TTT[T]() +//│ ║ l.39: trait TTT() { +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.40: fun ttt(x: T): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.41: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member ttt is declared but not defined +//│ ║ l.40: fun ttt(x: T): T +//│ ╙── ^^^ +//│ module InterfaceMember() { +//│ trait Counter() +//│ trait IEvent() +//│ trait IFoo() +//│ trait II[T]() +//│ trait Next() +//│ trait SearchFunc() +//│ trait Simple() +//│ trait Simple2[T]() +//│ trait StringArray() +//│ trait TTT[T]() +//│ fun create: () -> {v: number} +//│ fun get: (x: {t: string},) -> string +//│ } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 63e47908a..a7cf2b9f6 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -2,200 +2,78 @@ :NewDefs :NoJS :AllowTypeErrors -fun extend(first: T, second: U): (T) & (U) -fun foo(x: (T) & (U)): unit -fun over(f: ((number) => string) & ((object) => string)): string -declare trait IA() { - val x: number +export declare module Intersection { + fun extend(first: T, second: U): (T) & (U) + fun foo(x: (T) & (U)): unit + fun over(f: ((number) => string) & ((object) => string)): string + trait IA() { + val x: number + } + trait IB() { + val y: number + } + fun iii(x: (IA) & (IB)): (IA) & (IB) + fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) + fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) + fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) + fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) + class A() {} + class B() {} + fun inter(c: (A) & (B)): (A) & (B) } -declare trait IB() { - val y: number -} -fun iii(x: (IA) & (IB)): (IA) & (IB) -fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -declare class A() {} -declare class B() {} -fun inter(c: (A) & (B)): (A) & (B) -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.5: fun extend(first: T, second: U): (T) & (U) -//│ ╙── ^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.6: fun foo(x: (T) & (U)): unit -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.6: fun foo(x: (T) & (U)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.6: fun foo(x: (T) & (U)): unit -//│ ╙── ^^^ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.7: fun over(f: ((number) => string) & ((object) => string)): string -//│ ╙── ^^^^^^^^ +//│ ║ l.8: fun over(f: ((number) => string) & ((object) => string)): string +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: IA +//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: IB +//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: IA +//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: IB +//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) +//│ ╙── ^^^^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: B +//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: B +//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: declare trait IA() { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.9: val x: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.10: } -//│ ╙── ^ +//│ ║ l.9: trait IA() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.10: val x: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.11: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: declare trait IB() { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.12: val y: number -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.13: } -//│ ╙── ^ -//│ ╔══[ERROR] trait IA cannot be used as a type -//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait IB cannot be used as a type -//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait IA cannot be used as a type -//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait IB cannot be used as a type -//│ ║ l.14: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: P -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: P -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: P -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: P -//│ ║ l.15: fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) -//│ ╙── ^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.16: fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) -//│ ╙── ^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.17: fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: V -//│ ║ l.18: fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) -//│ ╙── ^ -//│ fun extend: (first: error, second: error,) -> error -//│ fun foo: (x: error,) -> unit -//│ fun over: (f: (error | number) -> string,) -> string -//│ trait IA() -//│ trait IB() -//│ fun iii: (x: IA & IB,) -> (IA & IB) -//│ fun uu: (x: error,) -> error -//│ fun iiii: (x: error,) -> error -//│ fun arr: (a: MutArray[error],) -> MutArray[error] -//│ fun tt: (x: (error, error,),) -> (error, error,) -//│ class A() -//│ class B() -//│ fun inter: (c: nothing,) -> nothing +//│ ║ l.12: trait IB() { +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.13: val y: number +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.14: } +//│ ╙── ^^^ +//│ module Intersection() { +//│ class A() +//│ class B() +//│ trait IA() +//│ trait IB() +//│ fun arr: forall 'T. (a: MutArray['T],) -> MutArray['T] +//│ fun extend: forall 'T0 'U. (first: 'T0, second: 'U,) -> ('T0 & 'U) +//│ fun foo: (x: anything,) -> unit +//│ fun iii: (x: error,) -> error +//│ fun iiii: forall 'U0. (x: 'U0,) -> 'U0 +//│ fun inter: (c: error,) -> error +//│ fun over: (f: (error | number) -> string,) -> string +//│ fun tt: forall 'U1 'V 'T1. (x: ('U1 & 'V, 'V & 'T1,),) -> ('U1 & 'V, 'V & 'T1,) +//│ fun uu: (x: anything,) -> nothing +//│ } diff --git a/ts2mls/js/src/test/diff/Literal.mlsi b/ts2mls/js/src/test/diff/Literal.mlsi index d9c83d2fd..dc7e84977 100644 --- a/ts2mls/js/src/test/diff/Literal.mlsi +++ b/ts2mls/js/src/test/diff/Literal.mlsi @@ -2,9 +2,13 @@ :NewDefs :NoJS :AllowTypeErrors -export val a: {a: "A",b: "B",} -export val num: {y: 114,} -fun foo(x: {xx: "X",}): {yy: "Y",} -//│ let a: {a: "A", b: "B"} -//│ let num: {y: 114} -//│ fun foo: (x: {xx: "X"},) -> {yy: "Y"} +export declare module Literal { + val a: {a: "A",b: "B",} + val num: {y: 114,} + fun foo(x: {xx: "X",}): {yy: "Y",} +} +//│ module Literal() { +//│ let a: {a: "A", b: "B"} +//│ fun foo: (x: {xx: "X"},) -> {yy: "Y"} +//│ let num: {y: 114} +//│ } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index fbe392a2c..1dd406960 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -2,77 +2,104 @@ :NewDefs :NoJS :AllowTypeErrors -export declare module N1 { - fun f(x: anything): number - fun ff(y: anything): number - export declare class C() { - fun f(): unit +export declare module Namespace { + module N1 { + fun f(x: anything): number + fun ff(y: anything): number + export class C() { + fun f(): unit + } + trait I() { + fun f(): number + } + export module N2 { + fun fff(x: (false) | (true)): number + fun gg(c: N1.C): N1.C + class BBB() extends N1.C {} + } } - declare trait I() { - fun f(): number - } - export declare module N2 { - fun fff(x: (false) | (true)): number - fun gg(c: N1.C): N1.C - declare class BBB() extends N1.C {} + module AA { + fun f(x: anything): string + export class C() { + fun f(): unit + } + export trait I() { + fun f(): number + } + export module N2 { + } } } -export declare module AA { - fun f(x: anything): string - export declare class C() { - fun f(): unit - } - export declare trait I() { - fun f(): number - } - export declare module N2 { - } -} -fun f1(x: N1.C): N1.C -fun f2(x: AA.C): AA.C +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.10: fun f(): unit +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: declare trait I() { -//│ ║ ^^^^^^^^^^^ -//│ ║ l.12: fun f(): number -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.13: } -//│ ╙── ^^^ +//│ ║ l.12: trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.13: fun f(): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.14: } +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.13: fun f(): number +//│ ╙── ^ //│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.16: fun gg(c: N1.C): N1.C -//│ ╙── ^^ +//│ ║ l.17: fun gg(c: N1.C): N1.C +//│ ╙── ^^ //│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.16: fun gg(c: N1.C): N1.C -//│ ╙── ^^ +//│ ║ l.17: fun gg(c: N1.C): N1.C +//│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.17: declare class BBB() extends N1.C {} -//│ ╙── ^^^^ +//│ ║ l.18: class BBB() extends N1.C {} +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member fff is declared but not defined +//│ ║ l.16: fun fff(x: (false) | (true)): number +//│ ╙── ^^^ +//│ ╔══[ERROR] Member gg is declared but not defined +//│ ║ l.17: fun gg(c: N1.C): N1.C +//│ ╙── ^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.7: fun f(x: anything): number +//│ ╙── ^ +//│ ╔══[ERROR] Member ff is declared but not defined +//│ ║ l.8: fun ff(y: anything): number +//│ ╙── ^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.24: fun f(): unit +//│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: export declare trait I() { -//│ ║ ^^^^^^^^^^^ -//│ ║ l.26: fun f(): number -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: } -//│ ╙── ^^^ -//│ module N1() { -//│ class C() { -//│ fun f: () -> unit -//│ } -//│ trait I() -//│ module N2() { -//│ class BBB() -//│ fun fff: (x: bool,) -> number -//│ fun gg: (c: error,) -> error +//│ ║ l.26: export trait I() { +//│ ║ ^^^^^^^^^^^ +//│ ║ l.27: fun f(): number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.28: } +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.27: fun f(): number +//│ ╙── ^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.22: fun f(x: anything): string +//│ ╙── ^ +//│ module Namespace() { +//│ module AA() { +//│ class C() { +//│ fun f: () -> unit +//│ } +//│ trait I() +//│ module N2() +//│ fun f: (x: anything,) -> string //│ } -//│ fun f: (x: anything,) -> number -//│ fun ff: (y: anything,) -> number -//│ } -//│ module AA() { -//│ class C() { -//│ fun f: () -> unit +//│ module N1() { +//│ class C() { +//│ fun f: () -> unit +//│ } +//│ trait I() +//│ module N2() { +//│ class BBB() +//│ fun fff: (x: bool,) -> number +//│ fun gg: (c: error,) -> error +//│ } +//│ fun f: (x: anything,) -> number +//│ fun ff: (y: anything,) -> number //│ } -//│ trait I() -//│ module N2() -//│ fun f: (x: anything,) -> string //│ } -//│ fun f1: (x: C,) -> C -//│ fun f2: (x: C,) -> C diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 9da24354d..764ec2496 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -2,67 +2,68 @@ :NewDefs :NoJS :AllowTypeErrors -fun buildName(firstName: string, lastName: (string) | (undefined)): string -fun buildName2(firstName: string, lastName: (string) | (undefined)): string -fun buildName3(firstName: string, lastName: MutArray): string -fun buildName4(firstName: string, lastName: MutArray): string -declare trait SquareConfig() { - val color: (string) | (undefined) - val width: (number) | (undefined) +export declare module Optional { + fun buildName(firstName: string, lastName: (string) | (undefined)): string + fun buildName2(firstName: string, lastName: (string) | (undefined)): string + fun buildName3(firstName: string, lastName: MutArray): string + fun buildName4(firstName: string, lastName: MutArray): string + trait SquareConfig() { + val color: (string) | (undefined) + val width: (number) | (undefined) + } + fun did(x: number, f: ((number) => number) | (undefined)): number + fun getOrElse(arr: (MutArray) | (undefined)): object + class ABC() {} + fun testABC(abc: (ABC) | (undefined)): unit + fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit + fun err(msg: ((number, string, )) | (undefined)): unit + fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string + fun boo(x: ((T) & (U)) | (undefined)): unit + class B() { + val b: T + } + fun boom(b: (B) | (undefined)): anything } -fun did(x: number, f: ((number) => number) | (undefined)): number -fun getOrElse(arr: (MutArray) | (undefined)): object -declare class ABC() {} -fun testABC(abc: (ABC) | (undefined)): unit -fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit -fun err(msg: ((number, string, )) | (undefined)): unit -fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string -fun boo(x: ((T) & (U)) | (undefined)): unit -declare class B() { - val b: T -} -fun boom(b: (B) | (undefined)): anything -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: declare trait SquareConfig() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: val color: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: val width: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.12: } -//│ ╙── ^ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.14: fun getOrElse(arr: (MutArray) | (undefined)): object -//│ ╙── ^^^^^^ +//│ ║ l.15: fun getOrElse(arr: (MutArray) | (undefined)): object +//│ ╙── ^^^^^^ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.14: fun getOrElse(arr: (MutArray) | (undefined)): object -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait SquareConfig cannot be used as a type -//│ ║ l.17: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.20: fun boo(x: ((T) & (U)) | (undefined)): unit -//│ ╙── ^^^ -//│ fun buildName: (firstName: string, lastName: string | undefined,) -> string -//│ fun buildName2: (firstName: string, lastName: string | undefined,) -> string -//│ fun buildName3: (firstName: string, lastName: MutArray[string],) -> string -//│ fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string -//│ trait SquareConfig() -//│ fun did: (x: number, f: number -> number | undefined,) -> number -//│ fun getOrElse: (arr: MutArray[error] | undefined,) -> error -//│ class ABC() -//│ fun testABC: (abc: ABC | undefined,) -> unit -//│ fun testSquareConfig: (conf: undefined | SquareConfig,) -> unit -//│ fun err: (msg: (number, string,) | undefined,) -> unit -//│ fun toStr: (x: false | number | true | undefined,) -> string -//│ fun boo: (x: error | undefined,) -> unit -//│ class B[T]() { -//│ let b: T +//│ ║ l.15: fun getOrElse(arr: (MutArray) | (undefined)): object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: ABC +//│ ║ l.17: fun testABC(abc: (ABC) | (undefined)): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] type identifier not found: SquareConfig +//│ ║ l.18: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: B +//│ ║ l.25: fun boom(b: (B) | (undefined)): anything +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[ERROR] traits are not yet supported +//│ ║ l.10: trait SquareConfig() { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.11: val color: (string) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.12: val width: (number) | (undefined) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.13: } +//│ ╙── ^^^ +//│ module Optional() { +//│ class ABC() +//│ class B[T]() { +//│ let b: T +//│ } +//│ trait SquareConfig() +//│ fun boo: (x: anything,) -> unit +//│ fun boom: (b: error | undefined,) -> anything +//│ fun buildName: (firstName: string, lastName: string | undefined,) -> string +//│ fun buildName2: (firstName: string, lastName: string | undefined,) -> string +//│ fun buildName3: (firstName: string, lastName: MutArray[string],) -> string +//│ fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string +//│ fun did: (x: number, f: number -> number | undefined,) -> number +//│ fun err: (msg: (number, string,) | undefined,) -> unit +//│ fun getOrElse: (arr: MutArray[error] | undefined,) -> error +//│ fun testABC: (abc: error | undefined,) -> unit +//│ fun testSquareConfig: (conf: error | undefined,) -> unit +//│ fun toStr: (x: false | number | true | undefined,) -> string //│ } -//│ fun boom: (b: B[nothing] | undefined,) -> anything diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index d799f20fc..031e85ad6 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -2,59 +2,72 @@ :NewDefs :NoJS :AllowTypeErrors -fun f: ((number) => string) & ((string) => string) -declare class M() { - val foo: ((number) => string) & ((string) => string) +export declare module Overload { + fun f: ((number) => string) & ((string) => string) + class M() { + val foo: ((number) => string) & ((string) => string) + } + fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) + fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) + fun g0: ((MutArray) => string) & ((MutArray) => string) + fun db: ((number) => MutArray) & ((object) => MutArray) + class N() {} + fun id: ((M) => unit) & ((N) => unit) + fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) + fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) + fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) + fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) + fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ + module XX { + fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ + } + class WWW() { + fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ + } + fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } -fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) -fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) -fun g0: ((MutArray) => string) & ((MutArray) => string) -fun db: ((number) => MutArray) & ((object) => MutArray) -declare class N() {} -fun id: ((M) => unit) & ((N) => unit) -fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) -fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) -fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) -fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) -fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ -export declare module XX { - fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ -} -declare class WWW() { - fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ -} -fun baz(): anything /* warning: the overload of function baz is not supported yet. */ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.11: fun g0: ((MutArray) => string) & ((MutArray) => string) -//│ ╙── ^^^^^^ +//│ ║ l.12: fun g0: ((MutArray) => string) & ((MutArray) => string) +//│ ╙── ^^^^^^ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.12: fun db: ((number) => MutArray) & ((object) => MutArray) -//│ ╙── ^^^^^^^^ +//│ ║ l.13: fun db: ((number) => MutArray) & ((object) => MutArray) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: M +//│ ║ l.15: fun id: ((M) => unit) & ((N) => unit) +//│ ╙── ^^^ +//│ ╔══[ERROR] type identifier not found: N +//│ ║ l.15: fun id: ((M) => unit) & ((N) => unit) +//│ ╙── ^^^ //│ ╔══[ERROR] type identifier not found: object -//│ ║ l.18: fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.19: fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ -//│ ╙── ^ -//│ fun f: (number | string) -> string -//│ class M() { -//│ let foo: (number | string) -> string -//│ } -//│ fun app: (string -> unit) -> (number | string) -> unit -//│ fun create: (false | number | true) -> unit -> bool -//│ fun g0: MutArray[out error | string] -> string -//│ fun db: (error | number) -> MutArray[number] -//│ class N() -//│ fun id: (M | N) -> unit -//│ fun tst: {z: false | number | true} -> {y: string} -//│ fun op: number -> (false | number | true | undefined) -> unit -//│ fun swap: (number | string, number | string,) -> (number, string,) -//│ fun u: (error | false | number | true) -> string -//│ fun doSome: (x: anything,) -> unit -//│ module XX() { -//│ fun f: (x: anything, n: anything,) -> string -//│ } -//│ class WWW() { -//│ fun F: (x: anything,) -> anything +//│ ║ l.19: fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) +//│ ╙── ^^^^^^^^ +//│ ╔══[ERROR] Member f is declared but not defined +//│ ║ l.22: fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ +//│ ╙── ^ +//│ ╔══[ERROR] Member F is declared but not defined +//│ ║ l.25: fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ +//│ ╙── ^ +//│ module Overload() { +//│ class M() { +//│ let foo: (number | string) -> string +//│ } +//│ class N() +//│ class WWW() { +//│ fun F: (x: anything,) -> anything +//│ } +//│ module XX() { +//│ fun f: (x: anything, n: anything,) -> string +//│ } +//│ fun app: (string -> unit) -> (number | string) -> unit +//│ fun baz: () -> anything +//│ fun create: (false | number | true) -> unit -> bool +//│ fun db: (error | number) -> MutArray[number] +//│ fun doSome: (x: anything,) -> unit +//│ fun f: (number | string) -> string +//│ fun g0: MutArray[out error | string] -> string +//│ fun id: error -> unit +//│ fun op: number -> (false | number | true | undefined) -> unit +//│ fun swap: (number | string, number | string,) -> (number, string,) +//│ fun tst: {z: false | number | true} -> {y: string} +//│ fun u: (error | false | number | true) -> string //│ } -//│ fun baz: () -> anything diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index c371c8337..1b82d506d 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -2,65 +2,51 @@ :NewDefs :NoJS :AllowTypeErrors -fun key(x: (string, (false) | (true), )): string -fun value(x: (string, (false) | (true), )): (false) | (true) -fun third(x: (number, number, number, )): number -fun vec2(x: number, y: number): (number, number, ) -fun twoFunctions(ff: ((number) => number, (number) => number, ), x: number): number -fun tupleIt(x: string): (unit => string, ) -fun s(flag: (false) | (true)): ((string) | (number), ((number) | (false)) | (true), ) -fun s2(t: ((false) | (true), (string) | (number), )): (string) | (number) -fun ex(x: T, y: U): (T, U, (T) & (U), ) -fun foo(x: ((T) & (U), )): unit -fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) -declare class A() { - val x: number +export declare module Tuple { + fun key(x: (string, (false) | (true), )): string + fun value(x: (string, (false) | (true), )): (false) | (true) + fun third(x: (number, number, number, )): number + fun vec2(x: number, y: number): (number, number, ) + fun twoFunctions(ff: ((number) => number, (number) => number, ), x: number): number + fun tupleIt(x: string): (unit => string, ) + fun s(flag: (false) | (true)): ((string) | (number), ((number) | (false)) | (true), ) + fun s2(t: ((false) | (true), (string) | (number), )): (string) | (number) + fun ex(x: T, y: U): (T, U, (T) & (U), ) + fun foo(x: ((T) & (U), )): unit + fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) + class A() { + val x: number + } + class B() {} + fun swap(x: (A, B, )): (B, A, ) } -declare class B() {} -fun swap(x: (A, B, )): (B, A, ) -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.13: fun ex(x: T, y: U): (T, U, (T) & (U), ) -//│ ╙── ^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.14: fun foo(x: ((T) & (U), )): unit -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.14: fun foo(x: ((T) & (U), )): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.14: fun foo(x: ((T) & (U), )): unit -//│ ╙── ^^^ -//│ fun key: (x: (string, bool,),) -> string -//│ fun value: (x: (string, bool,),) -> bool -//│ fun third: (x: (number, number, number,),) -> number -//│ fun vec2: (x: number, y: number,) -> (number, number,) -//│ fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number -//│ fun tupleIt: (x: string,) -> unit -> string -//│ fun s: (flag: bool,) -> (number | string, false | number | true,) -//│ fun s2: (t: (bool, number | string,),) -> (number | string) -//│ fun ex: (x: error, y: error,) -> (error, error, error,) -//│ fun foo: (x: error,) -> unit -//│ fun conv: (x: {y: number},) -> ({y: number}, {z: string},) -//│ class A() { -//│ let x: number +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: B +//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: B +//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) +//│ ╙── ^ +//│ module Tuple() { +//│ class A() { +//│ let x: number +//│ } +//│ class B() +//│ fun conv: (x: {y: number},) -> ({y: number}, {z: string},) +//│ fun ex: forall 'T 'U. (x: 'T, y: 'U,) -> ('T, 'U, 'T & 'U,) +//│ fun foo: (x: anything,) -> unit +//│ fun key: (x: (string, bool,),) -> string +//│ fun s: (flag: bool,) -> (number | string, false | number | true,) +//│ fun s2: (t: (bool, number | string,),) -> (number | string) +//│ fun swap: (x: (error, error,),) -> (error, error,) +//│ fun third: (x: (number, number, number,),) -> number +//│ fun tupleIt: (x: string,) -> unit -> string +//│ fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number +//│ fun value: (x: (string, bool,),) -> bool +//│ fun vec2: (x: number, y: number,) -> (number, number,) //│ } -//│ class B() -//│ fun swap: (x: (A, B,),) -> (B, A,) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index d2e49c839..11a39652a 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -2,103 +2,101 @@ :NewDefs :NoJS :AllowTypeErrors -declare trait None() { - val _tag: "None" +export declare module Type { + trait None() { + val _tag: "None" + } + trait Some() { + val _tag: "Some" + val value: A + } + type Option = (None) | (Some) + type Func = (number) => number + type S2 = (string, string, ) + trait I1() {} + trait I2() {} + type I3 = (I1) & (I2) + type StringArray = Array + type SomeInterface = {x: number,y: number,} + class ABC() {} + type DEF = ABC + type TP = (A, B, C, ) + module NA { + fun fb(b: string): unit + type B = string + } + class NC() { + val b: string + } + type G = ABC + val none: {_tag: "None",} + fun some(a: A): (None) | (Some) } -declare trait Some() { - val _tag: "Some" - val value: A -} -type Option = (None) | (Some) -type Func = (number) => number -type S2 = (string, string, ) -declare trait I1() {} -declare trait I2() {} -type I3 = (I1) & (I2) -type StringArray = Array -type SomeInterface = {x: number,y: number,} -declare class ABC() {} -type DEF = ABC -type TP = (A, B, C, ) -export declare module NA { - fun fb(b: string): unit - type B = string -} -declare class NC() { - val b: string -} -type G = ABC -export val none: {_tag: "None",} -fun some(a: A): (None) | (Some) +//│ ╔══[ERROR] type identifier not found: None +//│ ║ l.33: fun some(a: A): (None) | (Some) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: Some +//│ ║ l.33: fun some(a: A): (None) | (Some) +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.5: declare trait None() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.6: val _tag: "None" -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.7: } -//│ ╙── ^ +//│ ║ l.6: trait None() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.7: val _tag: "None" +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.8: } +//│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: declare trait Some() { -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.9: val _tag: "Some" -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: val value: A -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.11: } -//│ ╙── ^ +//│ ║ l.9: trait Some() { +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.10: val _tag: "Some" +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.11: val value: A +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.12: } +//│ ╙── ^^^ //│ ╔══[ERROR] trait None cannot be used as a type -//│ ║ l.12: type Option = (None) | (Some) -//│ ╙── ^^^^^^ +//│ ║ l.13: type Option = (None) | (Some) +//│ ╙── ^^^^^^ //│ ╔══[ERROR] trait Some cannot be used as a type -//│ ║ l.12: type Option = (None) | (Some) -//│ ╙── ^^^^^^^^^ +//│ ║ l.13: type Option = (None) | (Some) +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.15: declare trait I1() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.16: trait I1() {} +//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: declare trait I2() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.17: trait I2() {} +//│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] trait I1 cannot be used as a type -//│ ║ l.17: type I3 = (I1) & (I2) -//│ ╙── ^^^^ +//│ ║ l.18: type I3 = (I1) & (I2) +//│ ╙── ^^^^ //│ ╔══[ERROR] trait I2 cannot be used as a type -//│ ║ l.17: type I3 = (I1) & (I2) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.32: fun some(a: A): (None) | (Some) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.32: fun some(a: A): (None) | (Some) -//│ ╙── ^ -//│ ╔══[ERROR] trait None cannot be used as a type -//│ ║ l.32: fun some(a: A): (None) | (Some) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Some cannot be used as a type -//│ ║ l.32: fun some(a: A): (None) | (Some) -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.32: fun some(a: A): (None) | (Some) -//│ ╙── ^ -//│ trait None() -//│ trait Some[A]() -//│ type Option[A] = None | Some[A] -//│ type Func = number -> number -//│ type S2 = (string, string,) -//│ trait I1() -//│ trait I2() -//│ type I3 = I1 & I2 -//│ type StringArray = Array[string] -//│ type SomeInterface = {x: number, y: number} -//│ class ABC() -//│ type DEF = ABC -//│ type TP[A, B, C] = (A, B, C,) -//│ module NA() { -//│ type B = string -//│ fun fb: (b: string,) -> unit -//│ } -//│ class NC() { -//│ let b: string +//│ ║ l.18: type I3 = (I1) & (I2) +//│ ╙── ^^^^ +//│ ╔══[ERROR] Member fb is declared but not defined +//│ ║ l.25: fun fb(b: string): unit +//│ ╙── ^^ +//│ module Type() { +//│ class ABC() +//│ type DEF = ABC +//│ type Func = number -> number +//│ type G = ABC +//│ trait I1() +//│ trait I2() +//│ type I3 = I1 & I2 +//│ module NA() { +//│ type B = string +//│ fun fb: (b: string,) -> unit +//│ } +//│ class NC() { +//│ let b: string +//│ } +//│ trait None() +//│ type Option[A] = None | Some[A] +//│ type S2 = (string, string,) +//│ trait Some[A]() +//│ type SomeInterface = {x: number, y: number} +//│ type StringArray = Array[string] +//│ type TP[A, B, C] = (A, B, C,) +//│ let none: {_tag: "None"} +//│ fun some: (a: anything,) -> error //│ } -//│ type G = ABC -//│ let none: {_tag: "None"} -//│ fun some: (a: error,) -> (None | Some[error]) diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index e04d6ba11..3b14cb5f9 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -2,98 +2,96 @@ :NewDefs :NoJS :AllowTypeErrors -fun inc(x: T): number -declare class CC() { - fun print(s: T): unit +export declare module TypeParameter { + fun inc(x: T): number + class CC() { + fun print(s: T): unit + } + fun con(t: T): U + class Printer() { + fun print(t: T): unit + } + fun setStringPrinter(p: Printer): unit + fun getStringPrinter(): Printer + fun foo(p: Printer, x: T): T + fun foo2(p: Printer, x: T): T + class F() { + val x: T + fun GG(y: U): T + } + trait I() { + val x: T + fun GG(y: U): T + } + class FFF() { + fun fff(x: T): unit + } + fun fff(p: FFF, s: string): unit + fun getFFF(): FFF } -fun con(t: T): U -declare class Printer() { - fun print(t: T): unit -} -fun setStringPrinter(p: Printer): unit -fun getStringPrinter(): Printer -fun foo(p: Printer, x: T): T -fun foo2(p: Printer, x: T): T -declare class F() { - val x: T - fun GG(y: U): T -} -declare trait I() { - val x: T - fun GG(y: U): T -} -declare class FFF() { - fun fff(x: T): unit -} -fun fff(p: FFF, s: string): unit -fun getFFF(): FFF -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.5: fun inc(x: T): number -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.5: fun inc(x: T): number -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.9: fun con(t: T): U -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.9: fun con(t: T): U -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.9: fun con(t: T): U -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.15: fun foo(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun foo(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun foo(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.15: fun foo(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.16: fun foo2(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.16: fun foo2(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.16: fun foo2(p: Printer, x: T): T -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.16: fun foo2(p: Printer, x: T): T -//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: Printer +//│ ║ l.14: fun setStringPrinter(p: Printer): unit +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Printer +//│ ║ l.15: fun getStringPrinter(): Printer +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Printer +//│ ║ l.16: fun foo(p: Printer, x: T): T +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: Printer +//│ ║ l.17: fun foo2(p: Printer, x: T): T +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: FFF +//│ ║ l.29: fun fff(p: FFF, s: string): unit +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] type identifier not found: FFF +//│ ║ l.30: fun getFFF(): FFF +//│ ╙── ^^^^^^^^^^^ +//│ ╔══[ERROR] Member print is declared but not defined +//│ ║ l.8: fun print(s: T): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member print is declared but not defined +//│ ║ l.12: fun print(t: T): unit +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Member GG is declared but not defined +//│ ║ l.20: fun GG(y: U): T +//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.21: declare trait I() { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.22: val x: T -//│ ║ ^^^^^^^^^^ -//│ ║ l.23: fun GG(y: U): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: } -//│ ╙── ^ -//│ fun inc: (x: error,) -> number -//│ class CC[T]() { -//│ fun print: (s: T,) -> unit -//│ } -//│ fun con: (t: error,) -> error -//│ class Printer[T]() { -//│ fun print: (t: T,) -> unit -//│ } -//│ fun setStringPrinter: (p: Printer[string],) -> unit -//│ fun getStringPrinter: () -> Printer[string] -//│ fun foo: (p: Printer[error], x: error,) -> error -//│ fun foo2: (p: Printer[error], x: error,) -> error -//│ class F[T]() { -//│ fun GG: (y: anything,) -> T -//│ let x: T -//│ } -//│ trait I[T]() -//│ class FFF[T]() { -//│ fun fff: (x: T,) -> unit +//│ ║ l.22: trait I() { +//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.23: val x: T +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.24: fun GG(y: U): T +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: } +//│ ╙── ^^^ +//│ ╔══[ERROR] Member GG is declared but not defined +//│ ║ l.24: fun GG(y: U): T +//│ ╙── ^^ +//│ ╔══[ERROR] Member fff is declared but not defined +//│ ║ l.27: fun fff(x: T): unit +//│ ╙── ^^^ +//│ module TypeParameter() { +//│ class CC[T]() { +//│ fun print: (s: T,) -> unit +//│ } +//│ class F[T]() { +//│ fun GG: (y: anything,) -> T +//│ let x: T +//│ } +//│ class FFF[T]() { +//│ fun fff: (x: T,) -> unit +//│ } +//│ trait I[T]() +//│ class Printer[T]() { +//│ fun print: (t: T,) -> unit +//│ } +//│ fun con: (t: anything,) -> nothing +//│ fun fff: (p: error, s: string,) -> unit +//│ fun foo: forall 'T. (p: error, x: 'T,) -> 'T +//│ fun foo2: forall 'T0. (p: error, x: 'T0,) -> 'T0 +//│ fun getFFF: () -> error +//│ fun getStringPrinter: () -> error +//│ fun inc: (x: anything,) -> number +//│ fun setStringPrinter: (p: error,) -> unit //│ } -//│ fun fff: (p: FFF[string], s: string,) -> unit -//│ fun getFFF: () -> FFF[number] diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index 7817bc8ba..81cf40726 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -2,32 +2,21 @@ :NewDefs :NoJS :AllowTypeErrors -fun getString(x: (((string) | (number)) | (false)) | (true)): string -fun test(x: (false) | (true)): (string) | (number) -fun run(f: ((number) => number) | ((number) => string)): anything -fun get(arr: (MutArray) | (MutArray)): unit -fun get2(t: ((string, string, )) | ((number, string, ))): string -fun typeVar(x: (T) | (U)): (T) | (U) -fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) -//│ ╔══[ERROR] Type parameters here are not yet supported in this position -//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: U -//│ ║ l.10: fun typeVar(x: (T) | (U)): (T) | (U) -//│ ╙── ^^^ -//│ fun getString: (x: false | number | string | true,) -> string -//│ fun test: (x: bool,) -> (number | string) -//│ fun run: (f: number -> (number | string),) -> anything -//│ fun get: (arr: MutArray[out number | string],) -> unit -//│ fun get2: (t: (number | string, string,),) -> string -//│ fun typeVar: (x: error,) -> error -//│ fun uuuu: (x: false | number | string | true,) -> (false | number | string | true) +export declare module Union { + fun getString(x: (((string) | (number)) | (false)) | (true)): string + fun test(x: (false) | (true)): (string) | (number) + fun run(f: ((number) => number) | ((number) => string)): anything + fun get(arr: (MutArray) | (MutArray)): unit + fun get2(t: ((string, string, )) | ((number, string, ))): string + fun typeVar(x: (T) | (U)): (T) | (U) + fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) +} +//│ module Union() { +//│ fun get: (arr: MutArray[out number | string],) -> unit +//│ fun get2: (t: (number | string, string,),) -> string +//│ fun getString: (x: false | number | string | true,) -> string +//│ fun run: (f: number -> (number | string),) -> anything +//│ fun test: (x: bool,) -> (number | string) +//│ fun typeVar: forall 'T. (x: 'T,) -> 'T +//│ fun uuuu: (x: false | number | string | true,) -> (false | number | string | true) +//│ } diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index ac49f113e..f0bdc3cec 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -2,31 +2,35 @@ :NewDefs :NoJS :AllowTypeErrors -export val URI: string -export val URI2: string -export val foo: number -export val bar: false -declare class FooBar() {} -export val fb: FooBar -export declare module ABC { - export declare class DEF() {} +export declare module Variables { + val URI: string + val URI2: string + val foo: number + val bar: false + class FooBar() {} + val fb: FooBar + module ABC { + export class DEF() {} + } + val d: ABC.DEF + module DD { + export val foo: number + val bar: number + } } -export val d: ABC.DEF -export declare module DD { - export val foo: number - val bar: number -} -//│ let URI: string -//│ let URI2: string -//│ let foo: number -//│ let bar: false -//│ class FooBar() -//│ let fb: FooBar -//│ module ABC() { -//│ class DEF() -//│ } -//│ let d: DEF -//│ module DD() { -//│ let bar: number +//│ module Variables() { +//│ module ABC() { +//│ class DEF() +//│ } +//│ module DD() { +//│ let bar: number +//│ let foo: number +//│ } +//│ class FooBar() +//│ let URI: string +//│ let URI2: string +//│ let bar: false +//│ let d: DEF +//│ let fb: FooBar //│ let foo: number //│ } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index d43f90142..9039acc3f 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -1,12 +1,13 @@ package ts2mls import org.scalatest.funsuite.AnyFunSuite +import scala.collection.immutable class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ testsData.foreach((data) => test(data._2) { - val program = TSProgram(tsPath(data._1), true) + val program = TSProgram(tsPath(data._1), !directlyImportedSet.contains(data._1)) var writer = JSWriter(diffPath(data._2)) program.generate(writer) writer.close() @@ -14,29 +15,32 @@ class TSTypeGenerationTest extends AnyFunSuite { } object TSTypeGenerationTest { - private def tsPath(filenames: Seq[String]) = filenames.map((fn) => s"ts2mls/js/src/test/typescript/$fn") + private def tsPath(filename: String) = s"ts2mls/js/src/test/typescript/$filename" private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" + // TODO: do better? private val testsData = List( - (Seq("Array.ts"), "Array.mlsi"), - (Seq("BasicFunctions.ts"), "BasicFunctions.mlsi"), - (Seq("ClassMember.ts"), "ClassMember.mlsi"), - (Seq("Dec.d.ts"), "Dec.mlsi"), - (Seq("Enum.ts"), "Enum.mlsi"), - (Seq("ES5.d.ts"), "ES5.mlsi"), - (Seq("Export.ts"), "Export.mlsi"), - (Seq("Heritage.ts"), "Heritage.mlsi"), - (Seq("HighOrderFunc.ts"), "HighOrderFunc.mlsi"), - (Seq("InterfaceMember.ts"), "InterfaceMember.mlsi"), - (Seq("Intersection.ts"), "Intersection.mlsi"), - (Seq("Literal.ts"), "Literal.mlsi"), - (Seq("Namespace.ts"), "Namespace.mlsi"), - (Seq("Optional.ts"), "Optional.mlsi"), - (Seq("Overload.ts"), "Overload.mlsi"), - (Seq("Tuple.ts"), "Tuple.mlsi"), - (Seq("Type.ts"), "Type.mlsi"), - (Seq("TypeParameter.ts"), "TypeParameter.mlsi"), - (Seq("Union.ts"), "Union.mlsi"), - (Seq("Variables.ts"), "Variables.mlsi"), + ("Array.ts", "Array.mlsi"), + ("BasicFunctions.ts", "BasicFunctions.mlsi"), + ("ClassMember.ts", "ClassMember.mlsi"), + ("Dec.d.ts", "Dec.mlsi"), + ("Enum.ts", "Enum.mlsi"), + ("ES5.d.ts", "ES5.mlsi"), + ("Export.ts", "Export.mlsi"), + ("Heritage.ts", "Heritage.mlsi"), + ("HighOrderFunc.ts", "HighOrderFunc.mlsi"), + ("InterfaceMember.ts", "InterfaceMember.mlsi"), + ("Intersection.ts", "Intersection.mlsi"), + ("Literal.ts", "Literal.mlsi"), + ("Namespace.ts", "Namespace.mlsi"), + ("Optional.ts", "Optional.mlsi"), + ("Overload.ts", "Overload.mlsi"), + ("Tuple.ts", "Tuple.mlsi"), + ("Type.ts", "Type.mlsi"), + ("TypeParameter.ts", "TypeParameter.mlsi"), + ("Union.ts", "Union.mlsi"), + ("Variables.ts", "Variables.mlsi"), ) + + private val directlyImportedSet = Set[String]("ES5.d.ts") } diff --git a/ts2mls/js/src/test/typescript/Namespace.ts b/ts2mls/js/src/test/typescript/Namespace.ts index ab998336a..f7cf5bc75 100644 --- a/ts2mls/js/src/test/typescript/Namespace.ts +++ b/ts2mls/js/src/test/typescript/Namespace.ts @@ -44,10 +44,11 @@ namespace AA { export namespace N2 {} } -function f1(x: N1.C): N1.C { - return x; -} - -function f2(x: AA.C): AA.C { - return x; -} +// TODO: support +// function f1(x: N1.C): N1.C { +// return x; +// } + +// function f2(x: AA.C): AA.C { +// return x; +// } From bddb734a0ab05d1c88d58c36c3e3650cfd12aaa1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 28 Apr 2023 13:27:15 +0800 Subject: [PATCH 053/202] WIP: Generate import in ts2mls --- .../main/scala/ts2mls/TSCompilerInfo.scala | 6 +++ .../js/src/main/scala/ts2mls/TSProgram.scala | 29 ++++++++--- .../src/main/scala/ts2mls/TSSourceFile.scala | 17 ++++++- ts2mls/js/src/test/diff/Export.mlsi | 2 + ts2mls/js/src/test/diff/Import.mlsi | 28 +++++++++++ .../scala/ts2mls/TSTypeGenerationTests.scala | 50 +++++++++---------- ts2mls/js/src/test/typescript/Dependency.ts | 7 +++ ts2mls/js/src/test/typescript/Export.ts | 4 ++ ts2mls/js/src/test/typescript/Import.ts | 14 ++++++ 9 files changed, 122 insertions(+), 35 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Import.mlsi create mode 100644 ts2mls/js/src/test/typescript/Dependency.ts create mode 100644 ts2mls/js/src/test/typescript/Import.ts diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 5e8a39522..93ef0d007 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -34,6 +34,8 @@ object TypeScript { def isInterfaceDeclaration(node: js.Dynamic) = ts.isInterfaceDeclaration(node) def isFunctionLike(node: js.Dynamic) = ts.isFunctionLike(node) def isModuleDeclaration(node: js.Dynamic) = ts.isModuleDeclaration(node) + def isImportDeclaration(node: js.Dynamic) = ts.isImportDeclaration(node) + def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) def isTypeAliasDeclaration(node: js.Dynamic) = ts.isTypeAliasDeclaration(node) @@ -118,6 +120,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isArrayTypeNode = TypeScript.isArrayTypeNode(node) lazy val isTupleTypeNode = TypeScript.isTupleTypeNode(node) lazy val isImplementationOfOverload = checker.isImplementationOfOverload(node) + lazy val isImportDeclaration = TypeScript.isImportDeclaration(node) // if a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. @@ -168,6 +171,9 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS if (parent.isUndefined) node.fileName.toString() else parent.filename lazy val pos = node.pos + + lazy val moduleSpecifier = TSTokenObject(node.moduleSpecifier) + lazy val importClause = TSNodeObject(node.importClause) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 566c58a51..87bf0da28 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -15,16 +15,29 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { // check if file exists if (!program.fileExists(filename)) throw new Exception(s"file ${filename} doesn't exist.") - val globalNamespace = TSNamespace() - - // TODO: support multi-files correctly. implicit val checker = TSTypeChecker(program.getTypeChecker()) - TSSourceFile(program.getSourceFile(filename), globalNamespace) - def generate(writer: JSWriter): Unit = - if (!uesTopLevelModule) globalNamespace.generate(writer, "") + // TODO: support multi-files correctly. + private val globalNamespace = TSNamespace() + private val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) + private val importList = entryFile.getImportList + + import TSProgram._ + + def generate(workDir: String, targetPath: String): Unit = { + val moduleName = getModuleName(filename) + val relatedPath = + if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) + else throw new AssertionError(s"wrong work dir $workDir") + var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") + generate(writer) + writer.close() + } + + private def generate(writer: JSWriter): Unit = + if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { - import TSProgram._ + importList.foreach{f => writer.writeln(s"""import "${getModuleName(f)}.mlsi"""")} writer.writeln(s"export declare module ${getModuleName(filename)} {") globalNamespace.generate(writer, " ") writer.writeln("}") @@ -35,7 +48,7 @@ object TSProgram { def apply(filename: String, uesTopLevelModule: Boolean) = new TSProgram(filename, uesTopLevelModule) private def getModuleName(filename: String): String = - if (filename.lastIndexOf('.') > -1) + if (filename.endsWith(".d") || filename.endsWith(".ts")) getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'))) else filename.substring(filename.lastIndexOf('/') + 1) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 407a1a664..6a8a11858 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -4,14 +4,19 @@ import scala.scalajs.js import js.DynamicImplicits._ import types._ import mlscript.utils._ +import scala.collection.mutable.ListBuffer class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) + private val importList = ListBuffer[String]() TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces + if (nodeObject.isImportDeclaration) { + parseImportDeclaration(nodeObject) + } + else if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) else if (!nodeObject.declarationList.isUndefined) { // for variables val decNode = nodeObject.declarationList.declaration @@ -20,6 +25,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) + def getImportList: List[String] = importList.toList.distinct + + private def parseImportDeclaration(node: TSNodeObject): Unit = { + // ignore `import "filename.ts"` + if (!node.importClause.isUndefined) { + importList += node.moduleSpecifier.text + // TODO: type alias for different `import` + } + } + private def getSubstitutionArguments[T <: TSAny](args: TSArray[T]): List[TSType] = args.foldLeft(List[TSType]())((lst, arg) => arg match { case token: TSTokenObject => lst :+ getObjectType(token.typeNode) diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index f66f00a66..98c8bff81 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -13,6 +13,7 @@ export declare module Export { } export val baz: IBar } + fun default(x: anything): anything } //│ ╔══[ERROR] type identifier not found: IBar //│ ║ l.7: fun Baz(aa: string): IBar @@ -42,4 +43,5 @@ export declare module Export { //│ trait IBar() //│ let baz: IBar //│ } +//│ fun default: (x: anything,) -> anything //│ } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi new file mode 100644 index 000000000..01ac397a0 --- /dev/null +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -0,0 +1,28 @@ +:NewParser +:NewDefs +:NoJS +:AllowTypeErrors +import "Dependency.mlsi" +export declare module Import { + val t: number + val a: A + val b: A + val c: A + val d: number +} +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.8: val a: A +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.9: val b: A +//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.10: val c: A +//│ ╙── ^ +//│ module Import() { +//│ let a: error +//│ let b: error +//│ let c: error +//│ let d: number +//│ let t: number +//│ } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 9039acc3f..fd852f2ea 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -6,11 +6,9 @@ import scala.collection.immutable class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ - testsData.foreach((data) => test(data._2) { - val program = TSProgram(tsPath(data._1), !directlyImportedSet.contains(data._1)) - var writer = JSWriter(diffPath(data._2)) - program.generate(writer) - writer.close() + testsData.foreach((filename) => test(filename) { + val program = TSProgram(tsPath(filename), !directlyImportedSet.contains(filename)) + program.generate("ts2mls/js/src/test/typescript", "ts2mls/js/src/test/diff") }) } @@ -18,28 +16,28 @@ object TSTypeGenerationTest { private def tsPath(filename: String) = s"ts2mls/js/src/test/typescript/$filename" private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" - // TODO: do better? private val testsData = List( - ("Array.ts", "Array.mlsi"), - ("BasicFunctions.ts", "BasicFunctions.mlsi"), - ("ClassMember.ts", "ClassMember.mlsi"), - ("Dec.d.ts", "Dec.mlsi"), - ("Enum.ts", "Enum.mlsi"), - ("ES5.d.ts", "ES5.mlsi"), - ("Export.ts", "Export.mlsi"), - ("Heritage.ts", "Heritage.mlsi"), - ("HighOrderFunc.ts", "HighOrderFunc.mlsi"), - ("InterfaceMember.ts", "InterfaceMember.mlsi"), - ("Intersection.ts", "Intersection.mlsi"), - ("Literal.ts", "Literal.mlsi"), - ("Namespace.ts", "Namespace.mlsi"), - ("Optional.ts", "Optional.mlsi"), - ("Overload.ts", "Overload.mlsi"), - ("Tuple.ts", "Tuple.mlsi"), - ("Type.ts", "Type.mlsi"), - ("TypeParameter.ts", "TypeParameter.mlsi"), - ("Union.ts", "Union.mlsi"), - ("Variables.ts", "Variables.mlsi"), + "Array.ts", + "BasicFunctions.ts", + "ClassMember.ts", + "Dec.d.ts", + "Enum.ts", + "ES5.d.ts", + "Export.ts", + "Heritage.ts", + "HighOrderFunc.ts", + "Import.ts", + "InterfaceMember.ts", + "Intersection.ts", + "Literal.ts", + "Namespace.ts", + "Optional.ts", + "Overload.ts", + "Tuple.ts", + "Type.ts", + "TypeParameter.ts", + "Union.ts", + "Variables.ts", ) private val directlyImportedSet = Set[String]("ES5.d.ts") diff --git a/ts2mls/js/src/test/typescript/Dependency.ts b/ts2mls/js/src/test/typescript/Dependency.ts new file mode 100644 index 000000000..03e193835 --- /dev/null +++ b/ts2mls/js/src/test/typescript/Dependency.ts @@ -0,0 +1,7 @@ +export class A { + a: number +} + +export default function f() { + return 42; +} diff --git a/ts2mls/js/src/test/typescript/Export.ts b/ts2mls/js/src/test/typescript/Export.ts index 886423153..385d2d3ba 100644 --- a/ts2mls/js/src/test/typescript/Export.ts +++ b/ts2mls/js/src/test/typescript/Export.ts @@ -15,3 +15,7 @@ export namespace Foo { export const baz = Baz("baz") } + +export default function id(x) { + return x; +} diff --git a/ts2mls/js/src/test/typescript/Import.ts b/ts2mls/js/src/test/typescript/Import.ts new file mode 100644 index 000000000..126649c31 --- /dev/null +++ b/ts2mls/js/src/test/typescript/Import.ts @@ -0,0 +1,14 @@ +import "./Dependency" +import f from "./Dependency" +import { A } from "./Dependency" +import { A as B } from "./Dependency" +import * as D from "./Dependency" +import type { A as C } from "./Dependency" + + +const t = f(); + +const a = new A(); +const b = new B(); +let c: C +const d = D.default(); From 5d4b5fb5d5fe4d0984de618c9137e0b0b7cbd2d4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 28 Apr 2023 19:56:39 +0800 Subject: [PATCH 054/202] WIP: Recover full name from import path(not ready) --- .../main/scala/ts2mls/TSCompilerInfo.scala | 11 +++--- .../src/main/scala/ts2mls/TSSourceFile.scala | 26 +++++++++++--- ts2mls/js/src/test/diff/Import.mlsi | 35 +++++++++---------- ts2mls/js/src/test/typescript/Import.ts | 1 + 4 files changed, 44 insertions(+), 29 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 93ef0d007..effcf6c2c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -35,6 +35,7 @@ object TypeScript { def isFunctionLike(node: js.Dynamic) = ts.isFunctionLike(node) def isModuleDeclaration(node: js.Dynamic) = ts.isModuleDeclaration(node) def isImportDeclaration(node: js.Dynamic) = ts.isImportDeclaration(node) + def isSourceFile(node: js.Dynamic) = ts.isSourceFile(node) def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) @@ -72,8 +73,8 @@ object TSTypeChecker { } class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAny(sym) { - private lazy val parent = TSSymbolObject(sym.parent) private lazy val flags = sym.flags + lazy val parent = TSSymbolObject(sym.parent) // the first declaration of this symbol // if there is no overloading, there is only one declaration @@ -85,12 +86,6 @@ class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends T lazy val `type` = TSTypeObject(sym.selectDynamic("type")) lazy val isOptionalMember = (flags & TypeScript.symbolFlagsOptional) > 0 - - // get the full name of the reference symbol - // e.g. class A extends B => class A extends SomeNamespace'B - lazy val fullName: String = - if (parent.isUndefined || !parent.declaration.isNamespace) escapedName - else s"${parent.fullName}.$escapedName" } object TSSymbolObject { @@ -121,6 +116,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isTupleTypeNode = TypeScript.isTupleTypeNode(node) lazy val isImplementationOfOverload = checker.isImplementationOfOverload(node) lazy val isImportDeclaration = TypeScript.isImportDeclaration(node) + lazy val isSourceFile = TypeScript.isSourceFile(node) // if a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. @@ -174,6 +170,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val moduleSpecifier = TSTokenObject(node.moduleSpecifier) lazy val importClause = TSNodeObject(node.importClause) + lazy val namedBindings = TSNodeObject(node.namedBindings) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 6a8a11858..1a3d8a918 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -4,18 +4,23 @@ import scala.scalajs.js import js.DynamicImplicits._ import types._ import mlscript.utils._ -import scala.collection.mutable.ListBuffer +import scala.collection.mutable.{ListBuffer, HashMap} class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = ListBuffer[String]() + private val moduleMap = HashMap[String, String]() + private val resolvedPath = sf.resolvedPath.toString() + private val originalFileName = sf.originalFileName.toString() + private val rootPath = + resolvedPath.substring(0, resolvedPath.length() - originalFileName.length()) + + originalFileName.substring(0, originalFileName.lastIndexOf("/") + 1) TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { - if (nodeObject.isImportDeclaration) { + if (nodeObject.isImportDeclaration) parseImportDeclaration(nodeObject) - } else if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) else if (!nodeObject.declarationList.isUndefined) { // for variables @@ -31,6 +36,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // ignore `import "filename.ts"` if (!node.importClause.isUndefined) { importList += node.moduleSpecifier.text + if (!node.importClause.namedBindings.isUndefined && !node.importClause.namedBindings.name.isUndefined) { + val absPath = + if (node.moduleSpecifier.text.startsWith("./")) + rootPath + node.moduleSpecifier.text.substring(2) + else node.moduleSpecifier.text // TODO: node_module? + moduleMap.put(absPath, node.importClause.namedBindings.name.escapedText) + } // TODO: type alias for different `import` } } @@ -41,6 +53,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case tp: TSTypeObject => lst :+ getObjectType(tp) }) + private def getSymbolFullname(sym: TSSymbolObject): String = + if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) + s"${moduleMap(sym.parent.declaration.symbol.escapedName.replaceAll("\"", ""))}.${sym.escapedName}" + else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) sym.escapedName + else s"${getSymbolFullname(sym.parent)}.${sym.escapedName}" + private def getObjectType(obj: TSTypeObject): TSType = if (obj.isMapped) lineHelper.getPos(obj.pos) match { case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) @@ -54,7 +72,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (obj.isTypeParameterSubstitution) TSSubstitutionType(obj.symbol.escapedName, getSubstitutionArguments(obj.typeArguments)) else if (obj.isObject) if (obj.isAnonymous) TSInterfaceType("", getAnonymousPropertiesType(obj.properties), List(), List()) - else TSReferenceType(obj.symbol.fullName) + else TSReferenceType(getSymbolFullname(obj.symbol)) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) lineHelper.getPos(obj.pos) match { case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index 01ac397a0..15a15e789 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -5,24 +5,23 @@ import "Dependency.mlsi" export declare module Import { val t: number - val a: A - val b: A - val c: A + val a: D.A + val b: D.A + val c: D.A val d: number + val aa: D.A } -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.8: val a: A +//│ ╔══[ERROR] type identifier not found: D +//│ ║ l.8: val a: D.A //│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.9: val b: A -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.10: val c: A -//│ ╙── ^ -//│ module Import() { -//│ let a: error -//│ let b: error -//│ let c: error -//│ let d: number -//│ let t: number -//│ } +//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. +//│ at: mlscript.utils.package$.lastWords(package.scala:205) +//│ at: mlscript.utils.package$.die(package.scala:204) +//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) +//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) +//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) +//│ at: mlscript.Typer.go$1(Typer.scala:490) +//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) +//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) +//│ at: mlscript.Typer.rec$1(Typer.scala:547) +//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) diff --git a/ts2mls/js/src/test/typescript/Import.ts b/ts2mls/js/src/test/typescript/Import.ts index 126649c31..d18e57d43 100644 --- a/ts2mls/js/src/test/typescript/Import.ts +++ b/ts2mls/js/src/test/typescript/Import.ts @@ -12,3 +12,4 @@ const a = new A(); const b = new B(); let c: C const d = D.default(); +const aa = new D.A(); From 5e30c4ea1dadcaa1fb6a479fa4c870be2ba883e2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 2 May 2023 10:33:22 +0800 Subject: [PATCH 055/202] WIP: Improve code quality of import resolving --- .../js/src/main/scala/ts2mls/TSModules.scala | 54 +++++++++++++++++++ .../src/main/scala/ts2mls/TSSourceFile.scala | 10 ++-- 2 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 ts2mls/js/src/main/scala/ts2mls/TSModules.scala diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala new file mode 100644 index 000000000..9fd6b94f1 --- /dev/null +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -0,0 +1,54 @@ +package ts2mls + +import scala.collection.mutable.HashMap +import mlscript.utils._ + +trait TSImport { self => + def resolveTypeAlias(name: String): String = self match { + case TSFullImport(_, alias) => s"$alias.$name" + case TSSingleImport(_, items) => + items.collect { + case (originalName, alias, _) if (originalName === name) => + alias.getOrElse(originalName) + }.headOption.getOrElse(name) + } + + def convert: String = self match { + case _: TSImport => "" // TODO: + } +} + +// import * as alias from "filename" +case class TSFullImport(filename: String, alias: String) extends TSImport +// import { s1, s2 as a } from "filename" +// export { s1, s2 as a } from "filename" +case class TSSingleImport(filename: String, items: List[(String, Option[String], Boolean)]) extends TSImport + +class TSImportList { + private val singleList = new HashMap[String, TSSingleImport]() + private val fullList = new HashMap[String, TSFullImport]() + + def +=(imp: TSImport): Unit = imp match { + case imp @ TSFullImport(filename, _) => fullList.addOne((filename, imp)) + case imp @ TSSingleImport(filename, items) => + if (singleList.contains(filename)) + singleList.update(filename, TSSingleImport(filename, singleList(filename).items ::: items)) + else singleList.addOne((filename, imp)) + } + + def resolveTypeAlias(modulePath: String, name: String): String = + if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) + else if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) + else throw new AssertionError(s"unresolved module path $modulePath.") + + def convert: String = ( + singleList.values.map(_.convert).toList ::: fullList.values.map(_.convert).toList + ).foldLeft("")((r, i) => s"$r\n$i") + + def getFilelist: List[String] = + (singleList.keys.toList ::: fullList.keys.toList).distinct +} + +object TSImportList { + def apply() = new TSImportList() +} diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 1a3d8a918..1b4f9e285 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -8,8 +8,7 @@ import scala.collection.mutable.{ListBuffer, HashMap} class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) - private val importList = ListBuffer[String]() - private val moduleMap = HashMap[String, String]() + private val importList = TSImportList() private val resolvedPath = sf.resolvedPath.toString() private val originalFileName = sf.originalFileName.toString() private val rootPath = @@ -30,18 +29,17 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) - def getImportList: List[String] = importList.toList.distinct + def getImportList: List[String] = importList.getFilelist private def parseImportDeclaration(node: TSNodeObject): Unit = { // ignore `import "filename.ts"` if (!node.importClause.isUndefined) { - importList += node.moduleSpecifier.text if (!node.importClause.namedBindings.isUndefined && !node.importClause.namedBindings.name.isUndefined) { val absPath = if (node.moduleSpecifier.text.startsWith("./")) rootPath + node.moduleSpecifier.text.substring(2) else node.moduleSpecifier.text // TODO: node_module? - moduleMap.put(absPath, node.importClause.namedBindings.name.escapedText) + importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText) } // TODO: type alias for different `import` } @@ -55,7 +53,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getSymbolFullname(sym: TSSymbolObject): String = if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) - s"${moduleMap(sym.parent.declaration.symbol.escapedName.replaceAll("\"", ""))}.${sym.escapedName}" + importList.resolveTypeAlias(sym.parent.declaration.symbol.escapedName.replaceAll("\"", ""), sym.escapedName) else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) sym.escapedName else s"${getSymbolFullname(sym.parent)}.${sym.escapedName}" From c2c83241bf3311e9e5a4573b75cbee9c6594bc33 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 2 May 2023 11:09:07 +0800 Subject: [PATCH 056/202] WIP: Add single import parsing(not ready yet) --- .../main/scala/ts2mls/TSCompilerInfo.scala | 2 ++ ts2mls/js/src/main/scala/ts2mls/TSData.scala | 5 ++++ .../js/src/main/scala/ts2mls/TSModules.scala | 29 ++++++++++++------- .../src/main/scala/ts2mls/TSSourceFile.scala | 17 +++++++++-- ts2mls/js/src/test/diff/Import.mlsi | 23 ++++++++++----- ts2mls/js/src/test/typescript/Dependency.ts | 12 ++++++++ ts2mls/js/src/test/typescript/Import.ts | 12 ++++---- 7 files changed, 74 insertions(+), 26 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index effcf6c2c..9f519e04e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -171,6 +171,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val moduleSpecifier = TSTokenObject(node.moduleSpecifier) lazy val importClause = TSNodeObject(node.importClause) lazy val namedBindings = TSNodeObject(node.namedBindings) + lazy val elements = TSNodeArray(node.elements) + lazy val propertyName = TSIdentifierObject(node.propertyName) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index 6f7e1f1ca..f9527794f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -30,6 +30,11 @@ abstract class TSArray[T <: TSAny](arr: js.Dynamic) extends TSAny(arr) { f(get(index)) foreach(f, index + 1) } + + def mapToList[U](f: T => U, index: Int = 0, res: List[U] = Nil): List[U] = + if (!isUndefined && index < length) + mapToList(f, index + 1, res :+ f(get(index))) + else res } class TSNodeArray(arr: js.Dynamic)(implicit checker: TSTypeChecker) extends TSArray[TSNodeObject](arr) { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 9fd6b94f1..2ac580775 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -4,16 +4,16 @@ import scala.collection.mutable.HashMap import mlscript.utils._ trait TSImport { self => - def resolveTypeAlias(name: String): String = self match { - case TSFullImport(_, alias) => s"$alias.$name" + def resolveTypeAlias(name: String): Option[String] = self match { + case TSFullImport(_, alias) => Some(s"$alias.$name") case TSSingleImport(_, items) => items.collect { case (originalName, alias, _) if (originalName === name) => alias.getOrElse(originalName) - }.headOption.getOrElse(name) + }.headOption } - def convert: String = self match { + def convertAlias: String = self match { case _: TSImport => "" // TODO: } } @@ -36,13 +36,22 @@ class TSImportList { else singleList.addOne((filename, imp)) } - def resolveTypeAlias(modulePath: String, name: String): String = - if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) - else if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) - else throw new AssertionError(s"unresolved module path $modulePath.") + def resolveTypeAlias(modulePath: String, name: String): String = { + val singleAlias = + if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) + else None + singleAlias match { + case Some(alias) => alias + case None => + val fullAlias = + if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) + else None + fullAlias.getOrElse(throw new AssertionError(s"unresolved imported name $name at $modulePath.")) + } + } - def convert: String = ( - singleList.values.map(_.convert).toList ::: fullList.values.map(_.convert).toList + def convertAlias: String = ( + singleList.values.map(_.convertAlias).toList ::: fullList.values.map(_.convertAlias).toList ).foldLeft("")((r, i) => s"$r\n$i") def getFilelist: List[String] = diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 1b4f9e285..f522dac5a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -34,14 +34,25 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def parseImportDeclaration(node: TSNodeObject): Unit = { // ignore `import "filename.ts"` if (!node.importClause.isUndefined) { - if (!node.importClause.namedBindings.isUndefined && !node.importClause.namedBindings.name.isUndefined) { + val bindings = node.importClause.namedBindings + if (!bindings.isUndefined) { val absPath = if (node.moduleSpecifier.text.startsWith("./")) rootPath + node.moduleSpecifier.text.substring(2) else node.moduleSpecifier.text // TODO: node_module? - importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText) + if (!bindings.elements.isUndefined) { + val list = bindings.elements.mapToList(ele => + if (ele.propertyName.isUndefined) + (ele.symbol.escapedName, None, false) + else + (ele.propertyName.escapedText, Some(ele.symbol.escapedName), false) + ) + importList += TSSingleImport(absPath, list) + } + else if (!bindings.name.isUndefined) { + importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText) + } } - // TODO: type alias for different `import` } } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index 15a15e789..f298f46a1 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -5,15 +5,24 @@ import "Dependency.mlsi" export declare module Import { val t: number - val a: D.A - val b: D.A - val c: D.A - val d: number - val aa: D.A + val a: A + val b: BB + val c: CC + val d: D.D + val dd: number } -//│ ╔══[ERROR] type identifier not found: D -//│ ║ l.8: val a: D.A +//│ ╔══[ERROR] type identifier not found: A +//│ ║ l.8: val a: A //│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: BB +//│ ║ l.9: val b: BB +//│ ╙── ^^ +//│ ╔══[ERROR] type identifier not found: CC +//│ ║ l.10: val c: CC +//│ ╙── ^^ +//│ ╔══[ERROR] type identifier not found: D +//│ ║ l.11: val d: D.D +//│ ╙── ^ //│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. //│ at: mlscript.utils.package$.lastWords(package.scala:205) //│ at: mlscript.utils.package$.die(package.scala:204) diff --git a/ts2mls/js/src/test/typescript/Dependency.ts b/ts2mls/js/src/test/typescript/Dependency.ts index 03e193835..99f8158a7 100644 --- a/ts2mls/js/src/test/typescript/Dependency.ts +++ b/ts2mls/js/src/test/typescript/Dependency.ts @@ -2,6 +2,18 @@ export class A { a: number } +export class B { + b: number +} + +export class C { + c: number +} + +export class D { + d: number +} + export default function f() { return 42; } diff --git a/ts2mls/js/src/test/typescript/Import.ts b/ts2mls/js/src/test/typescript/Import.ts index d18e57d43..bc3a66c83 100644 --- a/ts2mls/js/src/test/typescript/Import.ts +++ b/ts2mls/js/src/test/typescript/Import.ts @@ -1,15 +1,15 @@ import "./Dependency" import f from "./Dependency" import { A } from "./Dependency" -import { A as B } from "./Dependency" +import { B as BB } from "./Dependency" import * as D from "./Dependency" -import type { A as C } from "./Dependency" +import type { C as CC } from "./Dependency" const t = f(); const a = new A(); -const b = new B(); -let c: C -const d = D.default(); -const aa = new D.A(); +const b = new BB(); +let c: CC +const d = new D.D(); +const dd = D.default(); From 32f2bdcd7ef7999cd2a8c886973ef82d278ce602 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 2 May 2023 12:03:33 +0800 Subject: [PATCH 057/202] WIP: Generate type alias --- .../js/src/main/scala/ts2mls/TSModules.scala | 35 ++++++++++++++----- .../src/main/scala/ts2mls/TSNamespace.scala | 5 +-- .../js/src/main/scala/ts2mls/TSProgram.scala | 16 +++------ .../src/main/scala/ts2mls/TSSourceFile.scala | 9 ++++- ts2mls/js/src/test/diff/Import.mlsi | 19 ++++------ 5 files changed, 50 insertions(+), 34 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 2ac580775..69fc27277 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -2,10 +2,11 @@ package ts2mls import scala.collection.mutable.HashMap import mlscript.utils._ +import ts2mls.types.{TSTypeAlias, TSReferenceType} trait TSImport { self => def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(_, alias) => Some(s"$alias.$name") + case TSFullImport(_, alias, _) => Some(s"$alias.$name") case TSSingleImport(_, items) => items.collect { case (originalName, alias, _) if (originalName === name) => @@ -13,13 +14,32 @@ trait TSImport { self => }.headOption } - def convertAlias: String = self match { - case _: TSImport => "" // TODO: + def convertAlias: List[(TSTypeAlias, Boolean)] = self match { + case TSFullImport(filename, alias, reExp) => + val originalName = TSImport.getModuleName(filename) + if (originalName === alias) Nil + else (TSTypeAlias(alias, TSReferenceType(originalName), Nil), reExp) :: Nil + case TSSingleImport(filename, items) => + val moduleName = TSImport.getModuleName(filename) + items.map { + case (originalName, Some(alias), reExp) => + (TSTypeAlias(alias, TSReferenceType(s"$moduleName.$originalName"), Nil), reExp) + case (originalName, None, reExp) => + (TSTypeAlias(originalName, TSReferenceType(s"$moduleName.$originalName"), Nil), reExp) + } } } +object TSImport { + def getModuleName(filename: String): String = + if (filename.endsWith(".d") || filename.endsWith(".ts")) + getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'))) + else + filename.substring(filename.lastIndexOf('/') + 1) +} + // import * as alias from "filename" -case class TSFullImport(filename: String, alias: String) extends TSImport +case class TSFullImport(filename: String, alias: String, reExported: Boolean) extends TSImport // import { s1, s2 as a } from "filename" // export { s1, s2 as a } from "filename" case class TSSingleImport(filename: String, items: List[(String, Option[String], Boolean)]) extends TSImport @@ -29,7 +49,7 @@ class TSImportList { private val fullList = new HashMap[String, TSFullImport]() def +=(imp: TSImport): Unit = imp match { - case imp @ TSFullImport(filename, _) => fullList.addOne((filename, imp)) + case imp @ TSFullImport(filename, _, _) => fullList.addOne((filename, imp)) case imp @ TSSingleImport(filename, items) => if (singleList.contains(filename)) singleList.update(filename, TSSingleImport(filename, singleList(filename).items ::: items)) @@ -50,9 +70,8 @@ class TSImportList { } } - def convertAlias: String = ( - singleList.values.map(_.convertAlias).toList ::: fullList.values.map(_.convertAlias).toList - ).foldLeft("")((r, i) => s"$r\n$i") + def convertAlias: List[(TSTypeAlias, Boolean)] = + singleList.values.flatMap(_.convertAlias).toList ::: fullList.values.flatMap(_.convertAlias).toList def getFilelist: List[String] = (singleList.keys.toList ::: fullList.keys.toList).distinct diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 99129f9bc..55a63ff74 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -22,9 +22,10 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { sub } - def put(name: String, tp: TSType, exported: Boolean): Unit = + def put(name: String, tp: TSType, exported: Boolean, append: Boolean = true): Unit = if (!members.contains(name)) { - order += Right(name) + if (append) order += Right(name) + else Right(name) +: order members.put(name, (tp, exported)) } else members.update(name, (tp, exported)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 87bf0da28..f92857198 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -21,11 +21,10 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { private val globalNamespace = TSNamespace() private val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) private val importList = entryFile.getImportList - - import TSProgram._ + private val importAlias = entryFile.getUnexportedAlias def generate(workDir: String, targetPath: String): Unit = { - val moduleName = getModuleName(filename) + val moduleName = TSImport.getModuleName(filename) val relatedPath = if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) else throw new AssertionError(s"wrong work dir $workDir") @@ -37,8 +36,9 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { private def generate(writer: JSWriter): Unit = if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { - importList.foreach{f => writer.writeln(s"""import "${getModuleName(f)}.mlsi"""")} - writer.writeln(s"export declare module ${getModuleName(filename)} {") + importList.foreach{f => writer.writeln(s"""import "${TSImport.getModuleName(f)}.mlsi"""")} + importAlias.foreach{alias => writer.writeln(Converter.convert(alias, false)(""))} + writer.writeln(s"export declare module ${TSImport.getModuleName(filename)} {") globalNamespace.generate(writer, " ") writer.writeln("}") } @@ -46,10 +46,4 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { object TSProgram { def apply(filename: String, uesTopLevelModule: Boolean) = new TSProgram(filename, uesTopLevelModule) - - private def getModuleName(filename: String): String = - if (filename.endsWith(".d") || filename.endsWith(".ts")) - getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'))) - else - filename.substring(filename.lastIndexOf('/') + 1) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index f522dac5a..cecec8a79 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -30,6 +30,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) def getImportList: List[String] = importList.getFilelist + def getUnexportedAlias: List[TSTypeAlias] = + importList.convertAlias.filter(p => p match { + case (alias @ TSTypeAlias(name, _, _), true) => + global.put(name, alias, true, false) + false + case (_, false) => true + }).map(_._1) private def parseImportDeclaration(node: TSNodeObject): Unit = { // ignore `import "filename.ts"` @@ -50,7 +57,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType importList += TSSingleImport(absPath, list) } else if (!bindings.name.isUndefined) { - importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText) + importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText, false) } } } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index f298f46a1..26244e66c 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -3,6 +3,10 @@ :NoJS :AllowTypeErrors import "Dependency.mlsi" +type A = Dependency.A +type BB = Dependency.B +type CC = Dependency.C +type D = Dependency export declare module Import { val t: number val a: A @@ -11,18 +15,9 @@ export declare module Import { val d: D.D val dd: number } -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.8: val a: A -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: BB -//│ ║ l.9: val b: BB -//│ ╙── ^^ -//│ ╔══[ERROR] type identifier not found: CC -//│ ║ l.10: val c: CC -//│ ╙── ^^ -//│ ╔══[ERROR] type identifier not found: D -//│ ║ l.11: val d: D.D -//│ ╙── ^ +//│ ╔══[ERROR] type identifier not found: Dependency +//│ ║ l.6: type A = Dependency.A +//│ ╙── ^^^^^^^^^^ //│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. //│ at: mlscript.utils.package$.lastWords(package.scala:205) //│ at: mlscript.utils.package$.die(package.scala:204) From c00321aeaabe1d947caad14e555b9f613e0d4ebc Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 2 May 2023 13:54:04 +0800 Subject: [PATCH 058/202] WIP: Inline type names --- .../js/src/main/scala/ts2mls/TSModules.scala | 28 ++++--------------- .../js/src/main/scala/ts2mls/TSProgram.scala | 2 -- .../src/main/scala/ts2mls/TSSourceFile.scala | 9 +----- ts2mls/js/src/test/diff/Import.mlsi | 14 ++++------ 4 files changed, 11 insertions(+), 42 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 69fc27277..1fa609df5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -6,28 +6,13 @@ import ts2mls.types.{TSTypeAlias, TSReferenceType} trait TSImport { self => def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(_, alias, _) => Some(s"$alias.$name") - case TSSingleImport(_, items) => + case TSFullImport(filename, _) => Some(s"${TSImport.getModuleName(filename)}.$name") + case TSSingleImport(filename, items) => items.collect { case (originalName, alias, _) if (originalName === name) => - alias.getOrElse(originalName) + s"${TSImport.getModuleName(filename)}.$name" }.headOption } - - def convertAlias: List[(TSTypeAlias, Boolean)] = self match { - case TSFullImport(filename, alias, reExp) => - val originalName = TSImport.getModuleName(filename) - if (originalName === alias) Nil - else (TSTypeAlias(alias, TSReferenceType(originalName), Nil), reExp) :: Nil - case TSSingleImport(filename, items) => - val moduleName = TSImport.getModuleName(filename) - items.map { - case (originalName, Some(alias), reExp) => - (TSTypeAlias(alias, TSReferenceType(s"$moduleName.$originalName"), Nil), reExp) - case (originalName, None, reExp) => - (TSTypeAlias(originalName, TSReferenceType(s"$moduleName.$originalName"), Nil), reExp) - } - } } object TSImport { @@ -39,7 +24,7 @@ object TSImport { } // import * as alias from "filename" -case class TSFullImport(filename: String, alias: String, reExported: Boolean) extends TSImport +case class TSFullImport(filename: String, reExported: Boolean) extends TSImport // import { s1, s2 as a } from "filename" // export { s1, s2 as a } from "filename" case class TSSingleImport(filename: String, items: List[(String, Option[String], Boolean)]) extends TSImport @@ -49,7 +34,7 @@ class TSImportList { private val fullList = new HashMap[String, TSFullImport]() def +=(imp: TSImport): Unit = imp match { - case imp @ TSFullImport(filename, _, _) => fullList.addOne((filename, imp)) + case imp @ TSFullImport(filename, _) => fullList.addOne((filename, imp)) case imp @ TSSingleImport(filename, items) => if (singleList.contains(filename)) singleList.update(filename, TSSingleImport(filename, singleList(filename).items ::: items)) @@ -70,9 +55,6 @@ class TSImportList { } } - def convertAlias: List[(TSTypeAlias, Boolean)] = - singleList.values.flatMap(_.convertAlias).toList ::: fullList.values.flatMap(_.convertAlias).toList - def getFilelist: List[String] = (singleList.keys.toList ::: fullList.keys.toList).distinct } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index f92857198..433a35ab9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -21,7 +21,6 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { private val globalNamespace = TSNamespace() private val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) private val importList = entryFile.getImportList - private val importAlias = entryFile.getUnexportedAlias def generate(workDir: String, targetPath: String): Unit = { val moduleName = TSImport.getModuleName(filename) @@ -37,7 +36,6 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { importList.foreach{f => writer.writeln(s"""import "${TSImport.getModuleName(f)}.mlsi"""")} - importAlias.foreach{alias => writer.writeln(Converter.convert(alias, false)(""))} writer.writeln(s"export declare module ${TSImport.getModuleName(filename)} {") globalNamespace.generate(writer, " ") writer.writeln("}") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index cecec8a79..954abf20a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -30,13 +30,6 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) def getImportList: List[String] = importList.getFilelist - def getUnexportedAlias: List[TSTypeAlias] = - importList.convertAlias.filter(p => p match { - case (alias @ TSTypeAlias(name, _, _), true) => - global.put(name, alias, true, false) - false - case (_, false) => true - }).map(_._1) private def parseImportDeclaration(node: TSNodeObject): Unit = { // ignore `import "filename.ts"` @@ -57,7 +50,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType importList += TSSingleImport(absPath, list) } else if (!bindings.name.isUndefined) { - importList += TSFullImport(absPath, node.importClause.namedBindings.name.escapedText, false) + importList += TSFullImport(absPath, false) } } } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index 26244e66c..a7923c0c0 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -3,20 +3,16 @@ :NoJS :AllowTypeErrors import "Dependency.mlsi" -type A = Dependency.A -type BB = Dependency.B -type CC = Dependency.C -type D = Dependency export declare module Import { val t: number - val a: A - val b: BB - val c: CC - val d: D.D + val a: Dependency.A + val b: Dependency.B + val c: Dependency.C + val d: Dependency.D val dd: number } //│ ╔══[ERROR] type identifier not found: Dependency -//│ ║ l.6: type A = Dependency.A +//│ ║ l.8: val a: Dependency.A //│ ╙── ^^^^^^^^^^ //│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. //│ at: mlscript.utils.package$.lastWords(package.scala:205) From b2485f9282f86658aa2d23fde210aba46a8ba601 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 4 May 2023 10:31:07 +0800 Subject: [PATCH 059/202] WIP: Parse re-export in ts2mls and fix some bugs(not ready) --- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 ++ .../js/src/main/scala/ts2mls/TSModules.scala | 15 ++++-- .../src/main/scala/ts2mls/TSNamespace.scala | 5 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 48 ++++++++++++------- .../main/scala/ts2mls/types/Converter.scala | 8 ++-- ts2mls/js/src/test/diff/Export.mlsi | 45 +++++++++-------- ts2mls/js/src/test/diff/Type.mlsi | 2 +- ts2mls/js/src/test/typescript/Export.ts | 8 ++++ 8 files changed, 88 insertions(+), 46 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 9f519e04e..ce29f4baa 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -36,6 +36,7 @@ object TypeScript { def isModuleDeclaration(node: js.Dynamic) = ts.isModuleDeclaration(node) def isImportDeclaration(node: js.Dynamic) = ts.isImportDeclaration(node) def isSourceFile(node: js.Dynamic) = ts.isSourceFile(node) + def isExportDeclaration(node: js.Dynamic) = ts.isExportDeclaration(node) def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) @@ -117,6 +118,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isImplementationOfOverload = checker.isImplementationOfOverload(node) lazy val isImportDeclaration = TypeScript.isImportDeclaration(node) lazy val isSourceFile = TypeScript.isSourceFile(node) + lazy val isExportDeclaration = TypeScript.isExportDeclaration(node) // if a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. @@ -173,6 +175,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val namedBindings = TSNodeObject(node.namedBindings) lazy val elements = TSNodeArray(node.elements) lazy val propertyName = TSIdentifierObject(node.propertyName) + lazy val exportClause = TSNodeObject(node.exportClause) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 1fa609df5..f86db8858 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -9,10 +9,19 @@ trait TSImport { self => case TSFullImport(filename, _) => Some(s"${TSImport.getModuleName(filename)}.$name") case TSSingleImport(filename, items) => items.collect { - case (originalName, alias, _) if (originalName === name) => + case (originalName, _) if (originalName === name) => s"${TSImport.getModuleName(filename)}.$name" }.headOption } + + def createAlias: List[TSTypeAlias] = self match { + case TSFullImport(filename, alias) => + TSTypeAlias(alias, TSReferenceType(TSImport.getModuleName(filename)), Nil) :: Nil + case TSSingleImport(filename, items) => + items.map{ case (name, alias) => + TSTypeAlias(alias.getOrElse(name), TSReferenceType(s"${TSImport.getModuleName(filename)}.$name"), Nil) + } + } } object TSImport { @@ -24,10 +33,10 @@ object TSImport { } // import * as alias from "filename" -case class TSFullImport(filename: String, reExported: Boolean) extends TSImport +case class TSFullImport(filename: String, alias: String) extends TSImport // import { s1, s2 as a } from "filename" // export { s1, s2 as a } from "filename" -case class TSSingleImport(filename: String, items: List[(String, Option[String], Boolean)]) extends TSImport +case class TSSingleImport(filename: String, items: List[(String, Option[String])]) extends TSImport class TSImportList { private val singleList = new HashMap[String, TSSingleImport]() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 55a63ff74..99129f9bc 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -22,10 +22,9 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { sub } - def put(name: String, tp: TSType, exported: Boolean, append: Boolean = true): Unit = + def put(name: String, tp: TSType, exported: Boolean): Unit = if (!members.contains(name)) { - if (append) order += Right(name) - else Right(name) +: order + order += Right(name) members.put(name, (tp, exported)) } else members.update(name, (tp, exported)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 954abf20a..443390c6e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -19,7 +19,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { if (nodeObject.isImportDeclaration) - parseImportDeclaration(nodeObject) + parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) + else if (nodeObject.isExportDeclaration) { + if (!nodeObject.moduleSpecifier.isUndefined) // re-export + parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) + } else if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) else if (!nodeObject.declarationList.isUndefined) { // for variables @@ -31,28 +35,38 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType def getImportList: List[String] = importList.getFilelist - private def parseImportDeclaration(node: TSNodeObject): Unit = { + private def parseImportDeclaration(clause: TSNodeObject, moduleSpecifier: TSTokenObject, exported: Boolean): Unit = { // ignore `import "filename.ts"` - if (!node.importClause.isUndefined) { - val bindings = node.importClause.namedBindings - if (!bindings.isUndefined) { - val absPath = - if (node.moduleSpecifier.text.startsWith("./")) - rootPath + node.moduleSpecifier.text.substring(2) - else node.moduleSpecifier.text // TODO: node_module? - if (!bindings.elements.isUndefined) { - val list = bindings.elements.mapToList(ele => + if (!clause.isUndefined) { + val bindings = clause.namedBindings + val absPath = + if (moduleSpecifier.text.startsWith("./")) + rootPath + moduleSpecifier.text.substring(2) + else moduleSpecifier.text // TODO: node_module? + def run(node: TSNodeObject): Unit = + if (!node.elements.isUndefined) { + val list = node.elements.mapToList(ele => if (ele.propertyName.isUndefined) - (ele.symbol.escapedName, None, false) + (ele.symbol.escapedName, None) else - (ele.propertyName.escapedText, Some(ele.symbol.escapedName), false) + (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) - importList += TSSingleImport(absPath, list) + val imp = TSSingleImport(absPath, list) + if (exported) imp.createAlias.foreach{ + case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) + } + importList += imp } - else if (!bindings.name.isUndefined) { - importList += TSFullImport(absPath, false) + else if (!node.name.isUndefined) { + val imp = TSFullImport(absPath, node.name.escapedText) + if (exported) imp.createAlias.foreach{ + case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) + } + importList += imp } - } + + if (!bindings.isUndefined) run(bindings) + else run(clause) } } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 4f57cc66c..4a6ac3950 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -57,9 +57,11 @@ object Converter { case TSSubstitutionType(base, applied) => s"${base}<${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}>" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${name}: ${convert(tp)}" - case TSTypeAlias(name, ori, tp) => - if (tp.isEmpty) s"${indent}type $name = ${convert(ori)}" - else s"${indent}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" + case TSTypeAlias(name, ori, tp) => { + val exp = if (exported) "export " else "" + if (tp.isEmpty) s"${indent}${exp}type $name = ${convert(ori)}" + else s"${indent}${exp}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" + } case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => s"""Unsupported<"$code", "$filename", $line, $column>""" diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 98c8bff81..36df04b13 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -2,6 +2,7 @@ :NewDefs :NoJS :AllowTypeErrors +import "Dependency.mlsi" export declare module Export { export module Foo { fun Baz(aa: string): IBar @@ -14,34 +15,40 @@ export declare module Export { export val baz: IBar } fun default(x: anything): anything + class E() {} + export type G = Dependency.B + export type H = Dependency } //│ ╔══[ERROR] type identifier not found: IBar -//│ ║ l.7: fun Baz(aa: string): IBar +//│ ║ l.8: fun Baz(aa: string): IBar //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait IBar() { +//│ ║ l.9: trait IBar() { //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.9: val a: string -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: } +//│ ║ l.10: val a: string +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.11: } //│ ╙── ^^^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.11: export class Bar() extends IBar { +//│ ║ l.12: export class Bar() extends IBar { //│ ╙── ^^^^ //│ ╔══[ERROR] trait IBar cannot be used as a type -//│ ║ l.14: export val baz: IBar +//│ ║ l.15: export val baz: IBar //│ ╙── ^^^^ //│ ╔══[ERROR] Member Baz is declared but not defined -//│ ║ l.7: fun Baz(aa: string): IBar +//│ ║ l.8: fun Baz(aa: string): IBar //│ ╙── ^^^ -//│ module Export() { -//│ module Foo() { -//│ class Bar() { -//│ let a: string -//│ } -//│ fun Baz: (aa: string,) -> error -//│ trait IBar() -//│ let baz: IBar -//│ } -//│ fun default: (x: anything,) -> anything -//│ } +//│ ╔══[ERROR] type identifier not found: Dependency +//│ ║ l.19: export type G = Dependency.B +//│ ╙── ^^^^^^^^^^ +//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. +//│ at: mlscript.utils.package$.lastWords(package.scala:205) +//│ at: mlscript.utils.package$.die(package.scala:204) +//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) +//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) +//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) +//│ at: mlscript.Typer.go$1(Typer.scala:490) +//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) +//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) +//│ at: mlscript.Typer.rec$1(Typer.scala:547) +//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 11a39652a..1fe94ea1d 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -23,7 +23,7 @@ export declare module Type { type TP = (A, B, C, ) module NA { fun fb(b: string): unit - type B = string + export type B = string } class NC() { val b: string diff --git a/ts2mls/js/src/test/typescript/Export.ts b/ts2mls/js/src/test/typescript/Export.ts index 385d2d3ba..e150754c0 100644 --- a/ts2mls/js/src/test/typescript/Export.ts +++ b/ts2mls/js/src/test/typescript/Export.ts @@ -19,3 +19,11 @@ export namespace Foo { export default function id(x) { return x; } + +class E {} + +export { E } +export { E as F } +export { B as G } from "./Dependency" +export * as H from "./Dependency" + From 6cf551069a75babae8b9858e277457e914c273dc Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 4 May 2023 11:13:44 +0800 Subject: [PATCH 060/202] WIP: Parse normal export in ts2mls(not ready) --- .../src/main/scala/ts2mls/TSNamespace.scala | 6 +++ .../src/main/scala/ts2mls/TSSourceFile.scala | 46 +++++++++++++++---- ts2mls/js/src/test/diff/Export.mlsi | 5 +- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 99129f9bc..aeb242d19 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -29,6 +29,12 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { } else members.update(name, (tp, exported)) + def export(name: String): Unit = + if (members.contains(name)) + members.update(name, (members(name)._1, true)) + else if (subSpace.contains(name)) + subSpace.update(name, (subSpace(name)._1, true)) + def get(name: String): TSType = if (members.contains(name)) members(name)._1 else if (!parent.isEmpty) parent.get.get(name) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 443390c6e..5a6246dae 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -15,16 +15,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType resolvedPath.substring(0, resolvedPath.length() - originalFileName.length()) + originalFileName.substring(0, originalFileName.lastIndexOf("/") + 1) + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (nodeObject.isImportDeclaration) + parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) + }) + TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { - if (nodeObject.isImportDeclaration) - parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) - else if (nodeObject.isExportDeclaration) { - if (!nodeObject.moduleSpecifier.isUndefined) // re-export - parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) - } - else if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces + if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) else if (!nodeObject.declarationList.isUndefined) { // for variables val decNode = nodeObject.declarationList.declaration @@ -33,8 +33,36 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (nodeObject.isExportDeclaration) { + if (!nodeObject.moduleSpecifier.isUndefined) // re-export + parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) + else + parseExportDeclaration(nodeObject.exportClause.elements) + } + }) + def getImportList: List[String] = importList.getFilelist + private def parseExportDeclaration(elements: TSNodeArray): Unit = { + def getReferedType(name: String): TSType = global.get(name) match { + case cls: TSClassType => TSReferenceType(cls.name) + case TSEnumType => TSEnumType + case itf: TSInterfaceType => TSReferenceType(itf.name) + case ref: TSReferenceType => ref + case _ => throw new AssertionError(s"unsupported export type $name.") // FIXME: functions and variables? + } + elements.foreach(ele => + if (ele.propertyName.isUndefined) + global.export(ele.symbol.escapedName) + else { + val alias = ele.symbol.escapedName + global.put(alias, TSTypeAlias(alias, getReferedType(ele.propertyName.escapedText), Nil), true) + } + ) + } + private def parseImportDeclaration(clause: TSNodeObject, moduleSpecifier: TSTokenObject, exported: Boolean): Unit = { // ignore `import "filename.ts"` if (!clause.isUndefined) { @@ -52,14 +80,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) val imp = TSSingleImport(absPath, list) - if (exported) imp.createAlias.foreach{ + if (exported) imp.createAlias.foreach { // FIXME: functions and variables? case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) } importList += imp } else if (!node.name.isUndefined) { val imp = TSFullImport(absPath, node.name.escapedText) - if (exported) imp.createAlias.foreach{ + if (exported) imp.createAlias.foreach { // FIXME: functions and variables? case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) } importList += imp diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 36df04b13..70d430ef7 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -15,7 +15,8 @@ export declare module Export { export val baz: IBar } fun default(x: anything): anything - class E() {} + export class E() {} + export type F = E export type G = Dependency.B export type H = Dependency } @@ -39,7 +40,7 @@ export declare module Export { //│ ║ l.8: fun Baz(aa: string): IBar //│ ╙── ^^^ //│ ╔══[ERROR] type identifier not found: Dependency -//│ ║ l.19: export type G = Dependency.B +//│ ║ l.20: export type G = Dependency.B //│ ╙── ^^^^^^^^^^ //│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. //│ at: mlscript.utils.package$.lastWords(package.scala:205) From de7869e1fd34dea991806cf413a0efee24903744 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 8 May 2023 15:27:50 +0800 Subject: [PATCH 061/202] WIP: Add node module path resolver --- ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index ce29f4baa..8ec5b5f78 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -15,6 +15,8 @@ object TypeScript { } } + private val resolver = g.require.resolve + val typeFlagsEnumLike = ts.TypeFlags.EnumLike val typeFlagsObject = ts.TypeFlags.Object val typeFlagsTypeParameter = ts.TypeFlags.TypeParameter @@ -52,6 +54,8 @@ object TypeScript { def forEachChild(root: js.Dynamic, func: js.Dynamic => Unit) = ts.forEachChild(root, func) def createProgram(filenames: Seq[String]) = ts.createProgram(filenames.toJSArray, js.Dictionary("maxNodeModuleJsDepth" -> 0, "target" -> ts.ScriptTarget.ES5, "module" -> ts.ModuleKind.CommonJS)) + + def resolveNodeModulePath(path: String): String = resolver(path).toString() } class TSTypeChecker(checker: js.Dynamic) { From 9ebc9b24ee6d05514399b73d93047209e22289e6 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 9 May 2023 09:46:28 +0800 Subject: [PATCH 062/202] WIP: Add module resolver --- build.sbt | 1 + driver/js/src/main/scala/driver/Driver.scala | 3 ++ .../main/scala/ts2mls/TSModuleResolver.scala | 39 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala diff --git a/build.sbt b/build.sbt index 3a4d28c10..7aea280b1 100644 --- a/build.sbt +++ b/build.sbt @@ -108,5 +108,6 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js" ) .dependsOn(mlscript % "compile->compile;test->test") + .dependsOn(ts2mls % "compile->compile;test->test") lazy val driverJS = driver.js diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 97826037d..ab2ef0bcf 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -10,10 +10,13 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} +import ts2mls.TSModuleResolver class Driver(options: DriverOptions) { import Driver._ + private val moduleResolver = TSModuleResolver(options.path) + private val typer = new mlscript.Typer( dbg = false, diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala new file mode 100644 index 000000000..4ee252152 --- /dev/null +++ b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala @@ -0,0 +1,39 @@ +package ts2mls + +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import js.JSConverters._ + +class TSModuleResolver(workDir: String) { + import TSModuleResolver.{resolve, relative, parseName, extname} + + private val absWorkDir = resolve(workDir) + + def getAbsolutePath(path: String): String = + if (path.startsWith("./") || path.startsWith("/") || path.startsWith("../")) + resolve(path) + else + TypeScript.resolveNodeModulePath(path) + + def getRelatedPath(path: String): String = + relative(absWorkDir, resolve(path)) + + def getModuleName(filename: String): String = + parseName(filename) + + def getExtName(filename: String): String = + extname(filename) +} + +object TSModuleResolver { + private val np: js.Dynamic = g.require("path") // built-in node module + + def apply(path: String) = new TSModuleResolver(path) + + def resolve(path: String): String = np.resolve(path).toString() + + private def relative(from: String, to: String) = np.relative(from, to).toString() + private def parseName(filename: String) = np.parse(filename).name.toString() + private def extname(path: String) = np.extname(path).toString() +} From 6191b1e324d7ece70c65ecf1e4b41554a6555e8c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 9 May 2023 11:12:56 +0800 Subject: [PATCH 063/202] WIP: Refactor path related code --- driver/js/src/main/scala/driver/Driver.scala | 37 +++++++++---------- .../main/scala/ts2mls/TSModuleResolver.scala | 13 ++++--- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index ab2ef0bcf..2059b32bb 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -118,12 +118,9 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = { - val beginIndex = filename.lastIndexOf("/") - val endIndex = filename.lastIndexOf(".") - val prefixName = filename.substring(beginIndex + 1, endIndex) - val path = filename.substring(0, beginIndex + 1) - val moduleName = prefixName.substring(prefixName.lastIndexOf("/") + 1) - val relatedPath = path.substring(options.path.length) + val moduleName = moduleResolver.getModuleName(filename) + val path = TSModuleResolver.dirname(filename) + val relatedPath = moduleResolver.getRelatedPath(path) readFile(filename) match { case Some(content) => { @@ -134,7 +131,7 @@ class Driver(options: DriverOptions) { } val (cycleList, otherList) = depList.partitionMap { dep => { - val depFile = s"$path$dep" + val depFile = s"$path/$dep" if (depFile === filename) throw ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) else if (stack.contains(depFile)) L(dep) @@ -143,11 +140,11 @@ class Driver(options: DriverOptions) { val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, dep) => r match { case (sigs, recomp) => { - val filename = s"$path$dep" + val filename = s"$path/$dep" importedModule += filename - val prefixName = dep.substring(0, dep.lastIndexOf(".")) - (sigs :+ extractSig(filename, prefixName), - isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi")) + val moduleName = moduleResolver.getModuleName(dep) + (sigs :+ extractSig(filename, moduleName), + isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi")) } }) val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { @@ -158,16 +155,16 @@ class Driver(options: DriverOptions) { var newCtx: Ctx = Ctx.init val newExtrCtx: Opt[typer.ExtrCtx] = N val newVars: Map[Str, typer.SimpleType] = Map.empty - val newFilename = s"$path$dp" + val newFilename = s"$path/$dp" importedModule += newFilename compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) }) - if (options.force || needRecomp || isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$prefixName.mlsi")) { + if (options.force || needRecomp || isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi")) { System.out.println(s"compiling $filename...") - def importModule(modulePath: String): Unit = { - val filename = s"${options.outputDir}/.temp/$modulePath.mlsi" - val moduleName = modulePath.substring(modulePath.lastIndexOf("/") + 1) + def importModule(mlsiPath: String): Unit = { + val filename = s"${options.outputDir}/.temp/$mlsiPath" + val moduleName = moduleResolver.getModuleName(mlsiPath) readFile(filename) match { case Some(content) => { parse(filename, content) match { @@ -175,7 +172,7 @@ class Driver(options: DriverOptions) { val depList = imports.map { case Import(path) => path } - depList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + depList.foreach(d => importModule(moduleResolver.getMLSI(d))) val tpd = typer.typeTypingUnit(TypingUnit(declarations, Nil), topLevel = true) val sim = SimplifyPipeline(tpd, all = false) val exp = typer.expandType(sim) @@ -188,7 +185,7 @@ class Driver(options: DriverOptions) { } } - otherList.foreach(d => importModule(d.substring(0, d.lastIndexOf(".")))) + otherList.foreach(d => importModule(moduleResolver.getMLSI(d))) def generateInterface(moduleName: Option[String], tu: TypingUnit) = { val tpd = typer.typeTypingUnit(tu, topLevel = true) val sim = SimplifyPipeline(tpd, all = false)(ctx) @@ -200,8 +197,8 @@ class Driver(options: DriverOptions) { generateInterface(Some(moduleName), TypingUnit(definitions, Nil)) val interfaces = otherList.map(s => Import(s"${s}i")).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$prefixName.mlsi", interfaces) - generate(Pgrm(definitions), moduleName, imports, prefixName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) + writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$moduleName.mlsi", interfaces) + generate(Pgrm(definitions), moduleName, imports, moduleName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) true } else false diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala index 4ee252152..f907f5002 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala @@ -6,7 +6,7 @@ import js.DynamicImplicits._ import js.JSConverters._ class TSModuleResolver(workDir: String) { - import TSModuleResolver.{resolve, relative, parseName, extname} + import TSModuleResolver.{resolve, relative, basename, extname} private val absWorkDir = resolve(workDir) @@ -20,10 +20,10 @@ class TSModuleResolver(workDir: String) { relative(absWorkDir, resolve(path)) def getModuleName(filename: String): String = - parseName(filename) + basename(filename) - def getExtName(filename: String): String = - extname(filename) + def getMLSI(filename: String): String = + filename.replace(extname(filename), ".mlsi") } object TSModuleResolver { @@ -32,8 +32,11 @@ object TSModuleResolver { def apply(path: String) = new TSModuleResolver(path) def resolve(path: String): String = np.resolve(path).toString() + def dirname(filename: String) = np.dirname(filename).toString() private def relative(from: String, to: String) = np.relative(from, to).toString() - private def parseName(filename: String) = np.parse(filename).name.toString() private def extname(path: String) = np.extname(path).toString() + private def basename(filename: String) = + if (filename.contains(".d.ts")) np.basename(filename, ".d.ts").toString() + else np.basename(filename, extname(filename)).toString() } From 4ba886cf82d21d02dddda053508dc81a6cdadc21 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 9 May 2023 23:18:57 +0800 Subject: [PATCH 064/202] WIP: Refactor driver --- driver/js/src/main/scala/driver/Driver.scala | 188 +++++++++---------- 1 file changed, 92 insertions(+), 96 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 2059b32bb..567b957e6 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -55,10 +55,11 @@ class Driver(options: DriverOptions) { def genPackageJson(): Unit = if (!fs.existsSync(s"${options.outputDir}/package.json")) { val content = """{ "type": "module" }""" // TODO: more settings? - writeFile(options.outputDir, "package.json", content) + writeFile(s"${options.outputDir}/package.json", content) } - private def parse(filename: String, content: String) = { + type ParseResult = (List[Statement], List[NuDecl], List[Import], Origin) + private def parse(filename: String, content: String): ParseResult = { import fastparse._ import fastparse.Parsed.{Success, Failure} @@ -97,16 +98,29 @@ class Driver(options: DriverOptions) { case _ => s"declare $content" } + private def parseAndRun[Res](filename: String, f: (ParseResult) => Res): Res = readFile(filename) match { + case Some(content) => f(parse(filename, content)) + case _ => + throw + ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + } + private def extractSig(filename: String, moduleName: String): TypingUnit = - readFile(filename) match { - case Some(content) => - parse(filename, content) match { - case (_, declarations, _, origin) => TypingUnit( - NuTypeDef(Nms, TypeName(moduleName), Nil, Tup(Nil), N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N) :: Nil, Nil) - } - case None => - throw ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) - } + parseAndRun(filename, { + case (_, declarations, _, origin) => TypingUnit( + NuTypeDef(Nms, TypeName(moduleName), Nil, Tup(Nil), N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N) :: Nil, Nil) + }) + + private def `type`(tu: TypingUnit)( + implicit ctx: Ctx, + raise: Raise, + extrCtx: Opt[typer.ExtrCtx], + vars: Map[Str, typer.SimpleType] + ) = { + val tpd = typer.typeTypingUnit(tu, topLevel = true) + val sim = SimplifyPipeline(tpd, all = false) + typer.expandType(sim) + } private def compile( filename: String, @@ -121,108 +135,89 @@ class Driver(options: DriverOptions) { val moduleName = moduleResolver.getModuleName(filename) val path = TSModuleResolver.dirname(filename) val relatedPath = moduleResolver.getRelatedPath(path) + val mlsiFile = s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi" - readFile(filename) match { - case Some(content) => { - parse(filename, content) match { - case (definitions, _, imports, _) => { - val depList = imports.map { - case Import(path) => path - } - - val (cycleList, otherList) = depList.partitionMap { dep => { - val depFile = s"$path/$dep" - if (depFile === filename) - throw ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) - else if (stack.contains(depFile)) L(dep) - else R(dep) - } } - - val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, dep) => r match { - case (sigs, recomp) => { - val filename = s"$path/$dep" - importedModule += filename - val moduleName = moduleResolver.getModuleName(dep) - (sigs :+ extractSig(filename, moduleName), - isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi")) - } - }) - val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { - // We need to create another new context when compiling other files - // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" - // If we forget to add `import "D.mls"` in C, we need to raise an error - // Keeping using the same environment would not. - var newCtx: Ctx = Ctx.init - val newExtrCtx: Opt[typer.ExtrCtx] = N - val newVars: Map[Str, typer.SimpleType] = Map.empty - val newFilename = s"$path/$dp" - importedModule += newFilename - compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) - }) + parseAndRun(filename, { + case (definitions, _, imports, _) => { + val depList = imports.map { + case Import(path) => path + } - if (options.force || needRecomp || isInterfaceOutdate(filename, s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi")) { - System.out.println(s"compiling $filename...") - def importModule(mlsiPath: String): Unit = { - val filename = s"${options.outputDir}/.temp/$mlsiPath" - val moduleName = moduleResolver.getModuleName(mlsiPath) - readFile(filename) match { - case Some(content) => { - parse(filename, content) match { - case (_, declarations, imports, _) => { - val depList = imports.map { - case Import(path) => path - } - depList.foreach(d => importModule(moduleResolver.getMLSI(d))) - val tpd = typer.typeTypingUnit(TypingUnit(declarations, Nil), topLevel = true) - val sim = SimplifyPipeline(tpd, all = false) - val exp = typer.expandType(sim) - } - } - } - case _ => - throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + val (cycleList, otherList) = depList.partitionMap { dep => { + val depFile = s"$path/$dep" + if (depFile === filename) + throw ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) + else if (stack.contains(depFile)) L(depFile) + else R(dep) + } } + + val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, filename) => r match { + case (sigs, recomp) => { + importedModule += filename + val moduleName = moduleResolver.getModuleName(filename) + (sigs :+ extractSig(filename, moduleName), + isInterfaceOutdate(filename, mlsiFile)) + } + }) + val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { + // We need to create another new context when compiling other files + // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" + // If we forget to add `import "D.mls"` in C, we need to raise an error + // Keeping using the same environment would not. + var newCtx: Ctx = Ctx.init + val newExtrCtx: Opt[typer.ExtrCtx] = N + val newVars: Map[Str, typer.SimpleType] = Map.empty + val newFilename = s"$path/$dp" + importedModule += newFilename + compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) + }) + + if (options.force || needRecomp || isInterfaceOutdate(filename, mlsiFile)) { + System.out.println(s"compiling $filename...") + def importModule(mlsiPath: String): Unit = { + val filename = s"${options.outputDir}/.temp/$mlsiPath" + val moduleName = moduleResolver.getModuleName(mlsiPath) + parseAndRun(filename, { + case (_, declarations, imports, _) => { + val depList = imports.map { + case Import(path) => path } + depList.foreach(d => importModule(moduleResolver.getMLSI(d))) + `type`(TypingUnit(declarations, Nil)) } + }) + } - otherList.foreach(d => importModule(moduleResolver.getMLSI(d))) - def generateInterface(moduleName: Option[String], tu: TypingUnit) = { - val tpd = typer.typeTypingUnit(tu, topLevel = true) - val sim = SimplifyPipeline(tpd, all = false)(ctx) - val exp = typer.expandType(sim)(ctx) - packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) - } + otherList.foreach(d => importModule(moduleResolver.getMLSI(d))) + def generateInterface(moduleName: Option[String], tu: TypingUnit) = { + val exp = `type`(tu) + packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) + } - val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + - generateInterface(Some(moduleName), TypingUnit(definitions, Nil)) - val interfaces = otherList.map(s => Import(s"${s}i")).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + + generateInterface(Some(moduleName), TypingUnit(definitions, Nil)) + val interfaces = otherList.map(s => Import(moduleResolver.getMLSI(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - writeFile(s"${options.outputDir}/.temp/$relatedPath", s"$moduleName.mlsi", interfaces) - generate(Pgrm(definitions), moduleName, imports, moduleName, s"${options.outputDir}/$relatedPath", exported || importedModule(filename)) - true - } - else false - } + writeFile(mlsiFile, interfaces) + generate(Pgrm(definitions), s"${options.outputDir}/$relatedPath/$moduleName.js", imports, exported || importedModule(filename)) + true } + else false } - case _ => - throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) - } + }) } private def generate( program: Pgrm, - moduleName: String, - imports: Ls[Import], filename: String, - outputDir: String, + imports: Ls[Import], exported: Boolean ): Unit = try { val backend = new JSCompilerBackend() + val moduleName = moduleResolver.getModuleName(filename) val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") - writeFile(outputDir, s"$filename.js", code) + writeFile(filename, code) } catch { case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation)) } @@ -237,9 +232,10 @@ object Driver { if (!fs.existsSync(filename)) None else Some(fs.readFileSync(filename).toString) - private def writeFile(dir: String, filename: String, content: String) = { + private def writeFile(filename: String, content: String) = { + val dir = TSModuleResolver.dirname(filename) if (!fs.existsSync(dir)) fs.mkdirSync(dir, js.Dictionary("recursive" -> true)) - fs.writeFileSync(s"$dir/$filename", content) + fs.writeFileSync(filename, content) } private def getModificationTime(filename: String): String = From 785fcbe3e253a05abae374a82128f51c7632abed Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 29 May 2023 09:28:38 +0800 Subject: [PATCH 065/202] WIP: Generate new ctor --- .../main/scala/ts2mls/types/Converter.scala | 17 +- ts2mls/js/src/test/diff/Array.mlsi | 10 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 8 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 34 +- ts2mls/js/src/test/diff/Dec.mlsi | 16 +- ts2mls/js/src/test/diff/ES5.mlsi | 342 +++++++++--------- ts2mls/js/src/test/diff/Export.mlsi | 14 +- ts2mls/js/src/test/diff/Heritage.mlsi | 74 ++-- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 60 +-- ts2mls/js/src/test/diff/Intersection.mlsi | 16 +- ts2mls/js/src/test/diff/Namespace.mlsi | 22 +- ts2mls/js/src/test/diff/Optional.mlsi | 10 +- ts2mls/js/src/test/diff/Overload.mlsi | 6 +- ts2mls/js/src/test/diff/Tuple.mlsi | 4 +- ts2mls/js/src/test/diff/Type.mlsi | 28 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 14 +- ts2mls/js/src/test/diff/Variables.mlsi | 4 +- 17 files changed, 344 insertions(+), 335 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 4a6ac3950..56d16ca3c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -87,23 +87,24 @@ object Converter { case _ => "" // TODO: deal with private/protected static members }) + val ctor = + if (constructorList.isEmpty) "" + else + s"${indent} constructor(${constructorList.map(p => s"${convert(p)("")}").reduceLeft((res, p) => s"$res, $p")})\n" + val body = { // members without independent type parameters, translate them directly - val lst = allRecs.filter((s) => !s.isEmpty()) - if (lst.isEmpty) "{}" + val lst = (ctor :: allRecs).filter((s) => !s.isEmpty()) + if (lst.isEmpty) s"{}" else if (typeName === "trait ") s"{${lst.reduceLeft((bd, m) => s"$bd$m")}}" else s"{\n${lst.reduceLeft((bd, m) => s"$bd$m")}$indent}" } if (typeName === "trait ") body // anonymous interfaces else { // named interfaces and classes - val constructor = - if (constructorList.isEmpty) "()" - else s"(${constructorList.map(p => s"${convert(p)("")}").reduceLeft((res, p) => s"$res, $p")})" - val exp = if (exported) "export " else "" val inheritance = - if (parents.isEmpty) constructor - else parents.foldLeft(s"$constructor extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) + if (parents.isEmpty) "" + else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) if (typeVars.isEmpty) s"${indent}${exp}$typeName$inheritance $body" else s"${indent}${exp}$typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index f76450b0c..39530dc94 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -7,8 +7,8 @@ export declare module Array { fun getZero3(): MutArray fun first2(fs: MutArray<(number) => number>): (number) => number fun doEs(e: MutArray): MutArray - class C() {} - trait I() { + class C {} + trait I { val i: number } fun doCs(c: MutArray): MutArray @@ -17,7 +17,7 @@ export declare module Array { fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> fun translate(x: MutArray): MutArray fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> - class Temp() { + class Temp { val x: T } fun ta(ts: MutArray>): MutArray> @@ -48,8 +48,8 @@ export declare module Array { //│ ║ l.24: fun tat(ts: MutArray>): MutArray> //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.11: trait I { +//│ ║ ^^^^^^^^^ //│ ║ l.12: val i: number //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.13: } diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 58be982e1..6a630546d 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -17,12 +17,12 @@ export declare module BasicFunctions { fun create(): object fun pa(x: number): number fun wtf(x: anything): unit - class Foooooo() { + class Foooooo { val ooooooo: number } fun inn(f: Foooooo): unit fun out1(): Foooooo - trait Barrrrrrrrr() { + trait Barrrrrrrrr { val rrrrrrr: number } fun inn2(b: Barrrrrrrrr): unit @@ -44,8 +44,8 @@ export declare module BasicFunctions { //│ ║ l.29: fun out2(): Barrrrrrrrr //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: trait Barrrrrrrrr() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.25: trait Barrrrrrrrr { +//│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.26: val rrrrrrr: number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.27: } diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index adf37dc69..6db8f8149 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -3,48 +3,52 @@ :NoJS :AllowTypeErrors export declare module ClassMember { - class Student(s: string, age: number) { + class Student { + constructor(s: string, age: number) val name: string fun isFriend(other: Student): (false) | (true) fun addScore(sub: string, score: number): unit fun getID(): number } - class Foo() { + class Foo { fun bar(x: T): unit } - class EZ() { + class EZ { fun inc(x: number): number } - class Outer() { - class Inner() { + class Outer { + class Inner { val a: number } } - class TTT() { + class TTT { fun ttt(x: T): T fun ttt2(x: T): T } } +//│ ╔══[ERROR] identifier not found: constructor +//│ ║ l.7: constructor(s: string, age: number) +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member isFriend is declared but not defined -//│ ║ l.8: fun isFriend(other: Student): (false) | (true) +//│ ║ l.9: fun isFriend(other: Student): (false) | (true) //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Member addScore is declared but not defined -//│ ║ l.9: fun addScore(sub: string, score: number): unit -//│ ╙── ^^^^^^^^ +//│ ║ l.10: fun addScore(sub: string, score: number): unit +//│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Member getID is declared but not defined -//│ ║ l.10: fun getID(): number +//│ ║ l.11: fun getID(): number //│ ╙── ^^^^^ //│ ╔══[ERROR] Member bar is declared but not defined -//│ ║ l.13: fun bar(x: T): unit +//│ ║ l.14: fun bar(x: T): unit //│ ╙── ^^^ //│ ╔══[ERROR] Member inc is declared but not defined -//│ ║ l.16: fun inc(x: number): number +//│ ║ l.17: fun inc(x: number): number //│ ╙── ^^^ //│ ╔══[ERROR] Member ttt is declared but not defined -//│ ║ l.24: fun ttt(x: T): T +//│ ║ l.25: fun ttt(x: T): T //│ ╙── ^^^ //│ ╔══[ERROR] Member ttt2 is declared but not defined -//│ ║ l.25: fun ttt2(x: T): T +//│ ║ l.26: fun ttt2(x: T): T //│ ╙── ^^^^ //│ module ClassMember() { //│ class EZ() { @@ -58,7 +62,7 @@ export declare module ClassMember { //│ let a: number //│ } //│ } -//│ class Student(s: string, age: number) { +//│ class Student() { //│ fun addScore: (sub: string, score: number,) -> unit //│ fun getID: () -> number //│ fun isFriend: (other: Student,) -> bool diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index e0eac5c8e..8b0c8cd49 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -5,29 +5,33 @@ export declare module Dec { fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string - trait Get() { + trait Get { val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } - class Person(name: string, age: number) { + class Person { + constructor(name: string, age: number) fun getName(id: number): string } module OOO { } } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait Get() { -//│ ║ ^^^^^^^^^^^^^ +//│ ║ l.8: trait Get { +//│ ║ ^^^^^^^^^^^ //│ ║ l.9: val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.10: } //│ ╙── ^^^ +//│ ╔══[ERROR] identifier not found: constructor +//│ ║ l.12: constructor(name: string, age: number) +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] Member getName is declared but not defined -//│ ║ l.12: fun getName(id: number): string +//│ ║ l.13: fun getName(id: number): string //│ ╙── ^^^^^^^ //│ module Dec() { //│ trait Get() //│ module OOO() -//│ class Person(name: string, age: number) { +//│ class Person() { //│ fun getName: (id: number,) -> string //│ } //│ fun getName: (id: number | string,) -> string diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 323be3ab9..84523f5ce 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -15,12 +15,12 @@ fun encodeURI(uri: string): string fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string fun escape(string: string): string fun unescape(string: string): string -trait Symbol() { +trait Symbol { fun toString(): string fun valueOf(): Symbol } type PropertyKey = ((string) | (number)) | (Symbol) -trait PropertyDescriptor() { +trait PropertyDescriptor { val configurable: ((false) | (true)) | (undefined) val set: ((anything) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -28,10 +28,10 @@ trait PropertyDescriptor() { val writable: ((false) | (true)) | (undefined) val value: (anything) | (undefined) } -trait PropertyDescriptorMap() { +trait PropertyDescriptorMap { val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } -trait Object() { +trait Object { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) fun valueOf(): Object @@ -40,7 +40,7 @@ trait Object() { fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } -trait ObjectConstructor() { +trait ObjectConstructor { val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> fun getOwnPropertyNames(o: anything): MutArray fun isFrozen(o: anything): (false) | (true) @@ -59,47 +59,47 @@ trait ObjectConstructor() { fun isExtensible(o: anything): (false) | (true) } val Function: FunctionConstructor -trait FunctionConstructor() { +trait FunctionConstructor { val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> val prototype: Function } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -trait CallableFunction() extends Function { +trait CallableFunction extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait NewableFunction() extends Function { +trait NewableFunction extends Function { fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): unit fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait IArguments() { +trait IArguments { val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> val length: number val callee: Function } -trait String() { +trait String { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } -trait StringConstructor() { +trait StringConstructor { val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> val prototype: String fun fromCharCode(codes: MutArray): string } val Boolean: BooleanConstructor -trait BooleanConstructor() { +trait BooleanConstructor { val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> val prototype: Boolean } -trait Number() { +trait Number { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } -trait NumberConstructor() { +trait NumberConstructor { val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> val NaN: number val MIN_VALUE: number @@ -109,23 +109,23 @@ trait NumberConstructor() { val MAX_VALUE: number val prototype: Number } -trait TemplateStringsArray() extends ReadonlyArray { +trait TemplateStringsArray extends ReadonlyArray { val raw: ReadonlyArray } -trait ImportMeta() {} -trait ImportCallOptions() { +trait ImportMeta {} +trait ImportCallOptions { val assert: (ImportAssertions) | (undefined) } -trait ImportAssertions() { +trait ImportAssertions { val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } val Math: Math -trait Date() { +trait Date { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } -trait DateConstructor() { +trait DateConstructor { val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> @@ -133,7 +133,7 @@ trait DateConstructor() { fun parse(s: string): number val prototype: Date } -trait RegExp() { +trait RegExp { fun test(string: string): (false) | (true) val multiline: (false) | (true) val source: string @@ -144,49 +144,49 @@ trait RegExp() { fun exec(string: string): RegExpExecArray } val Error: ErrorConstructor -trait ErrorConstructor() { +trait ErrorConstructor { val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> val prototype: Error } val EvalError: EvalErrorConstructor -trait EvalErrorConstructor() extends ErrorConstructor { +trait EvalErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> val prototype: EvalError } val RangeError: RangeErrorConstructor -trait RangeErrorConstructor() extends ErrorConstructor { +trait RangeErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> val prototype: RangeError } val ReferenceError: ReferenceErrorConstructor -trait ReferenceErrorConstructor() extends ErrorConstructor { +trait ReferenceErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> val prototype: ReferenceError } val SyntaxError: SyntaxErrorConstructor -trait SyntaxErrorConstructor() extends ErrorConstructor { +trait SyntaxErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> val prototype: SyntaxError } val TypeError: TypeErrorConstructor -trait TypeErrorConstructor() extends ErrorConstructor { +trait TypeErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> val prototype: TypeError } val URIError: URIErrorConstructor -trait URIErrorConstructor() extends ErrorConstructor { +trait URIErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> val prototype: URIError } val JSON: JSON -trait ReadonlyArray() { +trait ReadonlyArray { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit @@ -204,20 +204,20 @@ trait ReadonlyArray() { fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number } -trait ConcatArray() { +trait ConcatArray { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } val Array: ArrayConstructor -trait ArrayConstructor() { +trait ArrayConstructor { val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) val prototype: MutArray } -trait TypedPropertyDescriptor() { +trait TypedPropertyDescriptor { val configurable: ((false) | (true)) | (undefined) val set: ((T) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -227,7 +227,7 @@ trait TypedPropertyDescriptor() { } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -trait ArrayLike() { +trait ArrayLike { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } @@ -248,36 +248,36 @@ type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5. type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -trait ThisType() {} +trait ThisType {} val ArrayBuffer: ArrayBufferConstructor -trait ArrayBufferTypes() { +trait ArrayBufferTypes { val ArrayBuffer: ArrayBuffer } type ArrayBufferLike = ArrayBuffer -trait ArrayBufferConstructor() { +trait ArrayBufferConstructor { val prototype: ArrayBuffer val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } -trait ArrayBufferView() { +trait ArrayBufferView { val buffer: ArrayBuffer val byteLength: number val byteOffset: number } val DataView: DataViewConstructor -trait DataViewConstructor() { +trait DataViewConstructor { val prototype: DataView val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } val Int8Array: Int8ArrayConstructor -trait Int8ArrayConstructor() { +trait Int8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array fun id"of"(items: MutArray): Int8Array val BYTES_PER_ELEMENT: number } -trait Uint8Array() { +trait Uint8Array { fun valueOf(): Uint8Array fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -307,7 +307,7 @@ trait Uint8Array() { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number val byteOffset: number } -trait Uint8ArrayConstructor() { +trait Uint8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array @@ -315,7 +315,7 @@ trait Uint8ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Uint8ClampedArray: Uint8ClampedArrayConstructor -trait Uint8ClampedArrayConstructor() { +trait Uint8ClampedArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray @@ -323,7 +323,7 @@ trait Uint8ClampedArrayConstructor() { val BYTES_PER_ELEMENT: number } val Int16Array: Int16ArrayConstructor -trait Int16ArrayConstructor() { +trait Int16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array @@ -331,7 +331,7 @@ trait Int16ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Uint16Array: Uint16ArrayConstructor -trait Uint16ArrayConstructor() { +trait Uint16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array @@ -339,7 +339,7 @@ trait Uint16ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Int32Array: Int32ArrayConstructor -trait Int32ArrayConstructor() { +trait Int32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array @@ -347,7 +347,7 @@ trait Int32ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Uint32Array: Uint32ArrayConstructor -trait Uint32ArrayConstructor() { +trait Uint32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array @@ -355,7 +355,7 @@ trait Uint32ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Float32Array: Float32ArrayConstructor -trait Float32ArrayConstructor() { +trait Float32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array @@ -363,7 +363,7 @@ trait Float32ArrayConstructor() { val BYTES_PER_ELEMENT: number } val Float64Array: Float64ArrayConstructor -trait Float64ArrayConstructor() { +trait Float64ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array @@ -371,7 +371,7 @@ trait Float64ArrayConstructor() { val BYTES_PER_ELEMENT: number } module Intl { - export trait CollatorOptions() { + export trait CollatorOptions { val sensitivity: (string) | (undefined) val ignorePunctuation: ((false) | (true)) | (undefined) val usage: (string) | (undefined) @@ -379,7 +379,7 @@ module Intl { val numeric: ((false) | (true)) | (undefined) val caseFirst: (string) | (undefined) } - export trait ResolvedCollatorOptions() { + export trait ResolvedCollatorOptions { val sensitivity: string val ignorePunctuation: (false) | (true) val usage: string @@ -388,11 +388,11 @@ module Intl { val caseFirst: string val collation: string } - export trait Collator() { + export trait Collator { fun compare(x: string, y: string): number fun resolvedOptions(): Intl.ResolvedCollatorOptions } - export trait NumberFormatOptions() { + export trait NumberFormatOptions { val minimumSignificantDigits: (number) | (undefined) val useGrouping: ((false) | (true)) | (undefined) val style: (string) | (undefined) @@ -404,7 +404,7 @@ module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: (number) | (undefined) } - export trait ResolvedNumberFormatOptions() { + export trait ResolvedNumberFormatOptions { val numberingSystem: string val minimumSignificantDigits: (number) | (undefined) val useGrouping: (false) | (true) @@ -416,11 +416,11 @@ module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: number } - export trait NumberFormat() { + export trait NumberFormat { fun format(value: number): string fun resolvedOptions(): Intl.ResolvedNumberFormatOptions } - export trait DateTimeFormatOptions() { + export trait DateTimeFormatOptions { val minute: ((string) | (string)) | (undefined) val year: ((string) | (string)) | (undefined) val hour: ((string) | (string)) | (undefined) @@ -435,7 +435,7 @@ module Intl { val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) val era: (((string) | (string)) | (string)) | (undefined) } - export trait ResolvedDateTimeFormatOptions() { + export trait ResolvedDateTimeFormatOptions { val numberingSystem: string val minute: (string) | (undefined) val year: (string) | (undefined) @@ -451,7 +451,7 @@ module Intl { val timeZoneName: (string) | (undefined) val era: (string) | (undefined) } - export trait DateTimeFormat() { + export trait DateTimeFormat { fun format(date: ((number) | (Date)) | (undefined)): string fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } @@ -460,8 +460,8 @@ module Intl { //│ ║ l.20: fun valueOf(): Symbol //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: trait Symbol() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.18: trait Symbol { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.19: fun toString(): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.20: fun valueOf(): Symbol @@ -478,8 +478,8 @@ module Intl { //│ ║ l.22: type PropertyKey = ((string) | (number)) | (Symbol) //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait PropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: trait PropertyDescriptor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: val set: ((anything) => unit) | (undefined) @@ -495,8 +495,8 @@ module Intl { //│ ║ l.30: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: trait PropertyDescriptorMap() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.31: trait PropertyDescriptorMap { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.32: val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.33: } @@ -514,8 +514,8 @@ module Intl { //│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: trait Object() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.34: trait Object { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) @@ -581,8 +581,8 @@ module Intl { //│ ║ l.58: fun keys(o: object): MutArray //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.43: trait ObjectConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.43: trait ObjectConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.44: val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray @@ -657,8 +657,8 @@ module Intl { //│ ║ l.61: val Function: FunctionConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.62: trait FunctionConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.62: trait FunctionConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.63: val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.64: val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> @@ -674,8 +674,8 @@ module Intl { //│ ║ l.68: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.69: trait CallableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.69: trait CallableFunction extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.71: fun call(thisArg: T, args: A): R @@ -694,8 +694,8 @@ module Intl { //│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.74: trait NewableFunction() extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.74: trait NewableFunction extends Function { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.76: fun call(thisArg: T, args: A): unit @@ -714,8 +714,8 @@ module Intl { //│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.79: trait IArguments() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.79: trait IArguments { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.80: val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.81: val length: number @@ -725,8 +725,8 @@ module Intl { //│ ║ l.83: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.374: export trait CollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.374: export trait CollatorOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.375: val sensitivity: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.376: val ignorePunctuation: ((false) | (true)) | (undefined) @@ -742,8 +742,8 @@ module Intl { //│ ║ l.381: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.382: export trait ResolvedCollatorOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.382: export trait ResolvedCollatorOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.383: val sensitivity: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.384: val ignorePunctuation: (false) | (true) @@ -764,8 +764,8 @@ module Intl { //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.391: export trait Collator() { -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.391: export trait Collator { +//│ ║ ^^^^^^^^^^^^^^^^ //│ ║ l.392: fun compare(x: string, y: string): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions @@ -779,8 +779,8 @@ module Intl { //│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: export trait NumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.395: export trait NumberFormatOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.396: val minimumSignificantDigits: (number) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.397: val useGrouping: ((false) | (true)) | (undefined) @@ -804,8 +804,8 @@ module Intl { //│ ║ l.406: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.407: export trait ResolvedNumberFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.407: export trait ResolvedNumberFormatOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.408: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.409: val minimumSignificantDigits: (number) | (undefined) @@ -832,8 +832,8 @@ module Intl { //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.419: export trait NumberFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.419: export trait NumberFormat { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.420: fun format(value: number): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions @@ -847,8 +847,8 @@ module Intl { //│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.423: export trait DateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.423: export trait DateTimeFormatOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.424: val minute: ((string) | (string)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.425: val year: ((string) | (string)) | (undefined) @@ -878,8 +878,8 @@ module Intl { //│ ║ l.437: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.438: export trait ResolvedDateTimeFormatOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.438: export trait ResolvedDateTimeFormatOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.439: val numberingSystem: string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.440: val minute: (string) | (undefined) @@ -917,8 +917,8 @@ module Intl { //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.454: export trait DateTimeFormat() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.454: export trait DateTimeFormat { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions @@ -932,8 +932,8 @@ module Intl { //│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.84: trait String() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.84: trait String { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.86: } @@ -942,8 +942,8 @@ module Intl { //│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number //│ ╙── ^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.87: trait StringConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.87: trait StringConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.88: val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.89: val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> @@ -961,8 +961,8 @@ module Intl { //│ ║ l.93: val Boolean: BooleanConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: trait BooleanConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.94: trait BooleanConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.95: val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.96: val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> @@ -972,8 +972,8 @@ module Intl { //│ ║ l.98: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.99: trait Number() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.99: trait Number { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.101: } @@ -982,8 +982,8 @@ module Intl { //│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.102: trait NumberConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.102: trait NumberConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.103: val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.104: val NaN: number @@ -1003,25 +1003,25 @@ module Intl { //│ ║ l.111: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.112: trait TemplateStringsArray() extends ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.112: trait TemplateStringsArray extends ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.113: val raw: ReadonlyArray //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.114: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.115: trait ImportMeta() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.115: trait ImportMeta {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.116: trait ImportCallOptions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.116: trait ImportCallOptions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.117: val assert: (ImportAssertions) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.118: } //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.119: trait ImportAssertions() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.119: trait ImportAssertions { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.120: val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.121: } @@ -1033,8 +1033,8 @@ module Intl { //│ ║ l.122: val Math: Math //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.123: trait Date() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.123: trait Date { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string @@ -1053,8 +1053,8 @@ module Intl { //│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.128: trait DateConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.128: trait DateConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.129: val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number @@ -1085,8 +1085,8 @@ module Intl { //│ ║ l.144: fun exec(string: string): RegExpExecArray //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.136: trait RegExp() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.136: trait RegExp { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.137: fun test(string: string): (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.138: val multiline: (false) | (true) @@ -1118,8 +1118,8 @@ module Intl { //│ ║ l.146: val Error: ErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.147: trait ErrorConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.147: trait ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.148: val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.149: val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> @@ -1132,8 +1132,8 @@ module Intl { //│ ║ l.152: val EvalError: EvalErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.153: trait EvalErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.153: trait EvalErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.154: val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.155: val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> @@ -1146,8 +1146,8 @@ module Intl { //│ ║ l.158: val RangeError: RangeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.159: trait RangeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.159: trait RangeErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.160: val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.161: val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> @@ -1160,8 +1160,8 @@ module Intl { //│ ║ l.164: val ReferenceError: ReferenceErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.165: trait ReferenceErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.165: trait ReferenceErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.166: val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.167: val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> @@ -1174,8 +1174,8 @@ module Intl { //│ ║ l.170: val SyntaxError: SyntaxErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.171: trait SyntaxErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.171: trait SyntaxErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.172: val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.173: val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> @@ -1188,8 +1188,8 @@ module Intl { //│ ║ l.176: val TypeError: TypeErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.177: trait TypeErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.177: trait TypeErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.178: val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.179: val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> @@ -1202,8 +1202,8 @@ module Intl { //│ ║ l.182: val URIError: URIErrorConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.183: trait URIErrorConstructor() extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.183: trait URIErrorConstructor extends ErrorConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.184: val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.185: val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> @@ -1240,8 +1240,8 @@ module Intl { //│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.189: trait ReadonlyArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.189: trait ReadonlyArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ @@ -1316,8 +1316,8 @@ module Intl { //│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number //│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.207: trait ConcatArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.207: trait ConcatArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.208: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.209: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> @@ -1338,8 +1338,8 @@ module Intl { //│ ║ l.213: val Array: ArrayConstructor //│ ╙── ^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.214: trait ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.214: trait ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.215: val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.216: val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> @@ -1354,8 +1354,8 @@ module Intl { //│ ║ l.217: fun isArray(arg: anything): (false) | (true) //│ ╙── ^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.220: trait TypedPropertyDescriptor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.220: trait TypedPropertyDescriptor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.221: val configurable: ((false) | (true)) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.222: val set: ((T) => unit) | (undefined) @@ -1383,8 +1383,8 @@ module Intl { //│ ║ l.229: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.230: trait ArrayLike() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.230: trait ArrayLike { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.231: val length: number //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.232: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> @@ -1440,14 +1440,14 @@ module Intl { //│ ║ l.250: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.251: trait ThisType() {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.251: trait ThisType {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type //│ ║ l.252: val ArrayBuffer: ArrayBufferConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.253: trait ArrayBufferTypes() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.253: trait ArrayBufferTypes { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.254: val ArrayBuffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.255: } @@ -1459,8 +1459,8 @@ module Intl { //│ ║ l.256: type ArrayBufferLike = ArrayBuffer //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.257: trait ArrayBufferConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.257: trait ArrayBufferConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.258: val prototype: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.259: val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> @@ -1473,8 +1473,8 @@ module Intl { //│ ║ l.260: fun isView(arg: anything): (false) | (true) //│ ╙── ^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.262: trait ArrayBufferView() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.262: trait ArrayBufferView { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.263: val buffer: ArrayBuffer //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.264: val byteLength: number @@ -1487,8 +1487,8 @@ module Intl { //│ ║ l.267: val DataView: DataViewConstructor //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.268: trait DataViewConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.268: trait DataViewConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.269: val prototype: DataView //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.270: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> @@ -1514,8 +1514,8 @@ module Intl { //│ ║ l.277: fun id"of"(items: MutArray): Int8Array //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.273: trait Int8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.273: trait Int8ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.274: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ @@ -1592,8 +1592,8 @@ module Intl { //│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.280: trait Uint8Array() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.280: trait Uint8Array { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.281: fun valueOf(): Uint8Array //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number @@ -1728,8 +1728,8 @@ module Intl { //│ ║ l.314: fun id"of"(items: MutArray): Uint8Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.310: trait Uint8ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.310: trait Uint8ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.311: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ @@ -1767,8 +1767,8 @@ module Intl { //│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray //│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.318: trait Uint8ClampedArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.318: trait Uint8ClampedArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.319: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ @@ -1806,8 +1806,8 @@ module Intl { //│ ║ l.330: fun id"of"(items: MutArray): Int16Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.326: trait Int16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.326: trait Int16ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.327: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ @@ -1845,8 +1845,8 @@ module Intl { //│ ║ l.338: fun id"of"(items: MutArray): Uint16Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.334: trait Uint16ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.334: trait Uint16ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.335: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ @@ -1884,8 +1884,8 @@ module Intl { //│ ║ l.346: fun id"of"(items: MutArray): Int32Array //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.342: trait Int32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.342: trait Int32ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.343: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ @@ -1923,8 +1923,8 @@ module Intl { //│ ║ l.354: fun id"of"(items: MutArray): Uint32Array //│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.350: trait Uint32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.350: trait Uint32ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.351: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ @@ -1962,8 +1962,8 @@ module Intl { //│ ║ l.362: fun id"of"(items: MutArray): Float32Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.358: trait Float32ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.358: trait Float32ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.359: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ @@ -2001,8 +2001,8 @@ module Intl { //│ ║ l.370: fun id"of"(items: MutArray): Float64Array //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.366: trait Float64ArrayConstructor() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.366: trait Float64ArrayConstructor { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.367: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 70d430ef7..b499f2c3b 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -6,16 +6,16 @@ import "Dependency.mlsi" export declare module Export { export module Foo { fun Baz(aa: string): IBar - trait IBar() { + trait IBar { val a: string } - export class Bar() extends IBar { + export class Bar extends IBar { val a: string } export val baz: IBar } fun default(x: anything): anything - export class E() {} + export class E {} export type F = E export type G = Dependency.B export type H = Dependency @@ -24,15 +24,15 @@ export declare module Export { //│ ║ l.8: fun Baz(aa: string): IBar //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait IBar() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.9: trait IBar { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.10: val a: string //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.11: } //│ ╙── ^^^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.12: export class Bar() extends IBar { -//│ ╙── ^^^^ +//│ ║ l.12: export class Bar extends IBar { +//│ ╙── ^^^^ //│ ╔══[ERROR] trait IBar cannot be used as a type //│ ║ l.15: export val baz: IBar //│ ╙── ^^^^ diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 362233434..24518fdf7 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -3,53 +3,53 @@ :NoJS :AllowTypeErrors export declare module Heritage { - class A() { + class A { fun foo(): unit } - class B() extends A {} - class C() { + class B extends A {} + class C { fun set(x: T): unit fun get(): T } - class D() extends C {} - trait Wu() { + class D extends C {} + trait Wu { val x: (false) | (true) } - class WuWu() extends Wu { + class WuWu extends Wu { val y: (false) | (true) } - trait WuWuWu() extends WuWu { + trait WuWuWu extends WuWu { val z: (false) | (true) } - trait Never() extends WuWuWu { + trait Never extends WuWuWu { fun w(): nothing } - class VG() { + class VG { val x: T } - class Home() extends VG { + class Home extends VG { val y: T } - trait O() { + trait O { fun xx(x: I): I } - class OR() extends O { + class OR extends O { fun xx(x: R): R } module Five { - export class ROTK() { + export class ROTK { val wu: string } - export class Y() extends Five.ROTK {} + export class Y extends Five.ROTK {} } - class Y() extends Five.ROTK {} + class Y extends Five.ROTK {} } //│ ╔══[ERROR] Member foo is declared but not defined //│ ║ l.7: fun foo(): unit //│ ╙── ^^^ //│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) -//│ ║ l.9: class B() extends A {} -//│ ╙── ^ +//│ ║ l.9: class B extends A {} +//│ ╙── ^ //│ ╔══[ERROR] Member set is declared but not defined //│ ║ l.11: fun set(x: T): unit //│ ╙── ^^^ @@ -57,28 +57,28 @@ export declare module Heritage { //│ ║ l.12: fun get(): T //│ ╙── ^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.14: class D() extends C {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.14: class D extends C {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.15: trait Wu() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.15: trait Wu { +//│ ║ ^^^^^^^^^^ //│ ║ l.16: val x: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.17: } //│ ╙── ^^^ //│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.18: class WuWu() extends Wu { -//│ ╙── ^^ +//│ ║ l.18: class WuWu extends Wu { +//│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.21: trait WuWuWu() extends WuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.21: trait WuWuWu extends WuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.22: val z: (false) | (true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.23: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.24: trait Never() extends WuWuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.24: trait Never extends WuWuWu { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: fun w(): nothing //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.26: } @@ -87,11 +87,11 @@ export declare module Heritage { //│ ║ l.25: fun w(): nothing //│ ╙── ^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.30: class Home() extends VG { -//│ ╙── ^^^^^^^^^^ +//│ ║ l.30: class Home extends VG { +//│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.33: trait O() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.33: trait O { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.34: fun xx(x: I): I //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.35: } @@ -100,17 +100,17 @@ export declare module Heritage { //│ ║ l.34: fun xx(x: I): I //│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.36: class OR() extends O { -//│ ╙── ^^^^ +//│ ║ l.36: class OR extends O { +//│ ╙── ^^^^ //│ ╔══[ERROR] Member xx is declared but not defined //│ ║ l.37: fun xx(x: R): R //│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.43: export class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.43: export class Y extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.45: class Y() extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ +//│ ║ l.45: class Y extends Five.ROTK {} +//│ ╙── ^^^^^^^^^ //│ module Heritage() { //│ class A() { //│ fun foo: () -> unit diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 15718224e..166bb80e6 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -3,46 +3,46 @@ :NoJS :AllowTypeErrors export declare module InterfaceMember { - trait IFoo() { + trait IFoo { val a: string fun b(x: number): number fun c(): (false) | (true) fun d(x: string): unit } - trait II() { + trait II { fun test(x: T): number } fun create(): {v: number,} fun get(x: {t: string,}): string - trait IEvent() { + trait IEvent { fun callback(): (number) => unit } - trait SearchFunc() { + trait SearchFunc { val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> } - trait StringArray() { + trait StringArray { val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> } - trait Counter() { + trait Counter { val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> val interval: number fun reset(): unit } - trait Simple() { + trait Simple { val a: number fun b(x: (false) | (true)): string } - trait Simple2() { + trait Simple2 { val abc: T } - trait Next() extends Simple {} - trait TTT() { + trait Next extends Simple {} + trait TTT { fun ttt(x: T): T } } //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.6: trait IFoo() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.6: trait IFoo { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.7: val a: string //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.8: fun b(x: number): number @@ -63,8 +63,8 @@ export declare module InterfaceMember { //│ ║ l.10: fun d(x: string): unit //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait II() { -//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.12: trait II { +//│ ║ ^^^^^^^^^^^^^ //│ ║ l.13: fun test(x: T): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.14: } @@ -73,8 +73,8 @@ export declare module InterfaceMember { //│ ║ l.13: fun test(x: T): number //│ ╙── ^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.17: trait IEvent() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.17: trait IEvent { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.18: fun callback(): (number) => unit //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.19: } @@ -83,22 +83,22 @@ export declare module InterfaceMember { //│ ║ l.18: fun callback(): (number) => unit //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.20: trait SearchFunc() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.20: trait SearchFunc { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.21: val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.22: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait StringArray() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.23: trait StringArray { +//│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ║ l.24: val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.25: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.26: trait Counter() { -//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.26: trait Counter { +//│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.27: val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.28: val interval: number @@ -111,8 +111,8 @@ export declare module InterfaceMember { //│ ║ l.29: fun reset(): unit //│ ╙── ^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: trait Simple() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.31: trait Simple { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.32: val a: number //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.33: fun b(x: (false) | (true)): string @@ -123,18 +123,18 @@ export declare module InterfaceMember { //│ ║ l.33: fun b(x: (false) | (true)): string //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.35: trait Simple2() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.35: trait Simple2 { +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.36: val abc: T //│ ║ ^^^^^^^^^^^^^^ //│ ║ l.37: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.38: trait Next() extends Simple {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.38: trait Next extends Simple {} +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.39: trait TTT() { -//│ ║ ^^^^^^^^^^^^^^^^ +//│ ║ l.39: trait TTT { +//│ ║ ^^^^^^^^^^^^^^ //│ ║ l.40: fun ttt(x: T): T //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.41: } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index a7cf2b9f6..cc8dad582 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -6,10 +6,10 @@ export declare module Intersection { fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit fun over(f: ((number) => string) & ((object) => string)): string - trait IA() { + trait IA { val x: number } - trait IB() { + trait IB { val y: number } fun iii(x: (IA) & (IB)): (IA) & (IB) @@ -17,8 +17,8 @@ export declare module Intersection { fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) - class A() {} - class B() {} + class A {} + class B {} fun inter(c: (A) & (B)): (A) & (B) } //│ ╔══[ERROR] type identifier not found: object @@ -49,15 +49,15 @@ export declare module Intersection { //│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait IA() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.9: trait IA { +//│ ║ ^^^^^^^^^^ //│ ║ l.10: val x: number //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.11: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait IB() { -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.12: trait IB { +//│ ║ ^^^^^^^^^^ //│ ║ l.13: val y: number //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.14: } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 1dd406960..ad56c4a0e 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -6,24 +6,24 @@ export declare module Namespace { module N1 { fun f(x: anything): number fun ff(y: anything): number - export class C() { + export class C { fun f(): unit } - trait I() { + trait I { fun f(): number } export module N2 { fun fff(x: (false) | (true)): number fun gg(c: N1.C): N1.C - class BBB() extends N1.C {} + class BBB extends N1.C {} } } module AA { fun f(x: anything): string - export class C() { + export class C { fun f(): unit } - export trait I() { + export trait I { fun f(): number } export module N2 { @@ -34,8 +34,8 @@ export declare module Namespace { //│ ║ l.10: fun f(): unit //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.12: trait I { +//│ ║ ^^^^^^^^^ //│ ║ l.13: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.14: } @@ -50,8 +50,8 @@ export declare module Namespace { //│ ║ l.17: fun gg(c: N1.C): N1.C //│ ╙── ^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.18: class BBB() extends N1.C {} -//│ ╙── ^^^^ +//│ ║ l.18: class BBB extends N1.C {} +//│ ╙── ^^^^ //│ ╔══[ERROR] Member fff is declared but not defined //│ ║ l.16: fun fff(x: (false) | (true)): number //│ ╙── ^^^ @@ -68,8 +68,8 @@ export declare module Namespace { //│ ║ l.24: fun f(): unit //│ ╙── ^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.26: export trait I() { -//│ ║ ^^^^^^^^^^^ +//│ ║ l.26: export trait I { +//│ ║ ^^^^^^^^^ //│ ║ l.27: fun f(): number //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.28: } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 764ec2496..e5ec2fbed 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -7,19 +7,19 @@ export declare module Optional { fun buildName2(firstName: string, lastName: (string) | (undefined)): string fun buildName3(firstName: string, lastName: MutArray): string fun buildName4(firstName: string, lastName: MutArray): string - trait SquareConfig() { + trait SquareConfig { val color: (string) | (undefined) val width: (number) | (undefined) } fun did(x: number, f: ((number) => number) | (undefined)): number fun getOrElse(arr: (MutArray) | (undefined)): object - class ABC() {} + class ABC {} fun testABC(abc: (ABC) | (undefined)): unit fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit fun err(msg: ((number, string, )) | (undefined)): unit fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string fun boo(x: ((T) & (U)) | (undefined)): unit - class B() { + class B { val b: T } fun boom(b: (B) | (undefined)): anything @@ -40,8 +40,8 @@ export declare module Optional { //│ ║ l.25: fun boom(b: (B) | (undefined)): anything //│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.10: trait SquareConfig() { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: trait SquareConfig { +//│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.11: val color: (string) | (undefined) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.12: val width: (number) | (undefined) diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 031e85ad6..f4788e801 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -4,14 +4,14 @@ :AllowTypeErrors export declare module Overload { fun f: ((number) => string) & ((string) => string) - class M() { + class M { val foo: ((number) => string) & ((string) => string) } fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) fun g0: ((MutArray) => string) & ((MutArray) => string) fun db: ((number) => MutArray) & ((object) => MutArray) - class N() {} + class N {} fun id: ((M) => unit) & ((N) => unit) fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) @@ -21,7 +21,7 @@ export declare module Overload { module XX { fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } - class WWW() { + class WWW { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 1b82d506d..bc82326c7 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -14,10 +14,10 @@ export declare module Tuple { fun ex(x: T, y: U): (T, U, (T) & (U), ) fun foo(x: ((T) & (U), )): unit fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) - class A() { + class A { val x: number } - class B() {} + class B {} fun swap(x: (A, B, )): (B, A, ) } //│ ╔══[ERROR] type identifier not found: A diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 1fe94ea1d..a4034a933 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -3,29 +3,29 @@ :NoJS :AllowTypeErrors export declare module Type { - trait None() { + trait None { val _tag: "None" } - trait Some() { + trait Some { val _tag: "Some" val value: A } type Option = (None) | (Some) type Func = (number) => number type S2 = (string, string, ) - trait I1() {} - trait I2() {} + trait I1 {} + trait I2 {} type I3 = (I1) & (I2) type StringArray = Array type SomeInterface = {x: number,y: number,} - class ABC() {} + class ABC {} type DEF = ABC type TP = (A, B, C, ) module NA { fun fb(b: string): unit export type B = string } - class NC() { + class NC { val b: string } type G = ABC @@ -39,15 +39,15 @@ export declare module Type { //│ ║ l.33: fun some(a: A): (None) | (Some) //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.6: trait None() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.6: trait None { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.7: val _tag: "None" //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.8: } //│ ╙── ^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait Some() { -//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.9: trait Some { +//│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.10: val _tag: "Some" //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ║ l.11: val value: A @@ -61,11 +61,11 @@ export declare module Type { //│ ║ l.13: type Option = (None) | (Some) //│ ╙── ^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: trait I1() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.16: trait I1 {} +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.17: trait I2() {} -//│ ╙── ^^^^^^^^^^^^^ +//│ ║ l.17: trait I2 {} +//│ ╙── ^^^^^^^^^^^ //│ ╔══[ERROR] trait I1 cannot be used as a type //│ ║ l.18: type I3 = (I1) & (I2) //│ ╙── ^^^^ diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 3b14cb5f9..8744abc12 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -4,26 +4,26 @@ :AllowTypeErrors export declare module TypeParameter { fun inc(x: T): number - class CC() { + class CC { fun print(s: T): unit } fun con(t: T): U - class Printer() { + class Printer { fun print(t: T): unit } fun setStringPrinter(p: Printer): unit fun getStringPrinter(): Printer fun foo(p: Printer, x: T): T fun foo2(p: Printer, x: T): T - class F() { + class F { val x: T fun GG(y: U): T } - trait I() { + trait I { val x: T fun GG(y: U): T } - class FFF() { + class FFF { fun fff(x: T): unit } fun fff(p: FFF, s: string): unit @@ -57,8 +57,8 @@ export declare module TypeParameter { //│ ║ l.20: fun GG(y: U): T //│ ╙── ^^ //│ ╔══[ERROR] traits are not yet supported -//│ ║ l.22: trait I() { -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.22: trait I { +//│ ║ ^^^^^^^^^^^^ //│ ║ l.23: val x: T //│ ║ ^^^^^^^^^^^^ //│ ║ l.24: fun GG(y: U): T diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index f0bdc3cec..8e5ab270a 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -7,10 +7,10 @@ export declare module Variables { val URI2: string val foo: number val bar: false - class FooBar() {} + class FooBar {} val fb: FooBar module ABC { - export class DEF() {} + export class DEF {} } val d: ABC.DEF module DD { From daf7c35aa8ee16000a5ce8d072533ea08d8270ac Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 29 May 2023 12:56:45 +0800 Subject: [PATCH 066/202] WIP: Refactor path management --- driver/js/src/main/scala/driver/Driver.scala | 64 +++++++++---------- .../js/src/main/scala/driver/FileInfo.scala | 44 +++++++++++++ driver/js/src/test/js/.temp/B.mlsi | 2 +- driver/js/src/test/js/.temp/C.mlsi | 2 +- driver/js/src/test/js/.temp/Cycle2.mlsi | 2 +- driver/js/src/test/js/.temp/Opened.mlsi | 2 +- driver/js/src/test/js/.temp/Simple.mlsi | 2 +- driver/js/src/test/mlscript/B.mls | 2 +- driver/js/src/test/mlscript/C.mls | 2 +- driver/js/src/test/mlscript/Cycle1.mls | 2 +- driver/js/src/test/mlscript/Cycle2.mls | 2 +- driver/js/src/test/mlscript/Opened.mls | 2 +- driver/js/src/test/mlscript/Self.mls | 2 +- driver/js/src/test/mlscript/Simple.mls | 2 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 2 +- .../main/scala/ts2mls/TSModuleResolver.scala | 36 +++-------- 17 files changed, 97 insertions(+), 75 deletions(-) create mode 100644 driver/js/src/main/scala/driver/FileInfo.scala diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 567b957e6..a1f180a29 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -15,8 +15,6 @@ import ts2mls.TSModuleResolver class Driver(options: DriverOptions) { import Driver._ - private val moduleResolver = TSModuleResolver(options.path) - private val typer = new mlscript.Typer( dbg = false, @@ -35,6 +33,8 @@ class Driver(options: DriverOptions) { private val importedModule = MutSet[String]() + import TSModuleResolver.normalize + // Return true if success def execute: Boolean = try { @@ -43,7 +43,7 @@ class Driver(options: DriverOptions) { implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() - compile(options.filename, false) + compile(FileInfo(options.path, options.filename), false) Driver.totalErrors == 0 } catch { @@ -123,7 +123,7 @@ class Driver(options: DriverOptions) { } private def compile( - filename: String, + file: FileInfo, exported: Boolean )( implicit ctx: Ctx, @@ -132,31 +132,26 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = { - val moduleName = moduleResolver.getModuleName(filename) - val path = TSModuleResolver.dirname(filename) - val relatedPath = moduleResolver.getRelatedPath(path) - val mlsiFile = s"${options.outputDir}/.temp/$relatedPath/$moduleName.mlsi" - - parseAndRun(filename, { + val mlsiFile = normalize(s"${options.outputDir}/${file.interfaceFilename}") + parseAndRun(file.filename, { case (definitions, _, imports, _) => { val depList = imports.map { case Import(path) => path } val (cycleList, otherList) = depList.partitionMap { dep => { - val depFile = s"$path/$dep" - if (depFile === filename) - throw ErrorReport(Ls((s"can not import $filename itself", None)), Diagnostic.Compilation) - else if (stack.contains(depFile)) L(depFile) + val depFile = file.`import`(dep) + if (depFile.filename === file.filename) + throw ErrorReport(Ls((s"can not import ${file.filename} itself", None)), Diagnostic.Compilation) + else if (stack.contains(depFile.filename)) L(depFile) else R(dep) } } - val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, filename) => r match { + val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, file) => r match { case (sigs, recomp) => { - importedModule += filename - val moduleName = moduleResolver.getModuleName(filename) - (sigs :+ extractSig(filename, moduleName), - isInterfaceOutdate(filename, mlsiFile)) + importedModule += file.filename + (sigs :+ extractSig(file.filename, file.moduleName), + isInterfaceOutdate(file.filename, s"${options.outputDir}/${file.interfaceFilename}")) } }) val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { @@ -167,39 +162,42 @@ class Driver(options: DriverOptions) { var newCtx: Ctx = Ctx.init val newExtrCtx: Opt[typer.ExtrCtx] = N val newVars: Map[Str, typer.SimpleType] = Map.empty - val newFilename = s"$path/$dp" - importedModule += newFilename - compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ filename) + val newFilename = file.`import`(dp) + importedModule += newFilename.filename + compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ file.filename) }) - if (options.force || needRecomp || isInterfaceOutdate(filename, mlsiFile)) { - System.out.println(s"compiling $filename...") - def importModule(mlsiPath: String): Unit = { - val filename = s"${options.outputDir}/.temp/$mlsiPath" - val moduleName = moduleResolver.getModuleName(mlsiPath) + if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { + System.out.println(s"compiling ${file.filename}...") + def importModule(file: FileInfo): Unit = { + val filename = s"${options.outputDir}/${file.interfaceFilename}" parseAndRun(filename, { case (_, declarations, imports, _) => { val depList = imports.map { case Import(path) => path } - depList.foreach(d => importModule(moduleResolver.getMLSI(d))) + depList.foreach(d => importModule(file.`import`(d))) `type`(TypingUnit(declarations, Nil)) } }) } - otherList.foreach(d => importModule(moduleResolver.getMLSI(d))) + otherList.foreach(d => importModule(file.`import`(d))) def generateInterface(moduleName: Option[String], tu: TypingUnit) = { val exp = `type`(tu) packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) } val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + - generateInterface(Some(moduleName), TypingUnit(definitions, Nil)) - val interfaces = otherList.map(s => Import(moduleResolver.getMLSI(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + generateInterface(Some(file.moduleName), TypingUnit(definitions, Nil)) + val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") writeFile(mlsiFile, interfaces) - generate(Pgrm(definitions), s"${options.outputDir}/$relatedPath/$moduleName.js", imports, exported || importedModule(filename)) + file.jsFilename match { + case Some(filename) => + generate(Pgrm(definitions), s"${options.outputDir}/$filename", file.moduleName, imports, exported || importedModule(file.filename)) + case _ => () + } true } else false @@ -210,11 +208,11 @@ class Driver(options: DriverOptions) { private def generate( program: Pgrm, filename: String, + moduleName: String, imports: Ls[Import], exported: Boolean ): Unit = try { val backend = new JSCompilerBackend() - val moduleName = moduleResolver.getModuleName(filename) val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") writeFile(filename, code) diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala new file mode 100644 index 000000000..c01c33096 --- /dev/null +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -0,0 +1,44 @@ +package driver + +import ts2mls.{TSModuleResolver, TypeScript} + +final case class FileInfo( + workDir: String, // work directory (related to compiler path) + localFilename: String // filename (related to work dir, or in node_modules) +) { + import TSModuleResolver.{normalize, isLocal, dirname, basename} + + val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) + if (TSModuleResolver.isLocal(localFilename)) Some(normalize(dirname(localFilename))) + else None + + // module name in ts/mls + val moduleName = basename(localFilename) + + // full filename (related to compiler path, or in node_modules) + lazy val filename: String = + if (relatedPath.isDefined) normalize(s"./$workDir/$localFilename") + else TypeScript.resolveNodeModulePath(localFilename) + + val interfaceFilename: String = // interface filename (related to output directory) + relatedPath.fold(s".temp/node_modules/$localFilename")(path => s".temp/${normalize(s"$path/$moduleName.mlsi")}") + + val jsFilename: Option[String] = + relatedPath.fold[Option[String]](None)(path => Some(normalize(s"$path/$moduleName.js"))) + + val importPath: String = + relatedPath.fold(s"$moduleName.mlsi")(path => s"./${normalize(s"$path/$moduleName.mlsi")}") + + def `import`(path: String): FileInfo = + if (isLocal(path)) + relatedPath match { + case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}") + case _ => ??? // TODO: + } + else FileInfo(workDir, path) +} + +object FileInfo { + def importPath(filename: String): String = + filename.replace(TSModuleResolver.extname(filename), ".mlsi") +} diff --git a/driver/js/src/test/js/.temp/B.mlsi b/driver/js/src/test/js/.temp/B.mlsi index 95464dfee..483b49f9e 100644 --- a/driver/js/src/test/js/.temp/B.mlsi +++ b/driver/js/src/test/js/.temp/B.mlsi @@ -1,4 +1,4 @@ -import "A.mlsi" +import "./A.mlsi" declare module B() { fun foo: error } diff --git a/driver/js/src/test/js/.temp/C.mlsi b/driver/js/src/test/js/.temp/C.mlsi index 5adae64d9..8d8ba6285 100644 --- a/driver/js/src/test/js/.temp/C.mlsi +++ b/driver/js/src/test/js/.temp/C.mlsi @@ -1,4 +1,4 @@ -import "B.mlsi" +import "./B.mlsi" declare module C() { let a: error let b: error diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/js/.temp/Cycle2.mlsi index 4fc2562d7..137bee6c7 100644 --- a/driver/js/src/test/js/.temp/Cycle2.mlsi +++ b/driver/js/src/test/js/.temp/Cycle2.mlsi @@ -1,4 +1,4 @@ -import "Cycle1.mlsi" +import "./Cycle1.mlsi" declare module Cycle2() { fun g: (x: int,) -> int unit diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/js/.temp/Opened.mlsi index eb0b9848e..09dc2c629 100644 --- a/driver/js/src/test/js/.temp/Opened.mlsi +++ b/driver/js/src/test/js/.temp/Opened.mlsi @@ -1,4 +1,4 @@ -import "tools/Inc.mlsi" +import "./tools/Inc.mlsi" declare module Opened() { fun hello: (x: int,) -> unit unit diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/js/.temp/Simple.mlsi index b92276be3..1a4bf1986 100644 --- a/driver/js/src/test/js/.temp/Simple.mlsi +++ b/driver/js/src/test/js/.temp/Simple.mlsi @@ -1,4 +1,4 @@ -import "Opened.mlsi" +import "./Opened.mlsi" declare module Simple() { mixin B() { this: {n: 'n} diff --git a/driver/js/src/test/mlscript/B.mls b/driver/js/src/test/mlscript/B.mls index 4dd737d60..b43d7fb0b 100644 --- a/driver/js/src/test/mlscript/B.mls +++ b/driver/js/src/test/mlscript/B.mls @@ -1,4 +1,4 @@ -import "A.mls" +import "./A.mls" // FIXME: access to class member not yet supported fun foo = A.Foo(12) diff --git a/driver/js/src/test/mlscript/C.mls b/driver/js/src/test/mlscript/C.mls index 5a9b7a882..2cdb50f85 100644 --- a/driver/js/src/test/mlscript/C.mls +++ b/driver/js/src/test/mlscript/C.mls @@ -1,4 +1,4 @@ -import "B.mls" +import "./B.mls" let a = B.foo let b = A.Foo(0) // not allowed, unless we import "A.mls" diff --git a/driver/js/src/test/mlscript/Cycle1.mls b/driver/js/src/test/mlscript/Cycle1.mls index 9efcfa8f7..6e8956d5f 100644 --- a/driver/js/src/test/mlscript/Cycle1.mls +++ b/driver/js/src/test/mlscript/Cycle1.mls @@ -1,4 +1,4 @@ -import "Cycle2.mls" +import "./Cycle2.mls" fun f(x: int): int = if x is 0 then 114 diff --git a/driver/js/src/test/mlscript/Cycle2.mls b/driver/js/src/test/mlscript/Cycle2.mls index a757dc943..7b8f24cf5 100644 --- a/driver/js/src/test/mlscript/Cycle2.mls +++ b/driver/js/src/test/mlscript/Cycle2.mls @@ -1,4 +1,4 @@ -import "Cycle1.mls" +import "./Cycle1.mls" fun g(x: int): int fun g(x: int): int = Cycle1.f(x) diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/mlscript/Opened.mls index 9a8c8e43d..33570eb68 100644 --- a/driver/js/src/test/mlscript/Opened.mls +++ b/driver/js/src/test/mlscript/Opened.mls @@ -1,4 +1,4 @@ -import "tools/Inc.mls" +import "./tools/Inc.mls" fun hello(x: int) = log(("hello!", Inc.inc(x))) diff --git a/driver/js/src/test/mlscript/Self.mls b/driver/js/src/test/mlscript/Self.mls index 4887945a8..3eeb9c61a 100644 --- a/driver/js/src/test/mlscript/Self.mls +++ b/driver/js/src/test/mlscript/Self.mls @@ -1,3 +1,3 @@ -import "Self.mls" +import "./Self.mls" class Foo() {} diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/mlscript/Simple.mls index 7f3819ff0..65b9c2b28 100644 --- a/driver/js/src/test/mlscript/Simple.mls +++ b/driver/js/src/test/mlscript/Simple.mls @@ -1,4 +1,4 @@ -import "Opened.mls" +import "./Opened.mls" mixin B { fun foo = this.n } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 81bb1832b..76822b186 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -46,7 +46,7 @@ object DriverDiffTests { private def entry(entryModule: String, expectError: Boolean = false) = TestOption( - s"${mlscriptPath}${entryModule}.mls", + s"./${entryModule}.mls", s"${jsPath}${entryModule}.js", s"${outputPath}${entryModule}.check", expectError diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 7f6f8b264..667039cd9 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1046,7 +1046,7 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { case Import(path) => JSImport( path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")), - "./" + path.substring(0, path.lastIndexOf(".")) + ".js" + path.substring(0, path.lastIndexOf(".")) + ".js" // TODO: node_modules ) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala index f907f5002..c321ae9cb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala @@ -5,38 +5,18 @@ import js.Dynamic.{global => g} import js.DynamicImplicits._ import js.JSConverters._ -class TSModuleResolver(workDir: String) { - import TSModuleResolver.{resolve, relative, basename, extname} - - private val absWorkDir = resolve(workDir) - - def getAbsolutePath(path: String): String = - if (path.startsWith("./") || path.startsWith("/") || path.startsWith("../")) - resolve(path) - else - TypeScript.resolveNodeModulePath(path) - - def getRelatedPath(path: String): String = - relative(absWorkDir, resolve(path)) - - def getModuleName(filename: String): String = - basename(filename) - - def getMLSI(filename: String): String = - filename.replace(extname(filename), ".mlsi") -} - object TSModuleResolver { private val np: js.Dynamic = g.require("path") // built-in node module - def apply(path: String) = new TSModuleResolver(path) - def resolve(path: String): String = np.resolve(path).toString() - def dirname(filename: String) = np.dirname(filename).toString() - - private def relative(from: String, to: String) = np.relative(from, to).toString() - private def extname(path: String) = np.extname(path).toString() - private def basename(filename: String) = + def dirname(filename: String): String = np.dirname(filename).toString() + def isLocal(path: String): Boolean = + path.startsWith("./") || path.startsWith("/") || path.startsWith("../") + def normalize(path: String): String = np.normalize(path).toString() + + def relative(from: String, to: String) = np.relative(from, to).toString() + def extname(path: String) = np.extname(path).toString() + def basename(filename: String) = if (filename.contains(".d.ts")) np.basename(filename, ".d.ts").toString() else np.basename(filename, extname(filename)).toString() } From d73058cfe0d883bc7ea7bbbaf69850eac43cf6ee Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 29 May 2023 14:52:20 +0800 Subject: [PATCH 067/202] WIP: Generate imported files in ts2mls --- .../js/src/main/scala/ts2mls/TSProgram.scala | 24 ++++++++----- ts2mls/js/src/test/diff/Dependency.mlsi | 34 +++++++++++++++++++ 2 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Dependency.mlsi diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 433a35ab9..d58b5b3b0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -17,26 +17,34 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { implicit val checker = TSTypeChecker(program.getTypeChecker()) - // TODO: support multi-files correctly. - private val globalNamespace = TSNamespace() - private val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) - private val importList = entryFile.getImportList + def generate(workDir: String, targetPath: String): Unit = generate(filename, workDir, targetPath) + + def generate(filename: String, workDir: String, targetPath: String): Unit = { + val globalNamespace = TSNamespace() + val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) + val importList = entryFile.getImportList - def generate(workDir: String, targetPath: String): Unit = { val moduleName = TSImport.getModuleName(filename) val relatedPath = if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) else throw new AssertionError(s"wrong work dir $workDir") var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") - generate(writer) + generate(writer, importList, globalNamespace, moduleName) writer.close() + + importList.foreach(imp => { + val newFilename = // TODO: node_modules + if (!imp.endsWith(".ts")) s"$imp.ts" + else imp + generate(newFilename, TSModuleResolver.resolve(workDir), targetPath) + }) } - private def generate(writer: JSWriter): Unit = + private def generate(writer: JSWriter, importList: List[String], globalNamespace: TSNamespace, moduleName: String): Unit = if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { importList.foreach{f => writer.writeln(s"""import "${TSImport.getModuleName(f)}.mlsi"""")} - writer.writeln(s"export declare module ${TSImport.getModuleName(filename)} {") + writer.writeln(s"export declare module $moduleName {") globalNamespace.generate(writer, " ") writer.writeln("}") } diff --git a/ts2mls/js/src/test/diff/Dependency.mlsi b/ts2mls/js/src/test/diff/Dependency.mlsi new file mode 100644 index 000000000..ecae987cd --- /dev/null +++ b/ts2mls/js/src/test/diff/Dependency.mlsi @@ -0,0 +1,34 @@ +:NewParser +:NewDefs +:NoJS +:AllowTypeErrors +export declare module Dependency { + export class A { + val a: number + } + export class B { + val b: number + } + export class C { + val c: number + } + export class D { + val d: number + } + fun default(): number +} +//│ module Dependency() { +//│ class A() { +//│ let a: number +//│ } +//│ class B() { +//│ let b: number +//│ } +//│ class C() { +//│ let c: number +//│ } +//│ class D() { +//│ let d: number +//│ } +//│ fun default: () -> number +//│ } From d8b155a5d850d7e235d5d895021d922937bb6291 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 29 May 2023 16:07:32 +0800 Subject: [PATCH 068/202] WIP: Handle cycle dependencies in ts2mls --- .../js/src/main/scala/ts2mls/TSModules.scala | 58 +++++++++++-------- .../js/src/main/scala/ts2mls/TSProgram.scala | 54 ++++++++++++----- .../src/main/scala/ts2mls/TSSourceFile.scala | 11 ++-- ts2mls/js/src/test/diff/Cycle1.mlsi | 23 ++++++++ ts2mls/js/src/test/diff/Cycle2.mlsi | 23 ++++++++ ts2mls/js/src/test/diff/Export.mlsi | 2 +- ts2mls/js/src/test/diff/Import.mlsi | 2 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 1 + ts2mls/js/src/test/typescript/Cycle1.ts | 4 ++ ts2mls/js/src/test/typescript/Cycle2.ts | 4 ++ 10 files changed, 137 insertions(+), 45 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Cycle1.mlsi create mode 100644 ts2mls/js/src/test/diff/Cycle2.mlsi create mode 100644 ts2mls/js/src/test/typescript/Cycle1.ts create mode 100644 ts2mls/js/src/test/typescript/Cycle2.ts diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index f86db8858..e06fab1ce 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -2,70 +2,82 @@ package ts2mls import scala.collection.mutable.HashMap import mlscript.utils._ -import ts2mls.types.{TSTypeAlias, TSReferenceType} +import ts2mls.types.{TSTypeAlias, TSReferenceType, Converter} trait TSImport { self => + val filename: String + val `import`: String + def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(filename, _) => Some(s"${TSImport.getModuleName(filename)}.$name") - case TSSingleImport(filename, items) => + case TSFullImport(filename, _, _) => Some(s"${TSImport.getModuleName(filename, false)}.$name") + case TSSingleImport(filename, _, items) => items.collect { case (originalName, _) if (originalName === name) => - s"${TSImport.getModuleName(filename)}.$name" + s"${TSImport.getModuleName(filename, false)}.$name" }.headOption } def createAlias: List[TSTypeAlias] = self match { - case TSFullImport(filename, alias) => - TSTypeAlias(alias, TSReferenceType(TSImport.getModuleName(filename)), Nil) :: Nil - case TSSingleImport(filename, items) => + case TSFullImport(filename, _, alias) => + TSTypeAlias(alias, TSReferenceType(TSImport.getModuleName(filename, false)), Nil) :: Nil + case TSSingleImport(filename, _, items) => items.map{ case (name, alias) => - TSTypeAlias(alias.getOrElse(name), TSReferenceType(s"${TSImport.getModuleName(filename)}.$name"), Nil) + TSTypeAlias(alias.getOrElse(name), TSReferenceType(s"${TSImport.getModuleName(filename, false)}.$name"), Nil) } } + + def generate(ns: TSNamespace, writer: JSWriter): Unit = self match { + case _: TSFullImport => ns.generate(writer, " ") + case TSSingleImport(_, _, items) => items.foreach((pair) => pair match { + case (name, _) => writer.writeln(Converter.convert(ns.get(name), true)(" ")) + }) + } } object TSImport { - def getModuleName(filename: String): String = + def getModuleName(filename: String, requirePrefix: Boolean): String = if (filename.endsWith(".d") || filename.endsWith(".ts")) - getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.'))) - else + getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.')), requirePrefix) + else if (!requirePrefix) filename.substring(filename.lastIndexOf('/') + 1) + else filename } -// import * as alias from "filename" -case class TSFullImport(filename: String, alias: String) extends TSImport -// import { s1, s2 as a } from "filename" -// export { s1, s2 as a } from "filename" -case class TSSingleImport(filename: String, items: List[(String, Option[String])]) extends TSImport +// import * as alias from "`import`"; // filename is absolute +case class TSFullImport(filename: String, `import`: String, alias: String) extends TSImport +// import { s1, s2 as a } from "`import`"; // filename is absolute +// export { s1, s2 as a } from "`import`"; // filename is absolute +case class TSSingleImport(filename: String, `import`: String, items: List[(String, Option[String])]) extends TSImport class TSImportList { private val singleList = new HashMap[String, TSSingleImport]() private val fullList = new HashMap[String, TSFullImport]() def +=(imp: TSImport): Unit = imp match { - case imp @ TSFullImport(filename, _) => fullList.addOne((filename, imp)) - case imp @ TSSingleImport(filename, items) => + case imp @ TSFullImport(filename, _, _) => fullList.addOne((filename, imp)) + case imp @ TSSingleImport(filename, impName, items) => if (singleList.contains(filename)) - singleList.update(filename, TSSingleImport(filename, singleList(filename).items ::: items)) + singleList.update(filename, TSSingleImport(filename, impName, singleList(filename).items ::: items)) else singleList.addOne((filename, imp)) } def resolveTypeAlias(modulePath: String, name: String): String = { + val absPath = TSModuleResolver.resolve(modulePath) val singleAlias = - if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) + if (singleList.contains(absPath)) singleList(absPath).resolveTypeAlias(name) else None singleAlias match { case Some(alias) => alias case None => val fullAlias = - if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) + if (fullList.contains(absPath)) fullList(absPath).resolveTypeAlias(name) else None fullAlias.getOrElse(throw new AssertionError(s"unresolved imported name $name at $modulePath.")) } } - def getFilelist: List[String] = - (singleList.keys.toList ::: fullList.keys.toList).distinct + def getFilelist: List[TSImport] = + (singleList.values.toList ::: fullList.values.toList) } object TSImportList { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index d58b5b3b0..340fadcb0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -3,6 +3,7 @@ package ts2mls import scala.scalajs.js import js.DynamicImplicits._ import ts2mls.types._ +import scala.collection.mutable.{HashSet, HashMap} // for general ts, we still consider that there is a top-level module // and in mls we will import ts file like this: @@ -11,39 +12,62 @@ import ts2mls.types._ // and it will be imported without top-level module before we compile other files class TSProgram(filename: String, uesTopLevelModule: Boolean) { private val program = TypeScript.createProgram(Seq(filename)) + private val cache = new HashMap[String, TSNamespace]() // check if file exists if (!program.fileExists(filename)) throw new Exception(s"file ${filename} doesn't exist.") implicit val checker = TSTypeChecker(program.getTypeChecker()) - def generate(workDir: String, targetPath: String): Unit = generate(filename, workDir, targetPath) + def generate(workDir: String, targetPath: String): Unit = generate(filename, workDir, targetPath)(List()) - def generate(filename: String, workDir: String, targetPath: String): Unit = { + def generate(filename: String, workDir: String, targetPath: String)(implicit stack: List[String]): Unit = { val globalNamespace = TSNamespace() - val entryFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) - val importList = entryFile.getImportList + val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) + val importList = sourceFile.getImportList + val absName = TSModuleResolver.resolve(filename) + cache.addOne(absName, globalNamespace) - val moduleName = TSImport.getModuleName(filename) + val moduleName = TSImport.getModuleName(filename, false) val relatedPath = if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) else throw new AssertionError(s"wrong work dir $workDir") - var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") - generate(writer, importList, globalNamespace, moduleName) - writer.close() - importList.foreach(imp => { - val newFilename = // TODO: node_modules - if (!imp.endsWith(".ts")) s"$imp.ts" - else imp - generate(newFilename, TSModuleResolver.resolve(workDir), targetPath) + def toTSFile(imp: TSImport) = // TODO: node_modules + if (!imp.filename.endsWith(".ts")) s"${imp.filename}.ts" + else imp.filename + val (cycleList, otherList) = importList.partition(imp => stack.contains(toTSFile(imp))) + + otherList.foreach(imp => { + val newFilename = toTSFile(imp) + generate(newFilename, TSModuleResolver.resolve(workDir), targetPath)(absName :: stack) + }) + + var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") + val imported = new HashSet[String]() + + otherList.foreach(imp => { + val name = TSImport.getModuleName(imp.`import`, true) + if (!imported(name)) { + imported += name + writer.writeln(s"""import "$name.mlsi"""") + } }) + cycleList.foreach(imp => { + val newFilename = toTSFile(imp) + writer.writeln(s"export declare module ${TSImport.getModuleName(imp.`import`, false)} {") + cache(newFilename).generate(writer, " ") + writer.writeln("}") + }) + + generate(writer, otherList, globalNamespace, moduleName) + + writer.close() } - private def generate(writer: JSWriter, importList: List[String], globalNamespace: TSNamespace, moduleName: String): Unit = + private def generate(writer: JSWriter, importList: List[TSImport], globalNamespace: TSNamespace, moduleName: String): Unit = if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { - importList.foreach{f => writer.writeln(s"""import "${TSImport.getModuleName(f)}.mlsi"""")} writer.writeln(s"export declare module $moduleName {") globalNamespace.generate(writer, " ") writer.writeln("}") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 5a6246dae..9267c7b1b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -43,7 +43,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) - def getImportList: List[String] = importList.getFilelist + def getImportList: List[TSImport] = importList.getFilelist private def parseExportDeclaration(elements: TSNodeArray): Unit = { def getReferedType(name: String): TSType = global.get(name) match { @@ -67,9 +67,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // ignore `import "filename.ts"` if (!clause.isUndefined) { val bindings = clause.namedBindings + val importName = moduleSpecifier.text val absPath = - if (moduleSpecifier.text.startsWith("./")) - rootPath + moduleSpecifier.text.substring(2) + if (TSModuleResolver.isLocal(moduleSpecifier.text)) + TSModuleResolver.resolve(rootPath + importName) else moduleSpecifier.text // TODO: node_module? def run(node: TSNodeObject): Unit = if (!node.elements.isUndefined) { @@ -79,14 +80,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) - val imp = TSSingleImport(absPath, list) + val imp = TSSingleImport(absPath, importName, list) if (exported) imp.createAlias.foreach { // FIXME: functions and variables? case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) } importList += imp } else if (!node.name.isUndefined) { - val imp = TSFullImport(absPath, node.name.escapedText) + val imp = TSFullImport(absPath, importName, node.name.escapedText) if (exported) imp.createAlias.foreach { // FIXME: functions and variables? case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) } diff --git a/ts2mls/js/src/test/diff/Cycle1.mlsi b/ts2mls/js/src/test/diff/Cycle1.mlsi new file mode 100644 index 000000000..3fd5e7a8e --- /dev/null +++ b/ts2mls/js/src/test/diff/Cycle1.mlsi @@ -0,0 +1,23 @@ +:NewParser +:NewDefs +:NoJS +:AllowTypeErrors +import "./Cycle2.mlsi" +export declare module Cycle1 { + export class A {} + val b: Cycle2.B +} +//│ ╔══[ERROR] type identifier not found: Cycle2 +//│ ║ l.8: val b: Cycle2.B +//│ ╙── ^^^^^^ +//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. +//│ at: mlscript.utils.package$.lastWords(package.scala:205) +//│ at: mlscript.utils.package$.die(package.scala:204) +//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) +//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) +//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) +//│ at: mlscript.Typer.go$1(Typer.scala:490) +//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) +//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) +//│ at: mlscript.Typer.rec$1(Typer.scala:547) +//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi new file mode 100644 index 000000000..6b7ccf271 --- /dev/null +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -0,0 +1,23 @@ +:NewParser +:NewDefs +:NoJS +:AllowTypeErrors +export declare module Cycle1 { + export class A {} + val b: Cycle2.B +} +export declare module Cycle2 { + export class B {} + val a: Cycle1.A +} +//│ ╔══[ERROR] Module `Cycle1` is not supported yet. +//│ ║ l.11: val a: Cycle1.A +//│ ╙── ^^ +//│ module Cycle1() { +//│ class A() +//│ let b: B +//│ } +//│ module Cycle2() { +//│ class B() +//│ let a: error +//│ } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index b499f2c3b..38aa0113c 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -2,7 +2,7 @@ :NewDefs :NoJS :AllowTypeErrors -import "Dependency.mlsi" +import "./Dependency.mlsi" export declare module Export { export module Foo { fun Baz(aa: string): IBar diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index a7923c0c0..2358c9eda 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -2,7 +2,7 @@ :NewDefs :NoJS :AllowTypeErrors -import "Dependency.mlsi" +import "./Dependency.mlsi" export declare module Import { val t: number val a: Dependency.A diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index fd852f2ea..8a68c28f7 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -20,6 +20,7 @@ object TSTypeGenerationTest { "Array.ts", "BasicFunctions.ts", "ClassMember.ts", + "Cycle1.ts", "Dec.d.ts", "Enum.ts", "ES5.d.ts", diff --git a/ts2mls/js/src/test/typescript/Cycle1.ts b/ts2mls/js/src/test/typescript/Cycle1.ts new file mode 100644 index 000000000..572c62ed1 --- /dev/null +++ b/ts2mls/js/src/test/typescript/Cycle1.ts @@ -0,0 +1,4 @@ +import { B } from "./Cycle2" + +export class A {} +export const b = new B(); diff --git a/ts2mls/js/src/test/typescript/Cycle2.ts b/ts2mls/js/src/test/typescript/Cycle2.ts new file mode 100644 index 000000000..daf987b8d --- /dev/null +++ b/ts2mls/js/src/test/typescript/Cycle2.ts @@ -0,0 +1,4 @@ +import { A } from "./Cycle1" + +export class B {} +export const a = new A(); From c6f59d5b54f571b26763001752824a408e2acfd4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 29 May 2023 16:10:14 +0800 Subject: [PATCH 069/202] WIP: Remove export in cycle modules --- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 2 +- ts2mls/js/src/test/diff/Cycle2.mlsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 340fadcb0..42276ecd5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -55,7 +55,7 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { }) cycleList.foreach(imp => { val newFilename = toTSFile(imp) - writer.writeln(s"export declare module ${TSImport.getModuleName(imp.`import`, false)} {") + writer.writeln(s"declare module ${TSImport.getModuleName(imp.`import`, false)} {") cache(newFilename).generate(writer, " ") writer.writeln("}") }) diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi index 6b7ccf271..bb81f1b43 100644 --- a/ts2mls/js/src/test/diff/Cycle2.mlsi +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -2,7 +2,7 @@ :NewDefs :NoJS :AllowTypeErrors -export declare module Cycle1 { +declare module Cycle1 { export class A {} val b: Cycle2.B } From 0fda118460854a4148c3e87851daaff2bfcb8261 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 30 May 2023 10:48:04 +0800 Subject: [PATCH 070/202] WIP: Fix re-exports --- .../js/src/main/scala/ts2mls/TSModules.scala | 8 ++-- .../src/main/scala/ts2mls/TSNamespace.scala | 12 ++++++ .../js/src/main/scala/ts2mls/TSProgram.scala | 26 +++++++++--- .../src/main/scala/ts2mls/TSSourceFile.scala | 19 +++------ .../main/scala/ts2mls/types/Converter.scala | 1 + .../src/main/scala/ts2mls/types/TSType.scala | 1 + ts2mls/js/src/test/diff/Export.mlsi | 41 +++++++++++-------- 7 files changed, 68 insertions(+), 40 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index e06fab1ce..9338a9feb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -4,6 +4,8 @@ import scala.collection.mutable.HashMap import mlscript.utils._ import ts2mls.types.{TSTypeAlias, TSReferenceType, Converter} +final case class TSReExport(alias: String, filename: String, memberName: Option[String]) + trait TSImport { self => val filename: String val `import`: String @@ -17,12 +19,12 @@ trait TSImport { self => }.headOption } - def createAlias: List[TSTypeAlias] = self match { + def createAlias: List[TSReExport] = self match { case TSFullImport(filename, _, alias) => - TSTypeAlias(alias, TSReferenceType(TSImport.getModuleName(filename, false)), Nil) :: Nil + TSReExport(alias, filename, None) :: Nil case TSSingleImport(filename, _, items) => items.map{ case (name, alias) => - TSTypeAlias(alias.getOrElse(name), TSReferenceType(s"${TSImport.getModuleName(filename, false)}.$name"), Nil) + TSReExport(alias.getOrElse(name), filename, Some(name)) } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index aeb242d19..83081063b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -40,6 +40,16 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { else if (!parent.isEmpty) parent.get.get(name) else throw new Exception(s"member $name not found.") + def getTop(name: String): Option[TSType] = + if (members.contains(name)) members(name)._1 match { + case cls: TSClassType => Some(TSReferenceType(cls.name)) + case itf: TSInterfaceType => Some(TSReferenceType(itf.name)) + case _: TSTypeAlias => None // type alias in ts would be erased. + case tp => Some(tp) // variables & functions + } + else if (subSpace.contains(name)) Some(TSReferenceType(name)) + else None + def containsMember(name: String, searchParent: Boolean = true): Boolean = if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) @@ -67,6 +77,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { case TSInterfaceType(name, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) + case TSRenamedType(name, original) if (exp) => + writer.writeln(s"${indent}export val $name = ${Converter.convert(original)("")}") case _ => writer.writeln(s"${indent}${expStr(exp)}val $name: ${Converter.convert(mem)("")}") } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 42276ecd5..450394f8f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -25,6 +25,7 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList + val reExportList = sourceFile.getReExportList val absName = TSModuleResolver.resolve(filename) cache.addOne(absName, globalNamespace) @@ -33,13 +34,13 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) else throw new AssertionError(s"wrong work dir $workDir") - def toTSFile(imp: TSImport) = // TODO: node_modules - if (!imp.filename.endsWith(".ts")) s"${imp.filename}.ts" - else imp.filename - val (cycleList, otherList) = importList.partition(imp => stack.contains(toTSFile(imp))) + def toTSFile(filename: String) = // TODO: node_modules + if (!filename.endsWith(".ts")) s"$filename.ts" + else filename + val (cycleList, otherList) = importList.partition(imp => stack.contains(toTSFile(imp.filename))) otherList.foreach(imp => { - val newFilename = toTSFile(imp) + val newFilename = toTSFile(imp.filename) generate(newFilename, TSModuleResolver.resolve(workDir), targetPath)(absName :: stack) }) @@ -54,12 +55,25 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { } }) cycleList.foreach(imp => { - val newFilename = toTSFile(imp) + val newFilename = toTSFile(imp.filename) writer.writeln(s"declare module ${TSImport.getModuleName(imp.`import`, false)} {") cache(newFilename).generate(writer, " ") writer.writeln("}") }) + reExportList.foreach { + case TSReExport(alias, filename, memberName) => + if (!cache.contains(toTSFile(filename))) + throw new AssertionError(s"unexpected re-export from ${toTSFile(filename)}") + else { + val ns = cache(toTSFile(filename)) + val moduleName = TSImport.getModuleName(filename, false) + memberName.fold( + globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true) + )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true))) + } + } + generate(writer, otherList, globalNamespace, moduleName) writer.close() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 9267c7b1b..cdfa4baa3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -9,6 +9,7 @@ import scala.collection.mutable.{ListBuffer, HashMap} class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = TSImportList() + private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() private val originalFileName = sf.originalFileName.toString() private val rootPath = @@ -44,21 +45,15 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) def getImportList: List[TSImport] = importList.getFilelist + def getReExportList: List[TSReExport] = reExportList.toList private def parseExportDeclaration(elements: TSNodeArray): Unit = { - def getReferedType(name: String): TSType = global.get(name) match { - case cls: TSClassType => TSReferenceType(cls.name) - case TSEnumType => TSEnumType - case itf: TSInterfaceType => TSReferenceType(itf.name) - case ref: TSReferenceType => ref - case _ => throw new AssertionError(s"unsupported export type $name.") // FIXME: functions and variables? - } elements.foreach(ele => if (ele.propertyName.isUndefined) global.export(ele.symbol.escapedName) else { val alias = ele.symbol.escapedName - global.put(alias, TSTypeAlias(alias, getReferedType(ele.propertyName.escapedText), Nil), true) + global.getTop(ele.propertyName.escapedText).fold(())(tp => global.put(alias, TSRenamedType(alias, tp), true)) } ) } @@ -81,16 +76,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) val imp = TSSingleImport(absPath, importName, list) - if (exported) imp.createAlias.foreach { // FIXME: functions and variables? - case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) - } + if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export importList += imp } else if (!node.name.isUndefined) { val imp = TSFullImport(absPath, importName, node.name.escapedText) - if (exported) imp.createAlias.foreach { // FIXME: functions and variables? - case alias @ TSTypeAlias(name, _, _) => global.put(name, alias, true) - } + if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export importList += imp } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 56d16ca3c..ebd7cea28 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -65,6 +65,7 @@ object Converter { case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => s"""Unsupported<"$code", "$filename", $line, $column>""" + case tp => throw new AssertionError(s"unexpected type $tp.") } private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index 56e444d5f..1c43e21d1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -45,5 +45,6 @@ case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType } case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType +case class TSRenamedType(name: String, original: TSType) extends TSType case class TSLiteralType(value: String, isString: Boolean) extends TSType case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 38aa0113c..705aa1ce4 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -16,9 +16,9 @@ export declare module Export { } fun default(x: anything): anything export class E {} - export type F = E - export type G = Dependency.B - export type H = Dependency + export val F = E + export val G = B + export val H = Dependency } //│ ╔══[ERROR] type identifier not found: IBar //│ ║ l.8: fun Baz(aa: string): IBar @@ -39,17 +39,24 @@ export declare module Export { //│ ╔══[ERROR] Member Baz is declared but not defined //│ ║ l.8: fun Baz(aa: string): IBar //│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: Dependency -//│ ║ l.20: export type G = Dependency.B -//│ ╙── ^^^^^^^^^^ -//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. -//│ at: mlscript.utils.package$.lastWords(package.scala:205) -//│ at: mlscript.utils.package$.die(package.scala:204) -//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) -//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) -//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) -//│ at: mlscript.Typer.go$1(Typer.scala:490) -//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) -//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) -//│ at: mlscript.Typer.rec$1(Typer.scala:547) -//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) +//│ ╔══[ERROR] identifier not found: B +//│ ║ l.20: export val G = B +//│ ╙── ^ +//│ ╔══[ERROR] identifier not found: Dependency +//│ ║ l.21: export val H = Dependency +//│ ╙── ^^^^^^^^^^ +//│ module Export() { +//│ class E() +//│ let F: () -> E +//│ module Foo() { +//│ class Bar() { +//│ let a: string +//│ } +//│ fun Baz: (aa: string,) -> error +//│ trait IBar() +//│ let baz: IBar +//│ } +//│ let G: error +//│ let H: error +//│ fun default: (x: anything,) -> anything +//│ } From 3c3d2eb6fee16f891ca0479a8b9f99c0f20f3553 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 30 May 2023 11:49:26 +0800 Subject: [PATCH 071/202] WIP: Move ts2mls JVM test to driver --- build.sbt | 15 +- driver/js/src/main/scala/driver/Driver.scala | 38 +- .../js/src/main/scala/driver/FileInfo.scala | 2 +- .../js/src/test/{js/.temp => mlscript}/A.mlsi | 0 .../js/src/test/{js/.temp => mlscript}/B.mlsi | 0 .../js/src/test/{js/.temp => mlscript}/C.mlsi | 0 .../test/{js/.temp => mlscript}/Cycle1.mlsi | 0 .../test/{js/.temp => mlscript}/Cycle2.mlsi | 0 .../test/{js/.temp => mlscript}/Opened.mlsi | 0 .../test/{js/.temp => mlscript}/Simple.mlsi | 0 .../{js/.temp => mlscript}/tools/Inc.mlsi | 0 .../test/scala/driver/DriverDiffTests.scala | 50 +- .../js/src/main/scala/ts2mls/JSWriter.scala | 2 +- ts2mls/js/src/test/diff/Array.mlsi | 54 - ts2mls/js/src/test/diff/BasicFunctions.mlsi | 50 - ts2mls/js/src/test/diff/ClassMember.mlsi | 51 - ts2mls/js/src/test/diff/Cycle1.mlsi | 18 - ts2mls/js/src/test/diff/Cycle2.mlsi | 15 - ts2mls/js/src/test/diff/Dec.mlsi | 26 - ts2mls/js/src/test/diff/Dependency.mlsi | 19 - ts2mls/js/src/test/diff/ES5.mlsi | 1686 ----------------- ts2mls/js/src/test/diff/Enum.mlsi | 9 - ts2mls/js/src/test/diff/Export.mlsi | 44 - ts2mls/js/src/test/diff/Heritage.mlsi | 105 - ts2mls/js/src/test/diff/HighOrderFunc.mlsi | 9 - ts2mls/js/src/test/diff/Import.mlsi | 18 - ts2mls/js/src/test/diff/InterfaceMember.mlsi | 120 -- ts2mls/js/src/test/diff/Intersection.mlsi | 60 - ts2mls/js/src/test/diff/Literal.mlsi | 9 - ts2mls/js/src/test/diff/Namespace.mlsi | 77 - ts2mls/js/src/test/diff/Optional.mlsi | 47 - ts2mls/js/src/test/diff/Overload.mlsi | 49 - ts2mls/js/src/test/diff/Tuple.mlsi | 34 - ts2mls/js/src/test/diff/Type.mlsi | 72 - ts2mls/js/src/test/diff/TypeParameter.mlsi | 70 - ts2mls/js/src/test/diff/Union.mlsi | 13 - ts2mls/js/src/test/diff/Variables.mlsi | 20 - .../test/scala/ts2mls/TsTypeDiffTests.scala | 8 - 38 files changed, 69 insertions(+), 2721 deletions(-) rename driver/js/src/test/{js/.temp => mlscript}/A.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/B.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/C.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/Cycle1.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/Cycle2.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/Opened.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/Simple.mlsi (100%) rename driver/js/src/test/{js/.temp => mlscript}/tools/Inc.mlsi (100%) delete mode 100644 ts2mls/jvm/src/test/scala/ts2mls/TsTypeDiffTests.scala diff --git a/build.sbt b/build.sbt index 7aea280b1..8cecc9663 100644 --- a/build.sbt +++ b/build.sbt @@ -8,7 +8,7 @@ ThisBuild / organization := "io.lptk" ThisBuild / organizationName := "LPTK" lazy val root = project.in(file(".")) - .aggregate(mlscriptJS, mlscriptJVM, ts2mlsTest, compilerJVM) + .aggregate(mlscriptJS, mlscriptJVM, driverTest, compilerJVM) .settings( publish := {}, publishLocal := {}, @@ -74,12 +74,6 @@ lazy val ts2mls = crossProject(JSPlatform, JVMPlatform).in(file("ts2mls")) lazy val ts2mlsJS = ts2mls.js lazy val ts2mlsJVM = ts2mls.jvm -lazy val ts2mlsTest = project.in(file("ts2mls")) - .settings( - scalaVersion := "2.13.8", - Test / test := ((ts2mlsJVM / Test / test) dependsOn (ts2mlsJS / Test / test)).value - ) - lazy val compiler = crossProject(JSPlatform, JVMPlatform).in(file("compiler")) .settings( name := "mlscript-compiler", @@ -105,9 +99,14 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) .jsSettings( libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", - Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js" + Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js", ) .dependsOn(mlscript % "compile->compile;test->test") .dependsOn(ts2mls % "compile->compile;test->test") lazy val driverJS = driver.js +lazy val driverTest = project.in(file("driver")) + .settings( + scalaVersion := "2.13.8", + Test / test := ((driverJS / Test / test) dependsOn (ts2mlsJS / Test / test)).value + ) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index a1f180a29..8ffa040e8 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -38,6 +38,7 @@ class Driver(options: DriverOptions) { // Return true if success def execute: Boolean = try { + Driver.totalErrors = 0 implicit var ctx: Ctx = Ctx.init implicit val raise: Raise = report implicit val extrCtx: Opt[typer.ExtrCtx] = N @@ -132,7 +133,8 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = { - val mlsiFile = normalize(s"${options.outputDir}/${file.interfaceFilename}") + val mlsiFile = normalize(s"${options.path}/${file.interfaceFilename}") + if (file.filename.endsWith(".ts")) {} // TODO: invoke ts2mls parseAndRun(file.filename, { case (definitions, _, imports, _) => { val depList = imports.map { @@ -151,7 +153,7 @@ class Driver(options: DriverOptions) { case (sigs, recomp) => { importedModule += file.filename (sigs :+ extractSig(file.filename, file.moduleName), - isInterfaceOutdate(file.filename, s"${options.outputDir}/${file.interfaceFilename}")) + isInterfaceOutdate(file.filename, s"${options.path}/${file.interfaceFilename}")) } }) val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { @@ -170,7 +172,7 @@ class Driver(options: DriverOptions) { if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { System.out.println(s"compiling ${file.filename}...") def importModule(file: FileInfo): Unit = { - val filename = s"${options.outputDir}/${file.interfaceFilename}" + val filename = s"${options.path}/${file.interfaceFilename}" parseAndRun(filename, { case (_, declarations, imports, _) => { val depList = imports.map { @@ -183,20 +185,22 @@ class Driver(options: DriverOptions) { } otherList.foreach(d => importModule(file.`import`(d))) - def generateInterface(moduleName: Option[String], tu: TypingUnit) = { - val exp = `type`(tu) - packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) - } - - val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + - generateInterface(Some(file.moduleName), TypingUnit(definitions, Nil)) - val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - - writeFile(mlsiFile, interfaces) - file.jsFilename match { - case Some(filename) => - generate(Pgrm(definitions), s"${options.outputDir}/$filename", file.moduleName, imports, exported || importedModule(file.filename)) - case _ => () + if (!file.filename.endsWith(".mlsi")) { + def generateInterface(moduleName: Option[String], tu: TypingUnit) = { + val exp = `type`(tu) + packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) + } + + val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + + generateInterface(Some(file.moduleName), TypingUnit(definitions, Nil)) + val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + + writeFile(mlsiFile, interfaces) + file.jsFilename match { + case Some(filename) => + generate(Pgrm(definitions), s"${options.outputDir}/$filename", file.moduleName, imports, exported || importedModule(file.filename)) + case _ => () + } } true } diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index c01c33096..e9f5c3b41 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -21,7 +21,7 @@ final case class FileInfo( else TypeScript.resolveNodeModulePath(localFilename) val interfaceFilename: String = // interface filename (related to output directory) - relatedPath.fold(s".temp/node_modules/$localFilename")(path => s".temp/${normalize(s"$path/$moduleName.mlsi")}") + relatedPath.fold(s"node_modules/$localFilename")(path => s"${normalize(s"$path/$moduleName.mlsi")}") val jsFilename: Option[String] = relatedPath.fold[Option[String]](None)(path => Some(normalize(s"$path/$moduleName.js"))) diff --git a/driver/js/src/test/js/.temp/A.mlsi b/driver/js/src/test/mlscript/A.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/A.mlsi rename to driver/js/src/test/mlscript/A.mlsi diff --git a/driver/js/src/test/js/.temp/B.mlsi b/driver/js/src/test/mlscript/B.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/B.mlsi rename to driver/js/src/test/mlscript/B.mlsi diff --git a/driver/js/src/test/js/.temp/C.mlsi b/driver/js/src/test/mlscript/C.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/C.mlsi rename to driver/js/src/test/mlscript/C.mlsi diff --git a/driver/js/src/test/js/.temp/Cycle1.mlsi b/driver/js/src/test/mlscript/Cycle1.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/Cycle1.mlsi rename to driver/js/src/test/mlscript/Cycle1.mlsi diff --git a/driver/js/src/test/js/.temp/Cycle2.mlsi b/driver/js/src/test/mlscript/Cycle2.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/Cycle2.mlsi rename to driver/js/src/test/mlscript/Cycle2.mlsi diff --git a/driver/js/src/test/js/.temp/Opened.mlsi b/driver/js/src/test/mlscript/Opened.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/Opened.mlsi rename to driver/js/src/test/mlscript/Opened.mlsi diff --git a/driver/js/src/test/js/.temp/Simple.mlsi b/driver/js/src/test/mlscript/Simple.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/Simple.mlsi rename to driver/js/src/test/mlscript/Simple.mlsi diff --git a/driver/js/src/test/js/.temp/tools/Inc.mlsi b/driver/js/src/test/mlscript/tools/Inc.mlsi similarity index 100% rename from driver/js/src/test/js/.temp/tools/Inc.mlsi rename to driver/js/src/test/mlscript/tools/Inc.mlsi diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 76822b186..25dcd320e 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -10,18 +10,20 @@ class DriverDiffTests extends AnyFunSuite { import DriverDiffTests._ testCases.foreach { - case TestOption(filename, executionFile, outputFile, expectError) => test(filename) { - val options = DriverOptions(filename, mlscriptPath, jsPath, forceCompiling) + case TestOption(filename, workDir, execution, expectError) => test(filename) { + val options = DriverOptions(filename, workDir, jsPath, forceCompiling) val driver = Driver(options) driver.genPackageJson() val success = driver.execute assert(success != expectError, s"failed when compiling $filename.") - if (!expectError) { - val output = cp.execSync(s"node $executionFile").toString() - val original = Driver.readFile(outputFile).getOrElse("") - if (original =/= output) fs.writeFileSync(outputFile, output) + if (!expectError) execution match { + case Some((executionFile, outputFile)) => + val output = cp.execSync(s"node $executionFile").toString() + val original = Driver.readFile(outputFile).getOrElse("") + if (original =/= output) fs.writeFileSync(outputFile, output) + case None => () } } } @@ -36,27 +38,53 @@ object DriverDiffTests { private val mlscriptPath = s"${diffPath}mlscript/" private val jsPath = s"${diffPath}js/" private val outputPath = s"${diffPath}output/" + private val ts2mlsPath = "ts2mls/js/src/test/diff" private case class TestOption( filename: String, - executionFile: String, - outputFile: String, + workDir: String, + execution: Option[(String, String)], expectError: Boolean ) private def entry(entryModule: String, expectError: Boolean = false) = TestOption( s"./${entryModule}.mls", - s"${jsPath}${entryModule}.js", - s"${outputPath}${entryModule}.check", + mlscriptPath, + Some((s"${jsPath}${entryModule}.js", s"${outputPath}${entryModule}.check")), expectError ) + private def ts2mlsEntry(entryModule: String, expectError: Boolean = false) = + TestOption(s"./${entryModule}.mlsi", ts2mlsPath, None, expectError) + private val testCases = List( entry("Simple"), entry("Cycle2"), entry("Self", true), - entry("C", true) + entry("C", true), + ts2mlsEntry("Array"), + ts2mlsEntry("BasicFunctions"), + ts2mlsEntry("ClassMember"), + ts2mlsEntry("Cycle1", true), // TODO: ??? + ts2mlsEntry("Dec"), + ts2mlsEntry("Enum"), + ts2mlsEntry("ES5"), + ts2mlsEntry("Export"), + ts2mlsEntry("Heritage"), + ts2mlsEntry("HighOrderFunc"), + ts2mlsEntry("Import"), + ts2mlsEntry("InterfaceMember"), + ts2mlsEntry("Intersection"), + ts2mlsEntry("Literal"), + ts2mlsEntry("Namespace"), + ts2mlsEntry("Optional"), + ts2mlsEntry("Overload"), + ts2mlsEntry("Tuple"), + ts2mlsEntry("Type"), + ts2mlsEntry("TypeParameter"), + ts2mlsEntry("Union"), + ts2mlsEntry("Variables"), ) private val cp = g.require("child_process") diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index f0de296a8..917d5bfb0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -18,7 +18,7 @@ class JSWriter(filename: String) { private var fileSize = 0 // how many bytes we've written in the file private var needTruncate = false - writeln(":NewParser\n:NewDefs\n:NoJS\n:AllowTypeErrors") + // writeln(":NewParser\n:NewDefs\n:NoJS\n:AllowTypeErrors") def writeln(str: String) = { val strln = str + "\n" diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index 39530dc94..80540b44b 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Array { fun first(x: MutArray): string fun getZero3(): MutArray @@ -23,53 +19,3 @@ export declare module Array { fun ta(ts: MutArray>): MutArray> fun tat(ts: MutArray>): MutArray> } -//│ ╔══[ERROR] type identifier not found: C -//│ ║ l.14: fun doCs(c: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: C -//│ ║ l.14: fun doCs(c: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: I -//│ ║ l.15: fun doIs(i: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: I -//│ ║ l.15: fun doIs(i: MutArray): MutArray -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: Temp -//│ ║ l.23: fun ta(ts: MutArray>): MutArray> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Temp -//│ ║ l.23: fun ta(ts: MutArray>): MutArray> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Temp -//│ ║ l.24: fun tat(ts: MutArray>): MutArray> -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: Temp -//│ ║ l.24: fun tat(ts: MutArray>): MutArray> -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.11: trait I { -//│ ║ ^^^^^^^^^ -//│ ║ l.12: val i: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.13: } -//│ ╙── ^^^ -//│ module Array() { -//│ class C() -//│ trait I() -//│ class Temp[T]() { -//│ let x: T -//│ } -//│ fun clean: (x: MutArray[(string, number,)],) -> MutArray[(string, number,)] -//│ fun doCs: (c: MutArray[error],) -> MutArray[error] -//│ fun doEs: (e: MutArray[int],) -> MutArray[int] -//│ fun doIs: (i: MutArray[error],) -> MutArray[error] -//│ fun first: (x: MutArray[string],) -> string -//│ fun first2: (fs: MutArray[number -> number],) -> number -> number -//│ fun getZero3: () -> MutArray[number] -//│ fun inter: forall 'U. (x: MutArray['U],) -> MutArray['U] -//│ fun ta: (ts: MutArray[error],) -> MutArray[error] -//│ fun tat: (ts: MutArray[error],) -> MutArray[error] -//│ fun translate: forall 'U0 'T. (x: MutArray['T],) -> MutArray['U0] -//│ fun uu: (x: MutArray[false | number | true],) -> MutArray[false | number | true] -//│ } diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 6a630546d..84efbcbce 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module BasicFunctions { fun hello(): unit fun add(x: number, y: number): number @@ -28,49 +24,3 @@ export declare module BasicFunctions { fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr } -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.17: fun create(): object -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: Foooooo -//│ ║ l.23: fun inn(f: Foooooo): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Foooooo -//│ ║ l.24: fun out1(): Foooooo -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Barrrrrrrrr -//│ ║ l.28: fun inn2(b: Barrrrrrrrr): unit -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Barrrrrrrrr -//│ ║ l.29: fun out2(): Barrrrrrrrr -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.25: trait Barrrrrrrrr { -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.26: val rrrrrrr: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: } -//│ ╙── ^^^ -//│ module BasicFunctions() { -//│ trait Barrrrrrrrr() -//│ class Foooooo() { -//│ let ooooooo: number -//│ } -//│ fun add: (x: number, y: number,) -> number -//│ fun bar: () -> anything -//│ fun create: () -> error -//│ fun fail: () -> nothing -//│ fun foo: () -> number -//│ fun hello: () -> unit -//│ fun id: (x: anything,) -> anything -//│ fun inn: (f: error,) -> unit -//│ fun inn2: (b: error,) -> unit -//│ fun isnull: (x: anything,) -> bool -//│ fun nu: (n: null,) -> null -//│ fun odd: (x: number,) -> bool -//│ fun out1: () -> error -//│ fun out2: () -> error -//│ fun pa: (x: number,) -> number -//│ fun sub: (x: number, y: number,) -> number -//│ fun un: (n: undefined,) -> undefined -//│ fun wtf: (x: anything,) -> unit -//│ } diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 6db8f8149..f12c29ac5 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module ClassMember { class Student { constructor(s: string, age: number) @@ -26,50 +22,3 @@ export declare module ClassMember { fun ttt2(x: T): T } } -//│ ╔══[ERROR] identifier not found: constructor -//│ ║ l.7: constructor(s: string, age: number) -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member isFriend is declared but not defined -//│ ║ l.9: fun isFriend(other: Student): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member addScore is declared but not defined -//│ ║ l.10: fun addScore(sub: string, score: number): unit -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member getID is declared but not defined -//│ ║ l.11: fun getID(): number -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member bar is declared but not defined -//│ ║ l.14: fun bar(x: T): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member inc is declared but not defined -//│ ║ l.17: fun inc(x: number): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member ttt is declared but not defined -//│ ║ l.25: fun ttt(x: T): T -//│ ╙── ^^^ -//│ ╔══[ERROR] Member ttt2 is declared but not defined -//│ ║ l.26: fun ttt2(x: T): T -//│ ╙── ^^^^ -//│ module ClassMember() { -//│ class EZ() { -//│ fun inc: (x: number,) -> number -//│ } -//│ class Foo[T]() { -//│ fun bar: (x: T,) -> unit -//│ } -//│ class Outer() { -//│ class Inner() { -//│ let a: number -//│ } -//│ } -//│ class Student() { -//│ fun addScore: (sub: string, score: number,) -> unit -//│ fun getID: () -> number -//│ fun isFriend: (other: Student,) -> bool -//│ let name: string -//│ } -//│ class TTT[T]() { -//│ fun ttt: (x: T,) -> T -//│ fun ttt2: (x: T,) -> T -//│ } -//│ } diff --git a/ts2mls/js/src/test/diff/Cycle1.mlsi b/ts2mls/js/src/test/diff/Cycle1.mlsi index 3fd5e7a8e..88c151e54 100644 --- a/ts2mls/js/src/test/diff/Cycle1.mlsi +++ b/ts2mls/js/src/test/diff/Cycle1.mlsi @@ -1,23 +1,5 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors import "./Cycle2.mlsi" export declare module Cycle1 { export class A {} val b: Cycle2.B } -//│ ╔══[ERROR] type identifier not found: Cycle2 -//│ ║ l.8: val b: Cycle2.B -//│ ╙── ^^^^^^ -//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. -//│ at: mlscript.utils.package$.lastWords(package.scala:205) -//│ at: mlscript.utils.package$.die(package.scala:204) -//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) -//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) -//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) -//│ at: mlscript.Typer.go$1(Typer.scala:490) -//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) -//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) -//│ at: mlscript.Typer.rec$1(Typer.scala:547) -//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi index bb81f1b43..e4cc05c66 100644 --- a/ts2mls/js/src/test/diff/Cycle2.mlsi +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors declare module Cycle1 { export class A {} val b: Cycle2.B @@ -10,14 +6,3 @@ export declare module Cycle2 { export class B {} val a: Cycle1.A } -//│ ╔══[ERROR] Module `Cycle1` is not supported yet. -//│ ║ l.11: val a: Cycle1.A -//│ ╙── ^^ -//│ module Cycle1() { -//│ class A() -//│ let b: B -//│ } -//│ module Cycle2() { -//│ class B() -//│ let a: error -//│ } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 8b0c8cd49..c156b599e 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Dec { fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string @@ -15,25 +11,3 @@ export declare module Dec { module OOO { } } -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.8: trait Get { -//│ ║ ^^^^^^^^^^^ -//│ ║ l.9: val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: } -//│ ╙── ^^^ -//│ ╔══[ERROR] identifier not found: constructor -//│ ║ l.12: constructor(name: string, age: number) -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member getName is declared but not defined -//│ ║ l.13: fun getName(id: number): string -//│ ╙── ^^^^^^^ -//│ module Dec() { -//│ trait Get() -//│ module OOO() -//│ class Person() { -//│ fun getName: (id: number,) -> string -//│ } -//│ fun getName: (id: number | string,) -> string -//│ fun render: (callback: unit -> unit | undefined,) -> string -//│ } diff --git a/ts2mls/js/src/test/diff/Dependency.mlsi b/ts2mls/js/src/test/diff/Dependency.mlsi index ecae987cd..5fe929e9f 100644 --- a/ts2mls/js/src/test/diff/Dependency.mlsi +++ b/ts2mls/js/src/test/diff/Dependency.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Dependency { export class A { val a: number @@ -17,18 +13,3 @@ export declare module Dependency { } fun default(): number } -//│ module Dependency() { -//│ class A() { -//│ let a: number -//│ } -//│ class B() { -//│ let b: number -//│ } -//│ class C() { -//│ let c: number -//│ } -//│ class D() { -//│ let d: number -//│ } -//│ fun default: () -> number -//│ } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 84523f5ce..af81b3310 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors val NaN: number val Infinity: number fun eval(x: string): anything @@ -456,1685 +452,3 @@ module Intl { fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions } } -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.20: fun valueOf(): Symbol -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.18: trait Symbol { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.19: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.20: fun valueOf(): Symbol -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.21: } -//│ ╙── ^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.19: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.20: fun valueOf(): Symbol -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.22: type PropertyKey = ((string) | (number)) | (Symbol) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait PropertyDescriptor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: val configurable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: val set: ((anything) => unit) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.26: val enumerable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.27: val get: (unit => anything) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.28: val writable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.29: val value: (anything) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.30: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: trait PropertyDescriptorMap { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.32: val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.33: } -//│ ╙── ^ -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] trait Object cannot be used as a type -//│ ║ l.37: fun valueOf(): Object -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Object cannot be used as a type -//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.34: trait Object { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.37: fun valueOf(): Object -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.38: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.39: val constructor: Function -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.41: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.42: } -//│ ╙── ^ -//│ ╔══[ERROR] Member hasOwnProperty is declared but not defined -//│ ║ l.35: fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member propertyIsEnumerable is declared but not defined -//│ ║ l.36: fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.37: fun valueOf(): Object -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.38: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isPrototypeOf is declared but not defined -//│ ║ l.40: fun isPrototypeOf(v: Object): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.41: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] trait PropertyDescriptor cannot be used as a type -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ThisType cannot be used as a type -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait PropertyDescriptorMap cannot be used as a type -//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ThisType cannot be used as a type -//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: __type -//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Symbol cannot be used as a type -//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] trait PropertyDescriptor cannot be used as a type -//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Object cannot be used as a type -//│ ║ l.58: fun keys(o: object): MutArray -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.58: fun keys(o: object): MutArray -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.43: trait ObjectConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.44: val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.47: fun getPrototypeOf(o: anything): anything -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.49: val prototype: Object -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.50: fun isSealed(o: anything): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.52: fun preventExtensions(o: T): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.53: val create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.55: val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.57: fun seal(o: T): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.58: fun keys(o: object): MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.60: } -//│ ╙── ^ -//│ ╔══[ERROR] Member getOwnPropertyNames is declared but not defined -//│ ║ l.45: fun getOwnPropertyNames(o: anything): MutArray -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isFrozen is declared but not defined -//│ ║ l.46: fun isFrozen(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member getPrototypeOf is declared but not defined -//│ ║ l.47: fun getPrototypeOf(o: anything): anything -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member defineProperty is declared but not defined -//│ ║ l.48: fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member isSealed is declared but not defined -//│ ║ l.50: fun isSealed(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member defineProperties is declared but not defined -//│ ║ l.51: fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member preventExtensions is declared but not defined -//│ ║ l.52: fun preventExtensions(o: T): T -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member freeze is declared but not defined -//│ ║ l.54: fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member getOwnPropertyDescriptor is declared but not defined -//│ ║ l.56: fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member seal is declared but not defined -//│ ║ l.57: fun seal(o: T): T -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member keys is declared but not defined -//│ ║ l.58: fun keys(o: object): MutArray -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member isExtensible is declared but not defined -//│ ║ l.59: fun isExtensible(o: anything): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait FunctionConstructor cannot be used as a type -//│ ║ l.61: val Function: FunctionConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.62: trait FunctionConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.63: val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.64: val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.65: val prototype: Function -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.66: } -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.67: type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.68: type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.69: trait CallableFunction extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.71: fun call(thisArg: T, args: A): R -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.73: } -//│ ╙── ^ -//│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.70: fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.71: fun call(thisArg: T, args: A): R -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.72: fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.74: trait NewableFunction extends Function { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.76: fun call(thisArg: T, args: A): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.78: } -//│ ╙── ^ -//│ ╔══[ERROR] Member apply is declared but not defined -//│ ║ l.75: fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member call is declared but not defined -//│ ║ l.76: fun call(thisArg: T, args: A): unit -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member bind is declared but not defined -//│ ║ l.77: fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.79: trait IArguments { -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.80: val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.81: val length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.82: val callee: Function -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.83: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.374: export trait CollatorOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.375: val sensitivity: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.376: val ignorePunctuation: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.377: val usage: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.378: val localeMatcher: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.379: val numeric: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.380: val caseFirst: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.381: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.382: export trait ResolvedCollatorOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.383: val sensitivity: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.384: val ignorePunctuation: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.385: val usage: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.386: val locale: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.387: val numeric: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.388: val caseFirst: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.389: val collation: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.390: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.391: export trait Collator { -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.392: fun compare(x: string, y: string): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.394: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member compare is declared but not defined -//│ ║ l.392: fun compare(x: string, y: string): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.393: fun resolvedOptions(): Intl.ResolvedCollatorOptions -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.395: export trait NumberFormatOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.396: val minimumSignificantDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.397: val useGrouping: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.398: val style: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.399: val localeMatcher: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.400: val currency: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.401: val minimumIntegerDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.402: val maximumFractionDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.403: val currencySign: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.404: val maximumSignificantDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.405: val minimumFractionDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.406: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.407: export trait ResolvedNumberFormatOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.408: val numberingSystem: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.409: val minimumSignificantDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.410: val useGrouping: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.411: val style: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.412: val locale: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.413: val currency: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.414: val minimumIntegerDigits: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.415: val maximumFractionDigits: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.416: val maximumSignificantDigits: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.417: val minimumFractionDigits: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.418: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.419: export trait NumberFormat { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.420: fun format(value: number): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.422: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.420: fun format(value: number): string -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.421: fun resolvedOptions(): Intl.ResolvedNumberFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.423: export trait DateTimeFormatOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.424: val minute: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.425: val year: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.426: val hour: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.427: val hour12: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.428: val weekday: (((string) | (string)) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.429: val formatMatcher: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.430: val day: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.431: val timeZone: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.432: val month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.433: val second: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.434: val localeMatcher: ((string) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.435: val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.436: val era: (((string) | (string)) | (string)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.437: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.438: export trait ResolvedDateTimeFormatOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.439: val numberingSystem: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.440: val minute: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.441: val year: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.442: val hour: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.443: val second: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.444: val hour12: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.445: val weekday: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.446: val day: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.447: val timeZone: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.448: val month: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.449: val locale: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.450: val calendar: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.451: val timeZoneName: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.452: val era: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.453: } -//│ ╙── ^^^ -//│ ╔══[ERROR] trait Date cannot be used as a type -//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Module `Intl` is not supported yet. -//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.454: export trait DateTimeFormat { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.457: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member format is declared but not defined -//│ ║ l.455: fun format(date: ((number) | (Date)) | (undefined)): string -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member resolvedOptions is declared but not defined -//│ ║ l.456: fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.84: trait String { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.86: } -//│ ╙── ^ -//│ ╔══[ERROR] Member localeCompare is declared but not defined -//│ ║ l.85: fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.87: trait StringConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.88: val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.89: val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.90: val prototype: String -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.91: fun fromCharCode(codes: MutArray): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.92: } -//│ ╙── ^ -//│ ╔══[ERROR] Member fromCharCode is declared but not defined -//│ ║ l.91: fun fromCharCode(codes: MutArray): string -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait BooleanConstructor cannot be used as a type -//│ ║ l.93: val Boolean: BooleanConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.94: trait BooleanConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.95: val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.96: val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.97: val prototype: Boolean -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.98: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.99: trait Number { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.101: } -//│ ╙── ^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.100: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.102: trait NumberConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.103: val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.104: val NaN: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.105: val MIN_VALUE: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.106: val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.107: val NEGATIVE_INFINITY: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.108: val POSITIVE_INFINITY: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.109: val MAX_VALUE: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.110: val prototype: Number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.111: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.112: trait TemplateStringsArray extends ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.113: val raw: ReadonlyArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.114: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.115: trait ImportMeta {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.116: trait ImportCallOptions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.117: val assert: (ImportAssertions) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.118: } -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.119: trait ImportAssertions { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.120: val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.121: } -//│ ╙── ^ -//│ ╔══[ERROR] function Math cannot be used as a type -//│ ║ l.122: val Math: Math -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: Math -//│ ║ l.122: val Math: Math -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.123: trait Date { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.127: } -//│ ╙── ^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.124: fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toLocaleDateString is declared but not defined -//│ ║ l.125: fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member toLocaleTimeString is declared but not defined -//│ ║ l.126: fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.128: trait DateConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.129: val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.131: val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.132: fun now(): number -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.133: fun parse(s: string): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.134: val prototype: Date -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.135: } -//│ ╙── ^ -//│ ╔══[ERROR] Member UTC is declared but not defined -//│ ║ l.130: fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member now is declared but not defined -//│ ║ l.132: fun now(): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member parse is declared but not defined -//│ ║ l.133: fun parse(s: string): number -//│ ╙── ^^^^^ -//│ ╔══[ERROR] trait RegExp cannot be used as a type -//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: RegExpExecArray -//│ ║ l.144: fun exec(string: string): RegExpExecArray -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.136: trait RegExp { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.137: fun test(string: string): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.138: val multiline: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.139: val source: string -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.141: val global: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.142: val lastIndex: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.143: val ignoreCase: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.144: fun exec(string: string): RegExpExecArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.145: } -//│ ╙── ^ -//│ ╔══[ERROR] Member test is declared but not defined -//│ ║ l.137: fun test(string: string): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member compile is declared but not defined -//│ ║ l.140: fun compile(pattern: string, flags: (string) | (undefined)): RegExp -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member exec is declared but not defined -//│ ║ l.144: fun exec(string: string): RegExpExecArray -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait ErrorConstructor cannot be used as a type -//│ ║ l.146: val Error: ErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.147: trait ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.148: val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.149: val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.150: val prototype: Error -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.151: } -//│ ╙── ^ -//│ ╔══[ERROR] trait EvalErrorConstructor cannot be used as a type -//│ ║ l.152: val EvalError: EvalErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.153: trait EvalErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.154: val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.155: val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.156: val prototype: EvalError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.157: } -//│ ╙── ^ -//│ ╔══[ERROR] trait RangeErrorConstructor cannot be used as a type -//│ ║ l.158: val RangeError: RangeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.159: trait RangeErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.160: val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.161: val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.162: val prototype: RangeError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.163: } -//│ ╙── ^ -//│ ╔══[ERROR] trait ReferenceErrorConstructor cannot be used as a type -//│ ║ l.164: val ReferenceError: ReferenceErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.165: trait ReferenceErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.166: val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.167: val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.168: val prototype: ReferenceError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.169: } -//│ ╙── ^ -//│ ╔══[ERROR] trait SyntaxErrorConstructor cannot be used as a type -//│ ║ l.170: val SyntaxError: SyntaxErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.171: trait SyntaxErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.172: val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.173: val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.174: val prototype: SyntaxError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.175: } -//│ ╙── ^ -//│ ╔══[ERROR] trait TypeErrorConstructor cannot be used as a type -//│ ║ l.176: val TypeError: TypeErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.177: trait TypeErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.178: val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.179: val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.180: val prototype: TypeError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.181: } -//│ ╙── ^ -//│ ╔══[ERROR] trait URIErrorConstructor cannot be used as a type -//│ ║ l.182: val URIError: URIErrorConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.183: trait URIErrorConstructor extends ErrorConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.184: val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.185: val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.186: val prototype: URIError -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.187: } -//│ ╙── ^ -//│ ╔══[ERROR] function JSON cannot be used as a type -//│ ║ l.188: val JSON: JSON -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: JSON -//│ ║ l.188: val JSON: JSON -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ReadonlyArray cannot be used as a type -//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.189: trait ReadonlyArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.194: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.196: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.198: val concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.199: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.202: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.203: val length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.206: } -//│ ╙── ^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.190: fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.191: fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.192: fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.193: fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.195: fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.196: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.197: fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.199: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.200: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.201: fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.202: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.204: fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.205: fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.207: trait ConcatArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.208: val length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.209: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.210: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.212: } -//│ ╙── ^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.210: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.211: fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -//│ ╙── ^^^^^ -//│ ╔══[ERROR] trait ArrayConstructor cannot be used as a type -//│ ║ l.213: val Array: ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.214: trait ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.215: val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.216: val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.217: fun isArray(arg: anything): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.218: val prototype: MutArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.219: } -//│ ╙── ^ -//│ ╔══[ERROR] Member isArray is declared but not defined -//│ ║ l.217: fun isArray(arg: anything): (false) | (true) -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.220: trait TypedPropertyDescriptor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.221: val configurable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.222: val set: ((T) => unit) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.223: val enumerable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.224: val get: (unit => T) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.225: val writable: ((false) | (true)) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.226: val value: (T) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.227: } -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: T -//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: PromiseLike -//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: PromiseLike -//│ ║ l.228: type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.229: type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.230: trait ArrayLike { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.231: val length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.232: val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.233: } -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.234: type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.235: type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.236: type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.237: type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.238: type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.239: type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.240: type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: __type -//│ ║ l.241: type Omit = __type -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.243: type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.244: type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.245: type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.246: type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.247: type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.248: type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.249: type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Unsupported -//│ ║ l.250: type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.251: trait ThisType {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayBufferConstructor cannot be used as a type -//│ ║ l.252: val ArrayBuffer: ArrayBufferConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.253: trait ArrayBufferTypes { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.254: val ArrayBuffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.255: } -//│ ╙── ^ -//│ ╔══[ERROR] function ArrayBuffer cannot be used as a type -//│ ║ l.256: type ArrayBufferLike = ArrayBuffer -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: ArrayBuffer -//│ ║ l.256: type ArrayBufferLike = ArrayBuffer -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.257: trait ArrayBufferConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.258: val prototype: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.259: val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.260: fun isView(arg: anything): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.261: } -//│ ╙── ^ -//│ ╔══[ERROR] Member isView is declared but not defined -//│ ║ l.260: fun isView(arg: anything): (false) | (true) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.262: trait ArrayBufferView { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.263: val buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.264: val byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.265: val byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.266: } -//│ ╙── ^ -//│ ╔══[ERROR] trait DataViewConstructor cannot be used as a type -//│ ║ l.267: val DataView: DataViewConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.268: trait DataViewConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.269: val prototype: DataView -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.270: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.271: } -//│ ╙── ^ -//│ ╔══[ERROR] trait Int8ArrayConstructor cannot be used as a type -//│ ║ l.272: val Int8Array: Int8ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Int8Array cannot be used as a type -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int8Array -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] function Int8Array cannot be used as a type -//│ ║ l.277: fun id"of"(items: MutArray): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int8Array -//│ ║ l.277: fun id"of"(items: MutArray): Int8Array -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.273: trait Int8ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.274: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.276: val prototype: Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.277: fun id"of"(items: MutArray): Int8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.278: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.279: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.275: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.277: fun id"of"(items: MutArray): Int8Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.281: fun valueOf(): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.299: fun reverse(): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.280: trait Uint8Array { -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.281: fun valueOf(): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.285: fun toLocaleString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.286: val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.290: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.294: fun join(separator: (string) | (undefined)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.297: val buffer: ArrayBuffer -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.299: fun reverse(): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.302: val byteLength: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.304: fun toString(): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.305: val length: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.308: val byteOffset: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.309: } -//│ ╙── ^ -//│ ╔══[ERROR] Member valueOf is declared but not defined -//│ ║ l.281: fun valueOf(): Uint8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member lastIndexOf is declared but not defined -//│ ║ l.282: fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member every is declared but not defined -//│ ║ l.283: fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.284: fun set(array: ArrayLike, offset: (number) | (undefined)): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member toLocaleString is declared but not defined -//│ ║ l.285: fun toLocaleString(): string -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member reduceRight is declared but not defined -//│ ║ l.287: fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member fill is declared but not defined -//│ ║ l.288: fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member sort is declared but not defined -//│ ║ l.289: fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member copyWithin is declared but not defined -//│ ║ l.291: fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Member find is declared but not defined -//│ ║ l.292: fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member subarray is declared but not defined -//│ ║ l.293: fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member join is declared but not defined -//│ ║ l.294: fun join(separator: (string) | (undefined)): string -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member map is declared but not defined -//│ ║ l.295: fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^ -//│ ╔══[ERROR] Member forEach is declared but not defined -//│ ║ l.296: fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member findIndex is declared but not defined -//│ ║ l.298: fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member reverse is declared but not defined -//│ ║ l.299: fun reverse(): Uint8Array -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] Member filter is declared but not defined -//│ ║ l.300: fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member slice is declared but not defined -//│ ║ l.301: fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member reduce is declared but not defined -//│ ║ l.303: fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] Member toString is declared but not defined -//│ ║ l.304: fun toString(): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member some is declared but not defined -//│ ║ l.306: fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member indexOf is declared but not defined -//│ ║ l.307: fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] trait Uint8Array cannot be used as a type -//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.310: trait Uint8ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.311: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.313: val prototype: Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.315: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.316: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.312: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.314: fun id"of"(items: MutArray): Uint8Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Uint8ClampedArrayConstructor cannot be used as a type -//│ ║ l.317: val Uint8ClampedArray: Uint8ClampedArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint8ClampedArray cannot be used as a type -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint8ClampedArray -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint8ClampedArray cannot be used as a type -//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint8ClampedArray -//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.318: trait Uint8ClampedArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.319: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.321: val prototype: Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.323: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.324: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.320: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.322: fun id"of"(items: MutArray): Uint8ClampedArray -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Int16ArrayConstructor cannot be used as a type -//│ ║ l.325: val Int16Array: Int16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Int16Array cannot be used as a type -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int16Array -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] function Int16Array cannot be used as a type -//│ ║ l.330: fun id"of"(items: MutArray): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int16Array -//│ ║ l.330: fun id"of"(items: MutArray): Int16Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.326: trait Int16ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.327: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.329: val prototype: Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.330: fun id"of"(items: MutArray): Int16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.331: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.332: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.328: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.330: fun id"of"(items: MutArray): Int16Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Uint16ArrayConstructor cannot be used as a type -//│ ║ l.333: val Uint16Array: Uint16ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint16Array cannot be used as a type -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint16Array -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint16Array cannot be used as a type -//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint16Array -//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.334: trait Uint16ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.335: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.337: val prototype: Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.339: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.340: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.336: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.338: fun id"of"(items: MutArray): Uint16Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Int32ArrayConstructor cannot be used as a type -//│ ║ l.341: val Int32Array: Int32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Int32Array cannot be used as a type -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int32Array -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] function Int32Array cannot be used as a type -//│ ║ l.346: fun id"of"(items: MutArray): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Int32Array -//│ ║ l.346: fun id"of"(items: MutArray): Int32Array -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.342: trait Int32ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.343: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.345: val prototype: Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.346: fun id"of"(items: MutArray): Int32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.347: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.348: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.344: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.346: fun id"of"(items: MutArray): Int32Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Uint32ArrayConstructor cannot be used as a type -//│ ║ l.349: val Uint32Array: Uint32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint32Array cannot be used as a type -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint32Array -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] function Uint32Array cannot be used as a type -//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Uint32Array -//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.350: trait Uint32ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.351: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.353: val prototype: Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.355: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.356: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.352: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.354: fun id"of"(items: MutArray): Uint32Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Float32ArrayConstructor cannot be used as a type -//│ ║ l.357: val Float32Array: Float32ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Float32Array cannot be used as a type -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Float32Array -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Float32Array cannot be used as a type -//│ ║ l.362: fun id"of"(items: MutArray): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Float32Array -//│ ║ l.362: fun id"of"(items: MutArray): Float32Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.358: trait Float32ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.359: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.361: val prototype: Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.362: fun id"of"(items: MutArray): Float32Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.363: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.364: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.360: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.362: fun id"of"(items: MutArray): Float32Array -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Float64ArrayConstructor cannot be used as a type -//│ ║ l.365: val Float64Array: Float64ArrayConstructor -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] trait ArrayLike cannot be used as a type -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Float64Array cannot be used as a type -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Float64Array -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] function Float64Array cannot be used as a type -//│ ║ l.370: fun id"of"(items: MutArray): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Float64Array -//│ ║ l.370: fun id"of"(items: MutArray): Float64Array -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.366: trait Float64ArrayConstructor { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.367: val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.369: val prototype: Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.370: fun id"of"(items: MutArray): Float64Array -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.371: val BYTES_PER_ELEMENT: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.372: } -//│ ╙── ^ -//│ ╔══[ERROR] Member from is declared but not defined -//│ ║ l.368: fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member of is declared but not defined -//│ ║ l.370: fun id"of"(items: MutArray): Float64Array -//│ ╙── ^^^^^^ -//│ let NaN: number -//│ let Infinity: number -//│ fun eval: (x: string,) -> anything -//│ fun parseInt: (string: string, radix: number | undefined,) -> number -//│ fun parseFloat: (string: string,) -> number -//│ fun isNaN: (number: number,) -> bool -//│ fun isFinite: (number: number,) -> bool -//│ fun decodeURI: (encodedURI: string,) -> string -//│ fun decodeURIComponent: (encodedURIComponent: string,) -> string -//│ fun encodeURI: (uri: string,) -> string -//│ fun encodeURIComponent: (uriComponent: false | number | string | true,) -> string -//│ fun escape: (string: string,) -> string -//│ fun unescape: (string: string,) -> string -//│ trait Symbol() -//│ type PropertyKey = number | string | Symbol -//│ trait PropertyDescriptor() -//│ trait PropertyDescriptorMap() -//│ trait Object() -//│ trait ObjectConstructor() -//│ let Function: FunctionConstructor -//│ trait FunctionConstructor() -//│ type ThisParameterType[T] = error -//│ type OmitThisParameter[T] = error -//│ trait CallableFunction() -//│ trait NewableFunction() -//│ trait IArguments() -//│ trait String() -//│ trait StringConstructor() -//│ let Boolean: BooleanConstructor -//│ trait BooleanConstructor() -//│ trait Number() -//│ trait NumberConstructor() -//│ trait TemplateStringsArray() -//│ trait ImportMeta() -//│ trait ImportCallOptions() -//│ trait ImportAssertions() -//│ let Math: error -//│ trait Date() -//│ trait DateConstructor() -//│ trait RegExp() -//│ let Error: ErrorConstructor -//│ trait ErrorConstructor() -//│ let EvalError: EvalErrorConstructor -//│ trait EvalErrorConstructor() -//│ let RangeError: RangeErrorConstructor -//│ trait RangeErrorConstructor() -//│ let ReferenceError: ReferenceErrorConstructor -//│ trait ReferenceErrorConstructor() -//│ let SyntaxError: SyntaxErrorConstructor -//│ trait SyntaxErrorConstructor() -//│ let TypeError: TypeErrorConstructor -//│ trait TypeErrorConstructor() -//│ let URIError: URIErrorConstructor -//│ trait URIErrorConstructor() -//│ let JSON: error -//│ trait ReadonlyArray[T]() -//│ trait ConcatArray[T]() -//│ let Array: ArrayConstructor -//│ trait ArrayConstructor() -//│ trait TypedPropertyDescriptor[T]() -//│ type PromiseConstructorLike = ((error -> unit) -> (anything -> unit) -> unit) -> error -//│ type Awaited[T] = error -//│ trait ArrayLike[T]() -//│ type Partial[T] = error -//│ type Required[T] = error -//│ type Readonly[T] = error -//│ type Pick[T, K] = error -//│ type Record[K, T] = error -//│ type Exclude[T, U] = error -//│ type Extract[T, U] = error -//│ type Omit[T, K] = error -//│ type NonNullable[T] = T -//│ type Parameters[T] = error -//│ type ConstructorParameters[T] = error -//│ type ReturnType[T] = error -//│ type InstanceType[T] = error -//│ type Uppercase[S] = error -//│ type Lowercase[S] = error -//│ type Capitalize[S] = error -//│ type Uncapitalize[S] = error -//│ trait ThisType[T]() -//│ let ArrayBuffer: ArrayBufferConstructor -//│ trait ArrayBufferTypes() -//│ type ArrayBufferLike = error -//│ trait ArrayBufferConstructor() -//│ trait ArrayBufferView() -//│ let DataView: DataViewConstructor -//│ trait DataViewConstructor() -//│ let Int8Array: Int8ArrayConstructor -//│ trait Int8ArrayConstructor() -//│ trait Uint8Array() -//│ trait Uint8ArrayConstructor() -//│ let Uint8ClampedArray: Uint8ClampedArrayConstructor -//│ trait Uint8ClampedArrayConstructor() -//│ let Int16Array: Int16ArrayConstructor -//│ trait Int16ArrayConstructor() -//│ let Uint16Array: Uint16ArrayConstructor -//│ trait Uint16ArrayConstructor() -//│ let Int32Array: Int32ArrayConstructor -//│ trait Int32ArrayConstructor() -//│ let Uint32Array: Uint32ArrayConstructor -//│ trait Uint32ArrayConstructor() -//│ let Float32Array: Float32ArrayConstructor -//│ trait Float32ArrayConstructor() -//│ let Float64Array: Float64ArrayConstructor -//│ trait Float64ArrayConstructor() -//│ module Intl() { -//│ trait Collator() -//│ trait CollatorOptions() -//│ trait DateTimeFormat() -//│ trait DateTimeFormatOptions() -//│ trait NumberFormat() -//│ trait NumberFormatOptions() -//│ trait ResolvedCollatorOptions() -//│ trait ResolvedDateTimeFormatOptions() -//│ trait ResolvedNumberFormatOptions() -//│ } diff --git a/ts2mls/js/src/test/diff/Enum.mlsi b/ts2mls/js/src/test/diff/Enum.mlsi index ed385f980..1bd8d8389 100644 --- a/ts2mls/js/src/test/diff/Enum.mlsi +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -1,14 +1,5 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Enum { fun pass(c: int): (false) | (true) fun stop(): int fun g(x: int): int } -//│ module Enum() { -//│ fun g: (x: int,) -> int -//│ fun pass: (c: int,) -> bool -//│ fun stop: () -> int -//│ } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 705aa1ce4..02528c5c6 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors import "./Dependency.mlsi" export declare module Export { export module Foo { @@ -20,43 +16,3 @@ export declare module Export { export val G = B export val H = Dependency } -//│ ╔══[ERROR] type identifier not found: IBar -//│ ║ l.8: fun Baz(aa: string): IBar -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait IBar { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.10: val a: string -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: } -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.12: export class Bar extends IBar { -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait IBar cannot be used as a type -//│ ║ l.15: export val baz: IBar -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member Baz is declared but not defined -//│ ║ l.8: fun Baz(aa: string): IBar -//│ ╙── ^^^ -//│ ╔══[ERROR] identifier not found: B -//│ ║ l.20: export val G = B -//│ ╙── ^ -//│ ╔══[ERROR] identifier not found: Dependency -//│ ║ l.21: export val H = Dependency -//│ ╙── ^^^^^^^^^^ -//│ module Export() { -//│ class E() -//│ let F: () -> E -//│ module Foo() { -//│ class Bar() { -//│ let a: string -//│ } -//│ fun Baz: (aa: string,) -> error -//│ trait IBar() -//│ let baz: IBar -//│ } -//│ let G: error -//│ let H: error -//│ fun default: (x: anything,) -> anything -//│ } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 24518fdf7..718eebecb 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Heritage { class A { fun foo(): unit @@ -44,104 +40,3 @@ export declare module Heritage { } class Y extends Five.ROTK {} } -//│ ╔══[ERROR] Member foo is declared but not defined -//│ ║ l.7: fun foo(): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Class inheritance is not supported yet (use mixins) -//│ ║ l.9: class B extends A {} -//│ ╙── ^ -//│ ╔══[ERROR] Member set is declared but not defined -//│ ║ l.11: fun set(x: T): unit -//│ ╙── ^^^ -//│ ╔══[ERROR] Member get is declared but not defined -//│ ║ l.12: fun get(): T -//│ ╙── ^^^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.14: class D extends C {} -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.15: trait Wu { -//│ ║ ^^^^^^^^^^ -//│ ║ l.16: val x: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.17: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Cannot inherit from a type alias -//│ ║ l.18: class WuWu extends Wu { -//│ ╙── ^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.21: trait WuWuWu extends WuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.22: val z: (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.23: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.24: trait Never extends WuWuWu { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: fun w(): nothing -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.26: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member w is declared but not defined -//│ ║ l.25: fun w(): nothing -//│ ╙── ^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.30: class Home extends VG { -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.33: trait O { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.34: fun xx(x: I): I -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.35: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member xx is declared but not defined -//│ ║ l.34: fun xx(x: I): I -//│ ╙── ^^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.36: class OR extends O { -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member xx is declared but not defined -//│ ║ l.37: fun xx(x: R): R -//│ ╙── ^^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.43: export class Y extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.45: class Y extends Five.ROTK {} -//│ ╙── ^^^^^^^^^ -//│ module Heritage() { -//│ class A() { -//│ fun foo: () -> unit -//│ } -//│ class B() -//│ class C[T]() { -//│ fun get: () -> T -//│ fun set: (x: T,) -> unit -//│ } -//│ class D() -//│ module Five() { -//│ class ROTK() { -//│ let wu: string -//│ } -//│ class Y() -//│ } -//│ class Home[T]() { -//│ let y: T -//│ } -//│ trait Never() -//│ trait O[I]() -//│ class OR[R]() { -//│ fun xx: (x: R,) -> R -//│ } -//│ class VG[T]() { -//│ let x: T -//│ } -//│ trait Wu() -//│ class WuWu() { -//│ let y: bool -//│ } -//│ trait WuWuWu() -//│ class Y() -//│ } diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi index 292fdcd00..48d79dde3 100644 --- a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi +++ b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi @@ -1,14 +1,5 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module HighOrderFunc { fun h1(inc: (number) => number, num: number): number fun h2(hint: string): unit => string fun h3(f: (number) => number, g: (number) => number): (number) => number } -//│ module HighOrderFunc() { -//│ fun h1: (inc: number -> number, num: number,) -> number -//│ fun h2: (hint: string,) -> unit -> string -//│ fun h3: (f: number -> number, g: number -> number,) -> number -> number -//│ } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index 2358c9eda..93ba06f98 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors import "./Dependency.mlsi" export declare module Import { val t: number @@ -11,17 +7,3 @@ export declare module Import { val d: Dependency.D val dd: number } -//│ ╔══[ERROR] type identifier not found: Dependency -//│ ║ l.8: val a: Dependency.A -//│ ╙── ^^^^^^^^^^ -//│ /!!!\ Uncaught error: java.lang.Exception: Internal Error: Program reached and unexpected state. -//│ at: mlscript.utils.package$.lastWords(package.scala:205) -//│ at: mlscript.utils.package$.die(package.scala:204) -//│ at: mlscript.ConstraintSolver.$anonfun$lookupMember$1(ConstraintSolver.scala:34) -//│ at: scala.collection.mutable.HashMap.getOrElse(HashMap.scala:436) -//│ at: mlscript.ConstraintSolver.lookupMember(ConstraintSolver.scala:34) -//│ at: mlscript.Typer.go$1(Typer.scala:490) -//│ at: mlscript.Typer.$anonfun$typeType2$11(Typer.scala:503) -//│ at: mlscript.TyperHelpers.trace(TyperHelpers.scala:32) -//│ at: mlscript.Typer.rec$1(Typer.scala:547) -//│ at: mlscript.Typer.$anonfun$typeType2$2(Typer.scala:548) diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 166bb80e6..2f66d2aaf 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module InterfaceMember { trait IFoo { val a: string @@ -40,119 +36,3 @@ export declare module InterfaceMember { fun ttt(x: T): T } } -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.6: trait IFoo { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.7: val a: string -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.8: fun b(x: number): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.9: fun c(): (false) | (true) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.10: fun d(x: string): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member b is declared but not defined -//│ ║ l.8: fun b(x: number): number -//│ ╙── ^ -//│ ╔══[ERROR] Member c is declared but not defined -//│ ║ l.9: fun c(): (false) | (true) -//│ ╙── ^ -//│ ╔══[ERROR] Member d is declared but not defined -//│ ║ l.10: fun d(x: string): unit -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait II { -//│ ║ ^^^^^^^^^^^^^ -//│ ║ l.13: fun test(x: T): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.14: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member test is declared but not defined -//│ ║ l.13: fun test(x: T): number -//│ ╙── ^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.17: trait IEvent { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.18: fun callback(): (number) => unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.19: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member callback is declared but not defined -//│ ║ l.18: fun callback(): (number) => unit -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.20: trait SearchFunc { -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.21: val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.22: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.23: trait StringArray { -//│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.24: val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.26: trait Counter { -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.27: val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.28: val interval: number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.29: fun reset(): unit -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.30: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member reset is declared but not defined -//│ ║ l.29: fun reset(): unit -//│ ╙── ^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.31: trait Simple { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.32: val a: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.33: fun b(x: (false) | (true)): string -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.34: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member b is declared but not defined -//│ ║ l.33: fun b(x: (false) | (true)): string -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.35: trait Simple2 { -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.36: val abc: T -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.37: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.38: trait Next extends Simple {} -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.39: trait TTT { -//│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.40: fun ttt(x: T): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.41: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member ttt is declared but not defined -//│ ║ l.40: fun ttt(x: T): T -//│ ╙── ^^^ -//│ module InterfaceMember() { -//│ trait Counter() -//│ trait IEvent() -//│ trait IFoo() -//│ trait II[T]() -//│ trait Next() -//│ trait SearchFunc() -//│ trait Simple() -//│ trait Simple2[T]() -//│ trait StringArray() -//│ trait TTT[T]() -//│ fun create: () -> {v: number} -//│ fun get: (x: {t: string},) -> string -//│ } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index cc8dad582..08c4789ec 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Intersection { fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit @@ -21,59 +17,3 @@ export declare module Intersection { class B {} fun inter(c: (A) & (B)): (A) & (B) } -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.8: fun over(f: ((number) => string) & ((object) => string)): string -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: IA -//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: IB -//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: IA -//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: IB -//│ ║ l.15: fun iii(x: (IA) & (IB)): (IA) & (IB) -//│ ╙── ^^^^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: B -//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: B -//│ ║ l.22: fun inter(c: (A) & (B)): (A) & (B) -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait IA { -//│ ║ ^^^^^^^^^^ -//│ ║ l.10: val x: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.11: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait IB { -//│ ║ ^^^^^^^^^^ -//│ ║ l.13: val y: number -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.14: } -//│ ╙── ^^^ -//│ module Intersection() { -//│ class A() -//│ class B() -//│ trait IA() -//│ trait IB() -//│ fun arr: forall 'T. (a: MutArray['T],) -> MutArray['T] -//│ fun extend: forall 'T0 'U. (first: 'T0, second: 'U,) -> ('T0 & 'U) -//│ fun foo: (x: anything,) -> unit -//│ fun iii: (x: error,) -> error -//│ fun iiii: forall 'U0. (x: 'U0,) -> 'U0 -//│ fun inter: (c: error,) -> error -//│ fun over: (f: (error | number) -> string,) -> string -//│ fun tt: forall 'U1 'V 'T1. (x: ('U1 & 'V, 'V & 'T1,),) -> ('U1 & 'V, 'V & 'T1,) -//│ fun uu: (x: anything,) -> nothing -//│ } diff --git a/ts2mls/js/src/test/diff/Literal.mlsi b/ts2mls/js/src/test/diff/Literal.mlsi index dc7e84977..7b5d6c310 100644 --- a/ts2mls/js/src/test/diff/Literal.mlsi +++ b/ts2mls/js/src/test/diff/Literal.mlsi @@ -1,14 +1,5 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Literal { val a: {a: "A",b: "B",} val num: {y: 114,} fun foo(x: {xx: "X",}): {yy: "Y",} } -//│ module Literal() { -//│ let a: {a: "A", b: "B"} -//│ fun foo: (x: {xx: "X"},) -> {yy: "Y"} -//│ let num: {y: 114} -//│ } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index ad56c4a0e..c0d083282 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Namespace { module N1 { fun f(x: anything): number @@ -30,76 +26,3 @@ export declare module Namespace { } } } -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.10: fun f(): unit -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.12: trait I { -//│ ║ ^^^^^^^^^ -//│ ║ l.13: fun f(): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.14: } -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.13: fun f(): number -//│ ╙── ^ -//│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.17: fun gg(c: N1.C): N1.C -//│ ╙── ^^ -//│ ╔══[ERROR] Module `N1` is not supported yet. -//│ ║ l.17: fun gg(c: N1.C): N1.C -//│ ╙── ^^ -//│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.18: class BBB extends N1.C {} -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member fff is declared but not defined -//│ ║ l.16: fun fff(x: (false) | (true)): number -//│ ╙── ^^^ -//│ ╔══[ERROR] Member gg is declared but not defined -//│ ║ l.17: fun gg(c: N1.C): N1.C -//│ ╙── ^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.7: fun f(x: anything): number -//│ ╙── ^ -//│ ╔══[ERROR] Member ff is declared but not defined -//│ ║ l.8: fun ff(y: anything): number -//│ ╙── ^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.24: fun f(): unit -//│ ╙── ^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.26: export trait I { -//│ ║ ^^^^^^^^^ -//│ ║ l.27: fun f(): number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.28: } -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.27: fun f(): number -//│ ╙── ^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.22: fun f(x: anything): string -//│ ╙── ^ -//│ module Namespace() { -//│ module AA() { -//│ class C() { -//│ fun f: () -> unit -//│ } -//│ trait I() -//│ module N2() -//│ fun f: (x: anything,) -> string -//│ } -//│ module N1() { -//│ class C() { -//│ fun f: () -> unit -//│ } -//│ trait I() -//│ module N2() { -//│ class BBB() -//│ fun fff: (x: bool,) -> number -//│ fun gg: (c: error,) -> error -//│ } -//│ fun f: (x: anything,) -> number -//│ fun ff: (y: anything,) -> number -//│ } -//│ } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index e5ec2fbed..a10a9f664 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Optional { fun buildName(firstName: string, lastName: (string) | (undefined)): string fun buildName2(firstName: string, lastName: (string) | (undefined)): string @@ -24,46 +20,3 @@ export declare module Optional { } fun boom(b: (B) | (undefined)): anything } -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.15: fun getOrElse(arr: (MutArray) | (undefined)): object -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.15: fun getOrElse(arr: (MutArray) | (undefined)): object -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: ABC -//│ ║ l.17: fun testABC(abc: (ABC) | (undefined)): unit -//│ ╙── ^^^^^ -//│ ╔══[ERROR] type identifier not found: SquareConfig -//│ ║ l.18: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit -//│ ╙── ^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: B -//│ ║ l.25: fun boom(b: (B) | (undefined)): anything -//│ ╙── ^^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.10: trait SquareConfig { -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: val color: (string) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.12: val width: (number) | (undefined) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.13: } -//│ ╙── ^^^ -//│ module Optional() { -//│ class ABC() -//│ class B[T]() { -//│ let b: T -//│ } -//│ trait SquareConfig() -//│ fun boo: (x: anything,) -> unit -//│ fun boom: (b: error | undefined,) -> anything -//│ fun buildName: (firstName: string, lastName: string | undefined,) -> string -//│ fun buildName2: (firstName: string, lastName: string | undefined,) -> string -//│ fun buildName3: (firstName: string, lastName: MutArray[string],) -> string -//│ fun buildName4: (firstName: string, lastName: MutArray[anything],) -> string -//│ fun did: (x: number, f: number -> number | undefined,) -> number -//│ fun err: (msg: (number, string,) | undefined,) -> unit -//│ fun getOrElse: (arr: MutArray[error] | undefined,) -> error -//│ fun testABC: (abc: error | undefined,) -> unit -//│ fun testSquareConfig: (conf: error | undefined,) -> unit -//│ fun toStr: (x: false | number | true | undefined,) -> string -//│ } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index f4788e801..f2e2ea729 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Overload { fun f: ((number) => string) & ((string) => string) class M { @@ -26,48 +22,3 @@ export declare module Overload { } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.12: fun g0: ((MutArray) => string) & ((MutArray) => string) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.13: fun db: ((number) => MutArray) & ((object) => MutArray) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: M -//│ ║ l.15: fun id: ((M) => unit) & ((N) => unit) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: N -//│ ║ l.15: fun id: ((M) => unit) & ((N) => unit) -//│ ╙── ^^^ -//│ ╔══[ERROR] type identifier not found: object -//│ ║ l.19: fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) -//│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member f is declared but not defined -//│ ║ l.22: fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ -//│ ╙── ^ -//│ ╔══[ERROR] Member F is declared but not defined -//│ ║ l.25: fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ -//│ ╙── ^ -//│ module Overload() { -//│ class M() { -//│ let foo: (number | string) -> string -//│ } -//│ class N() -//│ class WWW() { -//│ fun F: (x: anything,) -> anything -//│ } -//│ module XX() { -//│ fun f: (x: anything, n: anything,) -> string -//│ } -//│ fun app: (string -> unit) -> (number | string) -> unit -//│ fun baz: () -> anything -//│ fun create: (false | number | true) -> unit -> bool -//│ fun db: (error | number) -> MutArray[number] -//│ fun doSome: (x: anything,) -> unit -//│ fun f: (number | string) -> string -//│ fun g0: MutArray[out error | string] -> string -//│ fun id: error -> unit -//│ fun op: number -> (false | number | true | undefined) -> unit -//│ fun swap: (number | string, number | string,) -> (number, string,) -//│ fun tst: {z: false | number | true} -> {y: string} -//│ fun u: (error | false | number | true) -> string -//│ } diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index bc82326c7..2d48c0262 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Tuple { fun key(x: (string, (false) | (true), )): string fun value(x: (string, (false) | (true), )): (false) | (true) @@ -20,33 +16,3 @@ export declare module Tuple { class B {} fun swap(x: (A, B, )): (B, A, ) } -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: B -//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: B -//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.21: fun swap(x: (A, B, )): (B, A, ) -//│ ╙── ^ -//│ module Tuple() { -//│ class A() { -//│ let x: number -//│ } -//│ class B() -//│ fun conv: (x: {y: number},) -> ({y: number}, {z: string},) -//│ fun ex: forall 'T 'U. (x: 'T, y: 'U,) -> ('T, 'U, 'T & 'U,) -//│ fun foo: (x: anything,) -> unit -//│ fun key: (x: (string, bool,),) -> string -//│ fun s: (flag: bool,) -> (number | string, false | number | true,) -//│ fun s2: (t: (bool, number | string,),) -> (number | string) -//│ fun swap: (x: (error, error,),) -> (error, error,) -//│ fun third: (x: (number, number, number,),) -> number -//│ fun tupleIt: (x: string,) -> unit -> string -//│ fun twoFunctions: (ff: (number -> number, number -> number,), x: number,) -> number -//│ fun value: (x: (string, bool,),) -> bool -//│ fun vec2: (x: number, y: number,) -> (number, number,) -//│ } diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index a4034a933..19a7eef85 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Type { trait None { val _tag: "None" @@ -32,71 +28,3 @@ export declare module Type { val none: {_tag: "None",} fun some(a: A): (None) | (Some) } -//│ ╔══[ERROR] type identifier not found: None -//│ ║ l.33: fun some(a: A): (None) | (Some) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] type identifier not found: Some -//│ ║ l.33: fun some(a: A): (None) | (Some) -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.6: trait None { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.7: val _tag: "None" -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.8: } -//│ ╙── ^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.9: trait Some { -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.10: val _tag: "Some" -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.11: val value: A -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.12: } -//│ ╙── ^^^ -//│ ╔══[ERROR] trait None cannot be used as a type -//│ ║ l.13: type Option = (None) | (Some) -//│ ╙── ^^^^^^ -//│ ╔══[ERROR] trait Some cannot be used as a type -//│ ║ l.13: type Option = (None) | (Some) -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.16: trait I1 {} -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.17: trait I2 {} -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] trait I1 cannot be used as a type -//│ ║ l.18: type I3 = (I1) & (I2) -//│ ╙── ^^^^ -//│ ╔══[ERROR] trait I2 cannot be used as a type -//│ ║ l.18: type I3 = (I1) & (I2) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Member fb is declared but not defined -//│ ║ l.25: fun fb(b: string): unit -//│ ╙── ^^ -//│ module Type() { -//│ class ABC() -//│ type DEF = ABC -//│ type Func = number -> number -//│ type G = ABC -//│ trait I1() -//│ trait I2() -//│ type I3 = I1 & I2 -//│ module NA() { -//│ type B = string -//│ fun fb: (b: string,) -> unit -//│ } -//│ class NC() { -//│ let b: string -//│ } -//│ trait None() -//│ type Option[A] = None | Some[A] -//│ type S2 = (string, string,) -//│ trait Some[A]() -//│ type SomeInterface = {x: number, y: number} -//│ type StringArray = Array[string] -//│ type TP[A, B, C] = (A, B, C,) -//│ let none: {_tag: "None"} -//│ fun some: (a: anything,) -> error -//│ } diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 8744abc12..d67cd90ef 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module TypeParameter { fun inc(x: T): number class CC { @@ -29,69 +25,3 @@ export declare module TypeParameter { fun fff(p: FFF, s: string): unit fun getFFF(): FFF } -//│ ╔══[ERROR] type identifier not found: Printer -//│ ║ l.14: fun setStringPrinter(p: Printer): unit -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Printer -//│ ║ l.15: fun getStringPrinter(): Printer -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Printer -//│ ║ l.16: fun foo(p: Printer, x: T): T -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: Printer -//│ ║ l.17: fun foo2(p: Printer, x: T): T -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: FFF -//│ ║ l.29: fun fff(p: FFF, s: string): unit -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] type identifier not found: FFF -//│ ║ l.30: fun getFFF(): FFF -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member print is declared but not defined -//│ ║ l.8: fun print(s: T): unit -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member print is declared but not defined -//│ ║ l.12: fun print(t: T): unit -//│ ╙── ^^^^^ -//│ ╔══[ERROR] Member GG is declared but not defined -//│ ║ l.20: fun GG(y: U): T -//│ ╙── ^^ -//│ ╔══[ERROR] traits are not yet supported -//│ ║ l.22: trait I { -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.23: val x: T -//│ ║ ^^^^^^^^^^^^ -//│ ║ l.24: fun GG(y: U): T -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.25: } -//│ ╙── ^^^ -//│ ╔══[ERROR] Member GG is declared but not defined -//│ ║ l.24: fun GG(y: U): T -//│ ╙── ^^ -//│ ╔══[ERROR] Member fff is declared but not defined -//│ ║ l.27: fun fff(x: T): unit -//│ ╙── ^^^ -//│ module TypeParameter() { -//│ class CC[T]() { -//│ fun print: (s: T,) -> unit -//│ } -//│ class F[T]() { -//│ fun GG: (y: anything,) -> T -//│ let x: T -//│ } -//│ class FFF[T]() { -//│ fun fff: (x: T,) -> unit -//│ } -//│ trait I[T]() -//│ class Printer[T]() { -//│ fun print: (t: T,) -> unit -//│ } -//│ fun con: (t: anything,) -> nothing -//│ fun fff: (p: error, s: string,) -> unit -//│ fun foo: forall 'T. (p: error, x: 'T,) -> 'T -//│ fun foo2: forall 'T0. (p: error, x: 'T0,) -> 'T0 -//│ fun getFFF: () -> error -//│ fun getStringPrinter: () -> error -//│ fun inc: (x: anything,) -> number -//│ fun setStringPrinter: (p: error,) -> unit -//│ } diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index 81cf40726..9f178ccca 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Union { fun getString(x: (((string) | (number)) | (false)) | (true)): string fun test(x: (false) | (true)): (string) | (number) @@ -11,12 +7,3 @@ export declare module Union { fun typeVar(x: (T) | (U)): (T) | (U) fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) } -//│ module Union() { -//│ fun get: (arr: MutArray[out number | string],) -> unit -//│ fun get2: (t: (number | string, string,),) -> string -//│ fun getString: (x: false | number | string | true,) -> string -//│ fun run: (f: number -> (number | string),) -> anything -//│ fun test: (x: bool,) -> (number | string) -//│ fun typeVar: forall 'T. (x: 'T,) -> 'T -//│ fun uuuu: (x: false | number | string | true,) -> (false | number | string | true) -//│ } diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index 8e5ab270a..c20c02182 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -1,7 +1,3 @@ -:NewParser -:NewDefs -:NoJS -:AllowTypeErrors export declare module Variables { val URI: string val URI2: string @@ -18,19 +14,3 @@ export declare module Variables { val bar: number } } -//│ module Variables() { -//│ module ABC() { -//│ class DEF() -//│ } -//│ module DD() { -//│ let bar: number -//│ let foo: number -//│ } -//│ class FooBar() -//│ let URI: string -//│ let URI2: string -//│ let bar: false -//│ let d: DEF -//│ let fb: FooBar -//│ let foo: number -//│ } diff --git a/ts2mls/jvm/src/test/scala/ts2mls/TsTypeDiffTests.scala b/ts2mls/jvm/src/test/scala/ts2mls/TsTypeDiffTests.scala deleted file mode 100644 index e919d5683..000000000 --- a/ts2mls/jvm/src/test/scala/ts2mls/TsTypeDiffTests.scala +++ /dev/null @@ -1,8 +0,0 @@ -package ts2mls - -import mlscript.DiffTests - -class TsTypeDiffTests extends DiffTests { - override protected lazy val files = - os.walk(os.pwd/"ts2mls"/"js"/"src"/"test"/"diff").filter(_.toIO.isFile) -} From 7944cb7811da735878c33c2dc7baf6f874303316 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 30 May 2023 12:21:36 +0800 Subject: [PATCH 072/202] WIP: Improve namespace translation --- .../src/main/scala/ts2mls/TSNamespace.scala | 5 ++ .../src/main/scala/ts2mls/TSSourceFile.scala | 47 +++++++++++-------- ts2mls/js/src/test/diff/ES5.mlsi | 6 +-- ts2mls/js/src/test/diff/Heritage.mlsi | 2 +- ts2mls/js/src/test/diff/Namespace.mlsi | 4 +- 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 83081063b..442350e27 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -13,6 +13,11 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { // easier to check the output one by one private val order = ListBuffer.empty[Either[String, String]] + override def toString(): String = parent match { + case Some(parent) if !parent.toString().isEmpty() => s"${parent.toString()}.$name" + case _ => name + } + def derive(name: String, exported: Boolean): TSNamespace = if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it else { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index cdfa4baa3..4480615d4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -90,19 +90,26 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } } - private def getSubstitutionArguments[T <: TSAny](args: TSArray[T]): List[TSType] = + private def getSubstitutionArguments[T <: TSAny](args: TSArray[T])(implicit ns: TSNamespace): List[TSType] = args.foldLeft(List[TSType]())((lst, arg) => arg match { case token: TSTokenObject => lst :+ getObjectType(token.typeNode) case tp: TSTypeObject => lst :+ getObjectType(tp) }) - private def getSymbolFullname(sym: TSSymbolObject): String = + private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) importList.resolveTypeAlias(sym.parent.declaration.symbol.escapedName.replaceAll("\"", ""), sym.escapedName) - else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) sym.escapedName - else s"${getSymbolFullname(sym.parent)}.${sym.escapedName}" + else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) + sym.escapedName + else { + def simplify(symName: String, nsName: String): String = + if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) + else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) + else symName + simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) + } - private def getObjectType(obj: TSTypeObject): TSType = + private def getObjectType(obj: TSTypeObject)(implicit ns: TSNamespace): TSType = if (obj.isMapped) lineHelper.getPos(obj.pos) match { case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) } @@ -123,7 +130,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else TSPrimitiveType(obj.intrinsicName) // the function `getMemberType` can't process function/tuple type alias correctly - private def getTypeAlias(tn: TSNodeObject): TSType = + private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = if (tn.isFunctionLike) getFunctionType(tn) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { @@ -134,17 +141,17 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } // parse string/numeric literal types. we need to add quotes if it is a string literal - private def getLiteralType(tp: TSNodeObject) = + private def getLiteralType(tp: TSNodeObject)(implicit ns: TSNamespace) = TSLiteralType(tp.literal.text, tp.literal.isStringLiteral) // parse object literal types - private def getObjectLiteralMembers(props: TSNodeArray) = + private def getObjectLiteralMembers(props: TSNodeArray)(implicit ns: TSNamespace) = props.foldLeft(Map[String, TSMemberType]())((mp, p) => { mp ++ Map(p.name.escapedText -> TSMemberType(TSLiteralType(p.initToken.text, p.initToken.isStringLiteral))) }) // get the type of variables in classes/named interfaces/anonymous interfaces - private def getMemberType(node: TSNodeObject): TSType = { + private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = { val res: TSType = if (node.isIndexSignature || node.isCallSignature || node.isConstructSignature) lineHelper.getPos(node.pos) match { @@ -158,13 +165,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else res } - private def getTypeParameters(node: TSNodeObject): List[TSTypeParameter] = + private def getTypeParameters(node: TSNodeObject)(implicit ns: TSNamespace): List[TSTypeParameter] = node.typeParameters.foldLeft(List[TSTypeParameter]())((lst, tp) => if (tp.constraint.isUndefined) lst :+ TSTypeParameter(tp.symbol.escapedName, None) else lst :+ TSTypeParameter(tp.symbol.escapedName, Some(getObjectType(tp.constraint.typeNode))) ) - private def getFunctionType(node: TSNodeObject): TSFunctionType = { + private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): TSFunctionType = { val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => ( // in typescript, you can use `this` to explicitly specifies the callee // but it never appears in the final javascript file @@ -176,22 +183,22 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType TSFunctionType(pList, getObjectType(node.returnType), getTypeParameters(node)) } - private def getStructuralType(types: TSTypeArray, isUnion: Boolean): TSType = + private def getStructuralType(types: TSTypeArray, isUnion: Boolean)(implicit ns: TSNamespace): TSType = types.foldLeft[Option[TSType]](None)((prev, cur) => prev match { case None => Some(getObjectType(cur)) case Some(p) => if (isUnion) Some(TSUnionType(p, getObjectType(cur))) else Some(TSIntersectionType(p, getObjectType(cur))) }).get - private def getTupleElements(elements: TSTypeArray): List[TSType] = + private def getTupleElements(elements: TSTypeArray)(implicit ns: TSNamespace): List[TSType] = elements.foldLeft(List[TSType]())((lst, ele) => lst :+ getObjectType(ele)) - private def getHeritageList(node: TSNodeObject): List[TSType] = + private def getHeritageList(node: TSNodeObject)(implicit ns: TSNamespace): List[TSType] = node.heritageClauses.foldLeftIndexed(List[TSType]())((lst, h, index) => lst :+ getObjectType(h.types.get(index).typeNode) ) - private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType]): Map[String, TSMemberType] = mem match { + private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType])(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { case func: TSFunctionType => { if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, node.modifier)) else { // deal with functions overloading @@ -214,7 +221,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) } - private def getClassMembersType(list: TSNodeArray, requireStatic: Boolean): Map[String, TSMemberType] = + private def getClassMembersType(list: TSNodeArray, requireStatic: Boolean)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => { val name = p.symbol.escapedName @@ -227,7 +234,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else mp }) - private def getConstructorList(members: TSNodeArray): List[TSParameterType] = + private def getConstructorList(members: TSNodeArray)(implicit ns: TSNamespace): List[TSParameterType] = members.foldLeft(List[TSParameterType]())((lst, mem) => { val name = mem.symbol.escapedName @@ -236,14 +243,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType res :+ TSParameterType(p.symbol.escapedName, getMemberType(p))) }) - private def getInterfacePropertiesType(list: TSNodeArray): Map[String, TSMemberType] = + private def getInterfacePropertiesType(list: TSNodeArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => addMember(getMemberType(p), p, p.symbol.escapedName, mp)) - private def getAnonymousPropertiesType(list: TSSymbolArray): Map[String, TSMemberType] = + private def getAnonymousPropertiesType(list: TSSymbolArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => mp ++ Map(p.escapedName -> TSMemberType(if (p.`type`.isUndefined) getMemberType(p.declaration) else getObjectType(p.`type`)))) - private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean): TSType = + private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean)(implicit ns: TSNamespace): TSType = if (isClass) TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), getTypeParameters(node), getHeritageList(node), getConstructorList(node.members)) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index af81b3310..a77ea4792 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -386,7 +386,7 @@ module Intl { } export trait Collator { fun compare(x: string, y: string): number - fun resolvedOptions(): Intl.ResolvedCollatorOptions + fun resolvedOptions(): ResolvedCollatorOptions } export trait NumberFormatOptions { val minimumSignificantDigits: (number) | (undefined) @@ -414,7 +414,7 @@ module Intl { } export trait NumberFormat { fun format(value: number): string - fun resolvedOptions(): Intl.ResolvedNumberFormatOptions + fun resolvedOptions(): ResolvedNumberFormatOptions } export trait DateTimeFormatOptions { val minute: ((string) | (string)) | (undefined) @@ -449,6 +449,6 @@ module Intl { } export trait DateTimeFormat { fun format(date: ((number) | (Date)) | (undefined)): string - fun resolvedOptions(): Intl.ResolvedDateTimeFormatOptions + fun resolvedOptions(): ResolvedDateTimeFormatOptions } } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 718eebecb..a68ce2a96 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -36,7 +36,7 @@ export declare module Heritage { export class ROTK { val wu: string } - export class Y extends Five.ROTK {} + export class Y extends ROTK {} } class Y extends Five.ROTK {} } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index c0d083282..2ed0afb8e 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -10,8 +10,8 @@ export declare module Namespace { } export module N2 { fun fff(x: (false) | (true)): number - fun gg(c: N1.C): N1.C - class BBB extends N1.C {} + fun gg(c: C): C + class BBB extends C {} } } module AA { From 38d88dd43682d39137d33b894b4ab6b3552fcf93 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 30 May 2023 13:48:07 +0800 Subject: [PATCH 073/202] WIP: Invoke ts2mls when importing from ts --- driver/js/src/main/scala/driver/Driver.scala | 8 ++++++-- driver/js/src/test/js/MyPrint.js | 9 +++++++++ driver/js/src/test/js/TS.js | 18 ++++++++++++++++++ driver/js/src/test/mlscript/MyPrint.mlsi | 6 ++++++ driver/js/src/test/mlscript/MyPrint.ts | 11 +++++++++++ driver/js/src/test/mlscript/TS.mls | 5 +++++ driver/js/src/test/mlscript/TS.mlsi | 6 ++++++ .../test/scala/driver/DriverDiffTests.scala | 1 + shared/src/main/scala/mlscript/JSBackend.scala | 3 ++- .../main/scala/mlscript/codegen/Codegen.scala | 7 +++++-- .../js/src/main/scala/ts2mls/TSProgram.scala | 3 ++- 11 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 driver/js/src/test/js/MyPrint.js create mode 100644 driver/js/src/test/js/TS.js create mode 100644 driver/js/src/test/mlscript/MyPrint.mlsi create mode 100644 driver/js/src/test/mlscript/MyPrint.ts create mode 100644 driver/js/src/test/mlscript/TS.mls create mode 100644 driver/js/src/test/mlscript/TS.mlsi diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 8ffa040e8..06f561bf1 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -10,7 +10,7 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} -import ts2mls.TSModuleResolver +import ts2mls.{TSModuleResolver, TSProgram} class Driver(options: DriverOptions) { import Driver._ @@ -134,7 +134,11 @@ class Driver(options: DriverOptions) { stack: List[String] ): Boolean = { val mlsiFile = normalize(s"${options.path}/${file.interfaceFilename}") - if (file.filename.endsWith(".ts")) {} // TODO: invoke ts2mls + if (file.filename.endsWith(".ts")) { + val tsprog = TSProgram(file.filename, true) + tsprog.generate(file.workDir, file.workDir) + return true + } parseAndRun(file.filename, { case (definitions, _, imports, _) => { val depList = imports.map { diff --git a/driver/js/src/test/js/MyPrint.js b/driver/js/src/test/js/MyPrint.js new file mode 100644 index 000000000..c5d6864d3 --- /dev/null +++ b/driver/js/src/test/js/MyPrint.js @@ -0,0 +1,9 @@ +export class DatePrint { + constructor(p) { + this.prefix = p; + } + print(msg) { + let date = new Date(1145141919810); + console.log(`[${this.prefix}] ${msg}. (${date})`); + } +} diff --git a/driver/js/src/test/js/TS.js b/driver/js/src/test/js/TS.js new file mode 100644 index 000000000..9a3b176ac --- /dev/null +++ b/driver/js/src/test/js/TS.js @@ -0,0 +1,18 @@ +import * as MyPrint from "./MyPrint.js" + +const TS = new class TS { + #tspt; + get tspt() { return this.#tspt; } + #printer; + get printer() { return this.#printer; } + constructor() { + } + $init() { + this.#tspt = MyPrint.DatePrint; + const tspt = this.#tspt; + this.#printer = tspt("love from ts"); + const printer = this.#printer; + printer.print("hello world!"); + } +}; +TS.$init(); diff --git a/driver/js/src/test/mlscript/MyPrint.mlsi b/driver/js/src/test/mlscript/MyPrint.mlsi new file mode 100644 index 000000000..629b3c90d --- /dev/null +++ b/driver/js/src/test/mlscript/MyPrint.mlsi @@ -0,0 +1,6 @@ +export declare module MyPrint { + export class DatePrint { + constructor(p: string) + fun print(msg: string): unit + } +} diff --git a/driver/js/src/test/mlscript/MyPrint.ts b/driver/js/src/test/mlscript/MyPrint.ts new file mode 100644 index 000000000..51f09eca7 --- /dev/null +++ b/driver/js/src/test/mlscript/MyPrint.ts @@ -0,0 +1,11 @@ +export class DatePrint { + private prefix: string + constructor(p: string) { + this.prefix = p + } + + print(msg: string) { + let date = new Date(1145141919810) + console.log(`[${this.prefix}] ${msg}. (${date})`) + } +} diff --git a/driver/js/src/test/mlscript/TS.mls b/driver/js/src/test/mlscript/TS.mls new file mode 100644 index 000000000..4b132a32a --- /dev/null +++ b/driver/js/src/test/mlscript/TS.mls @@ -0,0 +1,5 @@ +import "./MyPrint.ts" + +let tspt = MyPrint.DatePrint +let printer = new tspt("love from ts") +printer.print("hello world!") diff --git a/driver/js/src/test/mlscript/TS.mlsi b/driver/js/src/test/mlscript/TS.mlsi new file mode 100644 index 000000000..10387c730 --- /dev/null +++ b/driver/js/src/test/mlscript/TS.mlsi @@ -0,0 +1,6 @@ +import "./MyPrint.mlsi" +declare module TS() { + let tspt: error + let printer: error + error +} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 25dcd320e..585b8b13d 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -63,6 +63,7 @@ object DriverDiffTests { entry("Cycle2"), entry("Self", true), entry("C", true), + entry("TS", true), // TODO: merge ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 667039cd9..f9aa9ff3c 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1046,7 +1046,8 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { case Import(path) => JSImport( path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")), - path.substring(0, path.lastIndexOf(".")) + ".js" // TODO: node_modules + path.substring(0, path.lastIndexOf(".")) + ".js", // TODO: node_modules + path.endsWith(".ts") ) } diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index bf5b0e60b..c9bcdf03a 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -910,9 +910,12 @@ final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { SourceCode(s"export ${moduleDecl.toSourceCode}") } -final case class JSImport(name: Str, path: Str) extends JSStmt { +final case class JSImport(name: Str, path: Str, fromTS: Bool) extends JSStmt { def toSourceCode: SourceCode = - SourceCode(s"import { $name } from \"$path\"\n") + if (fromTS) + SourceCode(s"import * as $name from \"$path\"\n") + else + SourceCode(s"import { $name } from \"$path\"\n") } final case class JSComment(text: Str) extends JSStmt { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 450394f8f..625620ba0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -31,7 +31,8 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { val moduleName = TSImport.getModuleName(filename, false) val relatedPath = - if (filename.startsWith(workDir)) filename.substring(workDir.length() + 1, filename.lastIndexOf('/') + 1) + if (filename.startsWith(workDir)) + TSModuleResolver.relative(TSModuleResolver.resolve(workDir), TSModuleResolver.dirname(filename)) else throw new AssertionError(s"wrong work dir $workDir") def toTSFile(filename: String) = // TODO: node_modules From fd7b8c958b6a5cdbf40bd450bb13b19691e337d2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 2 Jun 2023 14:01:20 +0800 Subject: [PATCH 074/202] WIP: Refactor code --- driver/js/src/main/scala/driver/Driver.scala | 31 ++--------- .../test/scala/driver/DriverDiffTests.scala | 3 +- package-lock.json | 17 ++++++ package.json | 3 +- .../src/main/scala/ts2mls/JSFileSystem.scala | 29 ++++++++++ .../js/src/main/scala/ts2mls/JSWriter.scala | 40 ++++---------- .../main/scala/ts2mls/TSCompilerInfo.scala | 24 ++++++++- .../js/src/main/scala/ts2mls/TSModules.scala | 38 +++++++------ .../js/src/main/scala/ts2mls/TSProgram.scala | 54 +++++++++---------- .../src/main/scala/ts2mls/TSSourceFile.scala | 25 ++++----- .../scala/ts2mls/TSTypeGenerationTests.scala | 9 +++- 11 files changed, 147 insertions(+), 126 deletions(-) create mode 100644 ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 74465ec4f..87957dcb9 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -1,9 +1,6 @@ package driver import scala.scalajs.js -import js.Dynamic.{global => g} -import js.DynamicImplicits._ -import js.JSConverters._ import mlscript.utils._ import mlscript._ import mlscript.utils.shorthands._ @@ -14,6 +11,7 @@ import ts2mls.{TSModuleResolver, TSProgram} class Driver(options: DriverOptions) { import Driver._ + import ts2mls.JSFileSystem._ private val typer = new mlscript.Typer( @@ -54,7 +52,7 @@ class Driver(options: DriverOptions) { } def genPackageJson(): Unit = - if (!fs.existsSync(s"${options.outputDir}/package.json")) { + if (exists(s"${options.outputDir}/package.json")) { val content = """{ "type": "module" }""" // TODO: more settings? writeFile(s"${options.outputDir}/package.json", content) } @@ -134,9 +132,9 @@ class Driver(options: DriverOptions) { stack: List[String] ): Boolean = { val mlsiFile = normalize(s"${options.path}/${file.interfaceFilename}") - if (file.filename.endsWith(".ts")) { - val tsprog = TSProgram(file.filename, true) - tsprog.generate(file.workDir, file.workDir) + if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { + val tsprog = TSProgram(s"${file.workDir}/${file.localFilename}", file.workDir, true, N) // TODO + tsprog.generate(file.workDir) return true } parseAndRun(file.filename, { @@ -232,25 +230,6 @@ class Driver(options: DriverOptions) { object Driver { def apply(options: DriverOptions) = new Driver(options) - private val fs = g.require("fs") // must use fs module to manipulate files in JS - - def readFile(filename: String) = - if (!fs.existsSync(filename)) None - else Some(fs.readFileSync(filename).toString) - - private def writeFile(filename: String, content: String) = { - val dir = TSModuleResolver.dirname(filename) - if (!fs.existsSync(dir)) fs.mkdirSync(dir, js.Dictionary("recursive" -> true)) - fs.writeFileSync(filename, content) - } - - private def getModificationTime(filename: String): String = - if (!fs.existsSync(filename)) "" - else { - val state = fs.statSync(filename) - state.mtimeMs.toString - } - private def report(msg: String): Unit = System.err.println(msg) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 585b8b13d..1d316d078 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -8,6 +8,7 @@ import mlscript.utils._, shorthands._ class DriverDiffTests extends AnyFunSuite { import DriverDiffTests._ + import ts2mls.JSFileSystem._ testCases.foreach { case TestOption(filename, workDir, execution, expectError) => test(filename) { @@ -21,7 +22,7 @@ class DriverDiffTests extends AnyFunSuite { if (!expectError) execution match { case Some((executionFile, outputFile)) => val output = cp.execSync(s"node $executionFile").toString() - val original = Driver.readFile(outputFile).getOrElse("") + val original = readFile(outputFile).getOrElse("") if (original =/= output) fs.writeFileSync(outputFile, output) case None => () } diff --git a/package-lock.json b/package-lock.json index 636e503a3..44596f1b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,9 +5,21 @@ "packages": { "": { "dependencies": { + "json5": "^2.2.3", "typescript": "^4.7.4" } }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/typescript": { "version": "4.7.4", "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", @@ -22,6 +34,11 @@ } }, "dependencies": { + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, "typescript": { "version": "4.7.4", "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", diff --git a/package.json b/package.json index bc371fcd6..e8c64f3f1 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "typescript": "^4.7.4" + "typescript": "^4.7.4", + "json5": "^2.2.3" } } diff --git a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala new file mode 100644 index 000000000..1d297127f --- /dev/null +++ b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala @@ -0,0 +1,29 @@ +package ts2mls + +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import js.JSConverters._ + +object JSFileSystem { + private val fs = g.require("fs") // must use fs module to manipulate files in JS + + def exists(filename: String): Boolean = fs.existsSync(filename) + + def readFile(filename: String): Option[String] = + if (!exists(filename)) None + else Some(fs.readFileSync(filename).toString) + + def writeFile(filename: String, content: String): Unit = { + val dir = TSModuleResolver.dirname(filename) + if (!exists(dir)) fs.mkdirSync(dir, js.Dictionary("recursive" -> true)) + fs.writeFileSync(filename, content) + } + + def getModificationTime(filename: String): String = + if (!exists(filename)) "" + else { + val state = fs.statSync(filename) + state.mtimeMs.toString + } +} diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 917d5bfb0..e65383b51 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -4,47 +4,25 @@ import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ import mlscript.utils._ +import scala.collection.mutable.StringBuilder class JSWriter(filename: String) { - import JSWriter._ - - // Create an empty file if it does not exists. - if (!fs.existsSync(filename)) fs.writeFileSync(filename, "") + import JSFileSystem._ - // r+: Open file for reading and writing. An exception occurs if the file does not exist. - // See https://nodejs.org/api/fs.html#file-system-flags to get more details. - private val out = fs.openSync(filename, "r+") - - private var fileSize = 0 // how many bytes we've written in the file - private var needTruncate = false + private val buffer = new StringBuilder() - // writeln(":NewParser\n:NewDefs\n:NoJS\n:AllowTypeErrors") - - def writeln(str: String) = { + def writeln(str: String): Unit = { val strln = str + "\n" - val buffer = createBuffer(strln.length) - fs.readSync(out, buffer, 0, strln.length) - - // override when the content is different - if (strln =/= buffer.toString()) { - fs.writeSync(out, strln, fileSize) // `fileSize` is the offset from the beginning of the file - needTruncate = true // if the file has been modified, we need to truncate the file to keep it clean - } - - fileSize += strln.length + buffer ++= strln } - def close() = { - if (needTruncate) fs.truncateSync(out, fileSize) // remove other content to keep the file from chaos - - fs.closeSync(out) + def close(): Unit = { + val str = buffer.toString() + val origin = readFile(filename).getOrElse("") + if (str =/= origin) writeFile(filename, str) } } object JSWriter { - private val fs = g.require("fs") // must use fs module to manipulate files in JS - def apply(filename: String) = new JSWriter(filename) - - private def createBuffer(length: Int) = g.Buffer.alloc(length) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 8ec5b5f78..42731c218 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -7,16 +7,35 @@ import js.JSConverters._ import ts2mls.types._ object TypeScript { - private val ts: js.Dynamic = try g.require("typescript") catch { + private def load(moduleName: String) = try g.require(moduleName) catch { case _ : Throwable => { - System.err.println("Cannot find typescript in the current directory. Please install by running \"npm install\".") + System.err.println(s"Cannot find $moduleName in the current directory. Please install by running \"npm install\".") val process = g.require("process") process.exit(-1) } } + private val ts: js.Dynamic = load("typescript") + private val json: js.Dynamic = load("json5") + private val resolver = g.require.resolve + def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { + val config = filename.fold[js.Any](js.Dictionary())(filename => { + val content = JSFileSystem.readFile(TSModuleResolver.normalize(s"$basePath/$filename")).getOrElse("") + json.parse(content) + }) + val name = filename.getOrElse("tsconfig.json") + ts.parseJsonConfigFileContent(config, ts.sys, basePath, null, name) + } + + def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): Option[String] = { + val res = ts.resolveModuleName(importName, containingName, config, ts.sys) + if (!IsUndefined(res.resolvedModule) && !IsUndefined(res.resolvedModule.resolvedFileName)) + Some(res.resolvedModule.resolvedFileName.toString()) + else None + } + val typeFlagsEnumLike = ts.TypeFlags.EnumLike val typeFlagsObject = ts.TypeFlags.Object val typeFlagsTypeParameter = ts.TypeFlags.TypeParameter @@ -180,6 +199,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val elements = TSNodeArray(node.elements) lazy val propertyName = TSIdentifierObject(node.propertyName) lazy val exportClause = TSNodeObject(node.exportClause) + lazy val resolvedPath: String = node.resolvedPath.toString() } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 9338a9feb..8fef3b72d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -8,11 +8,10 @@ final case class TSReExport(alias: String, filename: String, memberName: Option[ trait TSImport { self => val filename: String - val `import`: String def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(filename, _, _) => Some(s"${TSImport.getModuleName(filename, false)}.$name") - case TSSingleImport(filename, _, items) => + case TSFullImport(filename, _) => Some(s"${TSImport.getModuleName(filename, false)}.$name") + case TSSingleImport(filename, items) => items.collect { case (originalName, _) if (originalName === name) => s"${TSImport.getModuleName(filename, false)}.$name" @@ -20,9 +19,9 @@ trait TSImport { self => } def createAlias: List[TSReExport] = self match { - case TSFullImport(filename, _, alias) => + case TSFullImport(filename, alias) => TSReExport(alias, filename, None) :: Nil - case TSSingleImport(filename, _, items) => + case TSSingleImport(filename, items) => items.map{ case (name, alias) => TSReExport(alias.getOrElse(name), filename, Some(name)) } @@ -30,7 +29,7 @@ trait TSImport { self => def generate(ns: TSNamespace, writer: JSWriter): Unit = self match { case _: TSFullImport => ns.generate(writer, " ") - case TSSingleImport(_, _, items) => items.foreach((pair) => pair match { + case TSSingleImport(_, items) => items.foreach((pair) => pair match { case (name, _) => writer.writeln(Converter.convert(ns.get(name), true)(" ")) }) } @@ -45,34 +44,33 @@ object TSImport { else filename } -// import * as alias from "`import`"; // filename is absolute -case class TSFullImport(filename: String, `import`: String, alias: String) extends TSImport -// import { s1, s2 as a } from "`import`"; // filename is absolute -// export { s1, s2 as a } from "`import`"; // filename is absolute -case class TSSingleImport(filename: String, `import`: String, items: List[(String, Option[String])]) extends TSImport +// import * as alias from "filename" +case class TSFullImport(filename: String, alias: String) extends TSImport +// import { s1, s2 as a } from "filename" +// export { s1, s2 as a } from "filename" +case class TSSingleImport(filename: String, items: List[(String, Option[String])]) extends TSImport class TSImportList { private val singleList = new HashMap[String, TSSingleImport]() private val fullList = new HashMap[String, TSFullImport]() - def +=(imp: TSImport): Unit = imp match { - case imp @ TSFullImport(filename, _, _) => fullList.addOne((filename, imp)) - case imp @ TSSingleImport(filename, impName, items) => - if (singleList.contains(filename)) - singleList.update(filename, TSSingleImport(filename, impName, singleList(filename).items ::: items)) - else singleList.addOne((filename, imp)) + def add(fullPath: String, imp: TSImport): Unit = imp match { + case imp: TSFullImport => fullList.addOne((fullPath, imp)) + case imp @ TSSingleImport(filename, items) => + if (singleList.contains(fullPath)) + singleList.update(fullPath, TSSingleImport(filename, singleList(fullPath).items ::: items)) + else singleList.addOne((fullPath, imp)) } def resolveTypeAlias(modulePath: String, name: String): String = { - val absPath = TSModuleResolver.resolve(modulePath) val singleAlias = - if (singleList.contains(absPath)) singleList(absPath).resolveTypeAlias(name) + if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) else None singleAlias match { case Some(alias) => alias case None => val fullAlias = - if (fullList.contains(absPath)) fullList(absPath).resolveTypeAlias(name) + if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) else None fullAlias.getOrElse(throw new AssertionError(s"unresolved imported name $name at $modulePath.")) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 625620ba0..51206aa85 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -10,77 +10,74 @@ import scala.collection.mutable.{HashSet, HashMap} // import * as TopLevelModuleName from "filename" // for es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files -class TSProgram(filename: String, uesTopLevelModule: Boolean) { +class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) { private val program = TypeScript.createProgram(Seq(filename)) private val cache = new HashMap[String, TSNamespace]() + private implicit val configContent = TypeScript.parseOption(workDir, tsconfig) // check if file exists if (!program.fileExists(filename)) throw new Exception(s"file ${filename} doesn't exist.") - implicit val checker = TSTypeChecker(program.getTypeChecker()) + private implicit val checker = TSTypeChecker(program.getTypeChecker()) - def generate(workDir: String, targetPath: String): Unit = generate(filename, workDir, targetPath)(List()) + def generate(targetPath: String): Unit = + generate(TSModuleResolver.resolve(filename), targetPath)(Nil) - def generate(filename: String, workDir: String, targetPath: String)(implicit stack: List[String]): Unit = { + private def generate(filename: String, targetPath: String)(implicit stack: List[String]): Unit = { val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList - val absName = TSModuleResolver.resolve(filename) - cache.addOne(absName, globalNamespace) + cache.addOne(filename, globalNamespace) val moduleName = TSImport.getModuleName(filename, false) - val relatedPath = - if (filename.startsWith(workDir)) - TSModuleResolver.relative(TSModuleResolver.resolve(workDir), TSModuleResolver.dirname(filename)) - else throw new AssertionError(s"wrong work dir $workDir") + val relatedPath = TSModuleResolver.relative(workDir, TSModuleResolver.dirname(filename)) - def toTSFile(filename: String) = // TODO: node_modules - if (!filename.endsWith(".ts")) s"$filename.ts" - else filename - val (cycleList, otherList) = importList.partition(imp => stack.contains(toTSFile(imp.filename))) + def resolve(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") + + val (cycleList, otherList) = + importList.partition(imp => stack.contains(resolve(imp.filename))) otherList.foreach(imp => { - val newFilename = toTSFile(imp.filename) - generate(newFilename, TSModuleResolver.resolve(workDir), targetPath)(absName :: stack) + generate(resolve(imp.filename), targetPath)(filename :: stack) }) var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") val imported = new HashSet[String]() otherList.foreach(imp => { - val name = TSImport.getModuleName(imp.`import`, true) + val name = TSImport.getModuleName(imp.filename, true) if (!imported(name)) { imported += name writer.writeln(s"""import "$name.mlsi"""") } }) cycleList.foreach(imp => { - val newFilename = toTSFile(imp.filename) - writer.writeln(s"declare module ${TSImport.getModuleName(imp.`import`, false)} {") - cache(newFilename).generate(writer, " ") + writer.writeln(s"declare module ${TSImport.getModuleName(imp.filename, false)} {") + cache(resolve(imp.filename)).generate(writer, " ") writer.writeln("}") }) reExportList.foreach { - case TSReExport(alias, filename, memberName) => - if (!cache.contains(toTSFile(filename))) - throw new AssertionError(s"unexpected re-export from ${toTSFile(filename)}") + case TSReExport(alias, imp, memberName) => + val absName = resolve(imp) + if (!cache.contains(absName)) + throw new AssertionError(s"unexpected re-export from ${imp}") else { - val ns = cache(toTSFile(filename)) - val moduleName = TSImport.getModuleName(filename, false) + val ns = cache(absName) + val moduleName = TSImport.getModuleName(absName, false) memberName.fold( globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true) )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true))) } } - generate(writer, otherList, globalNamespace, moduleName) + generate(writer, globalNamespace, moduleName) writer.close() } - private def generate(writer: JSWriter, importList: List[TSImport], globalNamespace: TSNamespace, moduleName: String): Unit = + private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String): Unit = if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { writer.writeln(s"export declare module $moduleName {") @@ -90,5 +87,6 @@ class TSProgram(filename: String, uesTopLevelModule: Boolean) { } object TSProgram { - def apply(filename: String, uesTopLevelModule: Boolean) = new TSProgram(filename, uesTopLevelModule) + def apply(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) = + new TSProgram(filename, workDir, uesTopLevelModule, tsconfig) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 4480615d4..029db755a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -6,15 +6,11 @@ import types._ import mlscript.utils._ import scala.collection.mutable.{ListBuffer, HashMap} -class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) { +class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = TSImportList() private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() - private val originalFileName = sf.originalFileName.toString() - private val rootPath = - resolvedPath.substring(0, resolvedPath.length() - originalFileName.length()) + - originalFileName.substring(0, originalFileName.lastIndexOf("/") + 1) TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) @@ -63,10 +59,9 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (!clause.isUndefined) { val bindings = clause.namedBindings val importName = moduleSpecifier.text - val absPath = - if (TSModuleResolver.isLocal(moduleSpecifier.text)) - TSModuleResolver.resolve(rootPath + importName) - else moduleSpecifier.text // TODO: node_module? + val fullPath = TypeScript.resolveModuleName(importName, resolvedPath, config).getOrElse( + throw new AssertionError(s"unexpected import $importName.") + ) def run(node: TSNodeObject): Unit = if (!node.elements.isUndefined) { val list = node.elements.mapToList(ele => @@ -75,14 +70,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) - val imp = TSSingleImport(absPath, importName, list) + val imp = TSSingleImport(importName, list) if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export - importList += imp + importList.add(fullPath, imp) } else if (!node.name.isUndefined) { - val imp = TSFullImport(absPath, importName, node.name.escapedText) + val imp = TSFullImport(importName, node.name.escapedText) if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export - importList += imp + importList.add(fullPath, imp) } if (!bindings.isUndefined) run(bindings) @@ -98,7 +93,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) - importList.resolveTypeAlias(sym.parent.declaration.symbol.escapedName.replaceAll("\"", ""), sym.escapedName) + importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) sym.escapedName else { @@ -313,6 +308,6 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } object TSSourceFile { - def apply(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker) = + def apply(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker, config: js.Dynamic) = new TSSourceFile(sf, global) } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 8a68c28f7..1f49036fc 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -7,8 +7,13 @@ class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ testsData.foreach((filename) => test(filename) { - val program = TSProgram(tsPath(filename), !directlyImportedSet.contains(filename)) - program.generate("ts2mls/js/src/test/typescript", "ts2mls/js/src/test/diff") + val program = TSProgram( + tsPath(filename), + "ts2mls/js/src/test/typescript", + !directlyImportedSet.contains(filename), + None + ) + program.generate("ts2mls/js/src/test/diff") }) } From ca9dcd58f849e2c2b15c5b059529eb33b76b2ba9 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 2 Jun 2023 16:10:11 +0800 Subject: [PATCH 075/202] WIP: Adjust structures for tsconfig --- driver/js/src/main/scala/driver/Driver.scala | 2 +- .../src/main/scala/driver/DriverOptions.scala | 10 ++++--- .../js/src/main/scala/driver/FileInfo.scala | 11 +++---- driver/js/src/test/js/MyPrint.js | 9 ------ driver/js/src/test/mlscript/TS.mlsi | 6 ---- driver/js/src/test/{ => projects}/js/A.js | 0 driver/js/src/test/{ => projects}/js/B.js | 0 driver/js/src/test/{ => projects}/js/C.js | 0 .../js/src/test/{ => projects}/js/Cycle1.js | 0 .../js/src/test/{ => projects}/js/Cycle2.js | 0 .../js/src/test/{ => projects}/js/Opened.js | 0 .../js/src/test/{ => projects}/js/Simple.js | 0 driver/js/src/test/{ => projects}/js/TS.js | 0 .../src/test/{ => projects}/js/package.json | 0 .../src/test/{ => projects}/js/tools/Inc.js | 0 .../js/src/test/projects/js/ts/ConfigGen.js | 13 ++++++++ driver/js/src/test/projects/js/ts/MyPrint.js | 14 +++++++++ .../mlscript/.interfaces}/A.mlsi | 0 .../mlscript/.interfaces}/B.mlsi | 0 .../mlscript/.interfaces}/C.mlsi | 0 .../mlscript/.interfaces}/Cycle1.mlsi | 0 .../mlscript/.interfaces}/Cycle2.mlsi | 0 .../mlscript/.interfaces}/Opened.mlsi | 0 .../mlscript/.interfaces}/Simple.mlsi | 0 .../mlscript/.interfaces}/tools/Inc.mlsi | 0 .../js/src/test/{ => projects}/mlscript/A.mls | 0 .../js/src/test/{ => projects}/mlscript/B.mls | 0 .../js/src/test/{ => projects}/mlscript/C.mls | 0 .../test/{ => projects}/mlscript/Cycle1.mls | 0 .../test/{ => projects}/mlscript/Cycle2.mls | 0 .../test/{ => projects}/mlscript/Opened.mls | 0 .../js/src/test/projects/mlscript/Output.mls | 4 +++ .../js/src/test/projects/mlscript/Output2.mls | 7 +++++ .../src/test/{ => projects}/mlscript/Self.mls | 0 .../test/{ => projects}/mlscript/Simple.mls | 0 .../src/test/{ => projects}/mlscript/TS.mls | 2 +- .../{ => projects}/mlscript/tools/Inc.mls | 0 driver/js/src/test/projects/package-lock.json | 30 +++++++++++++++++++ driver/js/src/test/projects/package.json | 5 ++++ driver/js/src/test/projects/ts/ConfigGen.ts | 11 +++++++ .../{mlscript => projects/ts}/MyPrint.mlsi | 0 .../test/{mlscript => projects/ts}/MyPrint.ts | 0 driver/js/src/test/projects/tsconfig.json | 6 ++++ .../test/scala/driver/DriverDiffTests.scala | 26 +++++++++------- 44 files changed, 120 insertions(+), 36 deletions(-) delete mode 100644 driver/js/src/test/js/MyPrint.js delete mode 100644 driver/js/src/test/mlscript/TS.mlsi rename driver/js/src/test/{ => projects}/js/A.js (100%) rename driver/js/src/test/{ => projects}/js/B.js (100%) rename driver/js/src/test/{ => projects}/js/C.js (100%) rename driver/js/src/test/{ => projects}/js/Cycle1.js (100%) rename driver/js/src/test/{ => projects}/js/Cycle2.js (100%) rename driver/js/src/test/{ => projects}/js/Opened.js (100%) rename driver/js/src/test/{ => projects}/js/Simple.js (100%) rename driver/js/src/test/{ => projects}/js/TS.js (100%) rename driver/js/src/test/{ => projects}/js/package.json (100%) rename driver/js/src/test/{ => projects}/js/tools/Inc.js (100%) create mode 100644 driver/js/src/test/projects/js/ts/ConfigGen.js create mode 100644 driver/js/src/test/projects/js/ts/MyPrint.js rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/A.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/B.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/C.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/Cycle1.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/Cycle2.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/Opened.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/Simple.mlsi (100%) rename driver/js/src/test/{mlscript => projects/mlscript/.interfaces}/tools/Inc.mlsi (100%) rename driver/js/src/test/{ => projects}/mlscript/A.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/B.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/C.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/Cycle1.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/Cycle2.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/Opened.mls (100%) create mode 100644 driver/js/src/test/projects/mlscript/Output.mls create mode 100644 driver/js/src/test/projects/mlscript/Output2.mls rename driver/js/src/test/{ => projects}/mlscript/Self.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/Simple.mls (100%) rename driver/js/src/test/{ => projects}/mlscript/TS.mls (79%) rename driver/js/src/test/{ => projects}/mlscript/tools/Inc.mls (100%) create mode 100644 driver/js/src/test/projects/package-lock.json create mode 100644 driver/js/src/test/projects/package.json create mode 100644 driver/js/src/test/projects/ts/ConfigGen.ts rename driver/js/src/test/{mlscript => projects/ts}/MyPrint.mlsi (100%) rename driver/js/src/test/{mlscript => projects/ts}/MyPrint.ts (100%) create mode 100644 driver/js/src/test/projects/tsconfig.json diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 87957dcb9..db0f188af 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -42,7 +42,7 @@ class Driver(options: DriverOptions) { implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() - compile(FileInfo(options.path, options.filename), false) + compile(FileInfo(options.path, options.filename, options.interfaceDir), false) Driver.totalErrors == 0 } catch { diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index f1d739f86..68dec013b 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -6,8 +6,10 @@ import js.DynamicImplicits._ import js.JSConverters._ final case class DriverOptions( - val filename: String, - val path: String, - val outputDir: String, - val force: Boolean // force to recompile if it is true + filename: String, + path: String, + outputDir: String, + tsconfig: Option[String], + interfaceDir: String, + force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index e9f5c3b41..013f8fc9e 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -4,7 +4,8 @@ import ts2mls.{TSModuleResolver, TypeScript} final case class FileInfo( workDir: String, // work directory (related to compiler path) - localFilename: String // filename (related to work dir, or in node_modules) + localFilename: String, // filename (related to work dir, or in node_modules) + interfaceDir: String, // .mlsi file directory (related to output dir) ) { import TSModuleResolver.{normalize, isLocal, dirname, basename} @@ -21,21 +22,21 @@ final case class FileInfo( else TypeScript.resolveNodeModulePath(localFilename) val interfaceFilename: String = // interface filename (related to output directory) - relatedPath.fold(s"node_modules/$localFilename")(path => s"${normalize(s"$path/$moduleName.mlsi")}") + relatedPath.fold(s"node_modules/$localFilename")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") val jsFilename: Option[String] = relatedPath.fold[Option[String]](None)(path => Some(normalize(s"$path/$moduleName.js"))) val importPath: String = - relatedPath.fold(s"$moduleName.mlsi")(path => s"./${normalize(s"$path/$moduleName.mlsi")}") + relatedPath.fold(moduleName)(path => s"./${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") def `import`(path: String): FileInfo = if (isLocal(path)) relatedPath match { - case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}") + case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) case _ => ??? // TODO: } - else FileInfo(workDir, path) + else FileInfo(workDir, path, interfaceDir) } object FileInfo { diff --git a/driver/js/src/test/js/MyPrint.js b/driver/js/src/test/js/MyPrint.js deleted file mode 100644 index c5d6864d3..000000000 --- a/driver/js/src/test/js/MyPrint.js +++ /dev/null @@ -1,9 +0,0 @@ -export class DatePrint { - constructor(p) { - this.prefix = p; - } - print(msg) { - let date = new Date(1145141919810); - console.log(`[${this.prefix}] ${msg}. (${date})`); - } -} diff --git a/driver/js/src/test/mlscript/TS.mlsi b/driver/js/src/test/mlscript/TS.mlsi deleted file mode 100644 index 10387c730..000000000 --- a/driver/js/src/test/mlscript/TS.mlsi +++ /dev/null @@ -1,6 +0,0 @@ -import "./MyPrint.mlsi" -declare module TS() { - let tspt: error - let printer: error - error -} diff --git a/driver/js/src/test/js/A.js b/driver/js/src/test/projects/js/A.js similarity index 100% rename from driver/js/src/test/js/A.js rename to driver/js/src/test/projects/js/A.js diff --git a/driver/js/src/test/js/B.js b/driver/js/src/test/projects/js/B.js similarity index 100% rename from driver/js/src/test/js/B.js rename to driver/js/src/test/projects/js/B.js diff --git a/driver/js/src/test/js/C.js b/driver/js/src/test/projects/js/C.js similarity index 100% rename from driver/js/src/test/js/C.js rename to driver/js/src/test/projects/js/C.js diff --git a/driver/js/src/test/js/Cycle1.js b/driver/js/src/test/projects/js/Cycle1.js similarity index 100% rename from driver/js/src/test/js/Cycle1.js rename to driver/js/src/test/projects/js/Cycle1.js diff --git a/driver/js/src/test/js/Cycle2.js b/driver/js/src/test/projects/js/Cycle2.js similarity index 100% rename from driver/js/src/test/js/Cycle2.js rename to driver/js/src/test/projects/js/Cycle2.js diff --git a/driver/js/src/test/js/Opened.js b/driver/js/src/test/projects/js/Opened.js similarity index 100% rename from driver/js/src/test/js/Opened.js rename to driver/js/src/test/projects/js/Opened.js diff --git a/driver/js/src/test/js/Simple.js b/driver/js/src/test/projects/js/Simple.js similarity index 100% rename from driver/js/src/test/js/Simple.js rename to driver/js/src/test/projects/js/Simple.js diff --git a/driver/js/src/test/js/TS.js b/driver/js/src/test/projects/js/TS.js similarity index 100% rename from driver/js/src/test/js/TS.js rename to driver/js/src/test/projects/js/TS.js diff --git a/driver/js/src/test/js/package.json b/driver/js/src/test/projects/js/package.json similarity index 100% rename from driver/js/src/test/js/package.json rename to driver/js/src/test/projects/js/package.json diff --git a/driver/js/src/test/js/tools/Inc.js b/driver/js/src/test/projects/js/tools/Inc.js similarity index 100% rename from driver/js/src/test/js/tools/Inc.js rename to driver/js/src/test/projects/js/tools/Inc.js diff --git a/driver/js/src/test/projects/js/ts/ConfigGen.js b/driver/js/src/test/projects/js/ts/ConfigGen.js new file mode 100644 index 000000000..3c2c49e2a --- /dev/null +++ b/driver/js/src/test/projects/js/ts/ConfigGen.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.generate = void 0; +var json5_1 = require("json5"); +function generate(outDir) { + var json = { + "compilerOptions": { + "outDir": outDir + } + }; + return (0, json5_1.stringify)(json); +} +exports.generate = generate; diff --git a/driver/js/src/test/projects/js/ts/MyPrint.js b/driver/js/src/test/projects/js/ts/MyPrint.js new file mode 100644 index 000000000..0e1158e7b --- /dev/null +++ b/driver/js/src/test/projects/js/ts/MyPrint.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DatePrint = void 0; +var DatePrint = /** @class */ (function () { + function DatePrint(p) { + this.prefix = p; + } + DatePrint.prototype.print = function (msg) { + var date = new Date(1145141919810); + console.log("[".concat(this.prefix, "] ").concat(msg, ". (").concat(date, ")")); + }; + return DatePrint; +}()); +exports.DatePrint = DatePrint; diff --git a/driver/js/src/test/mlscript/A.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/A.mlsi similarity index 100% rename from driver/js/src/test/mlscript/A.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/A.mlsi diff --git a/driver/js/src/test/mlscript/B.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/B.mlsi similarity index 100% rename from driver/js/src/test/mlscript/B.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/B.mlsi diff --git a/driver/js/src/test/mlscript/C.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/C.mlsi similarity index 100% rename from driver/js/src/test/mlscript/C.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/C.mlsi diff --git a/driver/js/src/test/mlscript/Cycle1.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/Cycle1.mlsi similarity index 100% rename from driver/js/src/test/mlscript/Cycle1.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/Cycle1.mlsi diff --git a/driver/js/src/test/mlscript/Cycle2.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/Cycle2.mlsi similarity index 100% rename from driver/js/src/test/mlscript/Cycle2.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/Cycle2.mlsi diff --git a/driver/js/src/test/mlscript/Opened.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/Opened.mlsi similarity index 100% rename from driver/js/src/test/mlscript/Opened.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/Opened.mlsi diff --git a/driver/js/src/test/mlscript/Simple.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/Simple.mlsi similarity index 100% rename from driver/js/src/test/mlscript/Simple.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/Simple.mlsi diff --git a/driver/js/src/test/mlscript/tools/Inc.mlsi b/driver/js/src/test/projects/mlscript/.interfaces/tools/Inc.mlsi similarity index 100% rename from driver/js/src/test/mlscript/tools/Inc.mlsi rename to driver/js/src/test/projects/mlscript/.interfaces/tools/Inc.mlsi diff --git a/driver/js/src/test/mlscript/A.mls b/driver/js/src/test/projects/mlscript/A.mls similarity index 100% rename from driver/js/src/test/mlscript/A.mls rename to driver/js/src/test/projects/mlscript/A.mls diff --git a/driver/js/src/test/mlscript/B.mls b/driver/js/src/test/projects/mlscript/B.mls similarity index 100% rename from driver/js/src/test/mlscript/B.mls rename to driver/js/src/test/projects/mlscript/B.mls diff --git a/driver/js/src/test/mlscript/C.mls b/driver/js/src/test/projects/mlscript/C.mls similarity index 100% rename from driver/js/src/test/mlscript/C.mls rename to driver/js/src/test/projects/mlscript/C.mls diff --git a/driver/js/src/test/mlscript/Cycle1.mls b/driver/js/src/test/projects/mlscript/Cycle1.mls similarity index 100% rename from driver/js/src/test/mlscript/Cycle1.mls rename to driver/js/src/test/projects/mlscript/Cycle1.mls diff --git a/driver/js/src/test/mlscript/Cycle2.mls b/driver/js/src/test/projects/mlscript/Cycle2.mls similarity index 100% rename from driver/js/src/test/mlscript/Cycle2.mls rename to driver/js/src/test/projects/mlscript/Cycle2.mls diff --git a/driver/js/src/test/mlscript/Opened.mls b/driver/js/src/test/projects/mlscript/Opened.mls similarity index 100% rename from driver/js/src/test/mlscript/Opened.mls rename to driver/js/src/test/projects/mlscript/Opened.mls diff --git a/driver/js/src/test/projects/mlscript/Output.mls b/driver/js/src/test/projects/mlscript/Output.mls new file mode 100644 index 000000000..8873cab1d --- /dev/null +++ b/driver/js/src/test/projects/mlscript/Output.mls @@ -0,0 +1,4 @@ +import "../ts/ConfigGen.ts" + +let res = ConfigGen.generate("foo") +res diff --git a/driver/js/src/test/projects/mlscript/Output2.mls b/driver/js/src/test/projects/mlscript/Output2.mls new file mode 100644 index 000000000..31d681f97 --- /dev/null +++ b/driver/js/src/test/projects/mlscript/Output2.mls @@ -0,0 +1,7 @@ +import "json5" + +class CompilerOptions(outDir: string) +class TSConfig(compilerOptions: CompilerOptions) + +let config = json5.stringify(TSConfig(CompilerOptions("bar"))) +config diff --git a/driver/js/src/test/mlscript/Self.mls b/driver/js/src/test/projects/mlscript/Self.mls similarity index 100% rename from driver/js/src/test/mlscript/Self.mls rename to driver/js/src/test/projects/mlscript/Self.mls diff --git a/driver/js/src/test/mlscript/Simple.mls b/driver/js/src/test/projects/mlscript/Simple.mls similarity index 100% rename from driver/js/src/test/mlscript/Simple.mls rename to driver/js/src/test/projects/mlscript/Simple.mls diff --git a/driver/js/src/test/mlscript/TS.mls b/driver/js/src/test/projects/mlscript/TS.mls similarity index 79% rename from driver/js/src/test/mlscript/TS.mls rename to driver/js/src/test/projects/mlscript/TS.mls index 4b132a32a..3e5324923 100644 --- a/driver/js/src/test/mlscript/TS.mls +++ b/driver/js/src/test/projects/mlscript/TS.mls @@ -1,4 +1,4 @@ -import "./MyPrint.ts" +import "../ts/MyPrint.ts" let tspt = MyPrint.DatePrint let printer = new tspt("love from ts") diff --git a/driver/js/src/test/mlscript/tools/Inc.mls b/driver/js/src/test/projects/mlscript/tools/Inc.mls similarity index 100% rename from driver/js/src/test/mlscript/tools/Inc.mls rename to driver/js/src/test/projects/mlscript/tools/Inc.mls diff --git a/driver/js/src/test/projects/package-lock.json b/driver/js/src/test/projects/package-lock.json new file mode 100644 index 000000000..7d0ea5f35 --- /dev/null +++ b/driver/js/src/test/projects/package-lock.json @@ -0,0 +1,30 @@ +{ + "name": "ts", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "json5": "^2.2.3" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + } + } +} diff --git a/driver/js/src/test/projects/package.json b/driver/js/src/test/projects/package.json new file mode 100644 index 000000000..ad0240519 --- /dev/null +++ b/driver/js/src/test/projects/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "json5": "^2.2.3" + } +} diff --git a/driver/js/src/test/projects/ts/ConfigGen.ts b/driver/js/src/test/projects/ts/ConfigGen.ts new file mode 100644 index 000000000..2589d76c7 --- /dev/null +++ b/driver/js/src/test/projects/ts/ConfigGen.ts @@ -0,0 +1,11 @@ +import { stringify } from "json5"; + +export function generate(outDir: string) { + const json = { + "compilerOptions": { + "outDir": outDir + } + } + + return stringify(json); +} diff --git a/driver/js/src/test/mlscript/MyPrint.mlsi b/driver/js/src/test/projects/ts/MyPrint.mlsi similarity index 100% rename from driver/js/src/test/mlscript/MyPrint.mlsi rename to driver/js/src/test/projects/ts/MyPrint.mlsi diff --git a/driver/js/src/test/mlscript/MyPrint.ts b/driver/js/src/test/projects/ts/MyPrint.ts similarity index 100% rename from driver/js/src/test/mlscript/MyPrint.ts rename to driver/js/src/test/projects/ts/MyPrint.ts diff --git a/driver/js/src/test/projects/tsconfig.json b/driver/js/src/test/projects/tsconfig.json new file mode 100644 index 000000000..560c70a91 --- /dev/null +++ b/driver/js/src/test/projects/tsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "outDir": "js/ts" + }, + "include": ["ts/*"], +} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 1d316d078..55253028d 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -11,8 +11,8 @@ class DriverDiffTests extends AnyFunSuite { import ts2mls.JSFileSystem._ testCases.foreach { - case TestOption(filename, workDir, execution, expectError) => test(filename) { - val options = DriverOptions(filename, workDir, jsPath, forceCompiling) + case TestOption(filename, workDir, interfaceDir, execution, tsconfig, expectError) => test(filename) { + val options = DriverOptions(filename, workDir, jsPath, tsconfig, interfaceDir, forceCompiling) val driver = Driver(options) driver.genPackageJson() val success = driver.execute @@ -35,36 +35,42 @@ object DriverDiffTests { // but we can ban it during CI private val forceCompiling = sys.env.get("CI").isEmpty - private val diffPath = "driver/js/src/test/" + private val diffPath = "driver/js/src/test/projects/" private val mlscriptPath = s"${diffPath}mlscript/" private val jsPath = s"${diffPath}js/" - private val outputPath = s"${diffPath}output/" + private val outputPath = s"${diffPath}../output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" private case class TestOption( filename: String, workDir: String, + interfaceDir: String, execution: Option[(String, String)], + tsconfig: Option[String], expectError: Boolean ) - private def entry(entryModule: String, expectError: Boolean = false) = + private def entry(entryModule: String, tsconfig: Option[String] = None, expectError: Boolean = false) = TestOption( s"./${entryModule}.mls", mlscriptPath, + ".interfaces", Some((s"${jsPath}${entryModule}.js", s"${outputPath}${entryModule}.check")), + tsconfig, expectError ) private def ts2mlsEntry(entryModule: String, expectError: Boolean = false) = - TestOption(s"./${entryModule}.mlsi", ts2mlsPath, None, expectError) + TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, expectError) - private val testCases = List( + private val testCases = List[TestOption]( entry("Simple"), entry("Cycle2"), - entry("Self", true), - entry("C", true), - entry("TS", true), // TODO: merge + entry("Self", None, true), + entry("C", None, true), + // entry("TS", Some(s"$diffPath/tsconfig.json")), TODO + // entry("Output", Some(s"$diffPath/tsconfig.json")), TODO + // entry("Output2", Some(s"$diffPath/tsconfig.json")), TODO ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), From b72b93d8e1ee79f8a75c1337aeaea36159f9ebbf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 5 Jun 2023 11:29:58 +0800 Subject: [PATCH 076/202] WIP: Fix several problems --- driver/js/src/main/scala/driver/Driver.scala | 8 +- .../mlscript}/A.mlsi | 0 .../mlscript}/B.mlsi | 0 .../mlscript}/C.mlsi | 0 .../mlscript}/Cycle1.mlsi | 0 .../mlscript}/Cycle2.mlsi | 0 .../mlscript}/Opened.mlsi | 0 .../mlscript}/Simple.mlsi | 0 .../projects/.interfaces/mlscript/TS.mlsi | 6 + .../mlscript}/tools/Inc.mlsi | 0 .../{ => .interfaces}/ts/MyPrint.mlsi | 2 +- driver/js/src/test/projects/js/C.js | 21 ---- .../src/test/projects/js/{ => mlscript}/A.js | 0 .../src/test/projects/js/{ => mlscript}/B.js | 0 .../test/projects/js/{ => mlscript}/Cycle1.js | 0 .../test/projects/js/{ => mlscript}/Cycle2.js | 0 .../test/projects/js/{ => mlscript}/Opened.js | 0 .../test/projects/js/{ => mlscript}/Simple.js | 0 .../src/test/projects/js/{ => mlscript}/TS.js | 2 +- .../test/projects/js/mlscript/mlscript/A.js | 22 ++++ .../test/projects/js/mlscript/mlscript/B.js | 11 ++ .../projects/js/mlscript/mlscript/Cycle1.js | 11 ++ .../projects/js/mlscript/mlscript/Cycle2.js | 17 +++ .../projects/js/mlscript/mlscript/Opened.js | 20 +++ .../projects/js/mlscript/mlscript/Simple.js | 65 ++++++++++ .../test/projects/js/mlscript/mlscript/TS.js | 18 +++ .../js/{ => mlscript/mlscript}/tools/Inc.js | 0 .../test/projects/js/mlscript/tools/Inc.js | 9 ++ .../js/src/test/projects/js/ts/ConfigGen.js | 12 +- driver/js/src/test/projects/js/ts/MyPrint.js | 19 ++- driver/js/src/test/projects/tsconfig.json | 5 +- .../test/scala/driver/DriverDiffTests.scala | 13 +- .../main/scala/ts2mls/types/Converter.scala | 4 +- ts2mls/js/src/test/diff/Array.mlsi | 6 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 4 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 12 +- ts2mls/js/src/test/diff/Cycle1.mlsi | 2 +- ts2mls/js/src/test/diff/Cycle2.mlsi | 4 +- ts2mls/js/src/test/diff/Dec.mlsi | 4 +- ts2mls/js/src/test/diff/Dependency.mlsi | 8 +- ts2mls/js/src/test/diff/ES5.mlsi | 114 +++++++++--------- ts2mls/js/src/test/diff/Export.mlsi | 6 +- ts2mls/js/src/test/diff/Heritage.mlsi | 30 ++--- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 20 +-- ts2mls/js/src/test/diff/Intersection.mlsi | 8 +- ts2mls/js/src/test/diff/Namespace.mlsi | 10 +- ts2mls/js/src/test/diff/Optional.mlsi | 6 +- ts2mls/js/src/test/diff/Overload.mlsi | 6 +- ts2mls/js/src/test/diff/Tuple.mlsi | 4 +- ts2mls/js/src/test/diff/Type.mlsi | 12 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 10 +- ts2mls/js/src/test/diff/Variables.mlsi | 4 +- 52 files changed, 343 insertions(+), 192 deletions(-) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/A.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/B.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/C.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/Cycle1.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/Cycle2.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/Opened.mlsi (100%) rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/Simple.mlsi (100%) create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi rename driver/js/src/test/projects/{mlscript/.interfaces => .interfaces/mlscript}/tools/Inc.mlsi (100%) rename driver/js/src/test/projects/{ => .interfaces}/ts/MyPrint.mlsi (73%) delete mode 100644 driver/js/src/test/projects/js/C.js rename driver/js/src/test/projects/js/{ => mlscript}/A.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/B.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/Cycle1.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/Cycle2.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/Opened.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/Simple.js (100%) rename driver/js/src/test/projects/js/{ => mlscript}/TS.js (89%) create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/A.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/B.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Opened.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Simple.js create mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/TS.js rename driver/js/src/test/projects/js/{ => mlscript/mlscript}/tools/Inc.js (100%) create mode 100644 driver/js/src/test/projects/js/mlscript/tools/Inc.js diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index db0f188af..5d53b1025 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -52,7 +52,7 @@ class Driver(options: DriverOptions) { } def genPackageJson(): Unit = - if (exists(s"${options.outputDir}/package.json")) { + if (!exists(s"${options.outputDir}/package.json")) { val content = """{ "type": "module" }""" // TODO: more settings? writeFile(s"${options.outputDir}/package.json", content) } @@ -131,10 +131,10 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = { - val mlsiFile = normalize(s"${options.path}/${file.interfaceFilename}") - if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { + val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") + if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript val tsprog = TSProgram(s"${file.workDir}/${file.localFilename}", file.workDir, true, N) // TODO - tsprog.generate(file.workDir) + tsprog.generate(s"${file.workDir}/${file.interfaceDir}") return true } parseAndRun(file.filename, { diff --git a/driver/js/src/test/projects/mlscript/.interfaces/A.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/A.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/A.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/A.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/B.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/B.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/B.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/B.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/C.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/C.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/C.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/Cycle1.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Cycle1.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/Cycle1.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/Cycle1.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/Cycle2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Cycle2.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/Cycle2.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/Cycle2.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/Opened.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Opened.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/Opened.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/Opened.mlsi diff --git a/driver/js/src/test/projects/mlscript/.interfaces/Simple.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Simple.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/Simple.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/Simple.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi new file mode 100644 index 000000000..2faaaa941 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi @@ -0,0 +1,6 @@ +import "../ts/MyPrint.mlsi" +declare module TS() { + let tspt: error + let printer: error + error +} diff --git a/driver/js/src/test/projects/mlscript/.interfaces/tools/Inc.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/tools/Inc.mlsi similarity index 100% rename from driver/js/src/test/projects/mlscript/.interfaces/tools/Inc.mlsi rename to driver/js/src/test/projects/.interfaces/mlscript/tools/Inc.mlsi diff --git a/driver/js/src/test/projects/ts/MyPrint.mlsi b/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi similarity index 73% rename from driver/js/src/test/projects/ts/MyPrint.mlsi rename to driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi index 629b3c90d..00214552b 100644 --- a/driver/js/src/test/projects/ts/MyPrint.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi @@ -1,5 +1,5 @@ export declare module MyPrint { - export class DatePrint { + export declare class DatePrint { constructor(p: string) fun print(msg: string): unit } diff --git a/driver/js/src/test/projects/js/C.js b/driver/js/src/test/projects/js/C.js deleted file mode 100644 index e548f473d..000000000 --- a/driver/js/src/test/projects/js/C.js +++ /dev/null @@ -1,21 +0,0 @@ -import { B } from "./B.js" - -function log(x) { - return console.info(x); -} -const C = new class C { - #a; - #b; - get a() { return this.#a; } - get b() { return this.#b; } - constructor() { - } - $init() { - this.#a = B.foo; - const a = this.#a; - this.#b = A.Foo(0); - const b = this.#b; - log(a.x); - } -}; -C.$init(); diff --git a/driver/js/src/test/projects/js/A.js b/driver/js/src/test/projects/js/mlscript/A.js similarity index 100% rename from driver/js/src/test/projects/js/A.js rename to driver/js/src/test/projects/js/mlscript/A.js diff --git a/driver/js/src/test/projects/js/B.js b/driver/js/src/test/projects/js/mlscript/B.js similarity index 100% rename from driver/js/src/test/projects/js/B.js rename to driver/js/src/test/projects/js/mlscript/B.js diff --git a/driver/js/src/test/projects/js/Cycle1.js b/driver/js/src/test/projects/js/mlscript/Cycle1.js similarity index 100% rename from driver/js/src/test/projects/js/Cycle1.js rename to driver/js/src/test/projects/js/mlscript/Cycle1.js diff --git a/driver/js/src/test/projects/js/Cycle2.js b/driver/js/src/test/projects/js/mlscript/Cycle2.js similarity index 100% rename from driver/js/src/test/projects/js/Cycle2.js rename to driver/js/src/test/projects/js/mlscript/Cycle2.js diff --git a/driver/js/src/test/projects/js/Opened.js b/driver/js/src/test/projects/js/mlscript/Opened.js similarity index 100% rename from driver/js/src/test/projects/js/Opened.js rename to driver/js/src/test/projects/js/mlscript/Opened.js diff --git a/driver/js/src/test/projects/js/Simple.js b/driver/js/src/test/projects/js/mlscript/Simple.js similarity index 100% rename from driver/js/src/test/projects/js/Simple.js rename to driver/js/src/test/projects/js/mlscript/Simple.js diff --git a/driver/js/src/test/projects/js/TS.js b/driver/js/src/test/projects/js/mlscript/TS.js similarity index 89% rename from driver/js/src/test/projects/js/TS.js rename to driver/js/src/test/projects/js/mlscript/TS.js index 4ccbcad60..2d4e3f8ac 100644 --- a/driver/js/src/test/projects/js/TS.js +++ b/driver/js/src/test/projects/js/mlscript/TS.js @@ -1,4 +1,4 @@ -import * as MyPrint from "./MyPrint.js" +import * as MyPrint from "../ts/MyPrint.js" const TS = new class TS { #tspt; diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/A.js b/driver/js/src/test/projects/js/mlscript/mlscript/A.js new file mode 100644 index 000000000..017078520 --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/A.js @@ -0,0 +1,22 @@ +export const A = new class A { + #Foo; + constructor() { + } + get Foo() { + const outer = this; + if (this.#Foo === undefined) { + class Foo { + #x; + get x() { return this.#x; } + constructor(x) { + this.#x = x; + } + }; + this.#Foo = ((x) => Object.freeze(new Foo(x))); + this.#Foo.class = Foo; + } + return this.#Foo; + } + $init() {} +}; +A.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/B.js b/driver/js/src/test/projects/js/mlscript/mlscript/B.js new file mode 100644 index 000000000..187ec80d9 --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/B.js @@ -0,0 +1,11 @@ +import { A } from "./A.js" + +export const B = new class B { + constructor() { + } + get foo() { + return A.Foo(12); + } + $init() {} +}; +B.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js new file mode 100644 index 000000000..fec5e0dc2 --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js @@ -0,0 +1,11 @@ +import { Cycle2 } from "./Cycle2.js" + +export const Cycle1 = new class Cycle1 { + constructor() { + } + f(x) { + return x === 0 ? 114 : Cycle2.g(x - 1); + } + $init() {} +}; +Cycle1.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js new file mode 100644 index 000000000..dfed8717a --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js @@ -0,0 +1,17 @@ +import { Cycle1 } from "./Cycle1.js" + +function log(x) { + return console.info(x); +} +export const Cycle2 = new class Cycle2 { + constructor() { + } + g(x) { + return Cycle1.f(x); + } + $init() { + const self = this; + log(self.g(42)); + } +}; +Cycle2.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js b/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js new file mode 100644 index 000000000..e1d57115b --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js @@ -0,0 +1,20 @@ +import { Inc } from "./tools/Inc.js" + +function log(x) { + return console.info(x); +} +export const Opened = new class Opened { + constructor() { + } + hello(x) { + return (log([ + "hello!", + Inc.inc(x) + ])); + } + $init() { + const self = this; + self.hello(114513); + } +}; +Opened.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js b/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js new file mode 100644 index 000000000..c428f0b0c --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js @@ -0,0 +1,65 @@ +import { Opened } from "./Opened.js" + +function log(x) { + return console.info(x); +} +const Simple = new class Simple { + #A; + #C; + #a; + get a() { return this.#a; } + constructor() { + } + B(base) { + const outer = this; + return (class B extends base { + constructor(...rest) { + super(...rest); + } + get foo() { + const self = this; + return self.n; + } + }); + } + get C() { + const outer = this; + if (this.#C === undefined) { + class C { + #b; + get b() { return this.#b; } + constructor() { + this.#b = 1; + const b = this.#b; + } + } + this.#C = new C(); + this.#C.class = C; + } + return this.#C; + } + get A() { + const outer = this; + if (this.#A === undefined) { + class A extends outer.B(Object) { + #n; + get n() { return this.#n; } + constructor(n) { + super(); + this.#n = n; + } + }; + this.#A = ((n) => Object.freeze(new A(n))); + this.#A.class = A; + } + return this.#A; + } + $init() { + const self = this; + this.#a = self.A(42); + const a = this.#a; + log(a.foo); + Opened.hello(a.n); + } +}; +Simple.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/TS.js b/driver/js/src/test/projects/js/mlscript/mlscript/TS.js new file mode 100644 index 000000000..2d4e3f8ac --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/mlscript/TS.js @@ -0,0 +1,18 @@ +import * as MyPrint from "../ts/MyPrint.js" + +const TS = new class TS { + #tspt; + get tspt() { return this.#tspt; } + #printer; + get printer() { return this.#printer; } + constructor() { + } + $init() { + this.#tspt = MyPrint.DatePrint; + const tspt = this.#tspt; + this.#printer = new tspt("love from ts"); + const printer = this.#printer; + printer.print("hello world!"); + } +}; +TS.$init(); diff --git a/driver/js/src/test/projects/js/tools/Inc.js b/driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js similarity index 100% rename from driver/js/src/test/projects/js/tools/Inc.js rename to driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js diff --git a/driver/js/src/test/projects/js/mlscript/tools/Inc.js b/driver/js/src/test/projects/js/mlscript/tools/Inc.js new file mode 100644 index 000000000..02fd1ff82 --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/tools/Inc.js @@ -0,0 +1,9 @@ +export const Inc = new class Inc { + constructor() { + } + inc(x) { + return x + 1; + } + $init() {} +}; +Inc.$init(); diff --git a/driver/js/src/test/projects/js/ts/ConfigGen.js b/driver/js/src/test/projects/js/ts/ConfigGen.js index 3c2c49e2a..71ca5cc92 100644 --- a/driver/js/src/test/projects/js/ts/ConfigGen.js +++ b/driver/js/src/test/projects/js/ts/ConfigGen.js @@ -1,13 +1,9 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.generate = void 0; -var json5_1 = require("json5"); -function generate(outDir) { - var json = { +import { stringify } from "json5"; +export function generate(outDir) { + const json = { "compilerOptions": { "outDir": outDir } }; - return (0, json5_1.stringify)(json); + return stringify(json); } -exports.generate = generate; diff --git a/driver/js/src/test/projects/js/ts/MyPrint.js b/driver/js/src/test/projects/js/ts/MyPrint.js index 0e1158e7b..c5d6864d3 100644 --- a/driver/js/src/test/projects/js/ts/MyPrint.js +++ b/driver/js/src/test/projects/js/ts/MyPrint.js @@ -1,14 +1,9 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.DatePrint = void 0; -var DatePrint = /** @class */ (function () { - function DatePrint(p) { +export class DatePrint { + constructor(p) { this.prefix = p; } - DatePrint.prototype.print = function (msg) { - var date = new Date(1145141919810); - console.log("[".concat(this.prefix, "] ").concat(msg, ". (").concat(date, ")")); - }; - return DatePrint; -}()); -exports.DatePrint = DatePrint; + print(msg) { + let date = new Date(1145141919810); + console.log(`[${this.prefix}] ${msg}. (${date})`); + } +} diff --git a/driver/js/src/test/projects/tsconfig.json b/driver/js/src/test/projects/tsconfig.json index 560c70a91..7d6e3297a 100644 --- a/driver/js/src/test/projects/tsconfig.json +++ b/driver/js/src/test/projects/tsconfig.json @@ -1,6 +1,9 @@ { "compilerOptions": { - "outDir": "js/ts" + "outDir": "js/ts", + "module": "ES2015", + "target": "ES2015", + "moduleResolution": "node" }, "include": ["ts/*"], } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 55253028d..1a9774929 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -36,7 +36,6 @@ object DriverDiffTests { private val forceCompiling = sys.env.get("CI").isEmpty private val diffPath = "driver/js/src/test/projects/" - private val mlscriptPath = s"${diffPath}mlscript/" private val jsPath = s"${diffPath}js/" private val outputPath = s"${diffPath}../output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" @@ -52,10 +51,10 @@ object DriverDiffTests { private def entry(entryModule: String, tsconfig: Option[String] = None, expectError: Boolean = false) = TestOption( - s"./${entryModule}.mls", - mlscriptPath, + s"./mlscript/${entryModule}.mls", + diffPath, ".interfaces", - Some((s"${jsPath}${entryModule}.js", s"${outputPath}${entryModule}.check")), + Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), tsconfig, expectError ) @@ -66,9 +65,9 @@ object DriverDiffTests { private val testCases = List[TestOption]( entry("Simple"), entry("Cycle2"), - entry("Self", None, true), - entry("C", None, true), - // entry("TS", Some(s"$diffPath/tsconfig.json")), TODO + entry("Self", expectError = true), + entry("C", expectError = true), + entry("TS", Some(s"$diffPath/tsconfig.json"), true), // TODO: type members // entry("Output", Some(s"$diffPath/tsconfig.json")), TODO // entry("Output2", Some(s"$diffPath/tsconfig.json")), TODO ts2mlsEntry("Array"), diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index ebd7cea28..4d21ec88b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -106,9 +106,9 @@ object Converter { val inheritance = if (parents.isEmpty) "" else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) - if (typeVars.isEmpty) s"${indent}${exp}$typeName$inheritance $body" + if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" else - s"${indent}${exp}$typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints + s"${indent}${exp}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index 80540b44b..31074d8cf 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -3,8 +3,8 @@ export declare module Array { fun getZero3(): MutArray fun first2(fs: MutArray<(number) => number>): (number) => number fun doEs(e: MutArray): MutArray - class C {} - trait I { + declare class C {} + declare trait I { val i: number } fun doCs(c: MutArray): MutArray @@ -13,7 +13,7 @@ export declare module Array { fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> fun translate(x: MutArray): MutArray fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> - class Temp { + declare class Temp { val x: T } fun ta(ts: MutArray>): MutArray> diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 84efbcbce..b62015b7c 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -13,12 +13,12 @@ export declare module BasicFunctions { fun create(): object fun pa(x: number): number fun wtf(x: anything): unit - class Foooooo { + declare class Foooooo { val ooooooo: number } fun inn(f: Foooooo): unit fun out1(): Foooooo - trait Barrrrrrrrr { + declare trait Barrrrrrrrr { val rrrrrrr: number } fun inn2(b: Barrrrrrrrr): unit diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index f12c29ac5..e86432241 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -1,23 +1,23 @@ export declare module ClassMember { - class Student { + declare class Student { constructor(s: string, age: number) val name: string fun isFriend(other: Student): (false) | (true) fun addScore(sub: string, score: number): unit fun getID(): number } - class Foo { + declare class Foo { fun bar(x: T): unit } - class EZ { + declare class EZ { fun inc(x: number): number } - class Outer { - class Inner { + declare class Outer { + declare class Inner { val a: number } } - class TTT { + declare class TTT { fun ttt(x: T): T fun ttt2(x: T): T } diff --git a/ts2mls/js/src/test/diff/Cycle1.mlsi b/ts2mls/js/src/test/diff/Cycle1.mlsi index 88c151e54..a81e08619 100644 --- a/ts2mls/js/src/test/diff/Cycle1.mlsi +++ b/ts2mls/js/src/test/diff/Cycle1.mlsi @@ -1,5 +1,5 @@ import "./Cycle2.mlsi" export declare module Cycle1 { - export class A {} + export declare class A {} val b: Cycle2.B } diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi index e4cc05c66..1dbbfe48a 100644 --- a/ts2mls/js/src/test/diff/Cycle2.mlsi +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -1,8 +1,8 @@ declare module Cycle1 { - export class A {} + export declare class A {} val b: Cycle2.B } export declare module Cycle2 { - export class B {} + export declare class B {} val a: Cycle1.A } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index c156b599e..c64d7dc1c 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,10 +1,10 @@ export declare module Dec { fun getName(id: (string) | (number)): string fun render(callback: (unit => unit) | (undefined)): string - trait Get { + declare trait Get { val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } - class Person { + declare class Person { constructor(name: string, age: number) fun getName(id: number): string } diff --git a/ts2mls/js/src/test/diff/Dependency.mlsi b/ts2mls/js/src/test/diff/Dependency.mlsi index 5fe929e9f..02ef2853b 100644 --- a/ts2mls/js/src/test/diff/Dependency.mlsi +++ b/ts2mls/js/src/test/diff/Dependency.mlsi @@ -1,14 +1,14 @@ export declare module Dependency { - export class A { + export declare class A { val a: number } - export class B { + export declare class B { val b: number } - export class C { + export declare class C { val c: number } - export class D { + export declare class D { val d: number } fun default(): number diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 7c05b8b00..b13fccea7 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -11,12 +11,12 @@ fun encodeURI(uri: string): string fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string fun escape(string: string): string fun unescape(string: string): string -trait Symbol { +declare trait Symbol { fun toString(): string fun valueOf(): Symbol } type PropertyKey = ((string) | (number)) | (Symbol) -trait PropertyDescriptor { +declare trait PropertyDescriptor { val configurable: ((false) | (true)) | (undefined) val set: ((anything) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -24,10 +24,10 @@ trait PropertyDescriptor { val writable: ((false) | (true)) | (undefined) val value: (anything) | (undefined) } -trait PropertyDescriptorMap { +declare trait PropertyDescriptorMap { val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> } -trait Object { +declare trait Object { fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) fun valueOf(): Object @@ -36,7 +36,7 @@ trait Object { fun isPrototypeOf(v: Object): (false) | (true) fun toString(): string } -trait ObjectConstructor { +declare trait ObjectConstructor { val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> fun getOwnPropertyNames(o: anything): MutArray fun isFrozen(o: anything): (false) | (true) @@ -55,47 +55,47 @@ trait ObjectConstructor { fun isExtensible(o: anything): (false) | (true) } val Function: FunctionConstructor -trait FunctionConstructor { +declare trait FunctionConstructor { val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> val prototype: Function } type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -trait CallableFunction extends Function { +declare trait CallableFunction extends Function { fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): R fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait NewableFunction extends Function { +declare trait NewableFunction extends Function { fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ fun call(thisArg: T, args: A): unit fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ } -trait IArguments { +declare trait IArguments { val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> val length: number val callee: Function } -trait String { +declare trait String { fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number } -trait StringConstructor { +declare trait StringConstructor { val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> val prototype: String fun fromCharCode(codes: MutArray): string } val Boolean: BooleanConstructor -trait BooleanConstructor { +declare trait BooleanConstructor { val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> val prototype: Boolean } -trait Number { +declare trait Number { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string } -trait NumberConstructor { +declare trait NumberConstructor { val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> val NaN: number val MIN_VALUE: number @@ -105,23 +105,23 @@ trait NumberConstructor { val MAX_VALUE: number val prototype: Number } -trait TemplateStringsArray extends ReadonlyArray { +declare trait TemplateStringsArray extends ReadonlyArray { val raw: ReadonlyArray } -trait ImportMeta {} -trait ImportCallOptions { +declare trait ImportMeta {} +declare trait ImportCallOptions { val assert: (ImportAssertions) | (undefined) } -trait ImportAssertions { +declare trait ImportAssertions { val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> } val Math: Math -trait Date { +declare trait Date { fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string } -trait DateConstructor { +declare trait DateConstructor { val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> @@ -129,7 +129,7 @@ trait DateConstructor { fun parse(s: string): number val prototype: Date } -trait RegExp { +declare trait RegExp { fun test(string: string): (false) | (true) val multiline: (false) | (true) val source: string @@ -140,49 +140,49 @@ trait RegExp { fun exec(string: string): RegExpExecArray } val Error: ErrorConstructor -trait ErrorConstructor { +declare trait ErrorConstructor { val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> val prototype: Error } val EvalError: EvalErrorConstructor -trait EvalErrorConstructor extends ErrorConstructor { +declare trait EvalErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> val prototype: EvalError } val RangeError: RangeErrorConstructor -trait RangeErrorConstructor extends ErrorConstructor { +declare trait RangeErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> val prototype: RangeError } val ReferenceError: ReferenceErrorConstructor -trait ReferenceErrorConstructor extends ErrorConstructor { +declare trait ReferenceErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> val prototype: ReferenceError } val SyntaxError: SyntaxErrorConstructor -trait SyntaxErrorConstructor extends ErrorConstructor { +declare trait SyntaxErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> val prototype: SyntaxError } val TypeError: TypeErrorConstructor -trait TypeErrorConstructor extends ErrorConstructor { +declare trait TypeErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> val prototype: TypeError } val URIError: URIErrorConstructor -trait URIErrorConstructor extends ErrorConstructor { +declare trait URIErrorConstructor extends ErrorConstructor { val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> val prototype: URIError } val JSON: JSON -trait ReadonlyArray { +declare trait ReadonlyArray { fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit @@ -200,20 +200,20 @@ trait ReadonlyArray { fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number } -trait ConcatArray { +declare trait ConcatArray { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> fun join(separator: (string) | (undefined)): string fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray } val Array: ArrayConstructor -trait ArrayConstructor { +declare trait ArrayConstructor { val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> fun isArray(arg: anything): (false) | (true) val prototype: MutArray } -trait TypedPropertyDescriptor { +declare trait TypedPropertyDescriptor { val configurable: ((false) | (true)) | (undefined) val set: ((T) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) @@ -223,7 +223,7 @@ trait TypedPropertyDescriptor { } type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -trait ArrayLike { +declare trait ArrayLike { val length: number val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> } @@ -244,36 +244,36 @@ type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5. type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -trait ThisType {} +declare trait ThisType {} val ArrayBuffer: ArrayBufferConstructor -trait ArrayBufferTypes { +declare trait ArrayBufferTypes { val ArrayBuffer: ArrayBuffer } type ArrayBufferLike = ArrayBuffer -trait ArrayBufferConstructor { +declare trait ArrayBufferConstructor { val prototype: ArrayBuffer val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> fun isView(arg: anything): (false) | (true) } -trait ArrayBufferView { +declare trait ArrayBufferView { val buffer: ArrayBuffer val byteLength: number val byteOffset: number } val DataView: DataViewConstructor -trait DataViewConstructor { +declare trait DataViewConstructor { val prototype: DataView val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> } val Int8Array: Int8ArrayConstructor -trait Int8ArrayConstructor { +declare trait Int8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array fun id"of"(items: MutArray): Int8Array val BYTES_PER_ELEMENT: number } -trait Uint8Array { +declare trait Uint8Array { fun valueOf(): Uint8Array fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) @@ -303,7 +303,7 @@ trait Uint8Array { fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number val byteOffset: number } -trait Uint8ArrayConstructor { +declare trait Uint8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array @@ -311,7 +311,7 @@ trait Uint8ArrayConstructor { val BYTES_PER_ELEMENT: number } val Uint8ClampedArray: Uint8ClampedArrayConstructor -trait Uint8ClampedArrayConstructor { +declare trait Uint8ClampedArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray @@ -319,7 +319,7 @@ trait Uint8ClampedArrayConstructor { val BYTES_PER_ELEMENT: number } val Int16Array: Int16ArrayConstructor -trait Int16ArrayConstructor { +declare trait Int16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array @@ -327,7 +327,7 @@ trait Int16ArrayConstructor { val BYTES_PER_ELEMENT: number } val Uint16Array: Uint16ArrayConstructor -trait Uint16ArrayConstructor { +declare trait Uint16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array @@ -335,7 +335,7 @@ trait Uint16ArrayConstructor { val BYTES_PER_ELEMENT: number } val Int32Array: Int32ArrayConstructor -trait Int32ArrayConstructor { +declare trait Int32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array @@ -343,7 +343,7 @@ trait Int32ArrayConstructor { val BYTES_PER_ELEMENT: number } val Uint32Array: Uint32ArrayConstructor -trait Uint32ArrayConstructor { +declare trait Uint32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array @@ -351,7 +351,7 @@ trait Uint32ArrayConstructor { val BYTES_PER_ELEMENT: number } val Float32Array: Float32ArrayConstructor -trait Float32ArrayConstructor { +declare trait Float32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array @@ -359,7 +359,7 @@ trait Float32ArrayConstructor { val BYTES_PER_ELEMENT: number } val Float64Array: Float64ArrayConstructor -trait Float64ArrayConstructor { +declare trait Float64ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array @@ -367,7 +367,7 @@ trait Float64ArrayConstructor { val BYTES_PER_ELEMENT: number } module Intl { - export trait CollatorOptions { + export declare trait CollatorOptions { val sensitivity: (string) | (undefined) val ignorePunctuation: ((false) | (true)) | (undefined) val usage: (string) | (undefined) @@ -375,7 +375,7 @@ module Intl { val numeric: ((false) | (true)) | (undefined) val caseFirst: (string) | (undefined) } - export trait ResolvedCollatorOptions { + export declare trait ResolvedCollatorOptions { val sensitivity: string val ignorePunctuation: (false) | (true) val usage: string @@ -384,11 +384,11 @@ module Intl { val caseFirst: string val collation: string } - export trait Collator { + export declare trait Collator { fun compare(x: string, y: string): number fun resolvedOptions(): ResolvedCollatorOptions } - export trait NumberFormatOptions { + export declare trait NumberFormatOptions { val minimumSignificantDigits: (number) | (undefined) val useGrouping: ((false) | (true)) | (undefined) val style: (string) | (undefined) @@ -400,7 +400,7 @@ module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: (number) | (undefined) } - export trait ResolvedNumberFormatOptions { + export declare trait ResolvedNumberFormatOptions { val numberingSystem: string val minimumSignificantDigits: (number) | (undefined) val useGrouping: (false) | (true) @@ -412,11 +412,11 @@ module Intl { val maximumSignificantDigits: (number) | (undefined) val minimumFractionDigits: number } - export trait NumberFormat { + export declare trait NumberFormat { fun format(value: number): string fun resolvedOptions(): ResolvedNumberFormatOptions } - export trait DateTimeFormatOptions { + export declare trait DateTimeFormatOptions { val minute: ((string) | (string)) | (undefined) val year: ((string) | (string)) | (undefined) val hour: ((string) | (string)) | (undefined) @@ -431,7 +431,7 @@ module Intl { val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) val era: (((string) | (string)) | (string)) | (undefined) } - export trait ResolvedDateTimeFormatOptions { + export declare trait ResolvedDateTimeFormatOptions { val numberingSystem: string val minute: (string) | (undefined) val year: (string) | (undefined) @@ -447,7 +447,7 @@ module Intl { val timeZoneName: (string) | (undefined) val era: (string) | (undefined) } - export trait DateTimeFormat { + export declare trait DateTimeFormat { fun format(date: ((number) | (Date)) | (undefined)): string fun resolvedOptions(): ResolvedDateTimeFormatOptions } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 02528c5c6..da8ad9e6d 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -2,16 +2,16 @@ import "./Dependency.mlsi" export declare module Export { export module Foo { fun Baz(aa: string): IBar - trait IBar { + declare trait IBar { val a: string } - export class Bar extends IBar { + export declare class Bar extends IBar { val a: string } export val baz: IBar } fun default(x: anything): anything - export class E {} + export declare class E {} export val F = E export val G = B export val H = Dependency diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index a68ce2a96..560b0ffbc 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -1,42 +1,42 @@ export declare module Heritage { - class A { + declare class A { fun foo(): unit } - class B extends A {} - class C { + declare class B extends A {} + declare class C { fun set(x: T): unit fun get(): T } - class D extends C {} - trait Wu { + declare class D extends C {} + declare trait Wu { val x: (false) | (true) } - class WuWu extends Wu { + declare class WuWu extends Wu { val y: (false) | (true) } - trait WuWuWu extends WuWu { + declare trait WuWuWu extends WuWu { val z: (false) | (true) } - trait Never extends WuWuWu { + declare trait Never extends WuWuWu { fun w(): nothing } - class VG { + declare class VG { val x: T } - class Home extends VG { + declare class Home extends VG { val y: T } - trait O { + declare trait O { fun xx(x: I): I } - class OR extends O { + declare class OR extends O { fun xx(x: R): R } module Five { - export class ROTK { + export declare class ROTK { val wu: string } - export class Y extends ROTK {} + export declare class Y extends ROTK {} } - class Y extends Five.ROTK {} + declare class Y extends Five.ROTK {} } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 2f66d2aaf..ae4b7d29c 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -1,38 +1,38 @@ export declare module InterfaceMember { - trait IFoo { + declare trait IFoo { val a: string fun b(x: number): number fun c(): (false) | (true) fun d(x: string): unit } - trait II { + declare trait II { fun test(x: T): number } fun create(): {v: number,} fun get(x: {t: string,}): string - trait IEvent { + declare trait IEvent { fun callback(): (number) => unit } - trait SearchFunc { + declare trait SearchFunc { val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> } - trait StringArray { + declare trait StringArray { val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> } - trait Counter { + declare trait Counter { val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> val interval: number fun reset(): unit } - trait Simple { + declare trait Simple { val a: number fun b(x: (false) | (true)): string } - trait Simple2 { + declare trait Simple2 { val abc: T } - trait Next extends Simple {} - trait TTT { + declare trait Next extends Simple {} + declare trait TTT { fun ttt(x: T): T } } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 08c4789ec..e1e1b8a8d 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -2,10 +2,10 @@ export declare module Intersection { fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit fun over(f: ((number) => string) & ((object) => string)): string - trait IA { + declare trait IA { val x: number } - trait IB { + declare trait IB { val y: number } fun iii(x: (IA) & (IB)): (IA) & (IB) @@ -13,7 +13,7 @@ export declare module Intersection { fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) - class A {} - class B {} + declare class A {} + declare class B {} fun inter(c: (A) & (B)): (A) & (B) } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 2ed0afb8e..86b174647 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -2,24 +2,24 @@ export declare module Namespace { module N1 { fun f(x: anything): number fun ff(y: anything): number - export class C { + export declare class C { fun f(): unit } - trait I { + declare trait I { fun f(): number } export module N2 { fun fff(x: (false) | (true)): number fun gg(c: C): C - class BBB extends C {} + declare class BBB extends C {} } } module AA { fun f(x: anything): string - export class C { + export declare class C { fun f(): unit } - export trait I { + export declare trait I { fun f(): number } export module N2 { diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index a10a9f664..b5e4bc560 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -3,19 +3,19 @@ export declare module Optional { fun buildName2(firstName: string, lastName: (string) | (undefined)): string fun buildName3(firstName: string, lastName: MutArray): string fun buildName4(firstName: string, lastName: MutArray): string - trait SquareConfig { + declare trait SquareConfig { val color: (string) | (undefined) val width: (number) | (undefined) } fun did(x: number, f: ((number) => number) | (undefined)): number fun getOrElse(arr: (MutArray) | (undefined)): object - class ABC {} + declare class ABC {} fun testABC(abc: (ABC) | (undefined)): unit fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit fun err(msg: ((number, string, )) | (undefined)): unit fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string fun boo(x: ((T) & (U)) | (undefined)): unit - class B { + declare class B { val b: T } fun boom(b: (B) | (undefined)): anything diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index f2e2ea729..4622d5f95 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,13 +1,13 @@ export declare module Overload { fun f: ((number) => string) & ((string) => string) - class M { + declare class M { val foo: ((number) => string) & ((string) => string) } fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) fun g0: ((MutArray) => string) & ((MutArray) => string) fun db: ((number) => MutArray) & ((object) => MutArray) - class N {} + declare class N {} fun id: ((M) => unit) & ((N) => unit) fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) @@ -17,7 +17,7 @@ export declare module Overload { module XX { fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ } - class WWW { + declare class WWW { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 2d48c0262..b9f33535d 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -10,9 +10,9 @@ export declare module Tuple { fun ex(x: T, y: U): (T, U, (T) & (U), ) fun foo(x: ((T) & (U), )): unit fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) - class A { + declare class A { val x: number } - class B {} + declare class B {} fun swap(x: (A, B, )): (B, A, ) } diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 19a7eef85..86801bf52 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -1,27 +1,27 @@ export declare module Type { - trait None { + declare trait None { val _tag: "None" } - trait Some { + declare trait Some { val _tag: "Some" val value: A } type Option = (None) | (Some) type Func = (number) => number type S2 = (string, string, ) - trait I1 {} - trait I2 {} + declare trait I1 {} + declare trait I2 {} type I3 = (I1) & (I2) type StringArray = Array type SomeInterface = {x: number,y: number,} - class ABC {} + declare class ABC {} type DEF = ABC type TP = (A, B, C, ) module NA { fun fb(b: string): unit export type B = string } - class NC { + declare class NC { val b: string } type G = ABC diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index d67cd90ef..28bfba64d 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,25 +1,25 @@ export declare module TypeParameter { fun inc(x: T): number - class CC { + declare class CC { fun print(s: T): unit } fun con(t: T): U - class Printer { + declare class Printer { fun print(t: T): unit } fun setStringPrinter(p: Printer): unit fun getStringPrinter(): Printer fun foo(p: Printer, x: T): T fun foo2(p: Printer, x: T): T - class F { + declare class F { val x: T fun GG(y: U): T } - trait I { + declare trait I { val x: T fun GG(y: U): T } - class FFF { + declare class FFF { fun fff(x: T): unit } fun fff(p: FFF, s: string): unit diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index c20c02182..0fdaf2339 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -3,10 +3,10 @@ export declare module Variables { val URI2: string val foo: number val bar: false - class FooBar {} + declare class FooBar {} val fb: FooBar module ABC { - export class DEF {} + export declare class DEF {} } val d: ABC.DEF module DD { From 83ac95a29454ad599e7b34a86d8989a891565eb1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 5 Jun 2023 12:16:27 +0800 Subject: [PATCH 077/202] WIP: Search js path based on tsconfig.json --- driver/js/src/main/scala/driver/Driver.scala | 25 ++++++++++++------- .../js/src/main/scala/driver/FileInfo.scala | 4 +-- driver/js/src/test/projects/js/mlscript/TS.js | 2 +- .../js/{ts => my_ts_path}/ConfigGen.js | 0 .../projects/js/{ts => my_ts_path}/MyPrint.js | 0 driver/js/src/test/projects/tsconfig.json | 2 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 +++ 9 files changed, 25 insertions(+), 15 deletions(-) rename driver/js/src/test/projects/js/{ts => my_ts_path}/ConfigGen.js (100%) rename driver/js/src/test/projects/js/{ts => my_ts_path}/MyPrint.js (100%) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 5d53b1025..7fe85d248 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -7,7 +7,7 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} -import ts2mls.{TSModuleResolver, TSProgram} +import ts2mls.{TSModuleResolver, TSProgram, TypeScript} class Driver(options: DriverOptions) { import Driver._ @@ -30,6 +30,7 @@ class Driver(options: DriverOptions) { } private val importedModule = MutSet[String]() + private val config = TypeScript.parseOption(options.path, options.tsconfig) import TSModuleResolver.normalize @@ -121,6 +122,14 @@ class Driver(options: DriverOptions) { typer.expandType(sim) } + private def resolveTarget(file: FileInfo, imp: String) = + if ((imp.startsWith("./") || imp.startsWith("../")) && !imp.endsWith(".mls") && !imp.endsWith(".mlsi")) { + val tsPath = TypeScript.getOutputFileNames(s"${TSModuleResolver.dirname(file.filename)}/$imp", config) + val outputBase = TSModuleResolver.dirname(TSModuleResolver.normalize(s"${options.outputDir}${file.jsFilename}")) + TSModuleResolver.relative(outputBase, tsPath) + } + else imp + private def compile( file: FileInfo, exported: Boolean @@ -133,9 +142,9 @@ class Driver(options: DriverOptions) { ): Boolean = { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript - val tsprog = TSProgram(s"${file.workDir}/${file.localFilename}", file.workDir, true, N) // TODO + val tsprog = TSProgram(s"${file.workDir}/${file.localFilename}", file.workDir, true, options.tsconfig) tsprog.generate(s"${file.workDir}/${file.interfaceDir}") - return true + return true // TODO: check if we really need to re-compile } parseAndRun(file.filename, { case (definitions, _, imports, _) => { @@ -198,11 +207,9 @@ class Driver(options: DriverOptions) { val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") writeFile(mlsiFile, interfaces) - file.jsFilename match { - case Some(filename) => - generate(Pgrm(definitions), s"${options.outputDir}/$filename", file.moduleName, imports, exported || importedModule(file.filename)) - case _ => () - } + generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map { + case Import(path) => Import(resolveTarget(file, path)) + }, exported || importedModule(file.filename)) } true } @@ -221,7 +228,7 @@ class Driver(options: DriverOptions) { val backend = new JSCompilerBackend() val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") - writeFile(filename, code) + writeFile(filename, code) // TODO: diffTests } catch { case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation)) } diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 013f8fc9e..60c632426 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -24,8 +24,8 @@ final case class FileInfo( val interfaceFilename: String = // interface filename (related to output directory) relatedPath.fold(s"node_modules/$localFilename")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") - val jsFilename: Option[String] = - relatedPath.fold[Option[String]](None)(path => Some(normalize(s"$path/$moduleName.js"))) + val jsFilename: String = + relatedPath.fold(moduleName)(path => normalize(s"$path/$moduleName.js")) val importPath: String = relatedPath.fold(moduleName)(path => s"./${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") diff --git a/driver/js/src/test/projects/js/mlscript/TS.js b/driver/js/src/test/projects/js/mlscript/TS.js index 2d4e3f8ac..b54fd6c43 100644 --- a/driver/js/src/test/projects/js/mlscript/TS.js +++ b/driver/js/src/test/projects/js/mlscript/TS.js @@ -1,4 +1,4 @@ -import * as MyPrint from "../ts/MyPrint.js" +import * as MyPrint from "../my_ts_path/MyPrint.js" const TS = new class TS { #tspt; diff --git a/driver/js/src/test/projects/js/ts/ConfigGen.js b/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js similarity index 100% rename from driver/js/src/test/projects/js/ts/ConfigGen.js rename to driver/js/src/test/projects/js/my_ts_path/ConfigGen.js diff --git a/driver/js/src/test/projects/js/ts/MyPrint.js b/driver/js/src/test/projects/js/my_ts_path/MyPrint.js similarity index 100% rename from driver/js/src/test/projects/js/ts/MyPrint.js rename to driver/js/src/test/projects/js/my_ts_path/MyPrint.js diff --git a/driver/js/src/test/projects/tsconfig.json b/driver/js/src/test/projects/tsconfig.json index 7d6e3297a..78e486264 100644 --- a/driver/js/src/test/projects/tsconfig.json +++ b/driver/js/src/test/projects/tsconfig.json @@ -1,6 +1,6 @@ { "compilerOptions": { - "outDir": "js/ts", + "outDir": "js/my_ts_path", "module": "ES2015", "target": "ES2015", "moduleResolution": "node" diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 1a9774929..b1c966507 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -67,7 +67,7 @@ object DriverDiffTests { entry("Cycle2"), entry("Self", expectError = true), entry("C", expectError = true), - entry("TS", Some(s"$diffPath/tsconfig.json"), true), // TODO: type members + entry("TS", Some("./tsconfig.json"), true), // TODO: type members // entry("Output", Some(s"$diffPath/tsconfig.json")), TODO // entry("Output2", Some(s"$diffPath/tsconfig.json")), TODO ts2mlsEntry("Array"), diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 61f84a891..ba5437416 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1095,7 +1095,7 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { JSImport( path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")), path.substring(0, path.lastIndexOf(".")) + ".js", // TODO: node_modules - path.endsWith(".ts") + !path.endsWith(".mls") && !path.endsWith(".mlsi") ) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 42731c218..bc5e9f1cb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -36,6 +36,9 @@ object TypeScript { else None } + def getOutputFileNames(filename: String, config: js.Dynamic): String = + ts.getOutputFileNames(config, filename, false).toString() + val typeFlagsEnumLike = ts.TypeFlags.EnumLike val typeFlagsObject = ts.TypeFlags.Object val typeFlagsTypeParameter = ts.TypeFlags.TypeParameter From 9399d54c185544b54d03b764d913c47da3f07132 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 5 Jun 2023 13:56:35 +0800 Subject: [PATCH 078/202] WIP: Generate mlsi for node_modules --- .gitignore | 1 + driver/js/src/main/scala/driver/Driver.scala | 4 +-- .../js/src/main/scala/driver/FileInfo.scala | 2 +- driver/js/src/test/output/Output.check | 1 + .../projects/.interfaces/mlscript/Output.mlsi | 5 ++++ .../.interfaces/node_modules/json5/json5.mlsi | 2 ++ .../projects/.interfaces/ts/ConfigGen.mlsi | 4 +++ .../src/test/projects/js/mlscript/Output.js | 17 ++++++++++++ .../test/projects/js/my_ts_path/ConfigGen.js | 4 +-- .../js/src/test/projects/mlscript/Output.mls | 2 +- driver/js/src/test/projects/ts/ConfigGen.ts | 4 +-- driver/js/src/test/projects/tsconfig.json | 4 ++- .../test/scala/driver/DriverDiffTests.scala | 4 +-- .../main/scala/ts2mls/TSCompilerInfo.scala | 7 ++++- .../js/src/main/scala/ts2mls/TSModules.scala | 2 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 27 ++++++++++++------- .../scala/ts2mls/TSTypeGenerationTests.scala | 5 +--- 17 files changed, 69 insertions(+), 26 deletions(-) create mode 100644 driver/js/src/test/output/Output.check create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi create mode 100644 driver/js/src/test/projects/js/mlscript/Output.js diff --git a/.gitignore b/.gitignore index 64a426b87..dabb8e335 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ project/metals.sbt mlsc.js mlsc.js.map .DS_Store +!driver/js/src/test/projects/.interfaces/node_modules diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 7fe85d248..f6aecc009 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -142,7 +142,7 @@ class Driver(options: DriverOptions) { ): Boolean = { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript - val tsprog = TSProgram(s"${file.workDir}/${file.localFilename}", file.workDir, true, options.tsconfig) + val tsprog = TSProgram(file.localFilename, file.workDir, true, options.tsconfig) tsprog.generate(s"${file.workDir}/${file.interfaceDir}") return true // TODO: check if we really need to re-compile } @@ -196,7 +196,7 @@ class Driver(options: DriverOptions) { } otherList.foreach(d => importModule(file.`import`(d))) - if (!file.filename.endsWith(".mlsi")) { + if (file.filename.endsWith(".mls")) { def generateInterface(moduleName: Option[String], tu: TypingUnit) = { val exp = `type`(tu) packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 60c632426..41e4e2e93 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -22,7 +22,7 @@ final case class FileInfo( else TypeScript.resolveNodeModulePath(localFilename) val interfaceFilename: String = // interface filename (related to output directory) - relatedPath.fold(s"node_modules/$localFilename")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") + relatedPath.fold(s"$interfaceDir/node_modules/$moduleName/$moduleName.mlsi")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") val jsFilename: String = relatedPath.fold(moduleName)(path => normalize(s"$path/$moduleName.js")) diff --git a/driver/js/src/test/output/Output.check b/driver/js/src/test/output/Output.check new file mode 100644 index 000000000..56cfa19d7 --- /dev/null +++ b/driver/js/src/test/output/Output.check @@ -0,0 +1 @@ +{compilerOptions:{outDir:'foo'}} diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi new file mode 100644 index 000000000..ae02971af --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi @@ -0,0 +1,5 @@ +import "../ts/ConfigGen.mlsi" +declare module Output() { + let res: string + unit +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi new file mode 100644 index 000000000..75b3319a4 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi @@ -0,0 +1,2 @@ +export declare module json5 { +} diff --git a/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi b/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi new file mode 100644 index 000000000..af43cf33a --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi @@ -0,0 +1,4 @@ +import "json5.mlsi" +export declare module ConfigGen { + fun generate(outDir: string): string +} diff --git a/driver/js/src/test/projects/js/mlscript/Output.js b/driver/js/src/test/projects/js/mlscript/Output.js new file mode 100644 index 000000000..c3fda219d --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/Output.js @@ -0,0 +1,17 @@ +import * as ConfigGen from "../my_ts_path/ConfigGen.js" + +function log(x) { + return console.info(x); +} +const Output = new class Output { + #res; + get res() { return this.#res; } + constructor() { + } + $init() { + this.#res = ConfigGen.generate("foo"); + const res = this.#res; + log(res); + } +}; +Output.$init(); diff --git a/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js b/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js index 71ca5cc92..d971405b0 100644 --- a/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js +++ b/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js @@ -1,9 +1,9 @@ -import { stringify } from "json5"; +import json5 from "json5"; export function generate(outDir) { const json = { "compilerOptions": { "outDir": outDir } }; - return stringify(json); + return json5.stringify(json); } diff --git a/driver/js/src/test/projects/mlscript/Output.mls b/driver/js/src/test/projects/mlscript/Output.mls index 8873cab1d..dddee4c31 100644 --- a/driver/js/src/test/projects/mlscript/Output.mls +++ b/driver/js/src/test/projects/mlscript/Output.mls @@ -1,4 +1,4 @@ import "../ts/ConfigGen.ts" let res = ConfigGen.generate("foo") -res +log(res) diff --git a/driver/js/src/test/projects/ts/ConfigGen.ts b/driver/js/src/test/projects/ts/ConfigGen.ts index 2589d76c7..d7963ca3c 100644 --- a/driver/js/src/test/projects/ts/ConfigGen.ts +++ b/driver/js/src/test/projects/ts/ConfigGen.ts @@ -1,4 +1,4 @@ -import { stringify } from "json5"; +import json5 from "json5"; export function generate(outDir: string) { const json = { @@ -7,5 +7,5 @@ export function generate(outDir: string) { } } - return stringify(json); + return json5.stringify(json); } diff --git a/driver/js/src/test/projects/tsconfig.json b/driver/js/src/test/projects/tsconfig.json index 78e486264..e9fc657b8 100644 --- a/driver/js/src/test/projects/tsconfig.json +++ b/driver/js/src/test/projects/tsconfig.json @@ -3,7 +3,9 @@ "outDir": "js/my_ts_path", "module": "ES2015", "target": "ES2015", - "moduleResolution": "node" + "moduleResolution": "node", + "allowJs": true, + "esModuleInterop": true }, "include": ["ts/*"], } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index b1c966507..6655914ae 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -68,8 +68,8 @@ object DriverDiffTests { entry("Self", expectError = true), entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members - // entry("Output", Some(s"$diffPath/tsconfig.json")), TODO - // entry("Output2", Some(s"$diffPath/tsconfig.json")), TODO + entry("Output", Some("./tsconfig.json")), + // entry("Output2", Some("./tsconfig.json")), ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index bc5e9f1cb..6daf9e457 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -75,7 +75,12 @@ object TypeScript { def forEachChild(root: js.Dynamic, func: js.Dynamic => Unit) = ts.forEachChild(root, func) def createProgram(filenames: Seq[String]) = - ts.createProgram(filenames.toJSArray, js.Dictionary("maxNodeModuleJsDepth" -> 0, "target" -> ts.ScriptTarget.ES5, "module" -> ts.ModuleKind.CommonJS)) + ts.createProgram(filenames.toJSArray, js.Dictionary( + "maxNodeModuleJsDepth" -> 0, + "target" -> ts.ScriptTarget.ES5, + "module" -> ts.ModuleKind.CommonJS, + "esModuleInterop" -> true + )) def resolveNodeModulePath(path: String): String = resolver(path).toString() } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 8fef3b72d..418e78e5a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -37,7 +37,7 @@ trait TSImport { self => object TSImport { def getModuleName(filename: String, requirePrefix: Boolean): String = - if (filename.endsWith(".d") || filename.endsWith(".ts")) + if (filename.endsWith(".d") || filename.endsWith(".ts") || filename.endsWith(".mls") || filename.endsWith(".mlsi")) getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.')), requirePrefix) else if (!requirePrefix) filename.substring(filename.lastIndexOf('/') + 1) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 51206aa85..58cd3e46f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -11,26 +11,30 @@ import scala.collection.mutable.{HashSet, HashMap} // for es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) { - private val program = TypeScript.createProgram(Seq(filename)) + private val fullname = TSModuleResolver.normalize(s"$workDir/$filename") + private val program = TypeScript.createProgram(Seq(fullname)) private val cache = new HashMap[String, TSNamespace]() private implicit val configContent = TypeScript.parseOption(workDir, tsconfig) // check if file exists - if (!program.fileExists(filename)) throw new Exception(s"file ${filename} doesn't exist.") + if (!program.fileExists(fullname)) throw new Exception(s"file ${fullname} doesn't exist.") private implicit val checker = TSTypeChecker(program.getTypeChecker()) + private def resolveTarget(filename: String) = { + val moduleName = TSImport.getModuleName(filename, false) + Option.when(!TSModuleResolver.isLocal(filename))(s"node_modules/$moduleName/$moduleName.mlsi") + } + def generate(targetPath: String): Unit = - generate(TSModuleResolver.resolve(filename), targetPath)(Nil) + generate(TSModuleResolver.resolve(fullname), targetPath, resolveTarget(filename))(Nil) - private def generate(filename: String, targetPath: String)(implicit stack: List[String]): Unit = { + private def generate(filename: String, targetPath: String, outputOverride: Option[String])(implicit stack: List[String]): Unit = { val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList cache.addOne(filename, globalNamespace) - - val moduleName = TSImport.getModuleName(filename, false) val relatedPath = TSModuleResolver.relative(workDir, TSModuleResolver.dirname(filename)) def resolve(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") @@ -39,10 +43,16 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t importList.partition(imp => stack.contains(resolve(imp.filename))) otherList.foreach(imp => { - generate(resolve(imp.filename), targetPath)(filename :: stack) + generate(resolve(imp.filename), targetPath, resolveTarget(imp.filename))(filename :: stack) }) - var writer = JSWriter(s"$targetPath/$relatedPath/$moduleName.mlsi") + val (moduleName, outputFilename) = outputOverride match { + case Some(output) => (TSImport.getModuleName(output, false), output) + case _ => + val moduleName = TSImport.getModuleName(filename, false) + (moduleName, s"$relatedPath/$moduleName.mlsi") + } + var writer = JSWriter(s"$targetPath/$outputFilename") val imported = new HashSet[String]() otherList.foreach(imp => { @@ -73,7 +83,6 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t } generate(writer, globalNamespace, moduleName) - writer.close() } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 1f49036fc..e635ad546 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -8,7 +8,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( - tsPath(filename), + filename, "ts2mls/js/src/test/typescript", !directlyImportedSet.contains(filename), None @@ -18,9 +18,6 @@ class TSTypeGenerationTest extends AnyFunSuite { } object TSTypeGenerationTest { - private def tsPath(filename: String) = s"ts2mls/js/src/test/typescript/$filename" - private def diffPath(filename: String) = s"ts2mls/js/src/test/diff/$filename" - private val testsData = List( "Array.ts", "BasicFunctions.ts", From 9eba28e5c8a907694fa2520063a0654916bcd932 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 5 Jun 2023 15:30:23 +0800 Subject: [PATCH 079/202] WIP: Allow importing node_modules directly(not ready) --- driver/js/src/main/scala/driver/Driver.scala | 3 +- .../js/src/main/scala/driver/FileInfo.scala | 12 +++-- .../.interfaces/mlscript/Output2.mlsi | 7 +++ .../src/test/projects/js/mlscript/Output2.js | 50 +++++++++++++++++++ .../js/src/test/projects/mlscript/Output2.mls | 2 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 8 +-- .../main/scala/ts2mls/TSCompilerInfo.scala | 4 -- .../js/src/main/scala/ts2mls/TSProgram.scala | 13 +++-- 9 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi create mode 100644 driver/js/src/test/projects/js/mlscript/Output2.js diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index f6aecc009..3ca217d7b 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -142,7 +142,8 @@ class Driver(options: DriverOptions) { ): Boolean = { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript - val tsprog = TSProgram(file.localFilename, file.workDir, true, options.tsconfig) + val tsprog = + TSProgram(if (!file.isNodeModule) file.localFilename else file.filename, file.workDir, true, options.tsconfig) tsprog.generate(s"${file.workDir}/${file.interfaceDir}") return true // TODO: check if we really need to re-compile } diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 41e4e2e93..214638339 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -10,16 +10,18 @@ final case class FileInfo( import TSModuleResolver.{normalize, isLocal, dirname, basename} val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) - if (TSModuleResolver.isLocal(localFilename)) Some(normalize(dirname(localFilename))) + if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) else None + val isNodeModule: Boolean = relatedPath.isEmpty + // module name in ts/mls val moduleName = basename(localFilename) // full filename (related to compiler path, or in node_modules) lazy val filename: String = - if (relatedPath.isDefined) normalize(s"./$workDir/$localFilename") - else TypeScript.resolveNodeModulePath(localFilename) + if (!isNodeModule) normalize(s"./$workDir/$localFilename") + else moduleName val interfaceFilename: String = // interface filename (related to output directory) relatedPath.fold(s"$interfaceDir/node_modules/$moduleName/$moduleName.mlsi")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") @@ -41,5 +43,7 @@ final case class FileInfo( object FileInfo { def importPath(filename: String): String = - filename.replace(TSModuleResolver.extname(filename), ".mlsi") + if (filename.endsWith(".mls") || filename.endsWith(".ts")) + filename.replace(TSModuleResolver.extname(filename), ".mlsi") + else filename + ".mlsi" } diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi new file mode 100644 index 000000000..740b5955a --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -0,0 +1,7 @@ +import "json5.mlsi" +declare module Output2() { + class CompilerOptions(outDir: string) + class TSConfig(compilerOptions: CompilerOptions) + let config: error + unit +} diff --git a/driver/js/src/test/projects/js/mlscript/Output2.js b/driver/js/src/test/projects/js/mlscript/Output2.js new file mode 100644 index 000000000..28e299e83 --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/Output2.js @@ -0,0 +1,50 @@ +import * as json5 from "json5" + +function log(x) { + return console.info(x); +} +const Output2 = new class Output2 { + #CompilerOptions; + #TSConfig; + #config; + get config() { return this.#config; } + constructor() { + } + get CompilerOptions() { + const outer = this; + if (this.#CompilerOptions === undefined) { + class CompilerOptions { + #outDir; + get outDir() { return this.#outDir; } + constructor(outDir) { + this.#outDir = outDir; + } + }; + this.#CompilerOptions = ((outDir) => Object.freeze(new CompilerOptions(outDir))); + this.#CompilerOptions.class = CompilerOptions; + } + return this.#CompilerOptions; + } + get TSConfig() { + const outer = this; + if (this.#TSConfig === undefined) { + class TSConfig { + #compilerOptions; + get compilerOptions() { return this.#compilerOptions; } + constructor(compilerOptions) { + this.#compilerOptions = compilerOptions; + } + }; + this.#TSConfig = ((compilerOptions) => Object.freeze(new TSConfig(compilerOptions))); + this.#TSConfig.class = TSConfig; + } + return this.#TSConfig; + } + $init() { + const self = this; + this.#config = json5.stringify(self.TSConfig(self.CompilerOptions("bar"))); + const config = this.#config; + log(config); + } +}; +Output2.$init(); diff --git a/driver/js/src/test/projects/mlscript/Output2.mls b/driver/js/src/test/projects/mlscript/Output2.mls index 31d681f97..d9f2656e8 100644 --- a/driver/js/src/test/projects/mlscript/Output2.mls +++ b/driver/js/src/test/projects/mlscript/Output2.mls @@ -4,4 +4,4 @@ class CompilerOptions(outDir: string) class TSConfig(compilerOptions: CompilerOptions) let config = json5.stringify(TSConfig(CompilerOptions("bar"))) -config +log(config) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 6655914ae..6b1a374d4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -69,7 +69,7 @@ object DriverDiffTests { entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), - // entry("Output2", Some("./tsconfig.json")), + entry("Output2", Some("./tsconfig.json"), true), // TODO ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index ba5437416..281cccd4b 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1092,9 +1092,10 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { private def translateImport(imp: Import) = imp match { case Import(path) => + val last = path.lastIndexOf(".") JSImport( - path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")), - path.substring(0, path.lastIndexOf(".")) + ".js", // TODO: node_modules + path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), + path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), !path.endsWith(".mls") && !path.endsWith(".mlsi") ) } @@ -1102,7 +1103,8 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import], exported: Bool): Ls[Str] = { imports.flatMap { case imp @ Import(path) => - val moduleName = path.substring(path.lastIndexOf("/") + 1, path.lastIndexOf(".")) + val last = path.lastIndexOf(".") + val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) topLevelScope.declareValue(moduleName, Some(false), false) translateImport(imp).toSourceCode.toLines } ::: generateNewDef(pgrm, topModuleName, exported) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 6daf9e457..7d2f93b6e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -18,8 +18,6 @@ object TypeScript { private val ts: js.Dynamic = load("typescript") private val json: js.Dynamic = load("json5") - private val resolver = g.require.resolve - def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { val config = filename.fold[js.Any](js.Dictionary())(filename => { val content = JSFileSystem.readFile(TSModuleResolver.normalize(s"$basePath/$filename")).getOrElse("") @@ -81,8 +79,6 @@ object TypeScript { "module" -> ts.ModuleKind.CommonJS, "esModuleInterop" -> true )) - - def resolveNodeModulePath(path: String): String = resolver(path).toString() } class TSTypeChecker(checker: js.Dynamic) { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 58cd3e46f..fa12d1ec2 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -11,13 +11,16 @@ import scala.collection.mutable.{HashSet, HashMap} // for es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) { - private val fullname = TSModuleResolver.normalize(s"$workDir/$filename") - private val program = TypeScript.createProgram(Seq(fullname)) - private val cache = new HashMap[String, TSNamespace]() private implicit val configContent = TypeScript.parseOption(workDir, tsconfig) + private val fullname = + if (JSFileSystem.exists(s"$workDir/$filename")) s"$workDir/$filename" + else TypeScript.resolveModuleName(filename, "", configContent) match { + case Some(path) => path + case _ => throw new Exception(s"file $workDir/$filename doesn't exist.") + } - // check if file exists - if (!program.fileExists(fullname)) throw new Exception(s"file ${fullname} doesn't exist.") + private val program = TypeScript.createProgram(Seq(fullname)) + private val cache = new HashMap[String, TSNamespace]() private implicit val checker = TSTypeChecker(program.getTypeChecker()) From 4af255d31ba44621fb8da46a1ab0bd66c2fce332 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 5 Jun 2023 16:38:57 +0800 Subject: [PATCH 080/202] WIP: Parse require in ts2mls(not ready) --- .../js/src/main/scala/driver/FileInfo.scala | 2 +- .../.interfaces/mlscript/Output2.mlsi | 2 +- .../.interfaces/node_modules/json5/json5.mlsi | 4 ++++ .../.interfaces/node_modules/json5/parse.mlsi | 3 +++ .../node_modules/json5/stringify.mlsi | 4 ++++ .../test/scala/driver/DriverDiffTests.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 4 ++++ .../js/src/main/scala/ts2mls/TSProgram.scala | 22 +++++++++++++------ .../src/main/scala/ts2mls/TSSourceFile.scala | 17 +++++++++++++- 9 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 214638339..831ad7432 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -36,7 +36,7 @@ final case class FileInfo( if (isLocal(path)) relatedPath match { case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) - case _ => ??? // TODO: + case _ => FileInfo(workDir, s"./node_modules/$moduleName/$path", interfaceDir) } else FileInfo(workDir, path, interfaceDir) } diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi index 740b5955a..f0a0d9eda 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -2,6 +2,6 @@ import "json5.mlsi" declare module Output2() { class CompilerOptions(outDir: string) class TSConfig(compilerOptions: CompilerOptions) - let config: error + let config: nothing unit } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi index 75b3319a4..51a100e1d 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi @@ -1,2 +1,6 @@ +import "./stringify.mlsi" +import "./parse.mlsi" export declare module json5 { + export val parse = parse.parse + export val stringify = stringify.stringify } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi new file mode 100644 index 000000000..159a02317 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi @@ -0,0 +1,3 @@ +export declare module parse { + fun parse(text: string, reviver: ((string) => (anything) => anything) | (undefined)): T +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi new file mode 100644 index 000000000..7babce47f --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi @@ -0,0 +1,4 @@ +export declare module stringify { + type StringifyOptions = {replacer: (((string) => (anything) => anything) | (MutArray<(string) | (number)>)) | (undefined),space: ((string) | (number)) | (undefined),quote: (string) | (undefined),} + fun stringify: (((anything) => (((string) => (anything) => anything) | (undefined)) => (((string) | (number)) | (undefined)) => string) & ((anything) => (MutArray<(string) | (number)>) => (((string) | (number)) | (undefined)) => string)) & ((anything) => ({replacer: (((string) => (anything) => anything) | (MutArray<(string) | (number)>)) | (undefined),space: ((string) | (number)) | (undefined),quote: (string) | (undefined),}) => string) +} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 6b1a374d4..8d3d1d558 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -69,7 +69,7 @@ object DriverDiffTests { entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json"), true), // TODO + entry("Output2", Some("./tsconfig.json"), true), // TODO: Fix type and commonJS ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 7d2f93b6e..cd11e3cb8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -59,6 +59,7 @@ object TypeScript { def isImportDeclaration(node: js.Dynamic) = ts.isImportDeclaration(node) def isSourceFile(node: js.Dynamic) = ts.isSourceFile(node) def isExportDeclaration(node: js.Dynamic) = ts.isExportDeclaration(node) + def isImportEqualsDeclaration(node: js.Dynamic) = ts.isImportEqualsDeclaration(node) def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) @@ -144,6 +145,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isTupleTypeNode = TypeScript.isTupleTypeNode(node) lazy val isImplementationOfOverload = checker.isImplementationOfOverload(node) lazy val isImportDeclaration = TypeScript.isImportDeclaration(node) + lazy val isRequire = TypeScript.isImportEqualsDeclaration(node) lazy val isSourceFile = TypeScript.isSourceFile(node) lazy val isExportDeclaration = TypeScript.isExportDeclaration(node) @@ -204,6 +206,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val propertyName = TSIdentifierObject(node.propertyName) lazy val exportClause = TSNodeObject(node.exportClause) lazy val resolvedPath: String = node.resolvedPath.toString() + lazy val moduleReference = TSNodeObject(node.moduleReference) + lazy val expression = TSTokenObject(node.expression) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index fa12d1ec2..32903c532 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -42,19 +42,27 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t def resolve(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") - val (cycleList, otherList) = - importList.partition(imp => stack.contains(resolve(imp.filename))) - - otherList.foreach(imp => { - generate(resolve(imp.filename), targetPath, resolveTarget(imp.filename))(filename :: stack) - }) - val (moduleName, outputFilename) = outputOverride match { case Some(output) => (TSImport.getModuleName(output, false), output) case _ => val moduleName = TSImport.getModuleName(filename, false) (moduleName, s"$relatedPath/$moduleName.mlsi") } + + val (cycleList, otherList) = + importList.partition(imp => stack.contains(resolve(imp.filename))) + + otherList.foreach(imp => { + generate(resolve(imp.filename), targetPath, outputOverride match { + case Some(filename) => + val moduleName = TSImport.getModuleName(imp.filename, false) + val dir = TSModuleResolver.dirname(filename) + val rel = TSModuleResolver.dirname(imp.filename) + Some(TSModuleResolver.normalize(s"$dir/$rel/$moduleName.mlsi")) + case _ => resolveTarget(imp.filename) + })(filename :: stack) + }) + var writer = JSWriter(s"$targetPath/$outputFilename") val imported = new HashSet[String]() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 029db755a..054e532a3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -14,7 +14,9 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) - if (nodeObject.isImportDeclaration) + if (nodeObject.isRequire) + parseRequire(nodeObject) + else if (nodeObject.isImportDeclaration) parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) }) @@ -43,6 +45,19 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType def getImportList: List[TSImport] = importList.getFilelist def getReExportList: List[TSReExport] = reExportList.toList + private def parseRequire(req: TSNodeObject): Unit = { + val localName = req.moduleReference.expression.text + val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config) match { + case Some(name) => name + case _ => throw new AssertionError(s"unexpected required module $localName") + } + val moduleName = TSImport.getModuleName(fullname, false) + val varName = req.name.escapedText + val imp = TSSingleImport(localName, List((varName, None))) + importList.add(fullname, imp) + global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName.$varName")), false) + } + private def parseExportDeclaration(elements: TSNodeArray): Unit = { elements.foreach(ele => if (ele.propertyName.isUndefined) From 7107afc0a8725b3730ba7c445066bbc7923f3228 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 6 Jun 2023 15:33:01 +0800 Subject: [PATCH 081/202] WIP: Fix commonJS modules --- driver/js/src/main/scala/driver/Driver.scala | 29 +++++++++++++-- driver/js/src/test/output/Output2.check | 1 + .../.interfaces/mlscript/Output2.mlsi | 1 + .../src/test/projects/js/mlscript/Output2.js | 11 +++++- .../js/src/test/projects/mlscript/Output2.mls | 7 +++- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 37 ++++++++++++------- .../main/scala/mlscript/codegen/Codegen.scala | 12 +++--- shared/src/main/scala/mlscript/syntax.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 28 ++++++++++++++ 10 files changed, 103 insertions(+), 27 deletions(-) create mode 100644 driver/js/src/test/output/Output2.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 0b0c1a8d3..24f9ef522 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -8,10 +8,12 @@ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} import ts2mls.{TSModuleResolver, TSProgram, TypeScript} +import ts2mls.JSFileSystem class Driver(options: DriverOptions) { import Driver._ import ts2mls.JSFileSystem._ + import JSCompilerBackend.ModuleType private val typer = new mlscript.Typer( @@ -32,7 +34,26 @@ class Driver(options: DriverOptions) { private val importedModule = MutSet[String]() private val config = TypeScript.parseOption(options.path, options.tsconfig) - import TSModuleResolver.normalize + import TSModuleResolver.{normalize, isLocal, dirname} + + private def checkESModule(filename: String) = + if (filename.endsWith(".mls")) None + else if (isLocal(filename)) + Some(TypeScript.isESModule(config, false)) + else { + val fullname = TypeScript.resolveModuleName(filename, "", config).getOrElse("node_modules/") + def find(path: String): Boolean = { + val dir = dirname(path) + val pack = s"$dir/package.json" + if (JSFileSystem.exists(pack)) { + val config = TypeScript.parsePackage(pack) + TypeScript.isESModule(config, true) + } + else if (dir.endsWith("node_modules/")) false // TODO: throw? + else find(dir) + } + Some(find(fullname)) + } // Return true if success def execute: Boolean = @@ -209,7 +230,9 @@ class Driver(options: DriverOptions) { writeFile(mlsiFile, interfaces) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map { - case Import(path) => Import(resolveTarget(file, path)) + case Import(path) => new Import(resolveTarget(file, path)) with ModuleType { + val isESModule = checkESModule(path) + } }, exported || importedModule(file.filename)) } true @@ -223,7 +246,7 @@ class Driver(options: DriverOptions) { program: Pgrm, filename: String, moduleName: String, - imports: Ls[Import], + imports: Ls[Import with ModuleType], exported: Boolean ): Unit = try { val backend = new JSCompilerBackend() diff --git a/driver/js/src/test/output/Output2.check b/driver/js/src/test/output/Output2.check new file mode 100644 index 000000000..343f9d4ba --- /dev/null +++ b/driver/js/src/test/output/Output2.check @@ -0,0 +1 @@ +{compilerOptions:{outDir:'bar'}} diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi index f0a0d9eda..8a7ec5a15 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -2,6 +2,7 @@ import "json5.mlsi" declare module Output2() { class CompilerOptions(outDir: string) class TSConfig(compilerOptions: CompilerOptions) + fun createConfig: (path: string,) -> nothing let config: nothing unit } diff --git a/driver/js/src/test/projects/js/mlscript/Output2.js b/driver/js/src/test/projects/js/mlscript/Output2.js index 28e299e83..a4e04bf46 100644 --- a/driver/js/src/test/projects/js/mlscript/Output2.js +++ b/driver/js/src/test/projects/js/mlscript/Output2.js @@ -1,4 +1,4 @@ -import * as json5 from "json5" +import json5 from "json5" function log(x) { return console.info(x); @@ -10,6 +10,13 @@ const Output2 = new class Output2 { get config() { return this.#config; } constructor() { } + createConfig(path) { + return ((() => { + let options = { outDir: path }; + let config = { compilerOptions: options }; + return json5.stringify(config); + })()); + } get CompilerOptions() { const outer = this; if (this.#CompilerOptions === undefined) { @@ -42,7 +49,7 @@ const Output2 = new class Output2 { } $init() { const self = this; - this.#config = json5.stringify(self.TSConfig(self.CompilerOptions("bar"))); + this.#config = self.createConfig("bar"); const config = this.#config; log(config); } diff --git a/driver/js/src/test/projects/mlscript/Output2.mls b/driver/js/src/test/projects/mlscript/Output2.mls index d9f2656e8..b8bd9ab35 100644 --- a/driver/js/src/test/projects/mlscript/Output2.mls +++ b/driver/js/src/test/projects/mlscript/Output2.mls @@ -3,5 +3,10 @@ import "json5" class CompilerOptions(outDir: string) class TSConfig(compilerOptions: CompilerOptions) -let config = json5.stringify(TSConfig(CompilerOptions("bar"))) +fun createConfig(path: string) = + let options = { outDir: path } + let config = { compilerOptions: options } + json5.stringify(config) + +let config = createConfig("bar") log(config) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 8d3d1d558..065e85a7f 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -69,7 +69,7 @@ object DriverDiffTests { entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json"), true), // TODO: Fix type and commonJS + entry("Output2", Some("./tsconfig.json")), ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 8a9909831..dd2af011f 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1090,24 +1090,33 @@ class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { SourceCode.fromStmts(polyfill.emit() ++ ins).toLines } - private def translateImport(imp: Import) = imp match { - case Import(path) => - val last = path.lastIndexOf(".") - JSImport( - path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), - path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), - !path.endsWith(".mls") && !path.endsWith(".mlsi") - ) + import JSCompilerBackend.ModuleType + + private def translateImport(imp: Import with ModuleType) = { + val path = imp.path + val last = path.lastIndexOf(".") + JSImport( + path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), + path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), + imp.isESModule + ) } - def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import], exported: Bool): Ls[Str] = { - imports.flatMap { - case imp @ Import(path) => - val last = path.lastIndexOf(".") + def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool): Ls[Str] = { + imports.flatMap (imp => { + val path = imp.path + val last = path.lastIndexOf(".") val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) topLevelScope.declareValue(moduleName, Some(false), false) - translateImport(imp).toSourceCode.toLines - } ::: generateNewDef(pgrm, topModuleName, exported) + translateImport(imp).toSourceCode.toLines + }) ::: generateNewDef(pgrm, topModuleName, exported) + } +} + +object JSCompilerBackend { + // N -> mls module, S(true) -> ES module, S(false) -> CommonJS module + trait ModuleType { + val isESModule: Opt[Bool] } } diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index 4cb1c1e28..0250fca48 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -916,12 +916,14 @@ final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { SourceCode(s"export ${moduleDecl.toSourceCode}") } -final case class JSImport(name: Str, path: Str, fromTS: Bool) extends JSStmt { +// None: mls module, Some(true): ES module, Some(false): common JS module +final case class JSImport(name: Str, path: Str, isESModule: Opt[Bool]) extends JSStmt { def toSourceCode: SourceCode = - if (fromTS) - SourceCode(s"import * as $name from \"$path\"\n") - else - SourceCode(s"import { $name } from \"$path\"\n") + isESModule match { + case N => SourceCode(s"import { $name } from \"$path\"\n") + case S(true) => SourceCode(s"import * as $name from \"$path\"\n") + case S(false) => SourceCode(s"import $name from \"$path\"\n") + } } final case class JSComment(text: Str) extends JSStmt { diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index 001e8d553..1a60e2f8c 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -113,8 +113,8 @@ sealed trait Statement extends StatementImpl final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement final case class DataDefn(body: Term) extends Statement final case class DatatypeDefn(head: Term, body: Term) extends Statement -final case class Import(path: Str) extends Statement final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } +case class Import(path: Str) extends Statement sealed trait DesugaredStatement extends Statement with DesugaredStatementImpl diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index cd11e3cb8..e7547f8f4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -5,6 +5,7 @@ import js.Dynamic.{global => g} import js.DynamicImplicits._ import js.JSConverters._ import ts2mls.types._ +import mlscript.utils._ object TypeScript { private def load(moduleName: String) = try g.require(moduleName) catch { @@ -18,6 +19,7 @@ object TypeScript { private val ts: js.Dynamic = load("typescript") private val json: js.Dynamic = load("json5") + // tsconfig.json def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { val config = filename.fold[js.Any](js.Dictionary())(filename => { val content = JSFileSystem.readFile(TSModuleResolver.normalize(s"$basePath/$filename")).getOrElse("") @@ -27,6 +29,12 @@ object TypeScript { ts.parseJsonConfigFileContent(config, ts.sys, basePath, null, name) } + // package.json + def parsePackage(path: String): js.Dynamic = { + val content = JSFileSystem.readFile(TSModuleResolver.normalize(path)).getOrElse("") + json.parse(content) + } + def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): Option[String] = { val res = ts.resolveModuleName(importName, containingName, config, ts.sys) if (!IsUndefined(res.resolvedModule) && !IsUndefined(res.resolvedModule.resolvedFileName)) @@ -80,6 +88,26 @@ object TypeScript { "module" -> ts.ModuleKind.CommonJS, "esModuleInterop" -> true )) + + def isESModule(config: js.Dynamic, isJS: Boolean): Boolean = + if (isJS) { + val tp = config.selectDynamic("type") + if (IsUndefined(tp)) false + else tp.toString() === "module" + } + else { + val raw = config.selectDynamic("raw") + if (IsUndefined(raw)) false + else { + val opt = raw.selectDynamic("compilerOptions") + if (IsUndefined(opt)) false + else { + val mdl = opt.selectDynamic("module") + if (IsUndefined(mdl)) false + else mdl.toString() =/= "CommonJS" + } + } + } } class TSTypeChecker(checker: js.Dynamic) { From 8d73371d6c69f6d709d4194e85f292ab4d5de53e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 6 Jun 2023 15:41:51 +0800 Subject: [PATCH 082/202] WIP: Rerun test --- .../.interfaces/mlscript/Output2.mlsi | 2 -- .../src/test/projects/js/mlscript/Output2.js | 32 ------------------- .../js/src/test/projects/mlscript/Output2.mls | 3 -- 3 files changed, 37 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi index 8a7ec5a15..10113f0c2 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -1,7 +1,5 @@ import "json5.mlsi" declare module Output2() { - class CompilerOptions(outDir: string) - class TSConfig(compilerOptions: CompilerOptions) fun createConfig: (path: string,) -> nothing let config: nothing unit diff --git a/driver/js/src/test/projects/js/mlscript/Output2.js b/driver/js/src/test/projects/js/mlscript/Output2.js index a4e04bf46..641649ac8 100644 --- a/driver/js/src/test/projects/js/mlscript/Output2.js +++ b/driver/js/src/test/projects/js/mlscript/Output2.js @@ -4,8 +4,6 @@ function log(x) { return console.info(x); } const Output2 = new class Output2 { - #CompilerOptions; - #TSConfig; #config; get config() { return this.#config; } constructor() { @@ -17,36 +15,6 @@ const Output2 = new class Output2 { return json5.stringify(config); })()); } - get CompilerOptions() { - const outer = this; - if (this.#CompilerOptions === undefined) { - class CompilerOptions { - #outDir; - get outDir() { return this.#outDir; } - constructor(outDir) { - this.#outDir = outDir; - } - }; - this.#CompilerOptions = ((outDir) => Object.freeze(new CompilerOptions(outDir))); - this.#CompilerOptions.class = CompilerOptions; - } - return this.#CompilerOptions; - } - get TSConfig() { - const outer = this; - if (this.#TSConfig === undefined) { - class TSConfig { - #compilerOptions; - get compilerOptions() { return this.#compilerOptions; } - constructor(compilerOptions) { - this.#compilerOptions = compilerOptions; - } - }; - this.#TSConfig = ((compilerOptions) => Object.freeze(new TSConfig(compilerOptions))); - this.#TSConfig.class = TSConfig; - } - return this.#TSConfig; - } $init() { const self = this; this.#config = self.createConfig("bar"); diff --git a/driver/js/src/test/projects/mlscript/Output2.mls b/driver/js/src/test/projects/mlscript/Output2.mls index b8bd9ab35..0cbdff521 100644 --- a/driver/js/src/test/projects/mlscript/Output2.mls +++ b/driver/js/src/test/projects/mlscript/Output2.mls @@ -1,8 +1,5 @@ import "json5" -class CompilerOptions(outDir: string) -class TSConfig(compilerOptions: CompilerOptions) - fun createConfig(path: string) = let options = { outDir: path } let config = { compilerOptions: options } From 2a136367616f47405fa9e73e3bf1931e2ecf5064 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 8 Jun 2023 12:09:46 +0800 Subject: [PATCH 083/202] WIP: Fix ts2mls test path and function translation --- .../.interfaces/node_modules/json5/parse.mlsi | 2 +- .../node_modules/json5/stringify.mlsi | 4 +- .../main/scala/ts2mls/types/Converter.scala | 5 +- ts2mls/js/src/test/diff/Array.mlsi | 14 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 16 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 12 +- ts2mls/js/src/test/diff/Dec.mlsi | 8 +- ts2mls/js/src/test/diff/Dependency.mlsi | 10 +- ts2mls/js/src/test/diff/ES5.mlsi | 906 +++++++++--------- ts2mls/js/src/test/diff/Enum.mlsi | 6 +- ts2mls/js/src/test/diff/Export.mlsi | 6 +- ts2mls/js/src/test/diff/Heritage.mlsi | 6 +- ts2mls/js/src/test/diff/HighOrderFunc.mlsi | 6 +- ts2mls/js/src/test/diff/Import.mlsi | 4 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 20 +- ts2mls/js/src/test/diff/Intersection.mlsi | 6 +- ts2mls/js/src/test/diff/Namespace.mlsi | 12 +- ts2mls/js/src/test/diff/Optional.mlsi | 20 +- ts2mls/js/src/test/diff/Overload.mlsi | 24 +- ts2mls/js/src/test/diff/Tuple.mlsi | 20 +- ts2mls/js/src/test/diff/Type.mlsi | 14 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 10 +- ts2mls/js/src/test/diff/Union.mlsi | 12 +- ts2mls/js/src/test/diff/Variables.mlsi | 10 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 46 +- 25 files changed, 600 insertions(+), 599 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi index e0c664779..85f82faa3 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi @@ -1,3 +1,3 @@ export declare module parse { - fun parse(text: Str, reviver: ((Str) => (anything) => anything) | (undefined)): T + fun parse(text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): T } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi index ec72e7013..bb86a1639 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi @@ -1,4 +1,4 @@ export declare module stringify { - type StringifyOptions = {replacer: (((Str) => (anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - fun stringify: (((anything) => (((Str) => (anything) => anything) | (undefined)) => (((Str) | (Num)) | (undefined)) => Str) & ((anything) => (MutArray<(Str) | (Num)>) => (((Str) | (Num)) | (undefined)) => Str)) & ((anything) => ({replacer: (((Str) => (anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) + type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} + fun stringify: (((value: anything, replacer: ((key: Str, value: anything) => anything) | (undefined), space: ((Str) | (Num)) | (undefined)) => Str) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: ((Str) | (Num)) | (undefined)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index b186ba80c..da14d531a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -40,9 +40,8 @@ object Converter { case TSPrimitiveType(typeName) => primitiveName(typeName) case TSReferenceType(name) => name case TSFunctionType(params, res, _) => - if (params.length == 0) s"${primitiveName("void")} => ${convert(res)}" - else - params.foldRight(convert(res))((p, f) => s"(${convert(p.tp)}) => $f") + val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") + s"($pList) => ${convert(res)}" case TSUnionType(lhs, rhs) => s"(${convert(lhs)}) | (${convert(rhs)})" case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" case TSTypeParameter(name, _) => name // constraints should be translated where the type parameters were created rather than be used diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index 31074d8cf..ab3d27aec 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -1,18 +1,18 @@ export declare module Array { - fun first(x: MutArray): string - fun getZero3(): MutArray - fun first2(fs: MutArray<(number) => number>): (number) => number - fun doEs(e: MutArray): MutArray + fun first(x: MutArray): Str + fun getZero3(): MutArray + fun first2(fs: MutArray<(x: Num) => Num>): (x: Num) => Num + fun doEs(e: MutArray): MutArray declare class C {} declare trait I { - val i: number + val i: Num } fun doCs(c: MutArray): MutArray fun doIs(i: MutArray): MutArray fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> - fun clean(x: MutArray<(string, number, )>): MutArray<(string, number, )> + fun clean(x: MutArray<(Str, Num, )>): MutArray<(Str, Num, )> fun translate(x: MutArray): MutArray - fun uu(x: MutArray<((number) | (false)) | (true)>): MutArray<((number) | (false)) | (true)> + fun uu(x: MutArray<((Num) | (false)) | (true)>): MutArray<((Num) | (false)) | (true)> declare class Temp { val x: T } diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index b62015b7c..9db221c75 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -1,25 +1,25 @@ export declare module BasicFunctions { fun hello(): unit - fun add(x: number, y: number): number - fun sub(x: number, y: number): number - fun foo(): number + fun add(x: Num, y: Num): Num + fun sub(x: Num, y: Num): Num + fun foo(): Num fun id(x: anything): anything - fun odd(x: number): (false) | (true) + fun odd(x: Num): (false) | (true) fun isnull(x: anything): (false) | (true) fun bar(): anything fun nu(n: null): null fun un(n: undefined): undefined fun fail(): nothing - fun create(): object - fun pa(x: number): number + fun create(): Object + fun pa(x: Num): Num fun wtf(x: anything): unit declare class Foooooo { - val ooooooo: number + val ooooooo: Num } fun inn(f: Foooooo): unit fun out1(): Foooooo declare trait Barrrrrrrrr { - val rrrrrrr: number + val rrrrrrr: Num } fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index e86432241..9a2e0229d 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -1,20 +1,20 @@ export declare module ClassMember { declare class Student { - constructor(s: string, age: number) - val name: string + constructor(s: Str, age: Num) + val name: Str fun isFriend(other: Student): (false) | (true) - fun addScore(sub: string, score: number): unit - fun getID(): number + fun addScore(sub: Str, score: Num): unit + fun getID(): Num } declare class Foo { fun bar(x: T): unit } declare class EZ { - fun inc(x: number): number + fun inc(x: Num): Num } declare class Outer { declare class Inner { - val a: number + val a: Num } } declare class TTT { diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index c64d7dc1c..3392a5e14 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,12 +1,12 @@ export declare module Dec { - fun getName(id: (string) | (number)): string - fun render(callback: (unit => unit) | (undefined)): string + fun getName(id: (Str) | (Num)): Str + fun render(callback: (() => unit) | (undefined)): Str declare trait Get { val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } declare class Person { - constructor(name: string, age: number) - fun getName(id: number): string + constructor(name: Str, age: Num) + fun getName(id: Num): Str } module OOO { } diff --git a/ts2mls/js/src/test/diff/Dependency.mlsi b/ts2mls/js/src/test/diff/Dependency.mlsi index 02ef2853b..266cf0683 100644 --- a/ts2mls/js/src/test/diff/Dependency.mlsi +++ b/ts2mls/js/src/test/diff/Dependency.mlsi @@ -1,15 +1,15 @@ export declare module Dependency { export declare class A { - val a: number + val a: Num } export declare class B { - val b: number + val b: Num } export declare class C { - val c: number + val c: Num } export declare class D { - val d: number + val d: Num } - fun default(): number + fun default(): Num } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index b13fccea7..2c157eb0a 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,454 +1,456 @@ -val NaN: number -val Infinity: number -fun eval(x: string): anything -fun parseInt(string: string, radix: (number) | (undefined)): number -fun parseFloat(string: string): number -fun isNaN(number: number): (false) | (true) -fun isFinite(number: number): (false) | (true) -fun decodeURI(encodedURI: string): string -fun decodeURIComponent(encodedURIComponent: string): string -fun encodeURI(uri: string): string -fun encodeURIComponent(uriComponent: (((string) | (number)) | (false)) | (true)): string -fun escape(string: string): string -fun unescape(string: string): string -declare trait Symbol { - fun toString(): string - fun valueOf(): Symbol -} -type PropertyKey = ((string) | (number)) | (Symbol) -declare trait PropertyDescriptor { - val configurable: ((false) | (true)) | (undefined) - val set: ((anything) => unit) | (undefined) - val enumerable: ((false) | (true)) | (undefined) - val get: (unit => anything) | (undefined) - val writable: ((false) | (true)) | (undefined) - val value: (anything) | (undefined) -} -declare trait PropertyDescriptorMap { - val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> -} -declare trait Object { - fun hasOwnProperty(v: ((string) | (number)) | (Symbol)): (false) | (true) - fun propertyIsEnumerable(v: ((string) | (number)) | (Symbol)): (false) | (true) - fun valueOf(): Object - fun toLocaleString(): string - val id"constructor": Function - fun isPrototypeOf(v: Object): (false) | (true) - fun toString(): string -} -declare trait ObjectConstructor { - val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> - fun getOwnPropertyNames(o: anything): MutArray - fun isFrozen(o: anything): (false) | (true) - fun getPrototypeOf(o: anything): anything - fun defineProperty(o: T, p: ((string) | (number)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T - val prototype: Object - fun isSealed(o: anything): (false) | (true) - fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T - fun preventExtensions(o: T): T - val create: ((object) => anything) & ((object) => ((PropertyDescriptorMap) & (ThisType)) => anything) - fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ - val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> - fun getOwnPropertyDescriptor(o: anything, p: ((string) | (number)) | (Symbol)): PropertyDescriptor - fun seal(o: T): T - fun keys(o: object): MutArray - fun isExtensible(o: anything): (false) | (true) -} -val Function: FunctionConstructor -declare trait FunctionConstructor { - val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> - val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> - val prototype: Function -} -type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> -type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -declare trait CallableFunction extends Function { - fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): R - fun bind(thisArg: T, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -} -declare trait NewableFunction extends Function { - fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): unit - fun bind(thisArg: anything, args: MutArray): (MutArray) => R /* warning: the overload of function bind is not supported yet. */ -} -declare trait IArguments { - val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> - val length: number - val callee: Function -} -declare trait String { - fun localeCompare(that: string, locales: ((string) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): number -} -declare trait StringConstructor { - val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> - val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> - val prototype: String - fun fromCharCode(codes: MutArray): string -} -val Boolean: BooleanConstructor -declare trait BooleanConstructor { - val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> - val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> - val prototype: Boolean -} -declare trait Number { - fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): string -} -declare trait NumberConstructor { - val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> - val NaN: number - val MIN_VALUE: number - val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> - val NEGATIVE_INFINITY: number - val POSITIVE_INFINITY: number - val MAX_VALUE: number - val prototype: Number -} -declare trait TemplateStringsArray extends ReadonlyArray { - val raw: ReadonlyArray -} -declare trait ImportMeta {} -declare trait ImportCallOptions { - val assert: (ImportAssertions) | (undefined) -} -declare trait ImportAssertions { - val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> -} -val Math: Math -declare trait Date { - fun toLocaleString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string - fun toLocaleDateString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string - fun toLocaleTimeString(locales: ((string) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): string -} -declare trait DateConstructor { - val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> - fun UTC(year: number, monthIndex: number, date: (number) | (undefined), hours: (number) | (undefined), minutes: (number) | (undefined), seconds: (number) | (undefined), ms: (number) | (undefined)): number - val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> - fun now(): number - fun parse(s: string): number - val prototype: Date -} -declare trait RegExp { - fun test(string: string): (false) | (true) - val multiline: (false) | (true) - val source: string - fun compile(pattern: string, flags: (string) | (undefined)): RegExp - val global: (false) | (true) - val lastIndex: number - val ignoreCase: (false) | (true) - fun exec(string: string): RegExpExecArray -} -val Error: ErrorConstructor -declare trait ErrorConstructor { - val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> - val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> - val prototype: Error -} -val EvalError: EvalErrorConstructor -declare trait EvalErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> - val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> - val prototype: EvalError -} -val RangeError: RangeErrorConstructor -declare trait RangeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> - val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> - val prototype: RangeError -} -val ReferenceError: ReferenceErrorConstructor -declare trait ReferenceErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> - val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> - val prototype: ReferenceError -} -val SyntaxError: SyntaxErrorConstructor -declare trait SyntaxErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> - val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> - val prototype: SyntaxError -} -val TypeError: TypeErrorConstructor -declare trait TypeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> - val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> - val prototype: TypeError -} -val URIError: URIErrorConstructor -declare trait URIErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> - val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> - val prototype: URIError -} -val JSON: JSON -declare trait ReadonlyArray { - fun lastIndexOf(searchElement: T, fromIndex: (number) | (undefined)): number - fun every(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun forEach(callbackfn: (T) => (number) => (ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit - fun filter(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> - fun reduceRight(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (T) => (number) => (ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray - val concat: ((MutArray>) => MutArray) & ((MutArray<(T) | (ConcatArray)>) => MutArray) - fun toLocaleString(): string - fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray - fun reduce(callbackfn: (U) => (T) => (number) => (ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - val length: number - fun some(predicate: (T) => (number) => (ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: T, fromIndex: (number) | (undefined)): number -} -declare trait ConcatArray { - val length: number - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> - fun join(separator: (string) | (undefined)): string - fun slice(start: (number) | (undefined), end: (number) | (undefined)): MutArray -} -val Array: ArrayConstructor -declare trait ArrayConstructor { - val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> - val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> - fun isArray(arg: anything): (false) | (true) - val prototype: MutArray -} -declare trait TypedPropertyDescriptor { - val configurable: ((false) | (true)) | (undefined) - val set: ((T) => unit) | (undefined) - val enumerable: ((false) | (true)) | (undefined) - val get: (unit => T) | (undefined) - val writable: ((false) | (true)) | (undefined) - val value: (T) | (undefined) -} -type PromiseConstructorLike = ((((T) | (PromiseLike)) => unit) => (((anything) | (undefined)) => unit) => unit) => PromiseLike -type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -declare trait ArrayLike { - val length: number - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> -} -type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> -type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> -type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> -type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> -type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> -type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> -type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> -type Omit = __type -type NonNullable = (T) & ({}) -type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> -type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> -type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> -type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> -type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> -type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> -type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> -type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -declare trait ThisType {} -val ArrayBuffer: ArrayBufferConstructor -declare trait ArrayBufferTypes { - val ArrayBuffer: ArrayBuffer -} -type ArrayBufferLike = ArrayBuffer -declare trait ArrayBufferConstructor { - val prototype: ArrayBuffer - val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> - fun isView(arg: anything): (false) | (true) -} -declare trait ArrayBufferView { - val buffer: ArrayBuffer - val byteLength: number - val byteOffset: number -} -val DataView: DataViewConstructor -declare trait DataViewConstructor { - val prototype: DataView - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> -} -val Int8Array: Int8ArrayConstructor -declare trait Int8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ - val prototype: Int8Array - fun id"of"(items: MutArray): Int8Array - val BYTES_PER_ELEMENT: number -} -declare trait Uint8Array { - fun valueOf(): Uint8Array - fun lastIndexOf(searchElement: number, fromIndex: (number) | (undefined)): number - fun every(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (number) | (undefined)): unit - fun toLocaleString(): string - val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> - fun reduceRight(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array - fun sort(compareFn: ((number) => (number) => number) | (undefined)): Uint8Array - val BYTES_PER_ELEMENT: number - fun copyWithin(target: number, start: (number) | (undefined), end: (number) | (undefined)): Uint8Array - fun find(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun subarray(begin: (number) | (undefined), end: (number) | (undefined)): Uint8Array - fun join(separator: (string) | (undefined)): string - fun map(callbackfn: (number) => (number) => (Uint8Array) => number, thisArg: (anything) | (undefined)): Uint8Array - fun forEach(callbackfn: (number) => (number) => (Uint8Array) => unit, thisArg: (anything) | (undefined)): unit - val buffer: ArrayBuffer - fun findIndex(predicate: (number) => (number) => (Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): number - fun reverse(): Uint8Array - fun filter(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array - fun slice(start: (number) | (undefined), end: (number) | (undefined)): Uint8Array - val byteLength: number - fun reduce(callbackfn: (U) => (number) => (number) => (Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): string - val length: number - fun some(predicate: (number) => (number) => (Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: number, fromIndex: (number) | (undefined)): number - val byteOffset: number -} -declare trait Uint8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ - val prototype: Uint8Array - fun id"of"(items: MutArray): Uint8Array - val BYTES_PER_ELEMENT: number -} -val Uint8ClampedArray: Uint8ClampedArrayConstructor -declare trait Uint8ClampedArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ - val prototype: Uint8ClampedArray - fun id"of"(items: MutArray): Uint8ClampedArray - val BYTES_PER_ELEMENT: number -} -val Int16Array: Int16ArrayConstructor -declare trait Int16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ - val prototype: Int16Array - fun id"of"(items: MutArray): Int16Array - val BYTES_PER_ELEMENT: number -} -val Uint16Array: Uint16ArrayConstructor -declare trait Uint16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ - val prototype: Uint16Array - fun id"of"(items: MutArray): Uint16Array - val BYTES_PER_ELEMENT: number -} -val Int32Array: Int32ArrayConstructor -declare trait Int32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ - val prototype: Int32Array - fun id"of"(items: MutArray): Int32Array - val BYTES_PER_ELEMENT: number -} -val Uint32Array: Uint32ArrayConstructor -declare trait Uint32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ - val prototype: Uint32Array - fun id"of"(items: MutArray): Uint32Array - val BYTES_PER_ELEMENT: number -} -val Float32Array: Float32ArrayConstructor -declare trait Float32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ - val prototype: Float32Array - fun id"of"(items: MutArray): Float32Array - val BYTES_PER_ELEMENT: number -} -val Float64Array: Float64ArrayConstructor -declare trait Float64ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> - fun from(arrayLike: ArrayLike, mapfn: (T) => (number) => number, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ - val prototype: Float64Array - fun id"of"(items: MutArray): Float64Array - val BYTES_PER_ELEMENT: number -} -module Intl { - export declare trait CollatorOptions { - val sensitivity: (string) | (undefined) - val ignorePunctuation: ((false) | (true)) | (undefined) - val usage: (string) | (undefined) - val localeMatcher: (string) | (undefined) - val numeric: ((false) | (true)) | (undefined) - val caseFirst: (string) | (undefined) - } - export declare trait ResolvedCollatorOptions { - val sensitivity: string - val ignorePunctuation: (false) | (true) - val usage: string - val locale: string - val numeric: (false) | (true) - val caseFirst: string - val collation: string - } - export declare trait Collator { - fun compare(x: string, y: string): number - fun resolvedOptions(): ResolvedCollatorOptions - } - export declare trait NumberFormatOptions { - val minimumSignificantDigits: (number) | (undefined) - val useGrouping: ((false) | (true)) | (undefined) - val style: (string) | (undefined) - val localeMatcher: (string) | (undefined) - val currency: (string) | (undefined) - val minimumIntegerDigits: (number) | (undefined) - val maximumFractionDigits: (number) | (undefined) - val currencySign: (string) | (undefined) - val maximumSignificantDigits: (number) | (undefined) - val minimumFractionDigits: (number) | (undefined) - } - export declare trait ResolvedNumberFormatOptions { - val numberingSystem: string - val minimumSignificantDigits: (number) | (undefined) - val useGrouping: (false) | (true) - val style: string - val locale: string - val currency: (string) | (undefined) - val minimumIntegerDigits: number - val maximumFractionDigits: number - val maximumSignificantDigits: (number) | (undefined) - val minimumFractionDigits: number - } - export declare trait NumberFormat { - fun format(value: number): string - fun resolvedOptions(): ResolvedNumberFormatOptions - } - export declare trait DateTimeFormatOptions { - val minute: ((string) | (string)) | (undefined) - val year: ((string) | (string)) | (undefined) - val hour: ((string) | (string)) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (((string) | (string)) | (string)) | (undefined) - val formatMatcher: ((string) | (string)) | (undefined) - val day: ((string) | (string)) | (undefined) - val timeZone: (string) | (undefined) - val month: (((((string) | (string)) | (string)) | (string)) | (string)) | (undefined) - val second: ((string) | (string)) | (undefined) - val localeMatcher: ((string) | (string)) | (undefined) - val timeZoneName: ((((((string) | (string)) | (string)) | (string)) | (string)) | (string)) | (undefined) - val era: (((string) | (string)) | (string)) | (undefined) - } - export declare trait ResolvedDateTimeFormatOptions { - val numberingSystem: string - val minute: (string) | (undefined) - val year: (string) | (undefined) - val hour: (string) | (undefined) - val second: (string) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (string) | (undefined) - val day: (string) | (undefined) - val timeZone: string - val month: (string) | (undefined) - val locale: string - val calendar: string - val timeZoneName: (string) | (undefined) - val era: (string) | (undefined) - } - export declare trait DateTimeFormat { - fun format(date: ((number) | (Date)) | (undefined)): string - fun resolvedOptions(): ResolvedDateTimeFormatOptions +export declare module ES5 { + val NaN: Num + val Infinity: Num + fun eval(x: Str): anything + fun parseInt(string: Str, radix: (Num) | (undefined)): Num + fun parseFloat(string: Str): Num + fun isNaN(number: Num): (false) | (true) + fun isFinite(number: Num): (false) | (true) + fun decodeURI(encodedURI: Str): Str + fun decodeURIComponent(encodedURIComponent: Str): Str + fun encodeURI(uri: Str): Str + fun encodeURIComponent(uriComponent: (((Str) | (Num)) | (false)) | (true)): Str + fun escape(string: Str): Str + fun unescape(string: Str): Str + declare trait Symbol { + fun toString(): Str + fun valueOf(): Symbol + } + type PropertyKey = ((Str) | (Num)) | (Symbol) + declare trait PropertyDescriptor { + val configurable: ((false) | (true)) | (undefined) + val set: ((v: anything) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (() => anything) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (anything) | (undefined) + } + declare trait PropertyDescriptorMap { + val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> + } + declare trait Object { + fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun valueOf(): Object + fun toLocaleString(): Str + val id"constructor": Function + fun isPrototypeOf(v: Object): (false) | (true) + fun toString(): Str + } + declare trait ObjectConstructor { + val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> + fun getOwnPropertyNames(o: anything): MutArray + fun isFrozen(o: anything): (false) | (true) + fun getPrototypeOf(o: anything): anything + fun defineProperty(o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T + val prototype: Object + fun isSealed(o: anything): (false) | (true) + fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T + fun preventExtensions(o: T): T + val create: ((o: Object) => anything) & ((o: Object, properties: (PropertyDescriptorMap) & (ThisType)) => anything) + fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ + val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> + fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor + fun seal(o: T): T + fun keys(o: Object): MutArray + fun isExtensible(o: anything): (false) | (true) + } + val Function: FunctionConstructor + declare trait FunctionConstructor { + val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> + val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> + val prototype: Function + } + type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> + type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> + declare trait CallableFunction extends Function { + fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): R + fun bind(thisArg: T, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ + } + declare trait NewableFunction extends Function { + fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): unit + fun bind(thisArg: anything, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ + } + declare trait IArguments { + val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> + val length: Num + val callee: Function + } + declare trait String { + fun localeCompare(that: Str, locales: ((Str) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): Num + } + declare trait StringConstructor { + val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> + val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> + val prototype: String + fun fromCharCode(codes: MutArray): Str + } + val Boolean: BooleanConstructor + declare trait BooleanConstructor { + val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> + val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> + val prototype: Boolean + } + declare trait Number { + fun toLocaleString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): Str + } + declare trait NumberConstructor { + val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> + val NaN: Num + val MIN_VALUE: Num + val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> + val NEGATIVE_INFINITY: Num + val POSITIVE_INFINITY: Num + val MAX_VALUE: Num + val prototype: Number + } + declare trait TemplateStringsArray extends ReadonlyArray { + val raw: ReadonlyArray + } + declare trait ImportMeta {} + declare trait ImportCallOptions { + val assert: (ImportAssertions) | (undefined) + } + declare trait ImportAssertions { + val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> + } + val Math: Math + declare trait Date { + fun toLocaleString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str + fun toLocaleDateString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str + fun toLocaleTimeString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str + } + declare trait DateConstructor { + val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> + fun UTC(year: Num, monthIndex: Num, date: (Num) | (undefined), hours: (Num) | (undefined), minutes: (Num) | (undefined), seconds: (Num) | (undefined), ms: (Num) | (undefined)): Num + val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> + fun now(): Num + fun parse(s: Str): Num + val prototype: Date + } + declare trait RegExp { + fun test(string: Str): (false) | (true) + val multiline: (false) | (true) + val source: Str + fun compile(pattern: Str, flags: (Str) | (undefined)): RegExp + val global: (false) | (true) + val lastIndex: Num + val ignoreCase: (false) | (true) + fun exec(string: Str): RegExpExecArray + } + val Error: ErrorConstructor + declare trait ErrorConstructor { + val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> + val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> + val prototype: Error + } + val EvalError: EvalErrorConstructor + declare trait EvalErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> + val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> + val prototype: EvalError + } + val RangeError: RangeErrorConstructor + declare trait RangeErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> + val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> + val prototype: RangeError + } + val ReferenceError: ReferenceErrorConstructor + declare trait ReferenceErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> + val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> + val prototype: ReferenceError + } + val SyntaxError: SyntaxErrorConstructor + declare trait SyntaxErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> + val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> + val prototype: SyntaxError + } + val TypeError: TypeErrorConstructor + declare trait TypeErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> + val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> + val prototype: TypeError + } + val URIError: URIErrorConstructor + declare trait URIErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> + val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> + val prototype: URIError + } + val JSON: JSON + declare trait ReadonlyArray { + fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun forEach(callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit + fun filter(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> + fun reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray + val concat: ((items: MutArray>) => MutArray) & ((items: MutArray<(T) | (ConcatArray)>) => MutArray) + fun toLocaleString(): Str + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray + fun reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + } + declare trait ConcatArray { + val length: Num + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> + fun join(separator: (Str) | (undefined)): Str + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray + } + val Array: ArrayConstructor + declare trait ArrayConstructor { + val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> + val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> + fun isArray(arg: anything): (false) | (true) + val prototype: MutArray + } + declare trait TypedPropertyDescriptor { + val configurable: ((false) | (true)) | (undefined) + val set: ((value: T) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (() => T) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (T) | (undefined) + } + type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike + type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> + declare trait ArrayLike { + val length: Num + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> + } + type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> + type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> + type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> + type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> + type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> + type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> + type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> + type Omit = __type + type NonNullable = (T) & ({}) + type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> + type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> + type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> + type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> + type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> + type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> + type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> + type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> + declare trait ThisType {} + val ArrayBuffer: ArrayBufferConstructor + declare trait ArrayBufferTypes { + val ArrayBuffer: ArrayBuffer + } + type ArrayBufferLike = ArrayBuffer + declare trait ArrayBufferConstructor { + val prototype: ArrayBuffer + val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> + fun isView(arg: anything): (false) | (true) + } + declare trait ArrayBufferView { + val buffer: ArrayBuffer + val byteLength: Num + val byteOffset: Num + } + val DataView: DataViewConstructor + declare trait DataViewConstructor { + val prototype: DataView + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> + } + val Int8Array: Int8ArrayConstructor + declare trait Int8ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int8Array + fun id"of"(items: MutArray): Int8Array + val BYTES_PER_ELEMENT: Num + } + declare trait Uint8Array { + fun valueOf(): Uint8Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike, offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> + fun reduceRight(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun find(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: (anything) | (undefined)): Uint8Array + fun forEach(callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Uint8Array + fun filter(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + val byteLength: Num + fun reduce(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num + } + declare trait Uint8ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint8Array + fun id"of"(items: MutArray): Uint8Array + val BYTES_PER_ELEMENT: Num + } + val Uint8ClampedArray: Uint8ClampedArrayConstructor + declare trait Uint8ClampedArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + val prototype: Uint8ClampedArray + fun id"of"(items: MutArray): Uint8ClampedArray + val BYTES_PER_ELEMENT: Num + } + val Int16Array: Int16ArrayConstructor + declare trait Int16ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int16Array + fun id"of"(items: MutArray): Int16Array + val BYTES_PER_ELEMENT: Num + } + val Uint16Array: Uint16ArrayConstructor + declare trait Uint16ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint16Array + fun id"of"(items: MutArray): Uint16Array + val BYTES_PER_ELEMENT: Num + } + val Int32Array: Int32ArrayConstructor + declare trait Int32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int32Array + fun id"of"(items: MutArray): Int32Array + val BYTES_PER_ELEMENT: Num + } + val Uint32Array: Uint32ArrayConstructor + declare trait Uint32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint32Array + fun id"of"(items: MutArray): Uint32Array + val BYTES_PER_ELEMENT: Num + } + val Float32Array: Float32ArrayConstructor + declare trait Float32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Float32Array + fun id"of"(items: MutArray): Float32Array + val BYTES_PER_ELEMENT: Num + } + val Float64Array: Float64ArrayConstructor + declare trait Float64ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> + fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + val prototype: Float64Array + fun id"of"(items: MutArray): Float64Array + val BYTES_PER_ELEMENT: Num + } + module Intl { + export declare trait CollatorOptions { + val sensitivity: (Str) | (undefined) + val ignorePunctuation: ((false) | (true)) | (undefined) + val usage: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val numeric: ((false) | (true)) | (undefined) + val caseFirst: (Str) | (undefined) + } + export declare trait ResolvedCollatorOptions { + val sensitivity: Str + val ignorePunctuation: (false) | (true) + val usage: Str + val locale: Str + val numeric: (false) | (true) + val caseFirst: Str + val collation: Str + } + export declare trait Collator { + fun compare(x: Str, y: Str): Num + fun resolvedOptions(): ResolvedCollatorOptions + } + export declare trait NumberFormatOptions { + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: ((false) | (true)) | (undefined) + val style: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val currency: (Str) | (undefined) + val minimumIntegerDigits: (Num) | (undefined) + val maximumFractionDigits: (Num) | (undefined) + val currencySign: (Str) | (undefined) + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: (Num) | (undefined) + } + export declare trait ResolvedNumberFormatOptions { + val numberingSystem: Str + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: (false) | (true) + val style: Str + val locale: Str + val currency: (Str) | (undefined) + val minimumIntegerDigits: Num + val maximumFractionDigits: Num + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: Num + } + export declare trait NumberFormat { + fun format(value: Num): Str + fun resolvedOptions(): ResolvedNumberFormatOptions + } + export declare trait DateTimeFormatOptions { + val minute: ((Str) | (Str)) | (undefined) + val year: ((Str) | (Str)) | (undefined) + val hour: ((Str) | (Str)) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (((Str) | (Str)) | (Str)) | (undefined) + val formatMatcher: ((Str) | (Str)) | (undefined) + val day: ((Str) | (Str)) | (undefined) + val timeZone: (Str) | (undefined) + val month: (((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val second: ((Str) | (Str)) | (undefined) + val localeMatcher: ((Str) | (Str)) | (undefined) + val timeZoneName: ((((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val era: (((Str) | (Str)) | (Str)) | (undefined) + } + export declare trait ResolvedDateTimeFormatOptions { + val numberingSystem: Str + val minute: (Str) | (undefined) + val year: (Str) | (undefined) + val hour: (Str) | (undefined) + val second: (Str) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (Str) | (undefined) + val day: (Str) | (undefined) + val timeZone: Str + val month: (Str) | (undefined) + val locale: Str + val calendar: Str + val timeZoneName: (Str) | (undefined) + val era: (Str) | (undefined) + } + export declare trait DateTimeFormat { + fun format(date: ((Num) | (Date)) | (undefined)): Str + fun resolvedOptions(): ResolvedDateTimeFormatOptions + } } } diff --git a/ts2mls/js/src/test/diff/Enum.mlsi b/ts2mls/js/src/test/diff/Enum.mlsi index 1bd8d8389..5fd0c17b8 100644 --- a/ts2mls/js/src/test/diff/Enum.mlsi +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -1,5 +1,5 @@ export declare module Enum { - fun pass(c: int): (false) | (true) - fun stop(): int - fun g(x: int): int + fun pass(c: Int): (false) | (true) + fun stop(): Int + fun g(x: Int): Int } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index da8ad9e6d..6ebacb54c 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -1,12 +1,12 @@ import "./Dependency.mlsi" export declare module Export { export module Foo { - fun Baz(aa: string): IBar + fun Baz(aa: Str): IBar declare trait IBar { - val a: string + val a: Str } export declare class Bar extends IBar { - val a: string + val a: Str } export val baz: IBar } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 560b0ffbc..622a8a763 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -7,7 +7,7 @@ export declare module Heritage { fun set(x: T): unit fun get(): T } - declare class D extends C {} + declare class D extends C {} declare trait Wu { val x: (false) | (true) } @@ -23,7 +23,7 @@ export declare module Heritage { declare class VG { val x: T } - declare class Home extends VG { + declare class Home extends VG { val y: T } declare trait O { @@ -34,7 +34,7 @@ export declare module Heritage { } module Five { export declare class ROTK { - val wu: string + val wu: Str } export declare class Y extends ROTK {} } diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi index 48d79dde3..82bfca983 100644 --- a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi +++ b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi @@ -1,5 +1,5 @@ export declare module HighOrderFunc { - fun h1(inc: (number) => number, num: number): number - fun h2(hint: string): unit => string - fun h3(f: (number) => number, g: (number) => number): (number) => number + fun h1(inc: (n: Num) => Num, num: Num): Num + fun h2(hint: Str): () => Str + fun h3(f: (x: Num) => Num, g: (x: Num) => Num): (x: Num) => Num } diff --git a/ts2mls/js/src/test/diff/Import.mlsi b/ts2mls/js/src/test/diff/Import.mlsi index 93ba06f98..c2f55a3d2 100644 --- a/ts2mls/js/src/test/diff/Import.mlsi +++ b/ts2mls/js/src/test/diff/Import.mlsi @@ -1,9 +1,9 @@ import "./Dependency.mlsi" export declare module Import { - val t: number + val t: Num val a: Dependency.A val b: Dependency.B val c: Dependency.C val d: Dependency.D - val dd: number + val dd: Num } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index ae4b7d29c..f3d08bade 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -1,17 +1,17 @@ export declare module InterfaceMember { declare trait IFoo { - val a: string - fun b(x: number): number + val a: Str + fun b(x: Num): Num fun c(): (false) | (true) - fun d(x: string): unit + fun d(x: Str): unit } declare trait II { - fun test(x: T): number + fun test(x: T): Num } - fun create(): {v: number,} - fun get(x: {t: string,}): string + fun create(): {v: Num,} + fun get(x: {t: Str,}): Str declare trait IEvent { - fun callback(): (number) => unit + fun callback(): (x: Num) => unit } declare trait SearchFunc { val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> @@ -21,12 +21,12 @@ export declare module InterfaceMember { } declare trait Counter { val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> - val interval: number + val interval: Num fun reset(): unit } declare trait Simple { - val a: number - fun b(x: (false) | (true)): string + val a: Num + fun b(x: (false) | (true)): Str } declare trait Simple2 { val abc: T diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index e1e1b8a8d..1296000be 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,12 +1,12 @@ export declare module Intersection { fun extend(first: T, second: U): (T) & (U) fun foo(x: (T) & (U)): unit - fun over(f: ((number) => string) & ((object) => string)): string + fun over(f: ((x: Num) => Str) & ((x: Object) => Str)): Str declare trait IA { - val x: number + val x: Num } declare trait IB { - val y: number + val y: Num } fun iii(x: (IA) & (IB)): (IA) & (IB) fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 86b174647..da3c4725c 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,26 +1,26 @@ export declare module Namespace { module N1 { - fun f(x: anything): number - fun ff(y: anything): number + fun f(x: anything): Num + fun ff(y: anything): Num export declare class C { fun f(): unit } declare trait I { - fun f(): number + fun f(): Num } export module N2 { - fun fff(x: (false) | (true)): number + fun fff(x: (false) | (true)): Num fun gg(c: C): C declare class BBB extends C {} } } module AA { - fun f(x: anything): string + fun f(x: anything): Str export declare class C { fun f(): unit } export declare trait I { - fun f(): number + fun f(): Num } export module N2 { } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index b5e4bc560..843419195 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,19 +1,19 @@ export declare module Optional { - fun buildName(firstName: string, lastName: (string) | (undefined)): string - fun buildName2(firstName: string, lastName: (string) | (undefined)): string - fun buildName3(firstName: string, lastName: MutArray): string - fun buildName4(firstName: string, lastName: MutArray): string + fun buildName(firstName: Str, lastName: (Str) | (undefined)): Str + fun buildName2(firstName: Str, lastName: (Str) | (undefined)): Str + fun buildName3(firstName: Str, lastName: MutArray): Str + fun buildName4(firstName: Str, lastName: MutArray): Str declare trait SquareConfig { - val color: (string) | (undefined) - val width: (number) | (undefined) + val color: (Str) | (undefined) + val width: (Num) | (undefined) } - fun did(x: number, f: ((number) => number) | (undefined)): number - fun getOrElse(arr: (MutArray) | (undefined)): object + fun did(x: Num, f: ((x: Num) => Num) | (undefined)): Num + fun getOrElse(arr: (MutArray) | (undefined)): Object declare class ABC {} fun testABC(abc: (ABC) | (undefined)): unit fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit - fun err(msg: ((number, string, )) | (undefined)): unit - fun toStr(x: (((number) | (false)) | (true)) | (undefined)): string + fun err(msg: ((Num, Str, )) | (undefined)): unit + fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str fun boo(x: ((T) & (U)) | (undefined)): unit declare class B { val b: T diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 4622d5f95..7c89dbf36 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,21 +1,21 @@ export declare module Overload { - fun f: ((number) => string) & ((string) => string) + fun f: ((x: Num) => Str) & ((x: Str) => Str) declare class M { - val foo: ((number) => string) & ((string) => string) + val foo: ((x: Num) => Str) & ((x: Str) => Str) } - fun app: (((string) => unit) => (number) => unit) & (((string) => unit) => (string) => unit) - fun create: ((number) => unit => (false) | (true)) & (((false) | (true)) => unit => (false) | (true)) - fun g0: ((MutArray) => string) & ((MutArray) => string) - fun db: ((number) => MutArray) & ((object) => MutArray) + fun app: ((f: (x: Str) => unit, x: Num) => unit) & ((f: (x: Str) => unit, x: Str) => unit) + fun create: ((x: Num) => () => (false) | (true)) & ((x: (false) | (true)) => () => (false) | (true)) + fun g0: ((x: MutArray) => Str) & ((x: MutArray) => Str) + fun db: ((x: Num) => MutArray) & ((x: Object) => MutArray) declare class N {} - fun id: ((M) => unit) & ((N) => unit) - fun tst: (({z: number,}) => {y: string,}) & (({z: (false) | (true),}) => {y: string,}) - fun op: ((number) => ((number) | (undefined)) => unit) & ((number) => (((false) | (true)) | (undefined)) => unit) - fun swap: (((number, string, )) => (number, string, )) & (((string, number, )) => (number, string, )) - fun u: ((((number) | (false)) | (true)) => string) & ((object) => string) + fun id: ((x: M) => unit) & ((x: N) => unit) + fun tst: ((x: {z: Num,}) => {y: Str,}) & ((x: {z: (false) | (true),}) => {y: Str,}) + fun op: ((x: Num, y: (Num) | (undefined)) => unit) & ((x: Num, y: ((false) | (true)) | (undefined)) => unit) + fun swap: ((x: (Num, Str, )) => (Num, Str, )) & ((x: (Str, Num, )) => (Num, Str, )) + fun u: ((x: ((Num) | (false)) | (true)) => Str) & ((x: Object) => Str) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ module XX { - fun f(x: T, n: anything): string /* warning: the overload of function f is not supported yet. */ + fun f(x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index b9f33535d..a1254554e 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -1,17 +1,17 @@ export declare module Tuple { - fun key(x: (string, (false) | (true), )): string - fun value(x: (string, (false) | (true), )): (false) | (true) - fun third(x: (number, number, number, )): number - fun vec2(x: number, y: number): (number, number, ) - fun twoFunctions(ff: ((number) => number, (number) => number, ), x: number): number - fun tupleIt(x: string): (unit => string, ) - fun s(flag: (false) | (true)): ((string) | (number), ((number) | (false)) | (true), ) - fun s2(t: ((false) | (true), (string) | (number), )): (string) | (number) + fun key(x: (Str, (false) | (true), )): Str + fun value(x: (Str, (false) | (true), )): (false) | (true) + fun third(x: (Num, Num, Num, )): Num + fun vec2(x: Num, y: Num): (Num, Num, ) + fun twoFunctions(ff: ((x: Num) => Num, (x: Num) => Num, ), x: Num): Num + fun tupleIt(x: Str): (() => Str, ) + fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) + fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) fun ex(x: T, y: U): (T, U, (T) & (U), ) fun foo(x: ((T) & (U), )): unit - fun conv(x: {y: number,}): ({y: number,}, {z: string,}, ) + fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) declare class A { - val x: number + val x: Num } declare class B {} fun swap(x: (A, B, )): (B, A, ) diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 86801bf52..fca69d0bf 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -7,22 +7,22 @@ export declare module Type { val value: A } type Option = (None) | (Some) - type Func = (number) => number - type S2 = (string, string, ) + type Func = (x: Num) => Num + type S2 = (Str, Str, ) declare trait I1 {} declare trait I2 {} type I3 = (I1) & (I2) - type StringArray = Array - type SomeInterface = {x: number,y: number,} + type StringArray = Array + type SomeInterface = {x: Num,y: Num,} declare class ABC {} type DEF = ABC type TP = (A, B, C, ) module NA { - fun fb(b: string): unit - export type B = string + fun fb(b: Str): unit + export type B = Str } declare class NC { - val b: string + val b: Str } type G = ABC val none: {_tag: "None",} diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 28bfba64d..0e9fd9100 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,5 +1,5 @@ export declare module TypeParameter { - fun inc(x: T): number + fun inc(x: T): Num declare class CC { fun print(s: T): unit } @@ -7,8 +7,8 @@ export declare module TypeParameter { declare class Printer { fun print(t: T): unit } - fun setStringPrinter(p: Printer): unit - fun getStringPrinter(): Printer + fun setStringPrinter(p: Printer): unit + fun getStringPrinter(): Printer fun foo(p: Printer, x: T): T fun foo2(p: Printer, x: T): T declare class F { @@ -22,6 +22,6 @@ export declare module TypeParameter { declare class FFF { fun fff(x: T): unit } - fun fff(p: FFF, s: string): unit - fun getFFF(): FFF + fun fff(p: FFF, s: Str): unit + fun getFFF(): FFF } diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index 9f178ccca..dd2c291d2 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -1,9 +1,9 @@ export declare module Union { - fun getString(x: (((string) | (number)) | (false)) | (true)): string - fun test(x: (false) | (true)): (string) | (number) - fun run(f: ((number) => number) | ((number) => string)): anything - fun get(arr: (MutArray) | (MutArray)): unit - fun get2(t: ((string, string, )) | ((number, string, ))): string + fun getString(x: (((Str) | (Num)) | (false)) | (true)): Str + fun test(x: (false) | (true)): (Str) | (Num) + fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything + fun get(arr: (MutArray) | (MutArray)): unit + fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str fun typeVar(x: (T) | (U)): (T) | (U) - fun uuuu(x: (((string) | (number)) | (false)) | (true)): (((string) | (number)) | (false)) | (true) + fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) } diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index 0fdaf2339..a099af375 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -1,7 +1,7 @@ export declare module Variables { - val URI: string - val URI2: string - val foo: number + val URI: Str + val URI2: Str + val foo: Num val bar: false declare class FooBar {} val fb: FooBar @@ -10,7 +10,7 @@ export declare module Variables { } val d: ABC.DEF module DD { - export val foo: number - val bar: number + export val foo: Num + val bar: Num } } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index e635ad546..992294a0f 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -9,7 +9,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( filename, - "ts2mls/js/src/test/typescript", + "./ts2mls/js/src/test/typescript", !directlyImportedSet.contains(filename), None ) @@ -19,28 +19,28 @@ class TSTypeGenerationTest extends AnyFunSuite { object TSTypeGenerationTest { private val testsData = List( - "Array.ts", - "BasicFunctions.ts", - "ClassMember.ts", - "Cycle1.ts", - "Dec.d.ts", - "Enum.ts", - "ES5.d.ts", - "Export.ts", - "Heritage.ts", - "HighOrderFunc.ts", - "Import.ts", - "InterfaceMember.ts", - "Intersection.ts", - "Literal.ts", - "Namespace.ts", - "Optional.ts", - "Overload.ts", - "Tuple.ts", - "Type.ts", - "TypeParameter.ts", - "Union.ts", - "Variables.ts", + "./Array.ts", + "./BasicFunctions.ts", + "./ClassMember.ts", + "./Cycle1.ts", + "./Dec.d.ts", + "./Enum.ts", + "./ES5.d.ts", + "./Export.ts", + "./Heritage.ts", + "./HighOrderFunc.ts", + "./Import.ts", + "./InterfaceMember.ts", + "./Intersection.ts", + "./Literal.ts", + "./Namespace.ts", + "./Optional.ts", + "./Overload.ts", + "./Tuple.ts", + "./Type.ts", + "./TypeParameter.ts", + "./Union.ts", + "./Variables.ts", ) private val directlyImportedSet = Set[String]("ES5.d.ts") From 3f8d59af23bfe182bda3fb3e547ff8904e338b93 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 8 Jun 2023 13:20:04 +0800 Subject: [PATCH 084/202] WIP: Fix optional parameters in functions --- .../.interfaces/node_modules/json5/parse.mlsi | 2 +- .../node_modules/json5/stringify.mlsi | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 45 ++++++--- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/ES5.mlsi | 92 +++++++++---------- ts2mls/js/src/test/diff/Optional.mlsi | 20 ++-- ts2mls/js/src/test/diff/Overload.mlsi | 2 +- 7 files changed, 93 insertions(+), 72 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi index 85f82faa3..1c44eedba 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi @@ -1,3 +1,3 @@ export declare module parse { - fun parse(text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): T + fun parse(text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi index bb86a1639..4ba65a749 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi @@ -1,4 +1,4 @@ export declare module stringify { type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - fun stringify: (((value: anything, replacer: ((key: Str, value: anything) => anything) | (undefined), space: ((Str) | (Num)) | (undefined)) => Str) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: ((Str) | (Num)) | (undefined)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) + fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 054e532a3..400879522 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -124,7 +124,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) } else if (obj.isEnumType) TSEnumType - else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) + else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) match { + case head :: Nil => head + case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) + case Nil => throw new AssertionError("empty function type.") + } else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) @@ -141,7 +145,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // the function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = - if (tn.isFunctionLike) getFunctionType(tn) + if (tn.isFunctionLike) getFunctionType(tn) match { + case head :: Nil => head + case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) + case Nil => throw new AssertionError("empty function type.") + } else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { @@ -167,7 +175,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType lineHelper.getPos(node.pos) match { case (line, column) => TSUnsupportedType(node.toString(), node.filename, line, column) } - else if (node.isFunctionLike) getFunctionType(node) + else if (node.isFunctionLike) getFunctionType(node) match { + case head :: Nil => head + case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) + case Nil => throw new AssertionError("empty function type.") + } else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) @@ -181,17 +193,26 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else lst :+ TSTypeParameter(tp.symbol.escapedName, Some(getObjectType(tp.constraint.typeNode))) ) - private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): TSFunctionType = { - val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => ( + private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): List[TSFunctionType] = { + val res = getObjectType(node.returnType) + val tv = getTypeParameters(node) + node.parameters.foldLeft(TSFunctionType(Nil, res, tv) :: Nil)((funs, p) => ( // in typescript, you can use `this` to explicitly specifies the callee // but it never appears in the final javascript file - if (p.symbol.escapedName === "this") lst - else if (p.isOptionalParameter) - lst :+ TSParameterType(p.symbol.escapedName, TSUnionType(getObjectType(p.symbolType), TSPrimitiveType("undefined"))) - else lst :+ TSParameterType(p.symbol.escapedName, getObjectType(p.symbolType))) + if (p.symbol.escapedName === "this") funs + else if (p.isOptionalParameter) funs.lastOption match { + case Some(TSFunctionType(params, res, tv)) => + funs :+ TSFunctionType(params :+ TSParameterType(p.symbol.escapedName, getObjectType(p.symbolType)), res, tv) + case _ => throw new AssertionError("empty function type.") + } + else funs.headOption match { + case Some(TSFunctionType(params, res, tv)) => + TSFunctionType(params :+ TSParameterType(p.symbol.escapedName, getObjectType(p.symbolType)), res, tv) :: Nil + case _ => throw new AssertionError("empty function type.") + }) ) - TSFunctionType(pList, getObjectType(node.returnType), getTypeParameters(node)) } + private def getStructuralType(types: TSTypeArray, isUnion: Boolean)(implicit ns: TSNamespace): TSType = types.foldLeft[Option[TSType]](None)((prev, cur) => prev match { @@ -299,10 +320,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = if (node.isFunctionLike) overload match { case None => - addFunctionIntoNamespace(getFunctionType(node), node, name) + getFunctionType(node).foreach(addFunctionIntoNamespace(_, node, name)) case Some(decs) => { decs.foreach((d) => - addFunctionIntoNamespace(getFunctionType(d), d, name) + getFunctionType(d).foreach(addFunctionIntoNamespace(_, d, name)) ) } } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 3392a5e14..8547bbe78 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,6 +1,6 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str - fun render(callback: (() => unit) | (undefined)): Str + fun render: (() => Str) & ((callback: () => unit) => Str) declare trait Get { val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 2c157eb0a..c790b6bc0 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -2,7 +2,7 @@ export declare module ES5 { val NaN: Num val Infinity: Num fun eval(x: Str): anything - fun parseInt(string: Str, radix: (Num) | (undefined)): Num + fun parseInt: ((string: Str) => Num) & ((string: Str, radix: Num) => Num) fun parseFloat(string: Str): Num fun isNaN(number: Num): (false) | (true) fun isFinite(number: Num): (false) | (true) @@ -79,7 +79,7 @@ export declare module ES5 { val callee: Function } declare trait String { - fun localeCompare(that: Str, locales: ((Str) | (MutArray)) | (undefined), options: (Intl.CollatorOptions) | (undefined)): Num + val localeCompare: (((that: Str) => Num) & ((that: Str, locales: (Str) | (MutArray)) => Num)) & ((that: Str, locales: (Str) | (MutArray), options: Intl.CollatorOptions) => Num) } declare trait StringConstructor { val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> @@ -94,7 +94,7 @@ export declare module ES5 { val prototype: Boolean } declare trait Number { - fun toLocaleString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.NumberFormatOptions) | (undefined)): Str + val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.NumberFormatOptions) => Str) } declare trait NumberConstructor { val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> @@ -118,13 +118,13 @@ export declare module ES5 { } val Math: Math declare trait Date { - fun toLocaleString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str - fun toLocaleDateString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str - fun toLocaleTimeString(locales: ((Str) | (MutArray)) | (undefined), options: (Intl.DateTimeFormatOptions) | (undefined)): Str + val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) + val toLocaleDateString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) + val toLocaleTimeString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) } declare trait DateConstructor { val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> - fun UTC(year: Num, monthIndex: Num, date: (Num) | (undefined), hours: (Num) | (undefined), minutes: (Num) | (undefined), seconds: (Num) | (undefined), ms: (Num) | (undefined)): Num + val UTC: ((((((year: Num, monthIndex: Num) => Num) & ((year: Num, monthIndex: Num, date: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num, ms: Num) => Num) val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> fun now(): Num fun parse(s: Str): Num @@ -134,7 +134,7 @@ export declare module ES5 { fun test(string: Str): (false) | (true) val multiline: (false) | (true) val source: Str - fun compile(pattern: Str, flags: (Str) | (undefined)): RegExp + val compile: ((pattern: Str) => RegExp) & ((pattern: Str, flags: Str) => RegExp) val global: (false) | (true) val lastIndex: Num val ignoreCase: (false) | (true) @@ -184,28 +184,28 @@ export declare module ES5 { } val JSON: JSON declare trait ReadonlyArray { - fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun forEach(callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: (anything) | (undefined)): unit - fun filter(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): MutArray /* warning: the overload of function filter is not supported yet. */ + val lastIndexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) + val every: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) + val forEach: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit) => unit) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: anything) => unit) + val filter: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => MutArray) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => MutArray) val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> fun reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: (anything) | (undefined)): MutArray + val join: (() => Str) & ((separator: Str) => Str) + val map: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U) => MutArray) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: anything) => MutArray) val concat: ((items: MutArray>) => MutArray) & ((items: MutArray<(T) | (ConcatArray)>) => MutArray) fun toLocaleString(): Str - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray + val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) fun reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + val some: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) + val indexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) } declare trait ConcatArray { val length: Num val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> - fun join(separator: (Str) | (undefined)): Str - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray + val join: (() => Str) & ((separator: Str) => Str) + val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) } val Array: ArrayConstructor declare trait ArrayConstructor { @@ -222,7 +222,7 @@ export declare module ES5 { val writable: ((false) | (true)) | (undefined) val value: (T) | (undefined) } - type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike + type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (() => unit) & ((reason: anything) => unit)) => unit) => PromiseLike type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> declare trait ArrayLike { val length: Num @@ -269,44 +269,44 @@ export declare module ES5 { val Int8Array: Int8ArrayConstructor declare trait Int8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int8Array) val prototype: Int8Array fun id"of"(items: MutArray): Int8Array val BYTES_PER_ELEMENT: Num } declare trait Uint8Array { fun valueOf(): Uint8Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike, offset: (Num) | (undefined)): unit + val lastIndexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) + val every: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) + val set: ((array: ArrayLike) => unit) & ((array: ArrayLike, offset: Num) => unit) fun toLocaleString(): Str val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> fun reduceRight(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array + val fill: (((value: Num) => Uint8Array) & ((value: Num, start: Num) => Uint8Array)) & ((value: Num, start: Num, end: Num) => Uint8Array) + val sort: (() => Uint8Array) & ((compareFn: (a: Num, b: Num) => Num) => Uint8Array) val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun find(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: (anything) | (undefined)): Uint8Array - fun forEach(callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: (anything) | (undefined)): unit + val copyWithin: (((target: Num) => Uint8Array) & ((target: Num, start: Num) => Uint8Array)) & ((target: Num, start: Num, end: Num) => Uint8Array) + val find: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) + val subarray: ((() => Uint8Array) & ((begin: Num) => Uint8Array)) & ((begin: Num, end: Num) => Uint8Array) + val join: (() => Str) & ((separator: Str) => Str) + val map: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num) => Uint8Array) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: anything) => Uint8Array) + val forEach: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit) => unit) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: anything) => unit) val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + val findIndex: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) fun reverse(): Uint8Array - fun filter(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + val filter: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => Uint8Array) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => Uint8Array) + val slice: ((() => Uint8Array) & ((start: Num) => Uint8Array)) & ((start: Num, end: Num) => Uint8Array) val byteLength: Num fun reduce(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val some: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) + val indexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) val byteOffset: Num } declare trait Uint8ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8Array) val prototype: Uint8Array fun id"of"(items: MutArray): Uint8Array val BYTES_PER_ELEMENT: Num @@ -314,7 +314,7 @@ export declare module ES5 { val Uint8ClampedArray: Uint8ClampedArrayConstructor declare trait Uint8ClampedArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8ClampedArray) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8ClampedArray) val prototype: Uint8ClampedArray fun id"of"(items: MutArray): Uint8ClampedArray val BYTES_PER_ELEMENT: Num @@ -322,7 +322,7 @@ export declare module ES5 { val Int16Array: Int16ArrayConstructor declare trait Int16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int16Array) val prototype: Int16Array fun id"of"(items: MutArray): Int16Array val BYTES_PER_ELEMENT: Num @@ -330,7 +330,7 @@ export declare module ES5 { val Uint16Array: Uint16ArrayConstructor declare trait Uint16ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint16Array) val prototype: Uint16Array fun id"of"(items: MutArray): Uint16Array val BYTES_PER_ELEMENT: Num @@ -338,7 +338,7 @@ export declare module ES5 { val Int32Array: Int32ArrayConstructor declare trait Int32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int32Array) val prototype: Int32Array fun id"of"(items: MutArray): Int32Array val BYTES_PER_ELEMENT: Num @@ -346,7 +346,7 @@ export declare module ES5 { val Uint32Array: Uint32ArrayConstructor declare trait Uint32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint32Array) val prototype: Uint32Array fun id"of"(items: MutArray): Uint32Array val BYTES_PER_ELEMENT: Num @@ -354,7 +354,7 @@ export declare module ES5 { val Float32Array: Float32ArrayConstructor declare trait Float32ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float32Array) val prototype: Float32Array fun id"of"(items: MutArray): Float32Array val BYTES_PER_ELEMENT: Num @@ -362,7 +362,7 @@ export declare module ES5 { val Float64Array: Float64ArrayConstructor declare trait Float64ArrayConstructor { val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> - fun from(arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float64Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float64Array) val prototype: Float64Array fun id"of"(items: MutArray): Float64Array val BYTES_PER_ELEMENT: Num @@ -449,7 +449,7 @@ export declare module ES5 { val era: (Str) | (undefined) } export declare trait DateTimeFormat { - fun format(date: ((Num) | (Date)) | (undefined)): Str + val format: (() => Str) & ((date: (Num) | (Date)) => Str) fun resolvedOptions(): ResolvedDateTimeFormatOptions } } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 843419195..0ae2a1db6 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,22 +1,22 @@ export declare module Optional { - fun buildName(firstName: Str, lastName: (Str) | (undefined)): Str - fun buildName2(firstName: Str, lastName: (Str) | (undefined)): Str + fun buildName: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) + fun buildName2: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) fun buildName3(firstName: Str, lastName: MutArray): Str fun buildName4(firstName: Str, lastName: MutArray): Str declare trait SquareConfig { val color: (Str) | (undefined) val width: (Num) | (undefined) } - fun did(x: Num, f: ((x: Num) => Num) | (undefined)): Num - fun getOrElse(arr: (MutArray) | (undefined)): Object + fun did: ((x: Num) => Num) & ((x: Num, f: (x: Num) => Num) => Num) + fun getOrElse: (() => Object) & ((arr: MutArray) => Object) declare class ABC {} - fun testABC(abc: (ABC) | (undefined)): unit - fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit - fun err(msg: ((Num, Str, )) | (undefined)): unit - fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str - fun boo(x: ((T) & (U)) | (undefined)): unit + fun testABC: (() => unit) & ((abc: ABC) => unit) + fun testSquareConfig: (() => unit) & ((conf: SquareConfig) => unit) + fun err: (() => unit) & ((msg: (Num, Str, )) => unit) + fun toStr: (() => Str) & ((x: ((Num) | (false)) | (true)) => Str) + fun boo(x: (T) & (U)): unit /* warning: the overload of function boo is not supported yet. */ declare class B { val b: T } - fun boom(b: (B) | (undefined)): anything + fun boom: (() => anything) & ((b: B) => anything) } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 7c89dbf36..a56708b6b 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -10,7 +10,7 @@ export declare module Overload { declare class N {} fun id: ((x: M) => unit) & ((x: N) => unit) fun tst: ((x: {z: Num,}) => {y: Str,}) & ((x: {z: (false) | (true),}) => {y: Str,}) - fun op: ((x: Num, y: (Num) | (undefined)) => unit) & ((x: Num, y: ((false) | (true)) | (undefined)) => unit) + fun op: ((((x: Num) => unit) & ((x: Num, y: Num) => unit)) & ((x: Num) => unit)) & ((x: Num, y: (false) | (true)) => unit) fun swap: ((x: (Num, Str, )) => (Num, Str, )) & ((x: (Str, Num, )) => (Num, Str, )) fun u: ((x: ((Num) | (false)) | (true)) => Str) & ((x: Object) => Str) fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ From 48103e009b2c61de3229502e5e5d940d397fe701 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 10 Jun 2023 10:15:33 +0800 Subject: [PATCH 085/202] WIP: Refactor driver diff test --- driver/js/src/main/scala/driver/Driver.scala | 13 ++++++++++--- ts2mls/js/src/main/scala/ts2mls/JSWriter.scala | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 6dd890d25..3daa73c7d 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -9,6 +9,7 @@ import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} import ts2mls.{TSModuleResolver, TSProgram, TypeScript} import ts2mls.JSFileSystem +import ts2mls.JSWriter class Driver(options: DriverOptions) { import Driver._ @@ -75,7 +76,7 @@ class Driver(options: DriverOptions) { def genPackageJson(): Unit = if (!exists(s"${options.outputDir}/package.json")) { val content = """{ "type": "module" }""" // TODO: more settings? - writeFile(s"${options.outputDir}/package.json", content) + saveToFile(s"${options.outputDir}/package.json", content) } type ParseResult = (List[Statement], List[NuDecl], List[Import], Origin) @@ -227,7 +228,7 @@ class Driver(options: DriverOptions) { generateInterface(Some(file.moduleName), TypingUnit(definitions, Nil)) val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - writeFile(mlsiFile, interfaces) + saveToFile(mlsiFile, interfaces) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map { case Import(path) => new Import(resolveTarget(file, path)) with ModuleType { val isESModule = checkESModule(path) @@ -251,7 +252,7 @@ class Driver(options: DriverOptions) { val backend = new JSCompilerBackend() val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") - writeFile(filename, code) // TODO: diffTests + saveToFile(filename, code) } catch { case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation)) } @@ -264,6 +265,12 @@ object Driver { System.err.println(msg) private var totalErrors = 0 + + private def saveToFile(filename: String, content: String) = { + val writer = JSWriter(filename) + writer.write(content) + writer.close() + } // TODO factor with duplicated logic in DiffTests private def report(diag: Diagnostic): Unit = { diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index e65383b51..9b9bffc0f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -16,6 +16,8 @@ class JSWriter(filename: String) { buffer ++= strln } + def write(str: String): Unit = buffer ++= str + def close(): Unit = { val str = buffer.toString() val origin = readFile(filename).getOrElse("") From d73c8460ebff27fe089eb5de8558aa5f405eed07 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 13 Jun 2023 12:08:21 +0800 Subject: [PATCH 086/202] WIP: Fix recomp check and filename check, remove outdated output --- .gitignore | 3 - driver/js/src/main/scala/driver/Driver.scala | 6 +- driver/js/src/test/output/MLS2TheMax.check | 9 +++ .../.interfaces/mlscript/MLS2TheMax.mlsi | 12 ++++ .../.interfaces/mlscript/tools/Concat.mlsi | 4 ++ .../.interfaces/node_modules/json5/json5.mlsi | 6 -- .../.interfaces/node_modules/json5/parse.mlsi | 3 - .../node_modules/json5/stringify.mlsi | 4 -- .../projects/.interfaces/ts/ReadLine.mlsi | 7 ++ .../test/projects/js/mlscript/MLS2TheMax.js | 64 ++++++++++++++++++ .../test/projects/js/mlscript/mlscript/A.js | 22 ------- .../test/projects/js/mlscript/mlscript/B.js | 11 ---- .../projects/js/mlscript/mlscript/Cycle1.js | 11 ---- .../projects/js/mlscript/mlscript/Cycle2.js | 17 ----- .../projects/js/mlscript/mlscript/Opened.js | 20 ------ .../projects/js/mlscript/mlscript/Simple.js | 65 ------------------- .../test/projects/js/mlscript/mlscript/TS.js | 18 ----- .../js/mlscript/mlscript/tools/Inc.js | 9 --- .../test/projects/js/mlscript/tools/Concat.js | 20 ++++++ .../test/projects/js/my_ts_path/ReadLine.js | 15 +++++ .../src/test/projects/mlscript/MLS2TheMax.mls | 30 +++++++++ .../test/projects/mlscript/tools/Concat.mls | 2 + driver/js/src/test/projects/ts/ReadLine.ts | 19 ++++++ .../test/scala/driver/DriverDiffTests.scala | 1 + .../js/src/main/scala/ts2mls/TSProgram.scala | 4 +- 25 files changed, 189 insertions(+), 193 deletions(-) create mode 100644 driver/js/src/test/output/MLS2TheMax.check create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi create mode 100644 driver/js/src/test/projects/js/mlscript/MLS2TheMax.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/A.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/B.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Opened.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/Simple.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/TS.js delete mode 100644 driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js create mode 100644 driver/js/src/test/projects/js/mlscript/tools/Concat.js create mode 100644 driver/js/src/test/projects/js/my_ts_path/ReadLine.js create mode 100644 driver/js/src/test/projects/mlscript/MLS2TheMax.mls create mode 100644 driver/js/src/test/projects/mlscript/tools/Concat.mls create mode 100644 driver/js/src/test/projects/ts/ReadLine.ts diff --git a/.gitignore b/.gitignore index dabb8e335..4a989b4c7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,4 @@ metals.sbt project/Dependencies.scala project/metals.sbt **.worksheet.sc -mlsc.js -mlsc.js.map .DS_Store -!driver/js/src/test/projects/.interfaces/node_modules diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index dd453a065..d9a47c469 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -189,7 +189,7 @@ class Driver(options: DriverOptions) { isInterfaceOutdate(file.filename, s"${options.path}/${file.interfaceFilename}")) } }) - val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => nr || { + val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => { // We need to create another new context when compiling other files // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" // If we forget to add `import "D.mls"` in C, we need to raise an error @@ -200,7 +200,7 @@ class Driver(options: DriverOptions) { val newFilename = file.`import`(dp) importedModule += newFilename.filename compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ file.filename) - }) + } || nr) if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { System.out.println(s"compiling ${file.filename}...") @@ -221,7 +221,7 @@ class Driver(options: DriverOptions) { if (file.filename.endsWith(".mls")) { def generateInterface(moduleName: Option[String], tu: TypingUnit) = { val exp = `type`(tu) - packTopModule(moduleName, exp.showIn(ShowCtx.mk(exp :: Nil), 0)) + packTopModule(moduleName, exp.show) } val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + diff --git a/driver/js/src/test/output/MLS2TheMax.check b/driver/js/src/test/output/MLS2TheMax.check new file mode 100644 index 000000000..8eed19984 --- /dev/null +++ b/driver/js/src/test/output/MLS2TheMax.check @@ -0,0 +1,9 @@ +What is your name? +Hello, Admin welcome to the game! +Dear Admin, please guess a number from 1 to 5 +You guessed wrong, Admin +Do you want to continue? +Dear Admin, please guess a number from 1 to 5 +You guessed right, Admin +Do you want to continue? +Bye! diff --git a/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi new file mode 100644 index 000000000..e2d685e14 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi @@ -0,0 +1,12 @@ +import "../ts/ReadLine.mlsi" +import "./tools/Concat.mlsi" +declare module MLS2TheMax() { + fun ask: (question: Str,) -> Str + class Game(name: Str) { + fun loop: unit + let number: 4 + fun shouldContinue: unit + } + fun main: unit + unit +} diff --git a/driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi new file mode 100644 index 000000000..bad43ee68 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi @@ -0,0 +1,4 @@ +declare module Concat() { + fun concat2: (Str, Str,) -> Str + fun concat3: (Str, Str, Str,) -> Str +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi deleted file mode 100644 index 51a100e1d..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi +++ /dev/null @@ -1,6 +0,0 @@ -import "./stringify.mlsi" -import "./parse.mlsi" -export declare module json5 { - export val parse = parse.parse - export val stringify = stringify.stringify -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi deleted file mode 100644 index 1c44eedba..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi +++ /dev/null @@ -1,3 +0,0 @@ -export declare module parse { - fun parse(text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi deleted file mode 100644 index 4ba65a749..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi +++ /dev/null @@ -1,4 +0,0 @@ -export declare module stringify { - type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) -} diff --git a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi new file mode 100644 index 000000000..b098d5463 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi @@ -0,0 +1,7 @@ +export declare module ReadLine { + val lines: MutArray + val i: Num + fun getStrLn(): Str + fun putStrLn(str: Str): unit + fun parse(s: Str): Num +} diff --git a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js new file mode 100644 index 000000000..7b5b989db --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js @@ -0,0 +1,64 @@ +import * as ReadLine from "../my_ts_path/ReadLine.js" + +import { Concat } from "./tools/Concat.js" + +const MLS2TheMax = new class MLS2TheMax { + #Game; + constructor() { + } + ask(question) { + return ((() => { + ReadLine.putStrLn(question); + return ReadLine.getStrLn(); + })()); + } + get main() { + const self = this; + return ((() => { + let name = self.ask("What is your name?"); + ReadLine.putStrLn(Concat.concat3("Hello, ", name, " welcome to the game!")); + return self.Game(name).loop; + })()); + } + get Game() { + const outer = this; + if (this.#Game === undefined) { + class Game { + #name; + get name() { return this.#name; } + #number; + get number() { return this.#number; } + constructor(name) { + this.#name = name; + this.#number = 4; + const number = this.#number; + } + get shouldContinue() { + const name = this.#name; + const self = this; + return ((() => { + let ans = outer.ask("Do you want to continue?"); + return ans === "y" === true ? self.loop : ReadLine.putStrLn("Bye!"); + })()); + } + get loop() { + const name = this.#name; + const self = this; + return ((() => { + let guess = outer.ask(Concat.concat3("Dear ", name, ", please guess a number from 1 to 5")); + ReadLine.parse(guess) == self.number === true ? ReadLine.putStrLn(Concat.concat2("You guessed right, ", name)) : ReadLine.putStrLn(Concat.concat2("You guessed wrong, ", name)); + return self.shouldContinue; + })()); + } + }; + this.#Game = ((name) => Object.freeze(new Game(name))); + this.#Game.class = Game; + } + return this.#Game; + } + $init() { + const self = this; + self.main; + } +}; +MLS2TheMax.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/A.js b/driver/js/src/test/projects/js/mlscript/mlscript/A.js deleted file mode 100644 index 017078520..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/A.js +++ /dev/null @@ -1,22 +0,0 @@ -export const A = new class A { - #Foo; - constructor() { - } - get Foo() { - const outer = this; - if (this.#Foo === undefined) { - class Foo { - #x; - get x() { return this.#x; } - constructor(x) { - this.#x = x; - } - }; - this.#Foo = ((x) => Object.freeze(new Foo(x))); - this.#Foo.class = Foo; - } - return this.#Foo; - } - $init() {} -}; -A.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/B.js b/driver/js/src/test/projects/js/mlscript/mlscript/B.js deleted file mode 100644 index 187ec80d9..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/B.js +++ /dev/null @@ -1,11 +0,0 @@ -import { A } from "./A.js" - -export const B = new class B { - constructor() { - } - get foo() { - return A.Foo(12); - } - $init() {} -}; -B.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js deleted file mode 100644 index fec5e0dc2..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle1.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Cycle2 } from "./Cycle2.js" - -export const Cycle1 = new class Cycle1 { - constructor() { - } - f(x) { - return x === 0 ? 114 : Cycle2.g(x - 1); - } - $init() {} -}; -Cycle1.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js b/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js deleted file mode 100644 index dfed8717a..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/Cycle2.js +++ /dev/null @@ -1,17 +0,0 @@ -import { Cycle1 } from "./Cycle1.js" - -function log(x) { - return console.info(x); -} -export const Cycle2 = new class Cycle2 { - constructor() { - } - g(x) { - return Cycle1.f(x); - } - $init() { - const self = this; - log(self.g(42)); - } -}; -Cycle2.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js b/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js deleted file mode 100644 index e1d57115b..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/Opened.js +++ /dev/null @@ -1,20 +0,0 @@ -import { Inc } from "./tools/Inc.js" - -function log(x) { - return console.info(x); -} -export const Opened = new class Opened { - constructor() { - } - hello(x) { - return (log([ - "hello!", - Inc.inc(x) - ])); - } - $init() { - const self = this; - self.hello(114513); - } -}; -Opened.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js b/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js deleted file mode 100644 index c428f0b0c..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/Simple.js +++ /dev/null @@ -1,65 +0,0 @@ -import { Opened } from "./Opened.js" - -function log(x) { - return console.info(x); -} -const Simple = new class Simple { - #A; - #C; - #a; - get a() { return this.#a; } - constructor() { - } - B(base) { - const outer = this; - return (class B extends base { - constructor(...rest) { - super(...rest); - } - get foo() { - const self = this; - return self.n; - } - }); - } - get C() { - const outer = this; - if (this.#C === undefined) { - class C { - #b; - get b() { return this.#b; } - constructor() { - this.#b = 1; - const b = this.#b; - } - } - this.#C = new C(); - this.#C.class = C; - } - return this.#C; - } - get A() { - const outer = this; - if (this.#A === undefined) { - class A extends outer.B(Object) { - #n; - get n() { return this.#n; } - constructor(n) { - super(); - this.#n = n; - } - }; - this.#A = ((n) => Object.freeze(new A(n))); - this.#A.class = A; - } - return this.#A; - } - $init() { - const self = this; - this.#a = self.A(42); - const a = this.#a; - log(a.foo); - Opened.hello(a.n); - } -}; -Simple.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/TS.js b/driver/js/src/test/projects/js/mlscript/mlscript/TS.js deleted file mode 100644 index 2d4e3f8ac..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/TS.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as MyPrint from "../ts/MyPrint.js" - -const TS = new class TS { - #tspt; - get tspt() { return this.#tspt; } - #printer; - get printer() { return this.#printer; } - constructor() { - } - $init() { - this.#tspt = MyPrint.DatePrint; - const tspt = this.#tspt; - this.#printer = new tspt("love from ts"); - const printer = this.#printer; - printer.print("hello world!"); - } -}; -TS.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js b/driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js deleted file mode 100644 index 02fd1ff82..000000000 --- a/driver/js/src/test/projects/js/mlscript/mlscript/tools/Inc.js +++ /dev/null @@ -1,9 +0,0 @@ -export const Inc = new class Inc { - constructor() { - } - inc(x) { - return x + 1; - } - $init() {} -}; -Inc.$init(); diff --git a/driver/js/src/test/projects/js/mlscript/tools/Concat.js b/driver/js/src/test/projects/js/mlscript/tools/Concat.js new file mode 100644 index 000000000..6348a9b0b --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/tools/Concat.js @@ -0,0 +1,20 @@ +function concat(x, y) { + if (arguments.length === 2) { + return x + y; + } else { + return (y) => x + y; + } +} +export const Concat = new class Concat { + constructor() { + } + concat2(s1, s2) { + return concat(s1)(s2); + } + concat3(s1, s2, s3) { + const self = this; + return self.concat2(self.concat2(s1, s2), s3); + } + $init() {} +}; +Concat.$init(); diff --git a/driver/js/src/test/projects/js/my_ts_path/ReadLine.js b/driver/js/src/test/projects/js/my_ts_path/ReadLine.js new file mode 100644 index 000000000..0f792fc53 --- /dev/null +++ b/driver/js/src/test/projects/js/my_ts_path/ReadLine.js @@ -0,0 +1,15 @@ +const lines = [ + "Admin", "1", "y", "4", "n" +]; +let i = 0; +export function getStrLn() { + return lines[i++]; +} +export function putStrLn(str) { + console.log(str); +} +// TODO: Option +export function parse(s) { + const i = +s; + return isNaN(i) || i % 1 !== 0 ? -1 : i; +} diff --git a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls new file mode 100644 index 000000000..c900376aa --- /dev/null +++ b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls @@ -0,0 +1,30 @@ +import "../ts/ReadLine.ts" +import "./tools/Concat.mls" + +fun ask(question: Str) = + ReadLine.putStrLn(question) + ReadLine.getStrLn() + +class Game(name: Str) { + let number = 4 // fixed, or we can not apply diff test + + fun shouldContinue = + let ans = ask("Do you want to continue?") + if + ans === "y" then loop + _ then ReadLine.putStrLn("Bye!") + + fun loop = + let guess = ask(Concat.concat3("Dear ", name, ", please guess a number from 1 to 5")) + if + ReadLine.parse(guess) == number then ReadLine.putStrLn(Concat.concat2("You guessed right, ", name)) + _ then ReadLine.putStrLn(Concat.concat2("You guessed wrong, ", name)) + shouldContinue +} + +fun main = + let name = ask("What is your name?") + ReadLine.putStrLn(Concat.concat3("Hello, ", name, " welcome to the game!")) + Game(name).loop + +main diff --git a/driver/js/src/test/projects/mlscript/tools/Concat.mls b/driver/js/src/test/projects/mlscript/tools/Concat.mls new file mode 100644 index 000000000..f84f943be --- /dev/null +++ b/driver/js/src/test/projects/mlscript/tools/Concat.mls @@ -0,0 +1,2 @@ +export fun concat2(s1, s2) = concat(s1)(s2) +export fun concat3(s1, s2, s3) = concat2(concat2(s1, s2), s3) diff --git a/driver/js/src/test/projects/ts/ReadLine.ts b/driver/js/src/test/projects/ts/ReadLine.ts new file mode 100644 index 000000000..8414e8eba --- /dev/null +++ b/driver/js/src/test/projects/ts/ReadLine.ts @@ -0,0 +1,19 @@ +const lines = [ + "Admin", "1", "y", "4", "n" +] + +let i = 0 + +export function getStrLn(): string { + return lines[i++]; +} + +export function putStrLn(str: string): void { + console.log(str); +} + +// TODO: Option +export function parse(s: string) { + const i = +s + return isNaN(i) || i % 1 !== 0 ? -1 : i +} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 065e85a7f..d87c7c0f4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -70,6 +70,7 @@ object DriverDiffTests { entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), + entry("MLS2TheMax", Some("./tsconfig.json")), ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 32903c532..2ef7cc2f6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -33,6 +33,8 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t generate(TSModuleResolver.resolve(fullname), targetPath, resolveTarget(filename))(Nil) private def generate(filename: String, targetPath: String, outputOverride: Option[String])(implicit stack: List[String]): Unit = { + if (filename.endsWith(".js")) return // if users need to reuse js libs, they need to wrap them with ts signatures. + val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList @@ -68,7 +70,7 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t otherList.foreach(imp => { val name = TSImport.getModuleName(imp.filename, true) - if (!imported(name)) { + if (!imported(name) && !resolve(imp.filename).endsWith(".js")) { imported += name writer.writeln(s"""import "$name.mlsi"""") } From dce3d87a883516c61525fa4f0ad7a56e458cccd6 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 13 Jun 2023 12:53:46 +0800 Subject: [PATCH 087/202] WIP: Update re-comp check --- driver/js/src/main/scala/driver/Driver.scala | 3 +-- ts2mls/js/src/main/scala/ts2mls/JSWriter.scala | 6 ++++-- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index d9a47c469..1dca74d4b 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -165,8 +165,7 @@ class Driver(options: DriverOptions) { if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript val tsprog = TSProgram(if (!file.isNodeModule) file.localFilename else file.filename, file.workDir, true, options.tsconfig) - tsprog.generate(s"${file.workDir}/${file.interfaceDir}") - return true // TODO: check if we really need to re-compile + return tsprog.generate(s"${file.workDir}/${file.interfaceDir}") } parseAndRun(file.filename, { case (definitions, _, imports, _) => { diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 9b9bffc0f..5f7354cc9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -18,10 +18,12 @@ class JSWriter(filename: String) { def write(str: String): Unit = buffer ++= str - def close(): Unit = { + def close(): Boolean = { val str = buffer.toString() val origin = readFile(filename).getOrElse("") - if (str =/= origin) writeFile(filename, str) + val updated = str =/= origin + if (updated) writeFile(filename, str) + updated } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 2ef7cc2f6..34a6c8a37 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -29,11 +29,11 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t Option.when(!TSModuleResolver.isLocal(filename))(s"node_modules/$moduleName/$moduleName.mlsi") } - def generate(targetPath: String): Unit = + def generate(targetPath: String): Boolean = generate(TSModuleResolver.resolve(fullname), targetPath, resolveTarget(filename))(Nil) - private def generate(filename: String, targetPath: String, outputOverride: Option[String])(implicit stack: List[String]): Unit = { - if (filename.endsWith(".js")) return // if users need to reuse js libs, they need to wrap them with ts signatures. + private def generate(filename: String, targetPath: String, outputOverride: Option[String])(implicit stack: List[String]): Boolean = { + if (filename.endsWith(".js")) return false // if users need to reuse js libs, they need to wrap them with ts signatures. val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) From 3bbf33434cb10e0d8cd743d3465bc3119cdf771e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 13 Jun 2023 13:04:58 +0800 Subject: [PATCH 088/202] WIP: Fix ts2mls test --- ts2mls/js/src/test/diff/ES5.mlsi | 904 +++++++++--------- .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 2 files changed, 452 insertions(+), 454 deletions(-) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index c790b6bc0..62b0ec8f4 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,456 +1,454 @@ -export declare module ES5 { +val NaN: Num +val Infinity: Num +fun eval(x: Str): anything +fun parseInt: ((string: Str) => Num) & ((string: Str, radix: Num) => Num) +fun parseFloat(string: Str): Num +fun isNaN(number: Num): (false) | (true) +fun isFinite(number: Num): (false) | (true) +fun decodeURI(encodedURI: Str): Str +fun decodeURIComponent(encodedURIComponent: Str): Str +fun encodeURI(uri: Str): Str +fun encodeURIComponent(uriComponent: (((Str) | (Num)) | (false)) | (true)): Str +fun escape(string: Str): Str +fun unescape(string: Str): Str +declare trait Symbol { + fun toString(): Str + fun valueOf(): Symbol +} +type PropertyKey = ((Str) | (Num)) | (Symbol) +declare trait PropertyDescriptor { + val configurable: ((false) | (true)) | (undefined) + val set: ((v: anything) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (() => anything) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (anything) | (undefined) +} +declare trait PropertyDescriptorMap { + val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> +} +declare trait Object { + fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun valueOf(): Object + fun toLocaleString(): Str + val id"constructor": Function + fun isPrototypeOf(v: Object): (false) | (true) + fun toString(): Str +} +declare trait ObjectConstructor { + val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> + fun getOwnPropertyNames(o: anything): MutArray + fun isFrozen(o: anything): (false) | (true) + fun getPrototypeOf(o: anything): anything + fun defineProperty(o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T + val prototype: Object + fun isSealed(o: anything): (false) | (true) + fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T + fun preventExtensions(o: T): T + val create: ((o: Object) => anything) & ((o: Object, properties: (PropertyDescriptorMap) & (ThisType)) => anything) + fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ + val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> + fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor + fun seal(o: T): T + fun keys(o: Object): MutArray + fun isExtensible(o: anything): (false) | (true) +} +val Function: FunctionConstructor +declare trait FunctionConstructor { + val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> + val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> + val prototype: Function +} +type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> +type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> +declare trait CallableFunction extends Function { + fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): R + fun bind(thisArg: T, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ +} +declare trait NewableFunction extends Function { + fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ + fun call(thisArg: T, args: A): unit + fun bind(thisArg: anything, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ +} +declare trait IArguments { + val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> + val length: Num + val callee: Function +} +declare trait String { + val localeCompare: (((that: Str) => Num) & ((that: Str, locales: (Str) | (MutArray)) => Num)) & ((that: Str, locales: (Str) | (MutArray), options: Intl.CollatorOptions) => Num) +} +declare trait StringConstructor { + val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> + val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> + val prototype: String + fun fromCharCode(codes: MutArray): Str +} +val Boolean: BooleanConstructor +declare trait BooleanConstructor { + val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> + val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> + val prototype: Boolean +} +declare trait Number { + val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.NumberFormatOptions) => Str) +} +declare trait NumberConstructor { + val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> val NaN: Num - val Infinity: Num - fun eval(x: Str): anything - fun parseInt: ((string: Str) => Num) & ((string: Str, radix: Num) => Num) - fun parseFloat(string: Str): Num - fun isNaN(number: Num): (false) | (true) - fun isFinite(number: Num): (false) | (true) - fun decodeURI(encodedURI: Str): Str - fun decodeURIComponent(encodedURIComponent: Str): Str - fun encodeURI(uri: Str): Str - fun encodeURIComponent(uriComponent: (((Str) | (Num)) | (false)) | (true)): Str - fun escape(string: Str): Str - fun unescape(string: Str): Str - declare trait Symbol { - fun toString(): Str - fun valueOf(): Symbol - } - type PropertyKey = ((Str) | (Num)) | (Symbol) - declare trait PropertyDescriptor { - val configurable: ((false) | (true)) | (undefined) - val set: ((v: anything) => unit) | (undefined) - val enumerable: ((false) | (true)) | (undefined) - val get: (() => anything) | (undefined) - val writable: ((false) | (true)) | (undefined) - val value: (anything) | (undefined) - } - declare trait PropertyDescriptorMap { - val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> - } - declare trait Object { - fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun valueOf(): Object - fun toLocaleString(): Str - val id"constructor": Function - fun isPrototypeOf(v: Object): (false) | (true) - fun toString(): Str - } - declare trait ObjectConstructor { - val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> - fun getOwnPropertyNames(o: anything): MutArray - fun isFrozen(o: anything): (false) | (true) - fun getPrototypeOf(o: anything): anything - fun defineProperty(o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T - val prototype: Object - fun isSealed(o: anything): (false) | (true) - fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T - fun preventExtensions(o: T): T - val create: ((o: Object) => anything) & ((o: Object, properties: (PropertyDescriptorMap) & (ThisType)) => anything) - fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ - val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> - fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor - fun seal(o: T): T - fun keys(o: Object): MutArray - fun isExtensible(o: anything): (false) | (true) - } - val Function: FunctionConstructor - declare trait FunctionConstructor { - val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> - val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> - val prototype: Function - } - type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> - type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> - declare trait CallableFunction extends Function { - fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): R - fun bind(thisArg: T, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ - } - declare trait NewableFunction extends Function { - fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): unit - fun bind(thisArg: anything, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ - } - declare trait IArguments { - val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> - val length: Num - val callee: Function - } - declare trait String { - val localeCompare: (((that: Str) => Num) & ((that: Str, locales: (Str) | (MutArray)) => Num)) & ((that: Str, locales: (Str) | (MutArray), options: Intl.CollatorOptions) => Num) - } - declare trait StringConstructor { - val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> - val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> - val prototype: String - fun fromCharCode(codes: MutArray): Str - } - val Boolean: BooleanConstructor - declare trait BooleanConstructor { - val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> - val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> - val prototype: Boolean - } - declare trait Number { - val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.NumberFormatOptions) => Str) - } - declare trait NumberConstructor { - val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> - val NaN: Num - val MIN_VALUE: Num - val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> - val NEGATIVE_INFINITY: Num - val POSITIVE_INFINITY: Num - val MAX_VALUE: Num - val prototype: Number - } - declare trait TemplateStringsArray extends ReadonlyArray { - val raw: ReadonlyArray - } - declare trait ImportMeta {} - declare trait ImportCallOptions { - val assert: (ImportAssertions) | (undefined) - } - declare trait ImportAssertions { - val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> - } - val Math: Math - declare trait Date { - val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) - val toLocaleDateString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) - val toLocaleTimeString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) - } - declare trait DateConstructor { - val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> - val UTC: ((((((year: Num, monthIndex: Num) => Num) & ((year: Num, monthIndex: Num, date: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num, ms: Num) => Num) - val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> - fun now(): Num - fun parse(s: Str): Num - val prototype: Date - } - declare trait RegExp { - fun test(string: Str): (false) | (true) - val multiline: (false) | (true) - val source: Str - val compile: ((pattern: Str) => RegExp) & ((pattern: Str, flags: Str) => RegExp) - val global: (false) | (true) - val lastIndex: Num - val ignoreCase: (false) | (true) - fun exec(string: Str): RegExpExecArray - } - val Error: ErrorConstructor - declare trait ErrorConstructor { - val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> - val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> - val prototype: Error - } - val EvalError: EvalErrorConstructor - declare trait EvalErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> - val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> - val prototype: EvalError - } - val RangeError: RangeErrorConstructor - declare trait RangeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> - val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> - val prototype: RangeError - } - val ReferenceError: ReferenceErrorConstructor - declare trait ReferenceErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> - val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> - val prototype: ReferenceError - } - val SyntaxError: SyntaxErrorConstructor - declare trait SyntaxErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> - val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> - val prototype: SyntaxError - } - val TypeError: TypeErrorConstructor - declare trait TypeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> - val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> - val prototype: TypeError - } - val URIError: URIErrorConstructor - declare trait URIErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> - val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> - val prototype: URIError - } - val JSON: JSON - declare trait ReadonlyArray { - val lastIndexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) - val every: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) - val forEach: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit) => unit) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: anything) => unit) - val filter: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => MutArray) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => MutArray) - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> - fun reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - val join: (() => Str) & ((separator: Str) => Str) - val map: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U) => MutArray) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: anything) => MutArray) - val concat: ((items: MutArray>) => MutArray) & ((items: MutArray<(T) | (ConcatArray)>) => MutArray) - fun toLocaleString(): Str - val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) - fun reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str - val length: Num - val some: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) - val indexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) - } - declare trait ConcatArray { - val length: Num - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> - val join: (() => Str) & ((separator: Str) => Str) - val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) - } - val Array: ArrayConstructor - declare trait ArrayConstructor { - val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> - val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> - fun isArray(arg: anything): (false) | (true) - val prototype: MutArray - } - declare trait TypedPropertyDescriptor { - val configurable: ((false) | (true)) | (undefined) - val set: ((value: T) => unit) | (undefined) - val enumerable: ((false) | (true)) | (undefined) - val get: (() => T) | (undefined) - val writable: ((false) | (true)) | (undefined) - val value: (T) | (undefined) - } - type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (() => unit) & ((reason: anything) => unit)) => unit) => PromiseLike - type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> - declare trait ArrayLike { - val length: Num - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> - } - type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> - type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> - type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> - type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> - type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> - type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> - type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> - type Omit = __type - type NonNullable = (T) & ({}) - type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> - type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> - type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> - type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> - type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> - type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> - type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> - type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> - declare trait ThisType {} - val ArrayBuffer: ArrayBufferConstructor - declare trait ArrayBufferTypes { - val ArrayBuffer: ArrayBuffer - } - type ArrayBufferLike = ArrayBuffer - declare trait ArrayBufferConstructor { - val prototype: ArrayBuffer - val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> - fun isView(arg: anything): (false) | (true) - } - declare trait ArrayBufferView { - val buffer: ArrayBuffer - val byteLength: Num - val byteOffset: Num - } - val DataView: DataViewConstructor - declare trait DataViewConstructor { - val prototype: DataView - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> - } - val Int8Array: Int8ArrayConstructor - declare trait Int8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int8Array) - val prototype: Int8Array - fun id"of"(items: MutArray): Int8Array - val BYTES_PER_ELEMENT: Num - } - declare trait Uint8Array { - fun valueOf(): Uint8Array - val lastIndexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) - val every: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) - val set: ((array: ArrayLike) => unit) & ((array: ArrayLike, offset: Num) => unit) - fun toLocaleString(): Str - val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> - fun reduceRight(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - val fill: (((value: Num) => Uint8Array) & ((value: Num, start: Num) => Uint8Array)) & ((value: Num, start: Num, end: Num) => Uint8Array) - val sort: (() => Uint8Array) & ((compareFn: (a: Num, b: Num) => Num) => Uint8Array) - val BYTES_PER_ELEMENT: Num - val copyWithin: (((target: Num) => Uint8Array) & ((target: Num, start: Num) => Uint8Array)) & ((target: Num, start: Num, end: Num) => Uint8Array) - val find: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) - val subarray: ((() => Uint8Array) & ((begin: Num) => Uint8Array)) & ((begin: Num, end: Num) => Uint8Array) - val join: (() => Str) & ((separator: Str) => Str) - val map: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num) => Uint8Array) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: anything) => Uint8Array) - val forEach: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit) => unit) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: anything) => unit) - val buffer: ArrayBuffer - val findIndex: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) - fun reverse(): Uint8Array - val filter: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => Uint8Array) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => Uint8Array) - val slice: ((() => Uint8Array) & ((start: Num) => Uint8Array)) & ((start: Num, end: Num) => Uint8Array) - val byteLength: Num - fun reduce(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str - val length: Num - val some: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) - val indexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) - val byteOffset: Num - } - declare trait Uint8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8Array) - val prototype: Uint8Array - fun id"of"(items: MutArray): Uint8Array - val BYTES_PER_ELEMENT: Num - } - val Uint8ClampedArray: Uint8ClampedArrayConstructor - declare trait Uint8ClampedArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8ClampedArray) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8ClampedArray) - val prototype: Uint8ClampedArray - fun id"of"(items: MutArray): Uint8ClampedArray - val BYTES_PER_ELEMENT: Num - } - val Int16Array: Int16ArrayConstructor - declare trait Int16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int16Array) - val prototype: Int16Array - fun id"of"(items: MutArray): Int16Array - val BYTES_PER_ELEMENT: Num - } - val Uint16Array: Uint16ArrayConstructor - declare trait Uint16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint16Array) - val prototype: Uint16Array - fun id"of"(items: MutArray): Uint16Array - val BYTES_PER_ELEMENT: Num - } - val Int32Array: Int32ArrayConstructor - declare trait Int32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int32Array) - val prototype: Int32Array - fun id"of"(items: MutArray): Int32Array - val BYTES_PER_ELEMENT: Num - } - val Uint32Array: Uint32ArrayConstructor - declare trait Uint32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint32Array) - val prototype: Uint32Array - fun id"of"(items: MutArray): Uint32Array - val BYTES_PER_ELEMENT: Num - } - val Float32Array: Float32ArrayConstructor - declare trait Float32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float32Array) - val prototype: Float32Array - fun id"of"(items: MutArray): Float32Array - val BYTES_PER_ELEMENT: Num - } - val Float64Array: Float64ArrayConstructor - declare trait Float64ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float64Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float64Array) - val prototype: Float64Array - fun id"of"(items: MutArray): Float64Array - val BYTES_PER_ELEMENT: Num - } - module Intl { - export declare trait CollatorOptions { - val sensitivity: (Str) | (undefined) - val ignorePunctuation: ((false) | (true)) | (undefined) - val usage: (Str) | (undefined) - val localeMatcher: (Str) | (undefined) - val numeric: ((false) | (true)) | (undefined) - val caseFirst: (Str) | (undefined) - } - export declare trait ResolvedCollatorOptions { - val sensitivity: Str - val ignorePunctuation: (false) | (true) - val usage: Str - val locale: Str - val numeric: (false) | (true) - val caseFirst: Str - val collation: Str - } - export declare trait Collator { - fun compare(x: Str, y: Str): Num - fun resolvedOptions(): ResolvedCollatorOptions - } - export declare trait NumberFormatOptions { - val minimumSignificantDigits: (Num) | (undefined) - val useGrouping: ((false) | (true)) | (undefined) - val style: (Str) | (undefined) - val localeMatcher: (Str) | (undefined) - val currency: (Str) | (undefined) - val minimumIntegerDigits: (Num) | (undefined) - val maximumFractionDigits: (Num) | (undefined) - val currencySign: (Str) | (undefined) - val maximumSignificantDigits: (Num) | (undefined) - val minimumFractionDigits: (Num) | (undefined) - } - export declare trait ResolvedNumberFormatOptions { - val numberingSystem: Str - val minimumSignificantDigits: (Num) | (undefined) - val useGrouping: (false) | (true) - val style: Str - val locale: Str - val currency: (Str) | (undefined) - val minimumIntegerDigits: Num - val maximumFractionDigits: Num - val maximumSignificantDigits: (Num) | (undefined) - val minimumFractionDigits: Num - } - export declare trait NumberFormat { - fun format(value: Num): Str - fun resolvedOptions(): ResolvedNumberFormatOptions - } - export declare trait DateTimeFormatOptions { - val minute: ((Str) | (Str)) | (undefined) - val year: ((Str) | (Str)) | (undefined) - val hour: ((Str) | (Str)) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (((Str) | (Str)) | (Str)) | (undefined) - val formatMatcher: ((Str) | (Str)) | (undefined) - val day: ((Str) | (Str)) | (undefined) - val timeZone: (Str) | (undefined) - val month: (((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) - val second: ((Str) | (Str)) | (undefined) - val localeMatcher: ((Str) | (Str)) | (undefined) - val timeZoneName: ((((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) - val era: (((Str) | (Str)) | (Str)) | (undefined) - } - export declare trait ResolvedDateTimeFormatOptions { - val numberingSystem: Str - val minute: (Str) | (undefined) - val year: (Str) | (undefined) - val hour: (Str) | (undefined) - val second: (Str) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (Str) | (undefined) - val day: (Str) | (undefined) - val timeZone: Str - val month: (Str) | (undefined) - val locale: Str - val calendar: Str - val timeZoneName: (Str) | (undefined) - val era: (Str) | (undefined) - } - export declare trait DateTimeFormat { - val format: (() => Str) & ((date: (Num) | (Date)) => Str) - fun resolvedOptions(): ResolvedDateTimeFormatOptions - } + val MIN_VALUE: Num + val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> + val NEGATIVE_INFINITY: Num + val POSITIVE_INFINITY: Num + val MAX_VALUE: Num + val prototype: Number +} +declare trait TemplateStringsArray extends ReadonlyArray { + val raw: ReadonlyArray +} +declare trait ImportMeta {} +declare trait ImportCallOptions { + val assert: (ImportAssertions) | (undefined) +} +declare trait ImportAssertions { + val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> +} +val Math: Math +declare trait Date { + val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) + val toLocaleDateString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) + val toLocaleTimeString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) +} +declare trait DateConstructor { + val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> + val UTC: ((((((year: Num, monthIndex: Num) => Num) & ((year: Num, monthIndex: Num, date: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num, ms: Num) => Num) + val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> + fun now(): Num + fun parse(s: Str): Num + val prototype: Date +} +declare trait RegExp { + fun test(string: Str): (false) | (true) + val multiline: (false) | (true) + val source: Str + val compile: ((pattern: Str) => RegExp) & ((pattern: Str, flags: Str) => RegExp) + val global: (false) | (true) + val lastIndex: Num + val ignoreCase: (false) | (true) + fun exec(string: Str): RegExpExecArray +} +val Error: ErrorConstructor +declare trait ErrorConstructor { + val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> + val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> + val prototype: Error +} +val EvalError: EvalErrorConstructor +declare trait EvalErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> + val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> + val prototype: EvalError +} +val RangeError: RangeErrorConstructor +declare trait RangeErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> + val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> + val prototype: RangeError +} +val ReferenceError: ReferenceErrorConstructor +declare trait ReferenceErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> + val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> + val prototype: ReferenceError +} +val SyntaxError: SyntaxErrorConstructor +declare trait SyntaxErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> + val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> + val prototype: SyntaxError +} +val TypeError: TypeErrorConstructor +declare trait TypeErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> + val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> + val prototype: TypeError +} +val URIError: URIErrorConstructor +declare trait URIErrorConstructor extends ErrorConstructor { + val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> + val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> + val prototype: URIError +} +val JSON: JSON +declare trait ReadonlyArray { + val lastIndexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) + val every: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) + val forEach: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit) => unit) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: anything) => unit) + val filter: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => MutArray) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => MutArray) + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> + fun reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + val join: (() => Str) & ((separator: Str) => Str) + val map: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U) => MutArray) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: anything) => MutArray) + val concat: ((items: MutArray>) => MutArray) & ((items: MutArray<(T) | (ConcatArray)>) => MutArray) + fun toLocaleString(): Str + val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) + fun reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + val some: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) + val indexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) +} +declare trait ConcatArray { + val length: Num + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> + val join: (() => Str) & ((separator: Str) => Str) + val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) +} +val Array: ArrayConstructor +declare trait ArrayConstructor { + val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> + val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> + fun isArray(arg: anything): (false) | (true) + val prototype: MutArray +} +declare trait TypedPropertyDescriptor { + val configurable: ((false) | (true)) | (undefined) + val set: ((value: T) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (() => T) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (T) | (undefined) +} +type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (() => unit) & ((reason: anything) => unit)) => unit) => PromiseLike +type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> +declare trait ArrayLike { + val length: Num + val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> +} +type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> +type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> +type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> +type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> +type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> +type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> +type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> +type Omit = __type +type NonNullable = (T) & ({}) +type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> +type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> +type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> +type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> +type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> +type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> +type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> +type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> +declare trait ThisType {} +val ArrayBuffer: ArrayBufferConstructor +declare trait ArrayBufferTypes { + val ArrayBuffer: ArrayBuffer +} +type ArrayBufferLike = ArrayBuffer +declare trait ArrayBufferConstructor { + val prototype: ArrayBuffer + val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> + fun isView(arg: anything): (false) | (true) +} +declare trait ArrayBufferView { + val buffer: ArrayBuffer + val byteLength: Num + val byteOffset: Num +} +val DataView: DataViewConstructor +declare trait DataViewConstructor { + val prototype: DataView + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> +} +val Int8Array: Int8ArrayConstructor +declare trait Int8ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int8Array) + val prototype: Int8Array + fun id"of"(items: MutArray): Int8Array + val BYTES_PER_ELEMENT: Num +} +declare trait Uint8Array { + fun valueOf(): Uint8Array + val lastIndexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) + val every: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) + val set: ((array: ArrayLike) => unit) & ((array: ArrayLike, offset: Num) => unit) + fun toLocaleString(): Str + val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> + fun reduceRight(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + val fill: (((value: Num) => Uint8Array) & ((value: Num, start: Num) => Uint8Array)) & ((value: Num, start: Num, end: Num) => Uint8Array) + val sort: (() => Uint8Array) & ((compareFn: (a: Num, b: Num) => Num) => Uint8Array) + val BYTES_PER_ELEMENT: Num + val copyWithin: (((target: Num) => Uint8Array) & ((target: Num, start: Num) => Uint8Array)) & ((target: Num, start: Num, end: Num) => Uint8Array) + val find: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) + val subarray: ((() => Uint8Array) & ((begin: Num) => Uint8Array)) & ((begin: Num, end: Num) => Uint8Array) + val join: (() => Str) & ((separator: Str) => Str) + val map: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num) => Uint8Array) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: anything) => Uint8Array) + val forEach: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit) => unit) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: anything) => unit) + val buffer: ArrayBuffer + val findIndex: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) + fun reverse(): Uint8Array + val filter: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => Uint8Array) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => Uint8Array) + val slice: ((() => Uint8Array) & ((start: Num) => Uint8Array)) & ((start: Num, end: Num) => Uint8Array) + val byteLength: Num + fun reduce(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + val some: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) + val indexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) + val byteOffset: Num +} +declare trait Uint8ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8Array) + val prototype: Uint8Array + fun id"of"(items: MutArray): Uint8Array + val BYTES_PER_ELEMENT: Num +} +val Uint8ClampedArray: Uint8ClampedArrayConstructor +declare trait Uint8ClampedArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8ClampedArray) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8ClampedArray) + val prototype: Uint8ClampedArray + fun id"of"(items: MutArray): Uint8ClampedArray + val BYTES_PER_ELEMENT: Num +} +val Int16Array: Int16ArrayConstructor +declare trait Int16ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int16Array) + val prototype: Int16Array + fun id"of"(items: MutArray): Int16Array + val BYTES_PER_ELEMENT: Num +} +val Uint16Array: Uint16ArrayConstructor +declare trait Uint16ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint16Array) + val prototype: Uint16Array + fun id"of"(items: MutArray): Uint16Array + val BYTES_PER_ELEMENT: Num +} +val Int32Array: Int32ArrayConstructor +declare trait Int32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int32Array) + val prototype: Int32Array + fun id"of"(items: MutArray): Int32Array + val BYTES_PER_ELEMENT: Num +} +val Uint32Array: Uint32ArrayConstructor +declare trait Uint32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint32Array) + val prototype: Uint32Array + fun id"of"(items: MutArray): Uint32Array + val BYTES_PER_ELEMENT: Num +} +val Float32Array: Float32ArrayConstructor +declare trait Float32ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float32Array) + val prototype: Float32Array + fun id"of"(items: MutArray): Float32Array + val BYTES_PER_ELEMENT: Num +} +val Float64Array: Float64ArrayConstructor +declare trait Float64ArrayConstructor { + val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> + val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float64Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float64Array) + val prototype: Float64Array + fun id"of"(items: MutArray): Float64Array + val BYTES_PER_ELEMENT: Num +} +module Intl { + export declare trait CollatorOptions { + val sensitivity: (Str) | (undefined) + val ignorePunctuation: ((false) | (true)) | (undefined) + val usage: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val numeric: ((false) | (true)) | (undefined) + val caseFirst: (Str) | (undefined) + } + export declare trait ResolvedCollatorOptions { + val sensitivity: Str + val ignorePunctuation: (false) | (true) + val usage: Str + val locale: Str + val numeric: (false) | (true) + val caseFirst: Str + val collation: Str + } + export declare trait Collator { + fun compare(x: Str, y: Str): Num + fun resolvedOptions(): ResolvedCollatorOptions + } + export declare trait NumberFormatOptions { + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: ((false) | (true)) | (undefined) + val style: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val currency: (Str) | (undefined) + val minimumIntegerDigits: (Num) | (undefined) + val maximumFractionDigits: (Num) | (undefined) + val currencySign: (Str) | (undefined) + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: (Num) | (undefined) + } + export declare trait ResolvedNumberFormatOptions { + val numberingSystem: Str + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: (false) | (true) + val style: Str + val locale: Str + val currency: (Str) | (undefined) + val minimumIntegerDigits: Num + val maximumFractionDigits: Num + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: Num + } + export declare trait NumberFormat { + fun format(value: Num): Str + fun resolvedOptions(): ResolvedNumberFormatOptions + } + export declare trait DateTimeFormatOptions { + val minute: ((Str) | (Str)) | (undefined) + val year: ((Str) | (Str)) | (undefined) + val hour: ((Str) | (Str)) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (((Str) | (Str)) | (Str)) | (undefined) + val formatMatcher: ((Str) | (Str)) | (undefined) + val day: ((Str) | (Str)) | (undefined) + val timeZone: (Str) | (undefined) + val month: (((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val second: ((Str) | (Str)) | (undefined) + val localeMatcher: ((Str) | (Str)) | (undefined) + val timeZoneName: ((((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val era: (((Str) | (Str)) | (Str)) | (undefined) + } + export declare trait ResolvedDateTimeFormatOptions { + val numberingSystem: Str + val minute: (Str) | (undefined) + val year: (Str) | (undefined) + val hour: (Str) | (undefined) + val second: (Str) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (Str) | (undefined) + val day: (Str) | (undefined) + val timeZone: Str + val month: (Str) | (undefined) + val locale: Str + val calendar: Str + val timeZoneName: (Str) | (undefined) + val era: (Str) | (undefined) + } + export declare trait DateTimeFormat { + val format: (() => Str) & ((date: (Num) | (Date)) => Str) + fun resolvedOptions(): ResolvedDateTimeFormatOptions } } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 992294a0f..0e0164e76 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -43,5 +43,5 @@ object TSTypeGenerationTest { "./Variables.ts", ) - private val directlyImportedSet = Set[String]("ES5.d.ts") + private val directlyImportedSet = Set[String]("./ES5.d.ts") } From a4782c7fda5926fc56e54262eef7b220d9511fb8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 13 Jun 2023 16:18:38 +0800 Subject: [PATCH 089/202] WIP: Import es5 and dom --- driver/js/src/main/scala/driver/Driver.scala | 21 +- driver/js/src/test/output/MLS2TheMax.check | 3 + .../.interfaces/mlscript/MLS2TheMax.mlsi | 4 + .../projects/.interfaces/ts/ReadLine.mlsi | 2 - .../test/projects/js/mlscript/MLS2TheMax.js | 48 +- .../test/projects/js/my_ts_path/ReadLine.js | 10 +- .../src/test/projects/mlscript/MLS2TheMax.mls | 26 +- driver/js/src/test/projects/ts/ReadLine.ts | 12 +- .../src/main/scala/mlscript/JSBackend.scala | 16 + .../main/scala/ts2mls/TSCompilerInfo.scala | 1 + .../src/main/scala/ts2mls/TSSourceFile.scala | 10 +- ts2mls/js/src/test/diff/Dom.mlsi | 23 + ts2mls/js/src/test/diff/ES5.mlsi | 500 +- ts2mls/js/src/test/diff/Optional.mlsi | 4 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 3 +- ts2mls/js/src/test/typescript/Dom.d.ts | 48 + ts2mls/js/src/test/typescript/ES5.d.ts | 7216 ++++++++--------- 17 files changed, 3880 insertions(+), 4067 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Dom.mlsi create mode 100644 ts2mls/js/src/test/typescript/Dom.d.ts diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 1dca74d4b..372483f4b 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -64,6 +64,7 @@ class Driver(options: DriverOptions) { implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() + initTyper compile(FileInfo(options.path, options.filename, options.interfaceDir), false) Driver.totalErrors == 0 } @@ -143,6 +144,17 @@ class Driver(options: DriverOptions) { typer.expandType(sim) } + private lazy val jsBuiltinDecs = Driver.jsBuiltinPaths.map(path => parseAndRun(path, { + case (_, declarations, _, _) => declarations + })) + + private def initTyper( + implicit ctx: Ctx, + raise: Raise, + extrCtx: Opt[typer.ExtrCtx], + vars: Map[Str, typer.SimpleType] + ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst, Nil))) + private def resolveTarget(file: FileInfo, imp: String) = if ((imp.startsWith("./") || imp.startsWith("../")) && !imp.endsWith(".mls") && !imp.endsWith(".mlsi")) { val tsPath = TypeScript.getOutputFileNames(s"${TSModuleResolver.dirname(file.filename)}/$imp", config) @@ -196,6 +208,7 @@ class Driver(options: DriverOptions) { var newCtx: Ctx = Ctx.init val newExtrCtx: Opt[typer.ExtrCtx] = N val newVars: Map[Str, typer.SimpleType] = Map.empty + initTyper val newFilename = file.`import`(dp) importedModule += newFilename.filename compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ file.filename) @@ -249,6 +262,7 @@ class Driver(options: DriverOptions) { exported: Boolean ): Unit = try { val backend = new JSCompilerBackend() + jsBuiltinDecs.foreach(lst => backend.declareJSBuiltin(Pgrm(lst))) val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") saveToFile(filename, code) @@ -260,6 +274,11 @@ class Driver(options: DriverOptions) { object Driver { def apply(options: DriverOptions) = new Driver(options) + private val jsBuiltinPaths = List( + "./ts2mls/js/src/test/diff/ES5.mlsi", + "./ts2mls/js/src/test/diff/Dom.mlsi" + ) + private def report(msg: String): Unit = System.err.println(msg) @@ -276,13 +295,13 @@ object Driver { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") val headStr = diag match { case ErrorReport(msg, loco, src) => + totalErrors += 1 src match { case Diagnostic.Lexing => s"╔══[LEXICAL ERROR] " case Diagnostic.Parsing => s"╔══[PARSE ERROR] " case _ => // TODO customize too - totalErrors += 1 s"╔══[ERROR] " } case WarningReport(msg, loco, src) => diff --git a/driver/js/src/test/output/MLS2TheMax.check b/driver/js/src/test/output/MLS2TheMax.check index 8eed19984..2f23d78ed 100644 --- a/driver/js/src/test/output/MLS2TheMax.check +++ b/driver/js/src/test/output/MLS2TheMax.check @@ -4,6 +4,9 @@ Dear Admin, please guess a number from 1 to 5 You guessed wrong, Admin Do you want to continue? Dear Admin, please guess a number from 1 to 5 +Not a number! +Do you want to continue? +Dear Admin, please guess a number from 1 to 5 You guessed right, Admin Do you want to continue? Bye! diff --git a/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi index e2d685e14..273387baa 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi @@ -2,7 +2,11 @@ import "../ts/ReadLine.mlsi" import "./tools/Concat.mlsi" declare module MLS2TheMax() { fun ask: (question: Str,) -> Str + class Some[A](value: A) + class None() + fun parse: (s: Str,) -> (None | Some[Num]) class Game(name: Str) { + fun check: (x: Num,) -> unit fun loop: unit let number: 4 fun shouldContinue: unit diff --git a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi index b098d5463..fe823ae52 100644 --- a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi @@ -2,6 +2,4 @@ export declare module ReadLine { val lines: MutArray val i: Num fun getStrLn(): Str - fun putStrLn(str: Str): unit - fun parse(s: Str): Num } diff --git a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js index 7b5b989db..eae3d4143 100644 --- a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js +++ b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js @@ -3,23 +3,56 @@ import * as ReadLine from "../my_ts_path/ReadLine.js" import { Concat } from "./tools/Concat.js" const MLS2TheMax = new class MLS2TheMax { + #Some; + #None; #Game; constructor() { } ask(question) { return ((() => { - ReadLine.putStrLn(question); + console.log(question); return ReadLine.getStrLn(); })()); } + parse(s) { + const self = this; + return ((() => { + let i = parseInt(s); + return isNaN(i) === true ? self.None() : self.Some(i); + })()); + } get main() { const self = this; return ((() => { let name = self.ask("What is your name?"); - ReadLine.putStrLn(Concat.concat3("Hello, ", name, " welcome to the game!")); + console.log(Concat.concat3("Hello, ", name, " welcome to the game!")); return self.Game(name).loop; })()); } + get Some() { + const outer = this; + if (this.#Some === undefined) { + class Some { + #value; + get value() { return this.#value; } + constructor(value) { + this.#value = value; + } + }; + this.#Some = ((value) => Object.freeze(new Some(value))); + this.#Some.class = Some; + } + return this.#Some; + } + get None() { + const outer = this; + if (this.#None === undefined) { + class None {}; + this.#None = (() => Object.freeze(new None())); + this.#None.class = None; + } + return this.#None; + } get Game() { const outer = this; if (this.#Game === undefined) { @@ -38,7 +71,14 @@ const MLS2TheMax = new class MLS2TheMax { const self = this; return ((() => { let ans = outer.ask("Do you want to continue?"); - return ans === "y" === true ? self.loop : ReadLine.putStrLn("Bye!"); + return ans === "y" === true ? self.loop : console.log("Bye!"); + })()); + } + check(x) { + const name = this.#name; + const self = this; + return ((() => { + return x == self.number === true ? console.log(Concat.concat2("You guessed right, ", name)) : console.log(Concat.concat2("You guessed wrong, ", name)); })()); } get loop() { @@ -46,7 +86,7 @@ const MLS2TheMax = new class MLS2TheMax { const self = this; return ((() => { let guess = outer.ask(Concat.concat3("Dear ", name, ", please guess a number from 1 to 5")); - ReadLine.parse(guess) == self.number === true ? ReadLine.putStrLn(Concat.concat2("You guessed right, ", name)) : ReadLine.putStrLn(Concat.concat2("You guessed wrong, ", name)); + ((tmp0) => tmp0 instanceof outer.Some.class ? ((i) => self.check(i))(tmp0.value) : console.log("Not a number!"))(outer.parse(guess)); return self.shouldContinue; })()); } diff --git a/driver/js/src/test/projects/js/my_ts_path/ReadLine.js b/driver/js/src/test/projects/js/my_ts_path/ReadLine.js index 0f792fc53..4f6afd07c 100644 --- a/driver/js/src/test/projects/js/my_ts_path/ReadLine.js +++ b/driver/js/src/test/projects/js/my_ts_path/ReadLine.js @@ -1,15 +1,7 @@ const lines = [ - "Admin", "1", "y", "4", "n" + "Admin", "1", "y", "foo", "y", "4", "n" ]; let i = 0; export function getStrLn() { return lines[i++]; } -export function putStrLn(str) { - console.log(str); -} -// TODO: Option -export function parse(s) { - const i = +s; - return isNaN(i) || i % 1 !== 0 ? -1 : i; -} diff --git a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls index c900376aa..7fac60d57 100644 --- a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls +++ b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls @@ -2,9 +2,18 @@ import "../ts/ReadLine.ts" import "./tools/Concat.mls" fun ask(question: Str) = - ReadLine.putStrLn(question) + console.log(question) ReadLine.getStrLn() +class Some(value: A) +class None() + +fun parse(s: Str) = + let i = parseInt(s) + if + isNaN(i) then None() + _ then Some(i) + class Game(name: Str) { let number = 4 // fixed, or we can not apply diff test @@ -12,19 +21,24 @@ class Game(name: Str) { let ans = ask("Do you want to continue?") if ans === "y" then loop - _ then ReadLine.putStrLn("Bye!") + _ then console.log("Bye!") + + fun check(x: Num) = + if + x == number then console.log(Concat.concat2("You guessed right, ", name)) + _ then console.log(Concat.concat2("You guessed wrong, ", name)) fun loop = let guess = ask(Concat.concat3("Dear ", name, ", please guess a number from 1 to 5")) - if - ReadLine.parse(guess) == number then ReadLine.putStrLn(Concat.concat2("You guessed right, ", name)) - _ then ReadLine.putStrLn(Concat.concat2("You guessed wrong, ", name)) + if parse(guess) is + Some(i) then check(i) + _ then console.log("Not a number!") shouldContinue } fun main = let name = ask("What is your name?") - ReadLine.putStrLn(Concat.concat3("Hello, ", name, " welcome to the game!")) + console.log(Concat.concat3("Hello, ", name, " welcome to the game!")) Game(name).loop main diff --git a/driver/js/src/test/projects/ts/ReadLine.ts b/driver/js/src/test/projects/ts/ReadLine.ts index 8414e8eba..c52aede02 100644 --- a/driver/js/src/test/projects/ts/ReadLine.ts +++ b/driver/js/src/test/projects/ts/ReadLine.ts @@ -1,5 +1,5 @@ const lines = [ - "Admin", "1", "y", "4", "n" + "Admin", "1", "y", "foo", "y", "4", "n" ] let i = 0 @@ -7,13 +7,3 @@ let i = 0 export function getStrLn(): string { return lines[i++]; } - -export function putStrLn(str: string): void { - console.log(str); -} - -// TODO: Option -export function parse(s: string) { - const i = +s - return isNaN(i) || i % 1 !== 0 ? -1 : i -} diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 79437404b..35110f7cf 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1078,6 +1078,22 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { + def declareJSBuiltin(pgrm: Pgrm): Unit = { + val (typeDefs, otherStmts) = pgrm.tops.partitionMap { + case ot: Terms => R(ot) + case fd: NuFunDef => R(fd) + case nd: NuTypeDef => L(nd) + case _ => die + } + + declareNewTypeDefs(typeDefs, true)(topLevelScope) + otherStmts.foreach { + case NuFunDef(_, Var(name), _, _) => + topLevelScope.declareStubValue(name)(true) + case _ => () + } + } + private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool): Ls[Str] = { val (typeDefs, otherStmts) = pgrm.tops.partitionMap { case ot: Terms => R(ot) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index e7547f8f4..f9aff9e88 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -236,6 +236,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val resolvedPath: String = node.resolvedPath.toString() lazy val moduleReference = TSNodeObject(node.moduleReference) lazy val expression = TSTokenObject(node.expression) + lazy val isVarParam = !IsUndefined(node.dotDotDotToken) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 400879522..9b743faeb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -196,18 +196,24 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): List[TSFunctionType] = { val res = getObjectType(node.returnType) val tv = getTypeParameters(node) + def eraseVarParam(tp: TSType, erase: Boolean) = tp match { + case TSArrayType(eleType) if (erase) => eleType + case _ => tp + } node.parameters.foldLeft(TSFunctionType(Nil, res, tv) :: Nil)((funs, p) => ( // in typescript, you can use `this` to explicitly specifies the callee // but it never appears in the final javascript file if (p.symbol.escapedName === "this") funs else if (p.isOptionalParameter) funs.lastOption match { case Some(TSFunctionType(params, res, tv)) => - funs :+ TSFunctionType(params :+ TSParameterType(p.symbol.escapedName, getObjectType(p.symbolType)), res, tv) + funs :+ TSFunctionType(params :+ + TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)), res, tv) case _ => throw new AssertionError("empty function type.") } else funs.headOption match { case Some(TSFunctionType(params, res, tv)) => - TSFunctionType(params :+ TSParameterType(p.symbol.escapedName, getObjectType(p.symbolType)), res, tv) :: Nil + TSFunctionType(params :+ + TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)), res, tv) :: Nil case _ => throw new AssertionError("empty function type.") }) ) diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/ts2mls/js/src/test/diff/Dom.mlsi new file mode 100644 index 000000000..9aa8effb8 --- /dev/null +++ b/ts2mls/js/src/test/diff/Dom.mlsi @@ -0,0 +1,23 @@ +declare trait Console { + fun assert(data: anything): unit + val count: (() => unit) & ((label: Str) => unit) + val timeEnd: (() => unit) & ((label: Str) => unit) + fun clear(): unit + val timeStamp: (() => unit) & ((label: Str) => unit) + fun info(data: anything): unit + fun debug(data: anything): unit + val countReset: (() => unit) & ((label: Str) => unit) + val dir: ((() => unit) & ((item: anything) => unit)) & ((item: anything, options: anything) => unit) + fun error(data: anything): unit + fun timeLog(data: anything): unit + val time: (() => unit) & ((label: Str) => unit) + fun group(data: anything): unit + val table: ((() => unit) & ((tabularData: anything) => unit)) & ((tabularData: anything, properties: MutArray) => unit) + fun trace(data: anything): unit + fun warn(data: anything): unit + fun groupCollapsed(data: anything): unit + fun dirxml(data: anything): unit + fun log(data: anything): unit + fun groupEnd(): unit +} +val console: Console diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 62b0ec8f4..a469c1941 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -24,431 +24,89 @@ declare trait PropertyDescriptor { val writable: ((false) | (true)) | (undefined) val value: (anything) | (undefined) } -declare trait PropertyDescriptorMap { - val __index: Unsupported<"[key: PropertyKey]: PropertyDescriptor;", "ts2mls/js/src/test/typescript/ES5.d.ts", 101, 33> -} -declare trait Object { - fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun valueOf(): Object - fun toLocaleString(): Str - val id"constructor": Function - fun isPrototypeOf(v: Object): (false) | (true) +declare trait Function { + fun bind(thisArg: anything, argArray: anything): anything + val apply: ((thisArg: anything) => anything) & ((thisArg: anything, argArray: anything) => anything) + val prototype: anything + fun call(thisArg: anything, argArray: anything): anything fun toString(): Str -} -declare trait ObjectConstructor { - val __call: Unsupported<"(value: any): any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 139, 12> - fun getOwnPropertyNames(o: anything): MutArray - fun isFrozen(o: anything): (false) | (true) - fun getPrototypeOf(o: anything): anything - fun defineProperty(o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType)): T - val prototype: Object - fun isSealed(o: anything): (false) | (true) - fun defineProperties(o: T, properties: (PropertyDescriptorMap) & (ThisType)): T - fun preventExtensions(o: T): T - val create: ((o: Object) => anything) & ((o: Object, properties: (PropertyDescriptorMap) & (ThisType)) => anything) - fun freeze(o: T): __type /* warning: the overload of function freeze is not supported yet. */ - val __new: Unsupported<"new(value?: any): Object;", "ts2mls/js/src/test/typescript/ES5.d.ts", 137, 29> - fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor - fun seal(o: T): T - fun keys(o: Object): MutArray - fun isExtensible(o: anything): (false) | (true) -} -val Function: FunctionConstructor -declare trait FunctionConstructor { - val __new: Unsupported<"new(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 292, 31> - val __call: Unsupported<"(...args: string[]): Function;", "ts2mls/js/src/test/typescript/ES5.d.ts", 297, 37> - val prototype: Function -} -type ThisParameterType = Unsupported<"T extends (this: infer U, ...args: never) => any ? U : unknown", "ts2mls/js/src/test/typescript/ES5.d.ts", 307, 27> -type OmitThisParameter = Unsupported<"unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 312, 27> -declare trait CallableFunction extends Function { - fun apply(thisArg: T, args: A): R /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): R - fun bind(thisArg: T, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ -} -declare trait NewableFunction extends Function { - fun apply(thisArg: T, args: A): unit /* warning: the overload of function apply is not supported yet. */ - fun call(thisArg: T, args: A): unit - fun bind(thisArg: anything, args: MutArray): (args: MutArray) => R /* warning: the overload of function bind is not supported yet. */ -} -declare trait IArguments { - val __index: Unsupported<"[index: number]: any;", "ts2mls/js/src/test/typescript/ES5.d.ts", 374, 22> val length: Num - val callee: Function -} -declare trait String { - val localeCompare: (((that: Str) => Num) & ((that: Str, locales: (Str) | (MutArray)) => Num)) & ((that: Str, locales: (Str) | (MutArray), options: Intl.CollatorOptions) => Num) -} -declare trait StringConstructor { - val __new: Unsupported<"new(value?: any): String;", "ts2mls/js/src/test/typescript/ES5.d.ts", 504, 29> - val __call: Unsupported<"(value?: any): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 505, 29> - val prototype: String - fun fromCharCode(codes: MutArray): Str -} -val Boolean: BooleanConstructor -declare trait BooleanConstructor { - val __new: Unsupported<"new(value?: any): Boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 521, 30> - val __call: Unsupported<"(value?: T): boolean;", "ts2mls/js/src/test/typescript/ES5.d.ts", 522, 30> - val prototype: Boolean -} -declare trait Number { - val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.NumberFormatOptions) => Str) -} -declare trait NumberConstructor { - val __call: Unsupported<"(value?: any): number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 559, 29> - val NaN: Num - val MIN_VALUE: Num - val __new: Unsupported<"new(value?: any): Number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 558, 29> - val NEGATIVE_INFINITY: Num - val POSITIVE_INFINITY: Num - val MAX_VALUE: Num - val prototype: Number -} -declare trait TemplateStringsArray extends ReadonlyArray { - val raw: ReadonlyArray -} -declare trait ImportMeta {} -declare trait ImportCallOptions { - val assert: (ImportAssertions) | (undefined) + val caller: Function + val arguments: anything +} +declare trait Boolean { + fun valueOf(): (false) | (true) +} +declare trait Math { + fun random(): Num + fun asin(x: Num): Num + val LOG2E: Num + fun min(values: Num): Num + fun cos(x: Num): Num + val LOG10E: Num + val PI: Num + fun floor(x: Num): Num + val SQRT2: Num + fun round(x: Num): Num + fun sin(x: Num): Num + val E: Num + val LN10: Num + fun exp(x: Num): Num + val LN2: Num + fun atan(x: Num): Num + fun pow(x: Num, y: Num): Num + fun ceil(x: Num): Num + fun max(values: Num): Num + fun atan2(y: Num, x: Num): Num + fun sqrt(x: Num): Num + fun tan(x: Num): Num + val SQRT1_2: Num + fun abs(x: Num): Num + fun log(x: Num): Num + fun acos(x: Num): Num } -declare trait ImportAssertions { - val __index: Unsupported<"[key: string]: string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 617, 28> -} -val Math: Math declare trait Date { - val toLocaleString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) - val toLocaleDateString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) - val toLocaleTimeString: ((() => Str) & ((locales: (Str) | (MutArray)) => Str)) & ((locales: (Str) | (MutArray), options: Intl.DateTimeFormatOptions) => Str) -} -declare trait DateConstructor { - val __call: Unsupported<"(): string;", "ts2mls/js/src/test/typescript/ES5.d.ts", 899, 128> - val UTC: ((((((year: Num, monthIndex: Num) => Num) & ((year: Num, monthIndex: Num, date: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num) => Num)) & ((year: Num, monthIndex: Num, date: Num, hours: Num, minutes: Num, seconds: Num, ms: Num) => Num) - val __new: Unsupported<"new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ts2mls/js/src/test/typescript/ES5.d.ts", 888, 38> - fun now(): Num - fun parse(s: Str): Num - val prototype: Date -} -declare trait RegExp { - fun test(string: Str): (false) | (true) - val multiline: (false) | (true) - val source: Str - val compile: ((pattern: Str) => RegExp) & ((pattern: Str, flags: Str) => RegExp) - val global: (false) | (true) - val lastIndex: Num - val ignoreCase: (false) | (true) - fun exec(string: Str): RegExpExecArray -} -val Error: ErrorConstructor -declare trait ErrorConstructor { - val __new: Unsupported<"new(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1044, 28> - val __call: Unsupported<"(message?: string): Error;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1045, 33> - val prototype: Error -} -val EvalError: EvalErrorConstructor -declare trait EvalErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1055, 57> - val __call: Unsupported<"(message?: string): EvalError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1056, 37> - val prototype: EvalError -} -val RangeError: RangeErrorConstructor -declare trait RangeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1066, 58> - val __call: Unsupported<"(message?: string): RangeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1067, 38> - val prototype: RangeError -} -val ReferenceError: ReferenceErrorConstructor -declare trait ReferenceErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1077, 62> - val __call: Unsupported<"(message?: string): ReferenceError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1078, 42> - val prototype: ReferenceError -} -val SyntaxError: SyntaxErrorConstructor -declare trait SyntaxErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1088, 59> - val __call: Unsupported<"(message?: string): SyntaxError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1089, 39> - val prototype: SyntaxError -} -val TypeError: TypeErrorConstructor -declare trait TypeErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1099, 57> - val __call: Unsupported<"(message?: string): TypeError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1100, 37> - val prototype: TypeError -} -val URIError: URIErrorConstructor -declare trait URIErrorConstructor extends ErrorConstructor { - val __new: Unsupported<"new(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1110, 56> - val __call: Unsupported<"(message?: string): URIError;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1111, 36> - val prototype: URIError -} -val JSON: JSON -declare trait ReadonlyArray { - val lastIndexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) - val every: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) - val forEach: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit) => unit) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => unit, thisArg: anything) => unit) - val filter: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => MutArray) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => MutArray) - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1274, 136> - fun reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - val join: (() => Str) & ((separator: Str) => Str) - val map: ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U) => MutArray) & ((callbackfn: (value: T, index: Num, array: ReadonlyArray) => U, thisArg: anything) => MutArray) - val concat: ((items: MutArray>) => MutArray) & ((items: MutArray<(T) | (ConcatArray)>) => MutArray) + fun getUTCMonth(): Num + fun valueOf(): Num + fun getUTCMinutes(): Num + fun setMilliseconds(ms: Num): Num fun toLocaleString(): Str - val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) - fun reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun getDate(): Num + fun getUTCDate(): Num + fun setDate(date: Num): Num + val setFullYear: (((year: Num) => Num) & ((year: Num, month: Num) => Num)) & ((year: Num, month: Num, date: Num) => Num) + fun getMinutes(): Num + fun getFullYear(): Num + fun setUTCDate(date: Num): Num + val setMinutes: (((min: Num) => Num) & ((min: Num, sec: Num) => Num)) & ((min: Num, sec: Num, ms: Num) => Num) + fun setTime(time: Num): Num + fun toUTCString(): Str + fun toLocaleDateString(): Str + val setUTCMonth: ((month: Num) => Num) & ((month: Num, date: Num) => Num) + val setUTCFullYear: (((year: Num) => Num) & ((year: Num, month: Num) => Num)) & ((year: Num, month: Num, date: Num) => Num) + val setHours: ((((hours: Num) => Num) & ((hours: Num, min: Num) => Num)) & ((hours: Num, min: Num, sec: Num) => Num)) & ((hours: Num, min: Num, sec: Num, ms: Num) => Num) + fun getTime(): Num + val setSeconds: ((sec: Num) => Num) & ((sec: Num, ms: Num) => Num) + val setUTCSeconds: ((sec: Num) => Num) & ((sec: Num, ms: Num) => Num) + fun getUTCFullYear(): Num + fun getUTCHours(): Num + fun getUTCDay(): Num + val setUTCMinutes: (((min: Num) => Num) & ((min: Num, sec: Num) => Num)) & ((min: Num, sec: Num, ms: Num) => Num) + fun getHours(): Num + fun toISOString(): Str + fun toTimeString(): Str + fun setUTCMilliseconds(ms: Num): Num + fun getUTCSeconds(): Num + fun getMilliseconds(): Num + val setMonth: ((month: Num) => Num) & ((month: Num, date: Num) => Num) + fun getDay(): Num + fun toLocaleTimeString(): Str + fun getSeconds(): Num + fun getUTCMilliseconds(): Num + fun toDateString(): Str fun toString(): Str - val length: Num - val some: ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything) => (false) | (true)) & ((predicate: (value: T, index: Num, array: ReadonlyArray) => anything, thisArg: anything) => (false) | (true)) - val indexOf: ((searchElement: T) => Num) & ((searchElement: T, fromIndex: Num) => Num) -} -declare trait ConcatArray { - val length: Num - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1280, 28> - val join: (() => Str) & ((separator: Str) => Str) - val slice: ((() => MutArray) & ((start: Num) => MutArray)) & ((start: Num, end: Num) => MutArray) -} -val Array: ArrayConstructor -declare trait ArrayConstructor { - val __new: Unsupported<"new (...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1472, 38> - val __call: Unsupported<"(...items: T[]): T[];", "ts2mls/js/src/test/typescript/ES5.d.ts", 1475, 34> - fun isArray(arg: anything): (false) | (true) - val prototype: MutArray -} -declare trait TypedPropertyDescriptor { - val configurable: ((false) | (true)) | (undefined) - val set: ((value: T) => unit) | (undefined) - val enumerable: ((false) | (true)) | (undefined) - val get: (() => T) | (undefined) - val writable: ((false) | (true)) | (undefined) - val value: (T) | (undefined) -} -type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike)) => unit, reject: (() => unit) & ((reason: anything) => unit)) => unit) => PromiseLike -type Awaited = Unsupported<"T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1527, 17> -declare trait ArrayLike { - val length: Num - val __index: Unsupported<"readonly [n: number]: T;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1536, 28> -} -type Partial = Unsupported<"{ [P in keyof T]?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1543, 17> -type Required = Unsupported<"{ [P in keyof T]-?: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1550, 18> -type Readonly = Unsupported<"{ readonly [P in keyof T]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1557, 18> -type Pick = Unsupported<"{ [P in K]: T[P]; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1564, 33> -type Record = Unsupported<"{ [P in K]: T; }", "ts2mls/js/src/test/typescript/ES5.d.ts", 1571, 37> -type Exclude = Unsupported<"T extends U ? never : T", "ts2mls/js/src/test/typescript/ES5.d.ts", 1578, 20> -type Extract = Unsupported<"T extends U ? T : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1583, 20> -type Omit = __type -type NonNullable = (T) & ({}) -type Parameters = Unsupported<"T extends (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1598, 50> -type ConstructorParameters = Unsupported<"T extends abstract new (...args: infer P) => any ? P : never", "ts2mls/js/src/test/typescript/ES5.d.ts", 1603, 74> -type ReturnType = Unsupported<"T extends (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1608, 50> -type InstanceType = Unsupported<"T extends abstract new (...args: any) => infer R ? R : any", "ts2mls/js/src/test/typescript/ES5.d.ts", 1613, 65> -type Uppercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1618, 34> -type Lowercase = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1623, 34> -type Capitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1628, 35> -type Uncapitalize = Unsupported<"intrinsic", "ts2mls/js/src/test/typescript/ES5.d.ts", 1633, 37> -declare trait ThisType {} -val ArrayBuffer: ArrayBufferConstructor -declare trait ArrayBufferTypes { - val ArrayBuffer: ArrayBuffer -} -type ArrayBufferLike = ArrayBuffer -declare trait ArrayBufferConstructor { - val prototype: ArrayBuffer - val __new: Unsupported<"new(byteLength: number): ArrayBuffer;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1667, 36> - fun isView(arg: anything): (false) | (true) -} -declare trait ArrayBufferView { - val buffer: ArrayBuffer - val byteLength: Num - val byteOffset: Num -} -val DataView: DataViewConstructor -declare trait DataViewConstructor { - val prototype: DataView - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ts2mls/js/src/test/typescript/ES5.d.ts", 1819, 33> -} -val Int8Array: Int8ArrayConstructor -declare trait Int8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2074, 63> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int8Array) - val prototype: Int8Array - fun id"of"(items: MutArray): Int8Array - val BYTES_PER_ELEMENT: Num -} -declare trait Uint8Array { - fun valueOf(): Uint8Array - val lastIndexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) - val every: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) - val set: ((array: ArrayLike) => unit) & ((array: ArrayLike, offset: Num) => unit) - fun toLocaleString(): Str - val __index: Unsupported<"[index: number]: number;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2349, 26> - fun reduceRight(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - val fill: (((value: Num) => Uint8Array) & ((value: Num, start: Num) => Uint8Array)) & ((value: Num, start: Num, end: Num) => Uint8Array) - val sort: (() => Uint8Array) & ((compareFn: (a: Num, b: Num) => Num) => Uint8Array) - val BYTES_PER_ELEMENT: Num - val copyWithin: (((target: Num) => Uint8Array) & ((target: Num, start: Num) => Uint8Array)) & ((target: Num, start: Num, end: Num) => Uint8Array) - val find: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) - val subarray: ((() => Uint8Array) & ((begin: Num) => Uint8Array)) & ((begin: Num, end: Num) => Uint8Array) - val join: (() => Str) & ((separator: Str) => Str) - val map: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num) => Uint8Array) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: anything) => Uint8Array) - val forEach: ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit) => unit) & ((callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: anything) => unit) - val buffer: ArrayBuffer - val findIndex: ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true)) => Num) & ((predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: anything) => Num) - fun reverse(): Uint8Array - val filter: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => Uint8Array) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => Uint8Array) - val slice: ((() => Uint8Array) & ((start: Num) => Uint8Array)) & ((start: Num, end: Num) => Uint8Array) - val byteLength: Num - fun reduce(callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str - val length: Num - val some: ((predicate: (value: Num, index: Num, array: Uint8Array) => anything) => (false) | (true)) & ((predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: anything) => (false) | (true)) - val indexOf: ((searchElement: Num) => Num) & ((searchElement: Num, fromIndex: Num) => Num) - val byteOffset: Num -} -declare trait Uint8ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2357, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8Array) - val prototype: Uint8Array - fun id"of"(items: MutArray): Uint8Array - val BYTES_PER_ELEMENT: Num -} -val Uint8ClampedArray: Uint8ClampedArrayConstructor -declare trait Uint8ClampedArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2639, 71> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint8ClampedArray) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint8ClampedArray) - val prototype: Uint8ClampedArray - fun id"of"(items: MutArray): Uint8ClampedArray - val BYTES_PER_ELEMENT: Num -} -val Int16Array: Int16ArrayConstructor -declare trait Int16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 2919, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int16Array) - val prototype: Int16Array - fun id"of"(items: MutArray): Int16Array - val BYTES_PER_ELEMENT: Num -} -val Uint16Array: Uint16ArrayConstructor -declare trait Uint16ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3202, 65> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint16Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint16Array) - val prototype: Uint16Array - fun id"of"(items: MutArray): Uint16Array - val BYTES_PER_ELEMENT: Num -} -val Int32Array: Int32ArrayConstructor -declare trait Int32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3485, 64> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Int32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Int32Array) - val prototype: Int32Array - fun id"of"(items: MutArray): Int32Array - val BYTES_PER_ELEMENT: Num -} -val Uint32Array: Uint32ArrayConstructor -declare trait Uint32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 3766, 65> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Uint32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Uint32Array) - val prototype: Uint32Array - fun id"of"(items: MutArray): Uint32Array - val BYTES_PER_ELEMENT: Num -} -val Float32Array: Float32ArrayConstructor -declare trait Float32ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4048, 66> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float32Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float32Array) - val prototype: Float32Array - fun id"of"(items: MutArray): Float32Array - val BYTES_PER_ELEMENT: Num -} -val Float64Array: Float64ArrayConstructor -declare trait Float64ArrayConstructor { - val __new: Unsupported<"new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ts2mls/js/src/test/typescript/ES5.d.ts", 4322, 66> - val from: ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num) => Float64Array) & ((arrayLike: ArrayLike, mapfn: (v: T, k: Num) => Num, thisArg: anything) => Float64Array) - val prototype: Float64Array - fun id"of"(items: MutArray): Float64Array - val BYTES_PER_ELEMENT: Num -} -module Intl { - export declare trait CollatorOptions { - val sensitivity: (Str) | (undefined) - val ignorePunctuation: ((false) | (true)) | (undefined) - val usage: (Str) | (undefined) - val localeMatcher: (Str) | (undefined) - val numeric: ((false) | (true)) | (undefined) - val caseFirst: (Str) | (undefined) - } - export declare trait ResolvedCollatorOptions { - val sensitivity: Str - val ignorePunctuation: (false) | (true) - val usage: Str - val locale: Str - val numeric: (false) | (true) - val caseFirst: Str - val collation: Str - } - export declare trait Collator { - fun compare(x: Str, y: Str): Num - fun resolvedOptions(): ResolvedCollatorOptions - } - export declare trait NumberFormatOptions { - val minimumSignificantDigits: (Num) | (undefined) - val useGrouping: ((false) | (true)) | (undefined) - val style: (Str) | (undefined) - val localeMatcher: (Str) | (undefined) - val currency: (Str) | (undefined) - val minimumIntegerDigits: (Num) | (undefined) - val maximumFractionDigits: (Num) | (undefined) - val currencySign: (Str) | (undefined) - val maximumSignificantDigits: (Num) | (undefined) - val minimumFractionDigits: (Num) | (undefined) - } - export declare trait ResolvedNumberFormatOptions { - val numberingSystem: Str - val minimumSignificantDigits: (Num) | (undefined) - val useGrouping: (false) | (true) - val style: Str - val locale: Str - val currency: (Str) | (undefined) - val minimumIntegerDigits: Num - val maximumFractionDigits: Num - val maximumSignificantDigits: (Num) | (undefined) - val minimumFractionDigits: Num - } - export declare trait NumberFormat { - fun format(value: Num): Str - fun resolvedOptions(): ResolvedNumberFormatOptions - } - export declare trait DateTimeFormatOptions { - val minute: ((Str) | (Str)) | (undefined) - val year: ((Str) | (Str)) | (undefined) - val hour: ((Str) | (Str)) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (((Str) | (Str)) | (Str)) | (undefined) - val formatMatcher: ((Str) | (Str)) | (undefined) - val day: ((Str) | (Str)) | (undefined) - val timeZone: (Str) | (undefined) - val month: (((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) - val second: ((Str) | (Str)) | (undefined) - val localeMatcher: ((Str) | (Str)) | (undefined) - val timeZoneName: ((((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) - val era: (((Str) | (Str)) | (Str)) | (undefined) - } - export declare trait ResolvedDateTimeFormatOptions { - val numberingSystem: Str - val minute: (Str) | (undefined) - val year: (Str) | (undefined) - val hour: (Str) | (undefined) - val second: (Str) | (undefined) - val hour12: ((false) | (true)) | (undefined) - val weekday: (Str) | (undefined) - val day: (Str) | (undefined) - val timeZone: Str - val month: (Str) | (undefined) - val locale: Str - val calendar: Str - val timeZoneName: (Str) | (undefined) - val era: (Str) | (undefined) - } - export declare trait DateTimeFormat { - val format: (() => Str) & ((date: (Num) | (Date)) => Str) - fun resolvedOptions(): ResolvedDateTimeFormatOptions - } + fun getMonth(): Num + fun getTimezoneOffset(): Num + val setUTCHours: ((((hours: Num) => Num) & ((hours: Num, min: Num) => Num)) & ((hours: Num, min: Num, sec: Num) => Num)) & ((hours: Num, min: Num, sec: Num, ms: Num) => Num) + val toJSON: (() => Str) & ((key: anything) => Str) } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 0ae2a1db6..221f3565a 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,8 +1,8 @@ export declare module Optional { fun buildName: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) fun buildName2: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) - fun buildName3(firstName: Str, lastName: MutArray): Str - fun buildName4(firstName: Str, lastName: MutArray): Str + fun buildName3(firstName: Str, lastName: Str): Str + fun buildName4(firstName: Str, lastName: anything): Str declare trait SquareConfig { val color: (Str) | (undefined) val width: (Num) | (undefined) diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 0e0164e76..bedbc4bad 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -24,6 +24,7 @@ object TSTypeGenerationTest { "./ClassMember.ts", "./Cycle1.ts", "./Dec.d.ts", + "./Dom.d.ts", "./Enum.ts", "./ES5.d.ts", "./Export.ts", @@ -43,5 +44,5 @@ object TSTypeGenerationTest { "./Variables.ts", ) - private val directlyImportedSet = Set[String]("./ES5.d.ts") + private val directlyImportedSet = Set[String]("./ES5.d.ts", "./Dom.d.ts") } diff --git a/ts2mls/js/src/test/typescript/Dom.d.ts b/ts2mls/js/src/test/typescript/Dom.d.ts new file mode 100644 index 000000000..23219f4ea --- /dev/null +++ b/ts2mls/js/src/test/typescript/Dom.d.ts @@ -0,0 +1,48 @@ +///////////////////////////// +/// Window APIs +///////////////////////////// + +/** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console) */ +interface Console { + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/assert) */ + assert(condition?: boolean, ...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/clear) */ + clear(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/count) */ + count(label?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/countReset) */ + countReset(label?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/debug) */ + debug(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dir) */ + dir(item?: any, options?: any): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/dirxml) */ + dirxml(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/error) */ + error(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/group) */ + group(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupCollapsed) */ + groupCollapsed(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/groupEnd) */ + groupEnd(): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/info) */ + info(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/log) */ + log(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/table) */ + table(tabularData?: any, properties?: string[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/time) */ + time(label?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeEnd) */ + timeEnd(label?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/timeLog) */ + timeLog(label?: string, ...data: any[]): void; + timeStamp(label?: string): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/trace) */ + trace(...data: any[]): void; + /** [MDN Reference](https://developer.mozilla.org/docs/Web/API/console/warn) */ + warn(...data: any[]): void; +} + +declare var console: Console; diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index e2023e7fc..947287d35 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -98,159 +98,159 @@ interface PropertyDescriptor { set?(v: any): void; } -interface PropertyDescriptorMap { - [key: PropertyKey]: PropertyDescriptor; -} +// interface PropertyDescriptorMap { +// [key: PropertyKey]: PropertyDescriptor; +// } -interface Object { - /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ - constructor: Function; +// interface Object { +// /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ +// constructor: Function; - /** Returns a string representation of an object. */ - toString(): string; +// /** Returns a string representation of an object. */ +// toString(): string; - /** Returns a date converted to a string using the current locale. */ - toLocaleString(): string; +// /** Returns a date converted to a string using the current locale. */ +// toLocaleString(): string; - /** Returns the primitive value of the specified object. */ - valueOf(): Object; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Object; - /** - * Determines whether an object has a property with the specified name. - * @param v A property name. - */ - hasOwnProperty(v: PropertyKey): boolean; +// /** +// * Determines whether an object has a property with the specified name. +// * @param v A property name. +// */ +// hasOwnProperty(v: PropertyKey): boolean; - /** - * Determines whether an object exists in another object's prototype chain. - * @param v Another object whose prototype chain is to be checked. - */ - isPrototypeOf(v: Object): boolean; +// /** +// * Determines whether an object exists in another object's prototype chain. +// * @param v Another object whose prototype chain is to be checked. +// */ +// isPrototypeOf(v: Object): boolean; - /** - * Determines whether a specified property is enumerable. - * @param v A property name. - */ - propertyIsEnumerable(v: PropertyKey): boolean; -} +// /** +// * Determines whether a specified property is enumerable. +// * @param v A property name. +// */ +// propertyIsEnumerable(v: PropertyKey): boolean; +// } -interface ObjectConstructor { - new(value?: any): Object; - (): any; - (value: any): any; +// interface ObjectConstructor { +// new(value?: any): Object; +// (): any; +// (value: any): any; - /** A reference to the prototype for a class of objects. */ - readonly prototype: Object; +// /** A reference to the prototype for a class of objects. */ +// readonly prototype: Object; - /** - * Returns the prototype of an object. - * @param o The object that references the prototype. - */ - getPrototypeOf(o: any): any; +// /** +// * Returns the prototype of an object. +// * @param o The object that references the prototype. +// */ +// getPrototypeOf(o: any): any; - /** - * Gets the own property descriptor of the specified object. - * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. - * @param o Object that contains the property. - * @param p Name of the property. - */ - getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; +// /** +// * Gets the own property descriptor of the specified object. +// * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. +// * @param o Object that contains the property. +// * @param p Name of the property. +// */ +// getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; - /** - * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly - * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. - * @param o Object that contains the own properties. - */ - getOwnPropertyNames(o: any): string[]; +// /** +// * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly +// * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. +// * @param o Object that contains the own properties. +// */ +// getOwnPropertyNames(o: any): string[]; - /** - * Creates an object that has the specified prototype or that has null prototype. - * @param o Object to use as a prototype. May be null. - */ - create(o: object | null): any; +// /** +// * Creates an object that has the specified prototype or that has null prototype. +// * @param o Object to use as a prototype. May be null. +// */ +// create(o: object | null): any; - /** - * Creates an object that has the specified prototype, and that optionally contains specified properties. - * @param o Object to use as a prototype. May be null - * @param properties JavaScript object that contains one or more property descriptors. - */ - create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; +// /** +// * Creates an object that has the specified prototype, and that optionally contains specified properties. +// * @param o Object to use as a prototype. May be null +// * @param properties JavaScript object that contains one or more property descriptors. +// */ +// create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; - /** - * Adds a property to an object, or modifies attributes of an existing property. - * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. - * @param p The property name. - * @param attributes Descriptor for the property. It can be for a data property or an accessor property. - */ - defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; +// /** +// * Adds a property to an object, or modifies attributes of an existing property. +// * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. +// * @param p The property name. +// * @param attributes Descriptor for the property. It can be for a data property or an accessor property. +// */ +// defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; - /** - * Adds one or more properties to an object, and/or modifies attributes of existing properties. - * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. - * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. - */ - defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; +// /** +// * Adds one or more properties to an object, and/or modifies attributes of existing properties. +// * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. +// * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. +// */ +// defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; - /** - * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - seal(o: T): T; +// /** +// * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// seal(o: T): T; - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param f Object on which to lock the attributes. - */ - freeze(f: T): T; +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param f Object on which to lock the attributes. +// */ +// freeze(f: T): T; - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): Readonly; +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// freeze(o: T): Readonly; - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param o Object on which to lock the attributes. - */ - freeze(o: T): Readonly; +// /** +// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. +// * @param o Object on which to lock the attributes. +// */ +// freeze(o: T): Readonly; - /** - * Prevents the addition of new properties to an object. - * @param o Object to make non-extensible. - */ - preventExtensions(o: T): T; +// /** +// * Prevents the addition of new properties to an object. +// * @param o Object to make non-extensible. +// */ +// preventExtensions(o: T): T; - /** - * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. - * @param o Object to test. - */ - isSealed(o: any): boolean; +// /** +// * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. +// * @param o Object to test. +// */ +// isSealed(o: any): boolean; - /** - * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. - * @param o Object to test. - */ - isFrozen(o: any): boolean; +// /** +// * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. +// * @param o Object to test. +// */ +// isFrozen(o: any): boolean; - /** - * Returns a value that indicates whether new properties can be added to an object. - * @param o Object to test. - */ - isExtensible(o: any): boolean; +// /** +// * Returns a value that indicates whether new properties can be added to an object. +// * @param o Object to test. +// */ +// isExtensible(o: any): boolean; - /** - * Returns the names of the enumerable string properties and methods of an object. - * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. - */ - keys(o: object): string[]; -} +// /** +// * Returns the names of the enumerable string properties and methods of an object. +// * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. +// */ +// keys(o: object): string[]; +// } -// TODO: name clash? -/** - * Provides functionality common to all JavaScript objects. - */ -// declare var Object: ObjectConstructor; +// // TODO: name clash? +// /** +// * Provides functionality common to all JavaScript objects. +// */ +// // declare var Object: ObjectConstructor; /** * Creates a new function. @@ -289,334 +289,334 @@ interface Function { caller: Function; } -interface FunctionConstructor { - /** - * Creates a new function. - * @param args A list of arguments the function accepts. - */ - new(...args: string[]): Function; - (...args: string[]): Function; - readonly prototype: Function; -} +// interface FunctionConstructor { +// /** +// * Creates a new function. +// * @param args A list of arguments the function accepts. +// */ +// new(...args: string[]): Function; +// (...args: string[]): Function; +// readonly prototype: Function; +// } -declare var Function: FunctionConstructor; +// declare var Function: FunctionConstructor; -/** - * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. - */ -type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; +// /** +// * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. +// */ +// type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; -/** - * Removes the 'this' parameter from a function type. - */ -type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; +// /** +// * Removes the 'this' parameter from a function type. +// */ +// type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; -interface CallableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ - apply(this: (this: T) => R, thisArg: T): R; - apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; +// interface CallableFunction extends Function { +// /** +// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args An array of argument values to be passed to the function. +// */ +// apply(this: (this: T) => R, thisArg: T): R; +// apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; - /** - * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. - * @param thisArg The object to be used as the this object. - * @param args Argument values to be passed to the function. - */ - call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; +// /** +// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args Argument values to be passed to the function. +// */ +// call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg The object to be used as the this object. - * @param args Arguments to bind to the parameters of the function. - */ - bind(this: T, thisArg: ThisParameterType): OmitThisParameter; - bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; - bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; - bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; - bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; - bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; -} +// /** +// * For a given function, creates a bound function that has the same body as the original function. +// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. +// * @param thisArg The object to be used as the this object. +// * @param args Arguments to bind to the parameters of the function. +// */ +// bind(this: T, thisArg: ThisParameterType): OmitThisParameter; +// bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; +// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; +// bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; +// } -interface NewableFunction extends Function { - /** - * Calls the function with the specified object as the this value and the elements of specified array as the arguments. - * @param thisArg The object to be used as the this object. - * @param args An array of argument values to be passed to the function. - */ - apply(this: new () => T, thisArg: T): void; - apply(this: new (...args: A) => T, thisArg: T, args: A): void; +// interface NewableFunction extends Function { +// /** +// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args An array of argument values to be passed to the function. +// */ +// apply(this: new () => T, thisArg: T): void; +// apply(this: new (...args: A) => T, thisArg: T, args: A): void; - /** - * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. - * @param thisArg The object to be used as the this object. - * @param args Argument values to be passed to the function. - */ - call(this: new (...args: A) => T, thisArg: T, ...args: A): void; +// /** +// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. +// * @param thisArg The object to be used as the this object. +// * @param args Argument values to be passed to the function. +// */ +// call(this: new (...args: A) => T, thisArg: T, ...args: A): void; - /** - * For a given function, creates a bound function that has the same body as the original function. - * The this object of the bound function is associated with the specified object, and has the specified initial parameters. - * @param thisArg The object to be used as the this object. - * @param args Arguments to bind to the parameters of the function. - */ - bind(this: T, thisArg: any): T; - bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; - bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; - bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; - bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; - bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; -} +// /** +// * For a given function, creates a bound function that has the same body as the original function. +// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. +// * @param thisArg The object to be used as the this object. +// * @param args Arguments to bind to the parameters of the function. +// */ +// bind(this: T, thisArg: any): T; +// bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; +// bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; +// bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; +// } -interface IArguments { - [index: number]: any; - length: number; - callee: Function; -} +// interface IArguments { +// [index: number]: any; +// length: number; +// callee: Function; +// } -interface String { - /** Returns a string representation of a string. */ - toString(): string; +// interface String { +// /** Returns a string representation of a string. */ +// toString(): string; - /** - * Returns the character at the specified index. - * @param pos The zero-based index of the desired character. - */ - charAt(pos: number): string; +// /** +// * Returns the character at the specified index. +// * @param pos The zero-based index of the desired character. +// */ +// charAt(pos: number): string; - /** - * Returns the Unicode value of the character at the specified location. - * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. - */ - charCodeAt(index: number): number; +// /** +// * Returns the Unicode value of the character at the specified location. +// * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. +// */ +// charCodeAt(index: number): number; - /** - * Returns a string that contains the concatenation of two or more strings. - * @param strings The strings to append to the end of the string. - */ - concat(...strings: string[]): string; +// /** +// * Returns a string that contains the concatenation of two or more strings. +// * @param strings The strings to append to the end of the string. +// */ +// concat(...strings: string[]): string; - /** - * Returns the position of the first occurrence of a substring. - * @param searchString The substring to search for in the string - * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. - */ - indexOf(searchString: string, position?: number): number; +// /** +// * Returns the position of the first occurrence of a substring. +// * @param searchString The substring to search for in the string +// * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. +// */ +// indexOf(searchString: string, position?: number): number; - /** - * Returns the last occurrence of a substring in the string. - * @param searchString The substring to search for. - * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. - */ - lastIndexOf(searchString: string, position?: number): number; +// /** +// * Returns the last occurrence of a substring in the string. +// * @param searchString The substring to search for. +// * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. +// */ +// lastIndexOf(searchString: string, position?: number): number; - /** - * Determines whether two strings are equivalent in the current locale. - * @param that String to compare to target string - */ - localeCompare(that: string): number; +// /** +// * Determines whether two strings are equivalent in the current locale. +// * @param that String to compare to target string +// */ +// localeCompare(that: string): number; - /** - * Matches a string with a regular expression, and returns an array containing the results of that search. - * @param regexp A variable name or string literal containing the regular expression pattern and flags. - */ - match(regexp: string | RegExp): RegExpMatchArray | null; +// /** +// * Matches a string with a regular expression, and returns an array containing the results of that search. +// * @param regexp A variable name or string literal containing the regular expression pattern and flags. +// */ +// match(regexp: string | RegExp): RegExpMatchArray | null; - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string or regular expression to search for. - * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. - */ - replace(searchValue: string | RegExp, replaceValue: string): string; +// /** +// * Replaces text in a string, using a regular expression or search string. +// * @param searchValue A string or regular expression to search for. +// * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. +// */ +// replace(searchValue: string | RegExp, replaceValue: string): string; - /** - * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string to search for. - * @param replacer A function that returns the replacement text. - */ - replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; +// /** +// * Replaces text in a string, using a regular expression or search string. +// * @param searchValue A string to search for. +// * @param replacer A function that returns the replacement text. +// */ +// replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; - /** - * Finds the first substring match in a regular expression search. - * @param regexp The regular expression pattern and applicable flags. - */ - search(regexp: string | RegExp): number; +// /** +// * Finds the first substring match in a regular expression search. +// * @param regexp The regular expression pattern and applicable flags. +// */ +// search(regexp: string | RegExp): number; - /** - * Returns a section of a string. - * @param start The index to the beginning of the specified portion of stringObj. - * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. - * If this value is not specified, the substring continues to the end of stringObj. - */ - slice(start?: number, end?: number): string; +// /** +// * Returns a section of a string. +// * @param start The index to the beginning of the specified portion of stringObj. +// * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. +// * If this value is not specified, the substring continues to the end of stringObj. +// */ +// slice(start?: number, end?: number): string; - /** - * Split a string into substrings using the specified separator and return them as an array. - * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. - * @param limit A value used to limit the number of elements returned in the array. - */ - split(separator: string | RegExp, limit?: number): string[]; +// /** +// * Split a string into substrings using the specified separator and return them as an array. +// * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. +// * @param limit A value used to limit the number of elements returned in the array. +// */ +// split(separator: string | RegExp, limit?: number): string[]; - /** - * Returns the substring at the specified location within a String object. - * @param start The zero-based index number indicating the beginning of the substring. - * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. - * If end is omitted, the characters from start through the end of the original string are returned. - */ - substring(start: number, end?: number): string; +// /** +// * Returns the substring at the specified location within a String object. +// * @param start The zero-based index number indicating the beginning of the substring. +// * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. +// * If end is omitted, the characters from start through the end of the original string are returned. +// */ +// substring(start: number, end?: number): string; - /** Converts all the alphabetic characters in a string to lowercase. */ - toLowerCase(): string; +// /** Converts all the alphabetic characters in a string to lowercase. */ +// toLowerCase(): string; - /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ - toLocaleLowerCase(locales?: string | string[]): string; +// /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ +// toLocaleLowerCase(locales?: string | string[]): string; - /** Converts all the alphabetic characters in a string to uppercase. */ - toUpperCase(): string; +// /** Converts all the alphabetic characters in a string to uppercase. */ +// toUpperCase(): string; - /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ - toLocaleUpperCase(locales?: string | string[]): string; +// /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ +// toLocaleUpperCase(locales?: string | string[]): string; - /** Removes the leading and trailing white space and line terminator characters from a string. */ - trim(): string; +// /** Removes the leading and trailing white space and line terminator characters from a string. */ +// trim(): string; - /** Returns the length of a String object. */ - readonly length: number; +// /** Returns the length of a String object. */ +// readonly length: number; - // IE extensions - /** - * Gets a substring beginning at the specified location and having the specified length. - * @deprecated A legacy feature for browser compatibility - * @param from The starting position of the desired substring. The index of the first character in the string is zero. - * @param length The number of characters to include in the returned substring. - */ - substr(from: number, length?: number): string; +// // IE extensions +// /** +// * Gets a substring beginning at the specified location and having the specified length. +// * @deprecated A legacy feature for browser compatibility +// * @param from The starting position of the desired substring. The index of the first character in the string is zero. +// * @param length The number of characters to include in the returned substring. +// */ +// substr(from: number, length?: number): string; - /** Returns the primitive value of the specified object. */ - valueOf(): string; +// /** Returns the primitive value of the specified object. */ +// valueOf(): string; - readonly [index: number]: string; -} +// readonly [index: number]: string; +// } -interface StringConstructor { - new(value?: any): String; - (value?: any): string; - readonly prototype: String; - fromCharCode(...codes: number[]): string; -} +// interface StringConstructor { +// new(value?: any): String; +// (value?: any): string; +// readonly prototype: String; +// fromCharCode(...codes: number[]): string; +// } -/** - * Allows manipulation and formatting of text strings and determination and location of substrings within strings. - */ -declare var String: StringConstructor; +// /** +// * Allows manipulation and formatting of text strings and determination and location of substrings within strings. +// */ +// declare var String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ valueOf(): boolean; } -interface BooleanConstructor { - new(value?: any): Boolean; - (value?: T): boolean; - readonly prototype: Boolean; -} +// interface BooleanConstructor { +// new(value?: any): Boolean; +// (value?: T): boolean; +// readonly prototype: Boolean; +// } -declare var Boolean: BooleanConstructor; +// declare var Boolean: BooleanConstructor; -interface Number { - /** - * Returns a string representation of an object. - * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. - */ - toString(radix?: number): string; +// interface Number { +// /** +// * Returns a string representation of an object. +// * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. +// */ +// toString(radix?: number): string; - /** - * Returns a string representing a number in fixed-point notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toFixed(fractionDigits?: number): string; +// /** +// * Returns a string representing a number in fixed-point notation. +// * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. +// */ +// toFixed(fractionDigits?: number): string; - /** - * Returns a string containing a number represented in exponential notation. - * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. - */ - toExponential(fractionDigits?: number): string; +// /** +// * Returns a string containing a number represented in exponential notation. +// * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. +// */ +// toExponential(fractionDigits?: number): string; - /** - * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. - * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. - */ - toPrecision(precision?: number): string; +// /** +// * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. +// * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. +// */ +// toPrecision(precision?: number): string; - /** Returns the primitive value of the specified object. */ - valueOf(): number; -} +// /** Returns the primitive value of the specified object. */ +// valueOf(): number; +// } -interface NumberConstructor { - new(value?: any): Number; - (value?: any): number; - readonly prototype: Number; +// interface NumberConstructor { +// new(value?: any): Number; +// (value?: any): number; +// readonly prototype: Number; - /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ - readonly MAX_VALUE: number; +// /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ +// readonly MAX_VALUE: number; - /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ - readonly MIN_VALUE: number; +// /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ +// readonly MIN_VALUE: number; - /** - * A value that is not a number. - * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. - */ - readonly NaN: number; +// /** +// * A value that is not a number. +// * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. +// */ +// readonly NaN: number; - /** - * A value that is less than the largest negative number that can be represented in JavaScript. - * JavaScript displays NEGATIVE_INFINITY values as -infinity. - */ - readonly NEGATIVE_INFINITY: number; +// /** +// * A value that is less than the largest negative number that can be represented in JavaScript. +// * JavaScript displays NEGATIVE_INFINITY values as -infinity. +// */ +// readonly NEGATIVE_INFINITY: number; - /** - * A value greater than the largest number that can be represented in JavaScript. - * JavaScript displays POSITIVE_INFINITY values as infinity. - */ - readonly POSITIVE_INFINITY: number; -} +// /** +// * A value greater than the largest number that can be represented in JavaScript. +// * JavaScript displays POSITIVE_INFINITY values as infinity. +// */ +// readonly POSITIVE_INFINITY: number; +// } -/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -declare var Number: NumberConstructor; +// /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +// declare var Number: NumberConstructor; -interface TemplateStringsArray extends ReadonlyArray { - readonly raw: readonly string[]; -} +// interface TemplateStringsArray extends ReadonlyArray { +// readonly raw: readonly string[]; +// } -/** - * The type of `import.meta`. - * - * If you need to declare that a given property exists on `import.meta`, - * this type may be augmented via interface merging. - */ -interface ImportMeta { -} +// /** +// * The type of `import.meta`. +// * +// * If you need to declare that a given property exists on `import.meta`, +// * this type may be augmented via interface merging. +// */ +// interface ImportMeta { +// } -/** - * The type for the optional second argument to `import()`. - * - * If your host environment supports additional options, this type may be - * augmented via interface merging. - */ -interface ImportCallOptions { - assert?: ImportAssertions; -} +// /** +// * The type for the optional second argument to `import()`. +// * +// * If your host environment supports additional options, this type may be +// * augmented via interface merging. +// */ +// interface ImportCallOptions { +// assert?: ImportAssertions; +// } -/** - * The type for the `assert` property of the optional second argument to `import()`. - */ -interface ImportAssertions { - [key: string]: string; -} +// /** +// * The type for the `assert` property of the optional second argument to `import()`. +// */ +// interface ImportAssertions { +// [key: string]: string; +// } interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ @@ -727,7 +727,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -declare var Math: Math; +// declare var Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -883,3626 +883,3626 @@ interface Date { toJSON(key?: any): string; } -interface DateConstructor { - new(): Date; - new(value: number | string): Date; - /** - * Creates a new Date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param monthIndex The month as a number between 0 and 11 (January to December). - * @param date The date as a number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. - * @param ms A number from 0 to 999 that specifies the milliseconds. - */ - new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; - (): string; - readonly prototype: Date; - /** - * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. - * @param s A date string - */ - parse(s: string): number; - /** - * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. - * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param monthIndex The month as a number between 0 and 11 (January to December). - * @param date The date as a number between 1 and 31. - * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. - * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. - * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. - * @param ms A number from 0 to 999 that specifies the milliseconds. - */ - UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; - /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ - now(): number; -} - -declare var Date: DateConstructor; - -// TODO: 0? -// interface RegExpMatchArray extends Array { +// interface DateConstructor { +// new(): Date; +// new(value: number | string): Date; // /** -// * The index of the search at which the result was found. +// * Creates a new Date. +// * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. +// * @param monthIndex The month as a number between 0 and 11 (January to December). +// * @param date The date as a number between 1 and 31. +// * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. +// * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. +// * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. +// * @param ms A number from 0 to 999 that specifies the milliseconds. // */ -// index?: number; +// new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; +// (): string; +// readonly prototype: Date; // /** -// * A copy of the search string. +// * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. +// * @param s A date string // */ -// input?: string; +// parse(s: string): number; // /** -// * The first match. This will always be present because `null` will be returned if there are no matches. +// * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. +// * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. +// * @param monthIndex The month as a number between 0 and 11 (January to December). +// * @param date The date as a number between 1 and 31. +// * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. +// * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. +// * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. +// * @param ms A number from 0 to 999 that specifies the milliseconds. // */ -// 0: string; +// UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; +// /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ +// now(): number; // } -// interface RegExpExecArray extends Array { +// declare var Date: DateConstructor; + +// // TODO: 0? +// // interface RegExpMatchArray extends Array { +// // /** +// // * The index of the search at which the result was found. +// // */ +// // index?: number; +// // /** +// // * A copy of the search string. +// // */ +// // input?: string; +// // /** +// // * The first match. This will always be present because `null` will be returned if there are no matches. +// // */ +// // 0: string; +// // } + +// // interface RegExpExecArray extends Array { +// // /** +// // * The index of the search at which the result was found. +// // */ +// // index: number; +// // /** +// // * A copy of the search string. +// // */ +// // input: string; +// // /** +// // * The first match. This will always be present because `null` will be returned if there are no matches. +// // */ +// // 0: string; +// // } + +// interface RegExp { // /** -// * The index of the search at which the result was found. +// * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. +// * @param string The String object or string literal on which to perform the search. // */ -// index: number; -// /** -// * A copy of the search string. -// */ -// input: string; +// exec(string: string): RegExpExecArray | null; + // /** -// * The first match. This will always be present because `null` will be returned if there are no matches. +// * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. +// * @param string String on which to perform the search. // */ -// 0: string; -// } - -interface RegExp { - /** - * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. - * @param string The String object or string literal on which to perform the search. - */ - exec(string: string): RegExpExecArray | null; - - /** - * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. - * @param string String on which to perform the search. - */ - test(string: string): boolean; - - /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ - readonly source: string; - - /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ - readonly global: boolean; +// test(string: string): boolean; - /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ - readonly ignoreCase: boolean; +// /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ +// readonly source: string; - /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ - readonly multiline: boolean; +// /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ +// readonly global: boolean; - lastIndex: number; +// /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ +// readonly ignoreCase: boolean; - // Non-standard extensions - /** @deprecated A legacy feature for browser compatibility */ - compile(pattern: string, flags?: string): this; -} +// /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ +// readonly multiline: boolean; -// TODO: $+ -// interface RegExpConstructor { -// new(pattern: RegExp | string): RegExp; -// new(pattern: string, flags?: string): RegExp; -// (pattern: RegExp | string): RegExp; -// (pattern: string, flags?: string): RegExp; -// readonly prototype: RegExp; +// lastIndex: number; // // Non-standard extensions // /** @deprecated A legacy feature for browser compatibility */ -// $1: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $2: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $3: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $4: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $5: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $6: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $7: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $8: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $9: string; -// /** @deprecated A legacy feature for browser compatibility */ -// input: string; -// /** @deprecated A legacy feature for browser compatibility */ -// $_: string; -// /** @deprecated A legacy feature for browser compatibility */ -// lastMatch: string; -// /** @deprecated A legacy feature for browser compatibility */ -// "$&": string; -// /** @deprecated A legacy feature for browser compatibility */ -// lastParen: string; -// /** @deprecated A legacy feature for browser compatibility */ -// "$+": string; -// /** @deprecated A legacy feature for browser compatibility */ -// leftContext: string; -// /** @deprecated A legacy feature for browser compatibility */ -// "$`": string; -// /** @deprecated A legacy feature for browser compatibility */ -// rightContext: string; -// /** @deprecated A legacy feature for browser compatibility */ -// "$'": string; +// compile(pattern: string, flags?: string): this; // } -// declare var RegExp: RegExpConstructor; - -interface Error { - name: string; - message: string; - stack?: string; -} - -interface ErrorConstructor { - new(message?: string): Error; - (message?: string): Error; - readonly prototype: Error; -} - -declare var Error: ErrorConstructor; - -interface EvalError extends Error { -} - -interface EvalErrorConstructor extends ErrorConstructor { - new(message?: string): EvalError; - (message?: string): EvalError; - readonly prototype: EvalError; -} - -declare var EvalError: EvalErrorConstructor; - -interface RangeError extends Error { -} - -interface RangeErrorConstructor extends ErrorConstructor { - new(message?: string): RangeError; - (message?: string): RangeError; - readonly prototype: RangeError; -} - -declare var RangeError: RangeErrorConstructor; - -interface ReferenceError extends Error { -} - -interface ReferenceErrorConstructor extends ErrorConstructor { - new(message?: string): ReferenceError; - (message?: string): ReferenceError; - readonly prototype: ReferenceError; -} - -declare var ReferenceError: ReferenceErrorConstructor; - -interface SyntaxError extends Error { -} - -interface SyntaxErrorConstructor extends ErrorConstructor { - new(message?: string): SyntaxError; - (message?: string): SyntaxError; - readonly prototype: SyntaxError; -} +// // TODO: $+ +// // interface RegExpConstructor { +// // new(pattern: RegExp | string): RegExp; +// // new(pattern: string, flags?: string): RegExp; +// // (pattern: RegExp | string): RegExp; +// // (pattern: string, flags?: string): RegExp; +// // readonly prototype: RegExp; + +// // // Non-standard extensions +// // /** @deprecated A legacy feature for browser compatibility */ +// // $1: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $2: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $3: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $4: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $5: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $6: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $7: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $8: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $9: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // input: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // $_: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // lastMatch: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // "$&": string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // lastParen: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // "$+": string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // leftContext: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // "$`": string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // rightContext: string; +// // /** @deprecated A legacy feature for browser compatibility */ +// // "$'": string; +// // } + +// // declare var RegExp: RegExpConstructor; + +// interface Error { +// name: string; +// message: string; +// stack?: string; +// } -declare var SyntaxError: SyntaxErrorConstructor; +// interface ErrorConstructor { +// new(message?: string): Error; +// (message?: string): Error; +// readonly prototype: Error; +// } -interface TypeError extends Error { -} +// declare var Error: ErrorConstructor; -interface TypeErrorConstructor extends ErrorConstructor { - new(message?: string): TypeError; - (message?: string): TypeError; - readonly prototype: TypeError; -} +// interface EvalError extends Error { +// } -declare var TypeError: TypeErrorConstructor; +// interface EvalErrorConstructor extends ErrorConstructor { +// new(message?: string): EvalError; +// (message?: string): EvalError; +// readonly prototype: EvalError; +// } -interface URIError extends Error { -} +// declare var EvalError: EvalErrorConstructor; -interface URIErrorConstructor extends ErrorConstructor { - new(message?: string): URIError; - (message?: string): URIError; - readonly prototype: URIError; -} +// interface RangeError extends Error { +// } -declare var URIError: URIErrorConstructor; +// interface RangeErrorConstructor extends ErrorConstructor { +// new(message?: string): RangeError; +// (message?: string): RangeError; +// readonly prototype: RangeError; +// } -interface JSON { - /** - * Converts a JavaScript Object Notation (JSON) string into an object. - * @param text A valid JSON string. - * @param reviver A function that transforms the results. This function is called for each member of the object. - * If a member contains nested objects, the nested objects are transformed before the parent object is. - */ - parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer A function that transforms the results. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; - /** - * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. - * @param value A JavaScript value, usually an object or array, to be converted. - * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. - * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. - */ - stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -} +// declare var RangeError: RangeErrorConstructor; -/** - * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. - */ -declare var JSON: JSON; +// interface ReferenceError extends Error { +// } +// interface ReferenceErrorConstructor extends ErrorConstructor { +// new(message?: string): ReferenceError; +// (message?: string): ReferenceError; +// readonly prototype: ReferenceError; +// } -///////////////////////////// -/// ECMAScript Array API (specially handled by compiler) -///////////////////////////// +// declare var ReferenceError: ReferenceErrorConstructor; -interface ReadonlyArray { - /** - * Gets the length of the array. This is a number one higher than the highest element defined in an array. - */ - readonly length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - /** - * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. - */ - toLocaleString(): string; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: ConcatArray[]): T[]; - /** - * Combines two or more arrays. - * @param items Additional items to add to the end of array1. - */ - concat(...items: (T | ConcatArray)[]): T[]; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): T[]; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; +// interface SyntaxError extends Error { +// } - readonly [n: number]: T; -} +// interface SyntaxErrorConstructor extends ErrorConstructor { +// new(message?: string): SyntaxError; +// (message?: string): SyntaxError; +// readonly prototype: SyntaxError; +// } -interface ConcatArray { - readonly length: number; - readonly [n: number]: T; - join(separator?: string): string; - slice(start?: number, end?: number): T[]; -} +// declare var SyntaxError: SyntaxErrorConstructor; -interface Array { - /** - * Gets or sets the length of the array. This is a number one higher than the highest index in the array. - */ - length: number; - /** - * Returns a string representation of an array. - */ - toString(): string; - /** - * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. - */ - toLocaleString(): string; - /** - * Removes the last element from an array and returns it. - * If the array is empty, undefined is returned and the array is not modified. - */ - pop(): T | undefined; - /** - * Appends new elements to the end of an array, and returns the new length of the array. - * @param items New elements to add to the array. - */ - push(...items: T[]): number; - /** - * Combines two or more arrays. - * This method returns a new array without modifying any existing arrays. - * @param items Additional arrays and/or items to add to the end of the array. - */ - concat(...items: ConcatArray[]): T[]; - /** - * Combines two or more arrays. - * This method returns a new array without modifying any existing arrays. - * @param items Additional arrays and/or items to add to the end of the array. - */ - concat(...items: (T | ConcatArray)[]): T[]; - /** - * Adds all the elements of an array into a string, separated by the specified separator string. - * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; - /** - * Reverses the elements in an array in place. - * This method mutates the array and returns a reference to the same array. - */ - reverse(): T[]; - /** - * Removes the first element from an array and returns it. - * If the array is empty, undefined is returned and the array is not modified. - */ - shift(): T | undefined; - /** - * Returns a copy of a section of an array. - * For both start and end, a negative index can be used to indicate an offset from the end of the array. - * For example, -2 refers to the second to last element of the array. - * @param start The beginning index of the specified portion of the array. - * If start is undefined, then the slice begins at index 0. - * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. - * If end is undefined, then the slice extends to the end of the array. - */ - slice(start?: number, end?: number): T[]; - /** - * Sorts an array in place. - * This method mutates the array and returns a reference to the same array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive - * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: T, b: T) => number): this; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @returns An array containing the elements that were deleted. - */ - splice(start: number, deleteCount?: number): T[]; - /** - * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. - * @param start The zero-based location in the array from which to start removing elements. - * @param deleteCount The number of elements to remove. - * @param items Elements to insert into the array in place of the deleted elements. - * @returns An array containing the elements that were deleted. - */ - splice(start: number, deleteCount: number, ...items: T[]): T[]; - /** - * Inserts new elements at the start of an array, and returns the new length of the array. - * @param items Elements to insert at the start of the array. - */ - unshift(...items: T[]): number; - /** - * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. - */ - indexOf(searchElement: T, fromIndex?: number): number; - /** - * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. - */ - lastIndexOf(searchElement: T, fromIndex?: number): number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; - /** - * Calls a defined callback function on each element of an array, and returns an array that contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; - reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; - /** - * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; - reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; - /** - * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +// interface TypeError extends Error { +// } - [n: number]: T; -} +// interface TypeErrorConstructor extends ErrorConstructor { +// new(message?: string): TypeError; +// (message?: string): TypeError; +// readonly prototype: TypeError; +// } -interface ArrayConstructor { - new(arrayLength?: number): any[]; - new (arrayLength: number): T[]; - new (...items: T[]): T[]; - (arrayLength?: number): any[]; - (arrayLength: number): T[]; - (...items: T[]): T[]; - isArray(arg: any): arg is any[]; - readonly prototype: any[]; -} +// declare var TypeError: TypeErrorConstructor; -declare var Array: ArrayConstructor; +// interface URIError extends Error { +// } -interface TypedPropertyDescriptor { - enumerable?: boolean; - configurable?: boolean; - writable?: boolean; - value?: T; - get?: () => T; - set?: (value: T) => void; -} +// interface URIErrorConstructor extends ErrorConstructor { +// new(message?: string): URIError; +// (message?: string): URIError; +// readonly prototype: URIError; +// } -declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; +// declare var URIError: URIErrorConstructor; -// interface PromiseLike { +// interface JSON { // /** -// * Attaches callbacks for the resolution and/or rejection of the Promise. -// * @param onfulfilled The callback to execute when the Promise is resolved. -// * @param onrejected The callback to execute when the Promise is rejected. -// * @returns A Promise for the completion of which ever callback is executed. +// * Converts a JavaScript Object Notation (JSON) string into an object. +// * @param text A valid JSON string. +// * @param reviver A function that transforms the results. This function is called for each member of the object. +// * If a member contains nested objects, the nested objects are transformed before the parent object is. // */ -// then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; -// } - -// /** -// * Represents the completion of an asynchronous operation -// */ -// interface Promise { +// parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; // /** -// * Attaches callbacks for the resolution and/or rejection of the Promise. -// * @param onfulfilled The callback to execute when the Promise is resolved. -// * @param onrejected The callback to execute when the Promise is rejected. -// * @returns A Promise for the completion of which ever callback is executed. +// * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. +// * @param value A JavaScript value, usually an object or array, to be converted. +// * @param replacer A function that transforms the results. +// * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. // */ -// then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; - +// stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; // /** -// * Attaches a callback for only the rejection of the Promise. -// * @param onrejected The callback to execute when the Promise is rejected. -// * @returns A Promise for the completion of the callback. +// * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. +// * @param value A JavaScript value, usually an object or array, to be converted. +// * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. +// * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. // */ -// catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +// stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; // } -/** - * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. - */ -type Awaited = - T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode - T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped - F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument - Awaited : // recursively unwrap the value - never : // the argument to `then` was not callable - T; // non-object or non-thenable - -interface ArrayLike { - readonly length: number; - readonly [n: number]: T; -} - -/** - * Make all properties in T optional - */ -type Partial = { - [P in keyof T]?: T[P]; -}; - -/** - * Make all properties in T required - */ -type Required = { - [P in keyof T]-?: T[P]; -}; - -/** - * Make all properties in T readonly - */ -type Readonly = { - readonly [P in keyof T]: T[P]; -}; - -/** - * From T, pick a set of properties whose keys are in the union K - */ -type Pick = { - [P in K]: T[P]; -}; - -/** - * Construct a type with a set of properties K of type T - */ -type Record = { - [P in K]: T; -}; - -/** - * Exclude from T those types that are assignable to U - */ -type Exclude = T extends U ? never : T; - -/** - * Extract from T those types that are assignable to U - */ -type Extract = T extends U ? T : never; - -/** - * Construct a type with the properties of T except for those in type K. - */ -type Omit = Pick>; +// /** +// * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. +// */ +// declare var JSON: JSON; -/** - * Exclude null and undefined from T - */ -type NonNullable = T & {}; -/** - * Obtain the parameters of a function type in a tuple - */ -type Parameters any> = T extends (...args: infer P) => any ? P : never; +// ///////////////////////////// +// /// ECMAScript Array API (specially handled by compiler) +// ///////////////////////////// -/** - * Obtain the parameters of a constructor function type in a tuple - */ -type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; +// interface ReadonlyArray { +// /** +// * Gets the length of the array. This is a number one higher than the highest element defined in an array. +// */ +// readonly length: number; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; +// /** +// * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. +// */ +// toLocaleString(): string; +// /** +// * Combines two or more arrays. +// * @param items Additional items to add to the end of array1. +// */ +// concat(...items: ConcatArray[]): T[]; +// /** +// * Combines two or more arrays. +// * @param items Additional items to add to the end of array1. +// */ +// concat(...items: (T | ConcatArray)[]): T[]; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): T[]; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. +// */ +// indexOf(searchElement: T, fromIndex?: number): number; +// /** +// * Returns the index of the last occurrence of a specified value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. +// */ +// lastIndexOf(searchElement: T, fromIndex?: number): number; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; -/** - * Obtain the return type of a function type - */ -type ReturnType any> = T extends (...args: any) => infer R ? R : any; +// readonly [n: number]: T; +// } -/** - * Obtain the return type of a constructor function type - */ -type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +// interface ConcatArray { +// readonly length: number; +// readonly [n: number]: T; +// join(separator?: string): string; +// slice(start?: number, end?: number): T[]; +// } -/** - * Convert string literal type to uppercase - */ -type Uppercase = intrinsic; +// interface Array { +// /** +// * Gets or sets the length of the array. This is a number one higher than the highest index in the array. +// */ +// length: number; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; +// /** +// * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. +// */ +// toLocaleString(): string; +// /** +// * Removes the last element from an array and returns it. +// * If the array is empty, undefined is returned and the array is not modified. +// */ +// pop(): T | undefined; +// /** +// * Appends new elements to the end of an array, and returns the new length of the array. +// * @param items New elements to add to the array. +// */ +// push(...items: T[]): number; +// /** +// * Combines two or more arrays. +// * This method returns a new array without modifying any existing arrays. +// * @param items Additional arrays and/or items to add to the end of the array. +// */ +// concat(...items: ConcatArray[]): T[]; +// /** +// * Combines two or more arrays. +// * This method returns a new array without modifying any existing arrays. +// * @param items Additional arrays and/or items to add to the end of the array. +// */ +// concat(...items: (T | ConcatArray)[]): T[]; +// /** +// * Adds all the elements of an array into a string, separated by the specified separator string. +// * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; +// /** +// * Reverses the elements in an array in place. +// * This method mutates the array and returns a reference to the same array. +// */ +// reverse(): T[]; +// /** +// * Removes the first element from an array and returns it. +// * If the array is empty, undefined is returned and the array is not modified. +// */ +// shift(): T | undefined; +// /** +// * Returns a copy of a section of an array. +// * For both start and end, a negative index can be used to indicate an offset from the end of the array. +// * For example, -2 refers to the second to last element of the array. +// * @param start The beginning index of the specified portion of the array. +// * If start is undefined, then the slice begins at index 0. +// * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. +// * If end is undefined, then the slice extends to the end of the array. +// */ +// slice(start?: number, end?: number): T[]; +// /** +// * Sorts an array in place. +// * This method mutates the array and returns a reference to the same array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive +// * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: T, b: T) => number): this; +// /** +// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. +// * @param start The zero-based location in the array from which to start removing elements. +// * @param deleteCount The number of elements to remove. +// * @returns An array containing the elements that were deleted. +// */ +// splice(start: number, deleteCount?: number): T[]; +// /** +// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. +// * @param start The zero-based location in the array from which to start removing elements. +// * @param deleteCount The number of elements to remove. +// * @param items Elements to insert into the array in place of the deleted elements. +// * @returns An array containing the elements that were deleted. +// */ +// splice(start: number, deleteCount: number, ...items: T[]): T[]; +// /** +// * Inserts new elements at the start of an array, and returns the new length of the array. +// * @param items Elements to insert at the start of the array. +// */ +// unshift(...items: T[]): number; +// /** +// * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. +// */ +// indexOf(searchElement: T, fromIndex?: number): number; +// /** +// * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. +// */ +// lastIndexOf(searchElement: T, fromIndex?: number): number; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; +// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; +// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; -/** - * Convert string literal type to lowercase - */ -type Lowercase = intrinsic; +// [n: number]: T; +// } -/** - * Convert first character of string literal type to uppercase - */ -type Capitalize = intrinsic; +// interface ArrayConstructor { +// new(arrayLength?: number): any[]; +// new (arrayLength: number): T[]; +// new (...items: T[]): T[]; +// (arrayLength?: number): any[]; +// (arrayLength: number): T[]; +// (...items: T[]): T[]; +// isArray(arg: any): arg is any[]; +// readonly prototype: any[]; +// } -/** - * Convert first character of string literal type to lowercase - */ -type Uncapitalize = intrinsic; +// declare var Array: ArrayConstructor; -/** - * Marker for contextual 'this' type - */ -interface ThisType { } +// interface TypedPropertyDescriptor { +// enumerable?: boolean; +// configurable?: boolean; +// writable?: boolean; +// value?: T; +// get?: () => T; +// set?: (value: T) => void; +// } -/** - * Represents a raw buffer of binary data, which is used to store data for the - * different typed arrays. ArrayBuffers cannot be read from or written to directly, - * but can be passed to a typed array or DataView Object to interpret the raw - * buffer as needed. - */ -interface ArrayBuffer { - /** - * Read-only. The length of the ArrayBuffer (in bytes). - */ - readonly byteLength: number; +// declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +// // interface PromiseLike { +// // /** +// // * Attaches callbacks for the resolution and/or rejection of the Promise. +// // * @param onfulfilled The callback to execute when the Promise is resolved. +// // * @param onrejected The callback to execute when the Promise is rejected. +// // * @returns A Promise for the completion of which ever callback is executed. +// // */ +// // then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +// // } + +// // /** +// // * Represents the completion of an asynchronous operation +// // */ +// // interface Promise { +// // /** +// // * Attaches callbacks for the resolution and/or rejection of the Promise. +// // * @param onfulfilled The callback to execute when the Promise is resolved. +// // * @param onrejected The callback to execute when the Promise is rejected. +// // * @returns A Promise for the completion of which ever callback is executed. +// // */ +// // then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; + +// // /** +// // * Attaches a callback for only the rejection of the Promise. +// // * @param onrejected The callback to execute when the Promise is rejected. +// // * @returns A Promise for the completion of the callback. +// // */ +// // catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +// // } - /** - * Returns a section of an ArrayBuffer. - */ - slice(begin: number, end?: number): ArrayBuffer; -} +// /** +// * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. +// */ +// type Awaited = +// T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode +// T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped +// F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument +// Awaited : // recursively unwrap the value +// never : // the argument to `then` was not callable +// T; // non-object or non-thenable + +// interface ArrayLike { +// readonly length: number; +// readonly [n: number]: T; +// } -/** - * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. - */ -interface ArrayBufferTypes { - ArrayBuffer: ArrayBuffer; -} -type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; +// /** +// * Make all properties in T optional +// */ +// type Partial = { +// [P in keyof T]?: T[P]; +// }; -interface ArrayBufferConstructor { - readonly prototype: ArrayBuffer; - new(byteLength: number): ArrayBuffer; - isView(arg: any): arg is ArrayBufferView; -} -declare var ArrayBuffer: ArrayBufferConstructor; +// /** +// * Make all properties in T required +// */ +// type Required = { +// [P in keyof T]-?: T[P]; +// }; -interface ArrayBufferView { - /** - * The ArrayBuffer instance referenced by the array. - */ - buffer: ArrayBufferLike; +// /** +// * Make all properties in T readonly +// */ +// type Readonly = { +// readonly [P in keyof T]: T[P]; +// }; - /** - * The length in bytes of the array. - */ - byteLength: number; +// /** +// * From T, pick a set of properties whose keys are in the union K +// */ +// type Pick = { +// [P in K]: T[P]; +// }; - /** - * The offset in bytes of the array. - */ - byteOffset: number; -} +// /** +// * Construct a type with a set of properties K of type T +// */ +// type Record = { +// [P in K]: T; +// }; -interface DataView { - readonly buffer: ArrayBuffer; - readonly byteLength: number; - readonly byteOffset: number; - /** - * Gets the Float32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getFloat32(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Exclude from T those types that are assignable to U +// */ +// type Exclude = T extends U ? never : T; - /** - * Gets the Float64 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getFloat64(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Extract from T those types that are assignable to U +// */ +// type Extract = T extends U ? T : never; - /** - * Gets the Int8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getInt8(byteOffset: number): number; +// /** +// * Construct a type with the properties of T except for those in type K. +// */ +// type Omit = Pick>; - /** - * Gets the Int16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getInt16(byteOffset: number, littleEndian?: boolean): number; - /** - * Gets the Int32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getInt32(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Exclude null and undefined from T +// */ +// type NonNullable = T & {}; - /** - * Gets the Uint8 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - */ - getUint8(byteOffset: number): number; +// /** +// * Obtain the parameters of a function type in a tuple +// */ +// type Parameters any> = T extends (...args: infer P) => any ? P : never; - /** - * Gets the Uint16 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getUint16(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Obtain the parameters of a constructor function type in a tuple +// */ +// type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; - /** - * Gets the Uint32 value at the specified byte offset from the start of the view. There is - * no alignment constraint; multi-byte values may be fetched from any offset. - * @param byteOffset The place in the buffer at which the value should be retrieved. - * @param littleEndian If false or undefined, a big-endian value should be read. - */ - getUint32(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Obtain the return type of a function type +// */ +// type ReturnType any> = T extends (...args: any) => infer R ? R : any; - /** - * Stores an Float32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; +// /** +// * Obtain the return type of a constructor function type +// */ +// type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; - /** - * Stores an Float64 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; +// /** +// * Convert string literal type to uppercase +// */ +// type Uppercase = intrinsic; - /** - * Stores an Int8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setInt8(byteOffset: number, value: number): void; +// /** +// * Convert string literal type to lowercase +// */ +// type Lowercase = intrinsic; - /** - * Stores an Int16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; +// /** +// * Convert first character of string literal type to uppercase +// */ +// type Capitalize = intrinsic; - /** - * Stores an Int32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; +// /** +// * Convert first character of string literal type to lowercase +// */ +// type Uncapitalize = intrinsic; - /** - * Stores an Uint8 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - */ - setUint8(byteOffset: number, value: number): void; +// /** +// * Marker for contextual 'this' type +// */ +// interface ThisType { } - /** - * Stores an Uint16 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; +// /** +// * Represents a raw buffer of binary data, which is used to store data for the +// * different typed arrays. ArrayBuffers cannot be read from or written to directly, +// * but can be passed to a typed array or DataView Object to interpret the raw +// * buffer as needed. +// */ +// interface ArrayBuffer { +// /** +// * Read-only. The length of the ArrayBuffer (in bytes). +// */ +// readonly byteLength: number; - /** - * Stores an Uint32 value at the specified byte offset from the start of the view. - * @param byteOffset The place in the buffer at which the value should be set. - * @param value The value to set. - * @param littleEndian If false or undefined, a big-endian value should be written. - */ - setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -} +// /** +// * Returns a section of an ArrayBuffer. +// */ +// slice(begin: number, end?: number): ArrayBuffer; +// } -interface DataViewConstructor { - readonly prototype: DataView; - new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; -} -declare var DataView: DataViewConstructor; +// /** +// * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. +// */ +// interface ArrayBufferTypes { +// ArrayBuffer: ArrayBuffer; +// } +// type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; -/** - * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Int8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// interface ArrayBufferConstructor { +// readonly prototype: ArrayBuffer; +// new(byteLength: number): ArrayBuffer; +// isView(arg: any): arg is ArrayBufferView; +// } +// declare var ArrayBuffer: ArrayBufferConstructor; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// interface ArrayBufferView { +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// buffer: ArrayBufferLike; + +// /** +// * The length in bytes of the array. +// */ +// byteLength: number; + +// /** +// * The offset in bytes of the array. +// */ +// byteOffset: number; +// } + +// interface DataView { +// readonly buffer: ArrayBuffer; +// readonly byteLength: number; +// readonly byteOffset: number; +// /** +// * Gets the Float32 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getFloat32(byteOffset: number, littleEndian?: boolean): number; + +// /** +// * Gets the Float64 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getFloat64(byteOffset: number, littleEndian?: boolean): number; + +// /** +// * Gets the Int8 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// */ +// getInt8(byteOffset: number): number; + +// /** +// * Gets the Int16 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getInt16(byteOffset: number, littleEndian?: boolean): number; +// /** +// * Gets the Int32 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getInt32(byteOffset: number, littleEndian?: boolean): number; + +// /** +// * Gets the Uint8 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// */ +// getUint8(byteOffset: number): number; + +// /** +// * Gets the Uint16 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getUint16(byteOffset: number, littleEndian?: boolean): number; + +// /** +// * Gets the Uint32 value at the specified byte offset from the start of the view. There is +// * no alignment constraint; multi-byte values may be fetched from any offset. +// * @param byteOffset The place in the buffer at which the value should be retrieved. +// * @param littleEndian If false or undefined, a big-endian value should be read. +// */ +// getUint32(byteOffset: number, littleEndian?: boolean): number; + +// /** +// * Stores an Float32 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + +// /** +// * Stores an Float64 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + +// /** +// * Stores an Int8 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// */ +// setInt8(byteOffset: number, value: number): void; + +// /** +// * Stores an Int16 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + +// /** +// * Stores an Int32 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + +// /** +// * Stores an Uint8 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// */ +// setUint8(byteOffset: number, value: number): void; + +// /** +// * Stores an Uint16 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + +// /** +// * Stores an Uint32 value at the specified byte offset from the start of the view. +// * @param byteOffset The place in the buffer at which the value should be set. +// * @param value The value to set. +// * @param littleEndian If false or undefined, a big-endian value should be written. +// */ +// setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +// } - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// interface DataViewConstructor { +// readonly prototype: DataView; +// new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; +// } +// declare var DataView: DataViewConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested +// * number of bytes could not be allocated an exception is raised. +// */ +// interface Int8Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Int8Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Int8Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Int8Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Int8Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Int8Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Int8Array; +// /** +// * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Int8Array; - [index: number]: number; -} -interface Int8ArrayConstructor { - readonly prototype: Int8Array; - new(length: number): Int8Array; - new(array: ArrayLike | ArrayBufferLike): Int8Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int8Array; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Int8Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Int8Array; +// [index: number]: number; +// } +// interface Int8ArrayConstructor { +// readonly prototype: Int8Array; +// new(length: number): Int8Array; +// new(array: ArrayLike | ArrayBufferLike): Int8Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int8Array; -} -declare var Int8Array: Int8ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int8Array; -/** - * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// declare var Int8Array: Int8ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the +// * requested number of bytes could not be allocated an exception is raised. +// */ +// interface Uint8Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Uint8Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Uint8Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Uint8Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Uint8Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Uint8Array; +// /** +// * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Uint8Array; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Uint8ArrayConstructor { - readonly prototype: Uint8Array; - new(length: number): Uint8Array; - new(array: ArrayLike | ArrayBufferLike): Uint8Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Uint8Array; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8Array; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Uint8Array; +// interface Uint8ArrayConstructor { +// readonly prototype: Uint8Array; +// new(length: number): Uint8Array; +// new(array: ArrayLike | ArrayBufferLike): Uint8Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; -} -// declare var Uint8Array: Uint8ArrayConstructor; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint8Array; -/** - * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. - * If the requested number of bytes could not be allocated an exception is raised. - */ -interface Uint8ClampedArray { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// // declare var Uint8Array: Uint8ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. +// * If the requested number of bytes could not be allocated an exception is raised. +// */ +// interface Uint8ClampedArray { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Uint8ClampedArray; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Uint8ClampedArray; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Uint8ClampedArray; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Uint8ClampedArray; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Uint8ClampedArray; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Uint8ClampedArray; +// /** +// * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Uint8ClampedArray; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Uint8ClampedArrayConstructor { - readonly prototype: Uint8ClampedArray; - new(length: number): Uint8ClampedArray; - new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Uint8ClampedArray; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint8ClampedArray; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Uint8ClampedArray; +// interface Uint8ClampedArrayConstructor { +// readonly prototype: Uint8ClampedArray; +// new(length: number): Uint8ClampedArray; +// new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; -} -declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; -/** - * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint8ClampedArray; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint8ClampedArray; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; +// } +// declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the +// * requested number of bytes could not be allocated an exception is raised. +// */ +// interface Int16Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Int16Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Int16Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Int16Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Int16Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Int16Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Int16Array; +// /** +// * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Int16Array; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Int16ArrayConstructor { - readonly prototype: Int16Array; - new(length: number): Int16Array; - new(array: ArrayLike | ArrayBufferLike): Int16Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Int16Array; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int16Array; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Int16Array; +// interface Int16ArrayConstructor { +// readonly prototype: Int16Array; +// new(length: number): Int16Array; +// new(array: ArrayLike | ArrayBufferLike): Int16Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int16Array; -} -declare var Int16Array: Int16ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int16Array; -/** - * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint16Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// declare var Int16Array: Int16ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the +// * requested number of bytes could not be allocated an exception is raised. +// */ +// interface Uint16Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Uint16Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Uint16Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Uint16Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Uint16Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Uint16Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Uint16Array; +// /** +// * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Uint16Array; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Uint16ArrayConstructor { - readonly prototype: Uint16Array; - new(length: number): Uint16Array; - new(array: ArrayLike | ArrayBufferLike): Uint16Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Uint16Array; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint16Array; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Uint16Array; +// interface Uint16ArrayConstructor { +// readonly prototype: Uint16Array; +// new(length: number): Uint16Array; +// new(array: ArrayLike | ArrayBufferLike): Uint16Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint16Array; -} -declare var Uint16Array: Uint16ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint16Array; -/** - * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Int32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// declare var Uint16Array: Uint16ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the +// * requested number of bytes could not be allocated an exception is raised. +// */ +// interface Int32Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Int32Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Int32Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Int32Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Int32Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Int32Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Int32Array; +// /** +// * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Int32Array; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Int32ArrayConstructor { - readonly prototype: Int32Array; - new(length: number): Int32Array; - new(array: ArrayLike | ArrayBufferLike): Int32Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Int32Array; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Int32Array; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Int32Array; +// interface Int32ArrayConstructor { +// readonly prototype: Int32Array; +// new(length: number): Int32Array; +// new(array: ArrayLike | ArrayBufferLike): Int32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; -} -declare var Int32Array: Int32ArrayConstructor; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Int32Array; -/** - * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the - * requested number of bytes could not be allocated an exception is raised. - */ -interface Uint32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Int32Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// declare var Int32Array: Int32ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the +// * requested number of bytes could not be allocated an exception is raised. +// */ +// interface Uint32Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; - /** - * Reverses the elements in an Array. - */ - reverse(): Uint32Array; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Uint32Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Uint32Array; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Uint32Array; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Uint32Array; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Uint32Array; +// /** +// * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Uint32Array; - [index: number]: number; -} +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; -interface Uint32ArrayConstructor { - readonly prototype: Uint32Array; - new(length: number): Uint32Array; - new(array: ArrayLike | ArrayBufferLike): Uint32Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Uint32Array; - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Uint32Array; +// [index: number]: number; +// } - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Uint32Array; +// interface Uint32ArrayConstructor { +// readonly prototype: Uint32Array; +// new(length: number): Uint32Array; +// new(array: ArrayLike | ArrayBufferLike): Uint32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; -} -declare var Uint32Array: Uint32ArrayConstructor; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Uint32Array; -/** - * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number - * of bytes could not be allocated an exception is raised. - */ -interface Float32Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Uint32Array; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// } +// declare var Uint32Array: Uint32ArrayConstructor; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number +// * of bytes could not be allocated an exception is raised. +// */ +// interface Float32Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; + +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Reverses the elements in an Array. - */ - reverse(): Float32Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Float32Array; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Float32Array; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Float32Array; - /** - * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Float32Array; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; - /** - * Converts a number to a string by using the current locale. - */ - toLocaleString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** - * Returns a string representation of an array. - */ - toString(): string; +// /** +// * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Float32Array; - /** Returns the primitive value of the specified object. */ - valueOf(): Float32Array; +// /** +// * Converts a number to a string by using the current locale. +// */ +// toLocaleString(): string; - [index: number]: number; -} +// /** +// * Returns a string representation of an array. +// */ +// toString(): string; -interface Float32ArrayConstructor { - readonly prototype: Float32Array; - new(length: number): Float32Array; - new(array: ArrayLike | ArrayBufferLike): Float32Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Float32Array; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// [index: number]: number; +// } - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float32Array; +// interface Float32ArrayConstructor { +// readonly prototype: Float32Array; +// new(length: number): Float32Array; +// new(array: ArrayLike | ArrayBufferLike): Float32Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Float32Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Float32Array; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float32Array; -} -declare var Float32Array: Float32ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; -/** - * A typed array of 64-bit float values. The contents are initialized to 0. If the requested - * number of bytes could not be allocated an exception is raised. - */ -interface Float64Array { - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; - /** - * The ArrayBuffer instance referenced by the array. - */ - readonly buffer: ArrayBufferLike; +// } +// declare var Float32Array: Float32ArrayConstructor; - /** - * The length in bytes of the array. - */ - readonly byteLength: number; +// /** +// * A typed array of 64-bit float values. The contents are initialized to 0. If the requested +// * number of bytes could not be allocated an exception is raised. +// */ +// interface Float64Array { +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * The offset in bytes of the array. - */ - readonly byteOffset: number; +// /** +// * The ArrayBuffer instance referenced by the array. +// */ +// readonly buffer: ArrayBufferLike; - /** - * Returns the this object after copying a section of the array identified by start and end - * to the same array starting at position target - * @param target If target is negative, it is treated as length+target where length is the - * length of the array. - * @param start If start is negative, it is treated as length+start. If end is negative, it - * is treated as length+end. If start is omitted, `0` is used. - * @param end If not specified, length of the this object is used as its default value. - */ - copyWithin(target: number, start?: number, end?: number): this; +// /** +// * The length in bytes of the array. +// */ +// readonly byteLength: number; - /** - * Determines whether all the members of an array satisfy the specified test. - * @param predicate A function that accepts up to three arguments. The every method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value false, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; +// /** +// * The offset in bytes of the array. +// */ +// readonly byteOffset: number; - /** - * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array - * @param value value to fill array section with - * @param start index to start filling the array at. If start is negative, it is treated as - * length+start where length is the length of the array. - * @param end index to stop filling the array at. If end is negative, it is treated as - * length+end. - */ - fill(value: number, start?: number, end?: number): this; +// /** +// * Returns the this object after copying a section of the array identified by start and end +// * to the same array starting at position target +// * @param target If target is negative, it is treated as length+target where length is the +// * length of the array. +// * @param start If start is negative, it is treated as length+start. If end is negative, it +// * is treated as length+end. If start is omitted, `0` is used. +// * @param end If not specified, length of the this object is used as its default value. +// */ +// copyWithin(target: number, start?: number, end?: number): this; - /** - * Returns the elements of an array that meet the condition specified in a callback function. - * @param predicate A function that accepts up to three arguments. The filter method calls - * the predicate function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; +// /** +// * Determines whether all the members of an array satisfy the specified test. +// * @param predicate A function that accepts up to three arguments. The every method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value false, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; - /** - * Returns the value of the first element in the array where predicate is true, and undefined - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, find - * immediately returns that element value. Otherwise, find returns undefined. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; +// /** +// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array +// * @param value value to fill array section with +// * @param start index to start filling the array at. If start is negative, it is treated as +// * length+start where length is the length of the array. +// * @param end index to stop filling the array at. If end is negative, it is treated as +// * length+end. +// */ +// fill(value: number, start?: number, end?: number): this; - /** - * Returns the index of the first element in the array where predicate is true, and -1 - * otherwise. - * @param predicate find calls predicate once for each element of the array, in ascending - * order, until it finds one where predicate returns true. If such an element is found, - * findIndex immediately returns that element index. Otherwise, findIndex returns -1. - * @param thisArg If provided, it will be used as the this value for each invocation of - * predicate. If it is not provided, undefined is used instead. - */ - findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; +// /** +// * Returns the elements of an array that meet the condition specified in a callback function. +// * @param predicate A function that accepts up to three arguments. The filter method calls +// * the predicate function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; - /** - * Performs the specified action for each element in an array. - * @param callbackfn A function that accepts up to three arguments. forEach calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; +// /** +// * Returns the value of the first element in the array where predicate is true, and undefined +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, find +// * immediately returns that element value. Otherwise, find returns undefined. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; - /** - * Returns the index of the first occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - indexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the index of the first element in the array where predicate is true, and -1 +// * otherwise. +// * @param predicate find calls predicate once for each element of the array, in ascending +// * order, until it finds one where predicate returns true. If such an element is found, +// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. +// * @param thisArg If provided, it will be used as the this value for each invocation of +// * predicate. If it is not provided, undefined is used instead. +// */ +// findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; - /** - * Adds all the elements of an array separated by the specified separator string. - * @param separator A string used to separate one element of an array from the next in the - * resulting String. If omitted, the array elements are separated with a comma. - */ - join(separator?: string): string; +// /** +// * Performs the specified action for each element in an array. +// * @param callbackfn A function that accepts up to three arguments. forEach calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; - /** - * Returns the index of the last occurrence of a value in an array. - * @param searchElement The value to locate in the array. - * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the - * search starts at index 0. - */ - lastIndexOf(searchElement: number, fromIndex?: number): number; +// /** +// * Returns the index of the first occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// indexOf(searchElement: number, fromIndex?: number): number; - /** - * The length of the array. - */ - readonly length: number; +// /** +// * Adds all the elements of an array separated by the specified separator string. +// * @param separator A string used to separate one element of an array from the next in the +// * resulting String. If omitted, the array elements are separated with a comma. +// */ +// join(separator?: string): string; - /** - * Calls a defined callback function on each element of an array, and returns an array that - * contains the results. - * @param callbackfn A function that accepts up to three arguments. The map method calls the - * callbackfn function one time for each element in the array. - * @param thisArg An object to which the this keyword can refer in the callbackfn function. - * If thisArg is omitted, undefined is used as the this value. - */ - map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; +// /** +// * Returns the index of the last occurrence of a value in an array. +// * @param searchElement The value to locate in the array. +// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the +// * search starts at index 0. +// */ +// lastIndexOf(searchElement: number, fromIndex?: number): number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; - reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; +// /** +// * The length of the array. +// */ +// readonly length: number; - /** - * Calls the specified callback function for all the elements in an array. The return value of - * the callback function is the accumulated result, and is provided as an argument in the next - * call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduce method calls the - * callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; +// /** +// * Calls a defined callback function on each element of an array, and returns an array that +// * contains the results. +// * @param callbackfn A function that accepts up to three arguments. The map method calls the +// * callbackfn function one time for each element in the array. +// * @param thisArg An object to which the this keyword can refer in the callbackfn function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an - * argument instead of an array value. - */ - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; - reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; +// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; - /** - * Calls the specified callback function for all the elements in an array, in descending order. - * The return value of the callback function is the accumulated result, and is provided as an - * argument in the next call to the callback function. - * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls - * the callbackfn function one time for each element in the array. - * @param initialValue If initialValue is specified, it is used as the initial value to start - * the accumulation. The first call to the callbackfn function provides this value as an argument - * instead of an array value. - */ - reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; +// /** +// * Calls the specified callback function for all the elements in an array. The return value of +// * the callback function is the accumulated result, and is provided as an argument in the next +// * call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the +// * callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Reverses the elements in an Array. - */ - reverse(): Float64Array; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an +// * argument instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; +// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; - /** - * Sets a value or an array of values. - * @param array A typed or untyped array of values to set. - * @param offset The index in the current array at which the values are to be written. - */ - set(array: ArrayLike, offset?: number): void; +// /** +// * Calls the specified callback function for all the elements in an array, in descending order. +// * The return value of the callback function is the accumulated result, and is provided as an +// * argument in the next call to the callback function. +// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls +// * the callbackfn function one time for each element in the array. +// * @param initialValue If initialValue is specified, it is used as the initial value to start +// * the accumulation. The first call to the callbackfn function provides this value as an argument +// * instead of an array value. +// */ +// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; - /** - * Returns a section of an array. - * @param start The beginning of the specified portion of the array. - * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. - */ - slice(start?: number, end?: number): Float64Array; +// /** +// * Reverses the elements in an Array. +// */ +// reverse(): Float64Array; - /** - * Determines whether the specified callback function returns true for any element of an array. - * @param predicate A function that accepts up to three arguments. The some method calls - * the predicate function for each element in the array until the predicate returns a value - * which is coercible to the Boolean value true, or until the end of the array. - * @param thisArg An object to which the this keyword can refer in the predicate function. - * If thisArg is omitted, undefined is used as the this value. - */ - some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; +// /** +// * Sets a value or an array of values. +// * @param array A typed or untyped array of values to set. +// * @param offset The index in the current array at which the values are to be written. +// */ +// set(array: ArrayLike, offset?: number): void; - /** - * Sorts an array. - * @param compareFn Function used to determine the order of the elements. It is expected to return - * a negative value if first argument is less than second argument, zero if they're equal and a positive - * value otherwise. If omitted, the elements are sorted in ascending order. - * ```ts - * [11,2,22,1].sort((a, b) => a - b) - * ``` - */ - sort(compareFn?: (a: number, b: number) => number): this; +// /** +// * Returns a section of an array. +// * @param start The beginning of the specified portion of the array. +// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. +// */ +// slice(start?: number, end?: number): Float64Array; - /** - * at begin, inclusive, up to end, exclusive. - * @param begin The index of the beginning of the array. - * @param end The index of the end of the array. - */ - subarray(begin?: number, end?: number): Float64Array; +// /** +// * Determines whether the specified callback function returns true for any element of an array. +// * @param predicate A function that accepts up to three arguments. The some method calls +// * the predicate function for each element in the array until the predicate returns a value +// * which is coercible to the Boolean value true, or until the end of the array. +// * @param thisArg An object to which the this keyword can refer in the predicate function. +// * If thisArg is omitted, undefined is used as the this value. +// */ +// some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; - toString(): string; +// /** +// * Sorts an array. +// * @param compareFn Function used to determine the order of the elements. It is expected to return +// * a negative value if first argument is less than second argument, zero if they're equal and a positive +// * value otherwise. If omitted, the elements are sorted in ascending order. +// * ```ts +// * [11,2,22,1].sort((a, b) => a - b) +// * ``` +// */ +// sort(compareFn?: (a: number, b: number) => number): this; - /** Returns the primitive value of the specified object. */ - valueOf(): Float64Array; +// /** +// * at begin, inclusive, up to end, exclusive. +// * @param begin The index of the beginning of the array. +// * @param end The index of the end of the array. +// */ +// subarray(begin?: number, end?: number): Float64Array; - [index: number]: number; -} +// toString(): string; -interface Float64ArrayConstructor { - readonly prototype: Float64Array; - new(length: number): Float64Array; - new(array: ArrayLike | ArrayBufferLike): Float64Array; - new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; +// /** Returns the primitive value of the specified object. */ +// valueOf(): Float64Array; - /** - * The size in bytes of each element in the array. - */ - readonly BYTES_PER_ELEMENT: number; +// [index: number]: number; +// } - /** - * Returns a new array from a set of elements. - * @param items A set of elements to include in the new array object. - */ - of(...items: number[]): Float64Array; +// interface Float64ArrayConstructor { +// readonly prototype: Float64Array; +// new(length: number): Float64Array; +// new(array: ArrayLike | ArrayBufferLike): Float64Array; +// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - */ - from(arrayLike: ArrayLike): Float64Array; +// /** +// * The size in bytes of each element in the array. +// */ +// readonly BYTES_PER_ELEMENT: number; - /** - * Creates an array from an array-like or iterable object. - * @param arrayLike An array-like or iterable object to convert to an array. - * @param mapfn A mapping function to call on every element of the array. - * @param thisArg Value of 'this' used to invoke the mapfn. - */ - from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; +// /** +// * Returns a new array from a set of elements. +// * @param items A set of elements to include in the new array object. +// */ +// of(...items: number[]): Float64Array; -} -declare var Float64Array: Float64ArrayConstructor; +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// */ +// from(arrayLike: ArrayLike): Float64Array; -///////////////////////////// -/// ECMAScript Internationalization API -///////////////////////////// +// /** +// * Creates an array from an array-like or iterable object. +// * @param arrayLike An array-like or iterable object to convert to an array. +// * @param mapfn A mapping function to call on every element of the array. +// * @param thisArg Value of 'this' used to invoke the mapfn. +// */ +// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; -declare namespace Intl { - interface CollatorOptions { - usage?: string | undefined; - localeMatcher?: string | undefined; - numeric?: boolean | undefined; - caseFirst?: string | undefined; - sensitivity?: string | undefined; - ignorePunctuation?: boolean | undefined; - } - - interface ResolvedCollatorOptions { - locale: string; - usage: string; - sensitivity: string; - ignorePunctuation: boolean; - collation: string; - caseFirst: string; - numeric: boolean; - } - - interface Collator { - compare(x: string, y: string): number; - resolvedOptions(): ResolvedCollatorOptions; - } - var Collator: { - new(locales?: string | string[], options?: CollatorOptions): Collator; - (locales?: string | string[], options?: CollatorOptions): Collator; - supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; - }; - - interface NumberFormatOptions { - localeMatcher?: string | undefined; - style?: string | undefined; - currency?: string | undefined; - currencySign?: string | undefined; - useGrouping?: boolean | undefined; - minimumIntegerDigits?: number | undefined; - minimumFractionDigits?: number | undefined; - maximumFractionDigits?: number | undefined; - minimumSignificantDigits?: number | undefined; - maximumSignificantDigits?: number | undefined; - } - - interface ResolvedNumberFormatOptions { - locale: string; - numberingSystem: string; - style: string; - currency?: string; - minimumIntegerDigits: number; - minimumFractionDigits: number; - maximumFractionDigits: number; - minimumSignificantDigits?: number; - maximumSignificantDigits?: number; - useGrouping: boolean; - } - - interface NumberFormat { - format(value: number): string; - resolvedOptions(): ResolvedNumberFormatOptions; - } - var NumberFormat: { - new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; - supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; - readonly prototype: NumberFormat; - }; - - interface DateTimeFormatOptions { - localeMatcher?: "best fit" | "lookup" | undefined; - weekday?: "long" | "short" | "narrow" | undefined; - era?: "long" | "short" | "narrow" | undefined; - year?: "numeric" | "2-digit" | undefined; - month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; - day?: "numeric" | "2-digit" | undefined; - hour?: "numeric" | "2-digit" | undefined; - minute?: "numeric" | "2-digit" | undefined; - second?: "numeric" | "2-digit" | undefined; - timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; - formatMatcher?: "best fit" | "basic" | undefined; - hour12?: boolean | undefined; - timeZone?: string | undefined; - } - - interface ResolvedDateTimeFormatOptions { - locale: string; - calendar: string; - numberingSystem: string; - timeZone: string; - hour12?: boolean; - weekday?: string; - era?: string; - year?: string; - month?: string; - day?: string; - hour?: string; - minute?: string; - second?: string; - timeZoneName?: string; - } - - interface DateTimeFormat { - format(date?: Date | number): string; - resolvedOptions(): ResolvedDateTimeFormatOptions; - } - var DateTimeFormat: { - new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; - supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; - readonly prototype: DateTimeFormat; - }; -} +// } +// declare var Float64Array: Float64ArrayConstructor; + +// ///////////////////////////// +// /// ECMAScript Internationalization API +// ///////////////////////////// + +// declare namespace Intl { +// interface CollatorOptions { +// usage?: string | undefined; +// localeMatcher?: string | undefined; +// numeric?: boolean | undefined; +// caseFirst?: string | undefined; +// sensitivity?: string | undefined; +// ignorePunctuation?: boolean | undefined; +// } + +// interface ResolvedCollatorOptions { +// locale: string; +// usage: string; +// sensitivity: string; +// ignorePunctuation: boolean; +// collation: string; +// caseFirst: string; +// numeric: boolean; +// } + +// interface Collator { +// compare(x: string, y: string): number; +// resolvedOptions(): ResolvedCollatorOptions; +// } +// var Collator: { +// new(locales?: string | string[], options?: CollatorOptions): Collator; +// (locales?: string | string[], options?: CollatorOptions): Collator; +// supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; +// }; + +// interface NumberFormatOptions { +// localeMatcher?: string | undefined; +// style?: string | undefined; +// currency?: string | undefined; +// currencySign?: string | undefined; +// useGrouping?: boolean | undefined; +// minimumIntegerDigits?: number | undefined; +// minimumFractionDigits?: number | undefined; +// maximumFractionDigits?: number | undefined; +// minimumSignificantDigits?: number | undefined; +// maximumSignificantDigits?: number | undefined; +// } + +// interface ResolvedNumberFormatOptions { +// locale: string; +// numberingSystem: string; +// style: string; +// currency?: string; +// minimumIntegerDigits: number; +// minimumFractionDigits: number; +// maximumFractionDigits: number; +// minimumSignificantDigits?: number; +// maximumSignificantDigits?: number; +// useGrouping: boolean; +// } + +// interface NumberFormat { +// format(value: number): string; +// resolvedOptions(): ResolvedNumberFormatOptions; +// } +// var NumberFormat: { +// new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; +// (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; +// supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; +// readonly prototype: NumberFormat; +// }; + +// interface DateTimeFormatOptions { +// localeMatcher?: "best fit" | "lookup" | undefined; +// weekday?: "long" | "short" | "narrow" | undefined; +// era?: "long" | "short" | "narrow" | undefined; +// year?: "numeric" | "2-digit" | undefined; +// month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; +// day?: "numeric" | "2-digit" | undefined; +// hour?: "numeric" | "2-digit" | undefined; +// minute?: "numeric" | "2-digit" | undefined; +// second?: "numeric" | "2-digit" | undefined; +// timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; +// formatMatcher?: "best fit" | "basic" | undefined; +// hour12?: boolean | undefined; +// timeZone?: string | undefined; +// } + +// interface ResolvedDateTimeFormatOptions { +// locale: string; +// calendar: string; +// numberingSystem: string; +// timeZone: string; +// hour12?: boolean; +// weekday?: string; +// era?: string; +// year?: string; +// month?: string; +// day?: string; +// hour?: string; +// minute?: string; +// second?: string; +// timeZoneName?: string; +// } + +// interface DateTimeFormat { +// format(date?: Date | number): string; +// resolvedOptions(): ResolvedDateTimeFormatOptions; +// } +// var DateTimeFormat: { +// new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; +// (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; +// supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; +// readonly prototype: DateTimeFormat; +// }; +// } -interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -} +// interface String { +// /** +// * Determines whether two strings are equivalent in the current or specified locale. +// * @param that String to compare to target string +// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. +// * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. +// */ +// localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +// } -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -} +// interface Number { +// /** +// * Converts a number to a string by using the current or specified locale. +// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. +// * @param options An object that contains one or more properties that specify comparison options. +// */ +// toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +// } -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +// interface Date { +// /** +// * Converts a date and time to a string by using the current or specified locale. +// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. +// * @param options An object that contains one or more properties that specify comparison options. +// */ +// toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +// /** +// * Converts a date to a string by using the current or specified locale. +// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. +// * @param options An object that contains one or more properties that specify comparison options. +// */ +// toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} +// /** +// * Converts a time to a string by using the current or specified locale. +// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. +// * @param options An object that contains one or more properties that specify comparison options. +// */ +// toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +// } From 4cda1316003b01778cec570ac9247ba669b69fa0 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 13 Jun 2023 17:20:28 +0800 Subject: [PATCH 090/202] WIP: Fix node_modules resolve names --- driver/js/src/main/scala/driver/Driver.scala | 3 ++ .../js/src/main/scala/driver/FileInfo.scala | 2 +- .../test/projects/mlscript/MyPartialOrder.mls | 7 +++++ driver/js/src/test/projects/package-lock.json | 30 ------------------- driver/js/src/test/projects/package.json | 5 ---- .../test/scala/driver/DriverDiffTests.scala | 1 + package-lock.json | 11 +++++++ package.json | 5 ++-- .../main/scala/ts2mls/TSCompilerInfo.scala | 5 ++-- 9 files changed, 29 insertions(+), 40 deletions(-) create mode 100644 driver/js/src/test/projects/mlscript/MyPartialOrder.mls delete mode 100644 driver/js/src/test/projects/package-lock.json delete mode 100644 driver/js/src/test/projects/package.json diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 372483f4b..168811666 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -72,6 +72,9 @@ class Driver(options: DriverOptions) { case err: Diagnostic => report(err) false + case _ : Throwable => + report("unexpected error") + false } def genPackageJson(): Unit = diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 831ad7432..a584761da 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -21,7 +21,7 @@ final case class FileInfo( // full filename (related to compiler path, or in node_modules) lazy val filename: String = if (!isNodeModule) normalize(s"./$workDir/$localFilename") - else moduleName + else localFilename val interfaceFilename: String = // interface filename (related to output directory) relatedPath.fold(s"$interfaceDir/node_modules/$moduleName/$moduleName.mlsi")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") diff --git a/driver/js/src/test/projects/mlscript/MyPartialOrder.mls b/driver/js/src/test/projects/mlscript/MyPartialOrder.mls new file mode 100644 index 000000000..56e1f098c --- /dev/null +++ b/driver/js/src/test/projects/mlscript/MyPartialOrder.mls @@ -0,0 +1,7 @@ +import "fp-ts/MeetSemilattice" + +class MyPartialOrder extends BoundedMeetSemilattice.BoundedMeetSemilattice { + // TODO: implement +} + +let order = new MyPartialOrder() diff --git a/driver/js/src/test/projects/package-lock.json b/driver/js/src/test/projects/package-lock.json deleted file mode 100644 index 7d0ea5f35..000000000 --- a/driver/js/src/test/projects/package-lock.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "ts", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "dependencies": { - "json5": "^2.2.3" - } - }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - } - }, - "dependencies": { - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" - } - } -} diff --git a/driver/js/src/test/projects/package.json b/driver/js/src/test/projects/package.json deleted file mode 100644 index ad0240519..000000000 --- a/driver/js/src/test/projects/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "json5": "^2.2.3" - } -} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index d87c7c0f4..cd523fb6a 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -71,6 +71,7 @@ object DriverDiffTests { entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), + entry("MyPartialOrder", Some("./tsconfig.json"), true), // TODO: type traits in modules ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), diff --git a/package-lock.json b/package-lock.json index 44596f1b5..5cad2ba8d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,10 +5,16 @@ "packages": { "": { "dependencies": { + "fp-ts": "^2.16.0", "json5": "^2.2.3", "typescript": "^4.7.4" } }, + "node_modules/fp-ts": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", + "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -34,6 +40,11 @@ } }, "dependencies": { + "fp-ts": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", + "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" + }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", diff --git a/package.json b/package.json index e8c64f3f1..b6c91f883 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "dependencies": { - "typescript": "^4.7.4", - "json5": "^2.2.3" + "fp-ts": "^2.16.0", + "json5": "^2.2.3", + "typescript": "^4.7.4" } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index f9aff9e88..95d3e0c15 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -18,6 +18,7 @@ object TypeScript { private val ts: js.Dynamic = load("typescript") private val json: js.Dynamic = load("json5") + private val sys: js.Dynamic = ts.sys // tsconfig.json def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { @@ -26,7 +27,7 @@ object TypeScript { json.parse(content) }) val name = filename.getOrElse("tsconfig.json") - ts.parseJsonConfigFileContent(config, ts.sys, basePath, null, name) + ts.parseJsonConfigFileContent(config, sys, basePath, null, name) } // package.json @@ -36,7 +37,7 @@ object TypeScript { } def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): Option[String] = { - val res = ts.resolveModuleName(importName, containingName, config, ts.sys) + val res = ts.resolveModuleName(importName, containingName, config, sys) if (!IsUndefined(res.resolvedModule) && !IsUndefined(res.resolvedModule.resolvedFileName)) Some(res.resolvedModule.resolvedFileName.toString()) else None From 46217f777fa2db0d56777a560c47decd34bcb9e2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 14 Jun 2023 16:00:01 +0800 Subject: [PATCH 091/202] WIP: Fix node_module generated path and refactor code --- .gitignore | 1 + driver/js/src/main/scala/driver/Driver.scala | 8 +-- .../js/src/main/scala/driver/FileInfo.scala | 13 +++-- .../.interfaces/mlscript/Output2.mlsi | 4 +- .../fp-ts/BoundedMeetSemilattice.mlsi | 6 ++ .../node_modules/fp-ts/MeetSemilattice.mlsi | 5 ++ .../.interfaces/node_modules/json5/json5.mlsi | 6 ++ .../.interfaces/node_modules/json5/parse.mlsi | 3 + .../node_modules/json5/stringify.mlsi | 4 ++ .../test/projects/mlscript/MyPartialOrder.mls | 4 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../main/scala/ts2mls/TSModuleResolver.scala | 7 ++- .../js/src/main/scala/ts2mls/TSModules.scala | 17 +++--- .../js/src/main/scala/ts2mls/TSProgram.scala | 56 +++++++------------ .../src/main/scala/ts2mls/TSSourceFile.scala | 11 ++-- ts2mls/js/src/test/diff/Namespace.mlsi | 2 + .../scala/ts2mls/TSTypeGenerationTests.scala | 3 +- ts2mls/js/src/test/typescript/Namespace.ts | 15 +++-- 18 files changed, 91 insertions(+), 76 deletions(-) create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi diff --git a/.gitignore b/.gitignore index 4a989b4c7..e4c387bfa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ project/Dependencies.scala project/metals.sbt **.worksheet.sc .DS_Store +!driver/js/src/test/projects/.interfaces/node_modules \ No newline at end of file diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 168811666..6d14bc65e 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -72,8 +72,8 @@ class Driver(options: DriverOptions) { case err: Diagnostic => report(err) false - case _ : Throwable => - report("unexpected error") + case t : Throwable => + report(s"unexpected error: ${t.toString()}") false } @@ -179,8 +179,8 @@ class Driver(options: DriverOptions) { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript val tsprog = - TSProgram(if (!file.isNodeModule) file.localFilename else file.filename, file.workDir, true, options.tsconfig) - return tsprog.generate(s"${file.workDir}/${file.interfaceDir}") + TSProgram(file.localFilename, file.workDir, true, options.tsconfig) + return tsprog.generate(mlsiFile) } parseAndRun(file.filename, { case (definitions, _, imports, _) => { diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index a584761da..193fcdfa6 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -1,6 +1,6 @@ package driver -import ts2mls.{TSModuleResolver, TypeScript} +import ts2mls.{TSModuleResolver, TypeScript, TSImport} final case class FileInfo( workDir: String, // work directory (related to compiler path) @@ -24,19 +24,20 @@ final case class FileInfo( else localFilename val interfaceFilename: String = // interface filename (related to output directory) - relatedPath.fold(s"$interfaceDir/node_modules/$moduleName/$moduleName.mlsi")(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") + relatedPath.fold( + s"$interfaceDir/${TSImport.createInterfaceForNode(localFilename)}" + )(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") val jsFilename: String = relatedPath.fold(moduleName)(path => normalize(s"$path/$moduleName.js")) - val importPath: String = - relatedPath.fold(moduleName)(path => s"./${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") - def `import`(path: String): FileInfo = if (isLocal(path)) relatedPath match { case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) - case _ => FileInfo(workDir, s"./node_modules/$moduleName/$path", interfaceDir) + case _ => + val currentPath = TSModuleResolver.dirname(TSImport.createInterfaceForNode(localFilename)) + FileInfo(workDir, s"./$currentPath/$path", interfaceDir) } else FileInfo(workDir, path, interfaceDir) } diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi index 1460aae42..0d552a5e7 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -1,6 +1,6 @@ import "json5.mlsi" declare module Output2() { - fun createConfig: (path: Str,) -> nothing - let config: nothing + fun createConfig: (path: Str,) -> error + let config: error undefined } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi new file mode 100644 index 000000000..06a5da8b2 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi @@ -0,0 +1,6 @@ +import "./MeetSemilattice.mlsi" +export declare module BoundedMeetSemilattice { + export declare trait BoundedMeetSemilattice extends MeetSemilattice { + val one: A + } +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi new file mode 100644 index 000000000..5a81175ab --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi @@ -0,0 +1,5 @@ +export declare module MeetSemilattice { + export declare trait MeetSemilattice { + fun meet(x: A, y: A): A + } +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi new file mode 100644 index 000000000..17f6237d8 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi @@ -0,0 +1,6 @@ +import "./stringify.mlsi" +import "./parse.mlsi" +export declare module index { + export val parse = parse.parse + export val stringify = stringify.stringify +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi new file mode 100644 index 000000000..1c44eedba --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi @@ -0,0 +1,3 @@ +export declare module parse { + fun parse(text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi new file mode 100644 index 000000000..4ba65a749 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi @@ -0,0 +1,4 @@ +export declare module stringify { + type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} + fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) +} diff --git a/driver/js/src/test/projects/mlscript/MyPartialOrder.mls b/driver/js/src/test/projects/mlscript/MyPartialOrder.mls index 56e1f098c..da4b31214 100644 --- a/driver/js/src/test/projects/mlscript/MyPartialOrder.mls +++ b/driver/js/src/test/projects/mlscript/MyPartialOrder.mls @@ -1,6 +1,6 @@ -import "fp-ts/MeetSemilattice" +import "fp-ts/BoundedMeetSemilattice" -class MyPartialOrder extends BoundedMeetSemilattice.BoundedMeetSemilattice { +class MyPartialOrder extends BoundedMeetSemilattice.BoundedMeetSemilattice { // TODO: implement } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index cd523fb6a..8070f41d8 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -69,7 +69,7 @@ object DriverDiffTests { entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json")), + entry("Output2", Some("./tsconfig.json"), true), // TODO: ??? entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), true), // TODO: type traits in modules ts2mlsEntry("Array"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala index c321ae9cb..69dcff704 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala @@ -15,8 +15,9 @@ object TSModuleResolver { def normalize(path: String): String = np.normalize(path).toString() def relative(from: String, to: String) = np.relative(from, to).toString() - def extname(path: String) = np.extname(path).toString() + def extname(path: String) = + if (path.endsWith(".d.ts")) ".d.ts" + else np.extname(path).toString() def basename(filename: String) = - if (filename.contains(".d.ts")) np.basename(filename, ".d.ts").toString() - else np.basename(filename, extname(filename)).toString() + np.basename(filename, extname(filename)).toString() } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 418e78e5a..c688acf7f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -10,11 +10,11 @@ trait TSImport { self => val filename: String def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(filename, _) => Some(s"${TSImport.getModuleName(filename, false)}.$name") + case TSFullImport(filename, _) => Some(s"${TSModuleResolver.basename(filename)}.$name") case TSSingleImport(filename, items) => items.collect { case (originalName, _) if (originalName === name) => - s"${TSImport.getModuleName(filename, false)}.$name" + s"${TSModuleResolver.basename(filename)}.$name" }.headOption } @@ -36,12 +36,13 @@ trait TSImport { self => } object TSImport { - def getModuleName(filename: String, requirePrefix: Boolean): String = - if (filename.endsWith(".d") || filename.endsWith(".ts") || filename.endsWith(".mls") || filename.endsWith(".mlsi")) - getModuleName(filename.substring(filename.lastIndexOf('/') + 1, filename.lastIndexOf('.')), requirePrefix) - else if (!requirePrefix) - filename.substring(filename.lastIndexOf('/') + 1) - else filename + def createInterfaceForNode(path: String): String = { + val moduleName = TSModuleResolver.basename(path) + val topLevelModule = + if (path.contains("/")) path.substring(0, path.indexOf("/")) + else moduleName + s"node_modules/$topLevelModule/$moduleName.mlsi" + } } // import * as alias from "filename" diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 34a6c8a37..3f4532207 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -24,71 +24,57 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t private implicit val checker = TSTypeChecker(program.getTypeChecker()) - private def resolveTarget(filename: String) = { - val moduleName = TSImport.getModuleName(filename, false) - Option.when(!TSModuleResolver.isLocal(filename))(s"node_modules/$moduleName/$moduleName.mlsi") - } + import TSModuleResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate(targetPath: String): Boolean = - generate(TSModuleResolver.resolve(fullname), targetPath, resolveTarget(filename))(Nil) + def generate(outputFilename: String): Boolean = + generate(resolve(fullname), outputFilename)(Nil) - private def generate(filename: String, targetPath: String, outputOverride: Option[String])(implicit stack: List[String]): Boolean = { - if (filename.endsWith(".js")) return false // if users need to reuse js libs, they need to wrap them with ts signatures. - + private def generate(filename: String, outputFilename: String)(implicit stack: List[String]): Boolean = { val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList cache.addOne(filename, globalNamespace) - val relatedPath = TSModuleResolver.relative(workDir, TSModuleResolver.dirname(filename)) + val relatedPath = relative(workDir, dirname(filename)) - def resolve(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") + def `import`(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") - val (moduleName, outputFilename) = outputOverride match { - case Some(output) => (TSImport.getModuleName(output, false), output) - case _ => - val moduleName = TSImport.getModuleName(filename, false) - (moduleName, s"$relatedPath/$moduleName.mlsi") - } + val moduleName = basename(filename) val (cycleList, otherList) = - importList.partition(imp => stack.contains(resolve(imp.filename))) + importList.partition(imp => stack.contains(`import`(imp.filename))) - otherList.foreach(imp => { - generate(resolve(imp.filename), targetPath, outputOverride match { - case Some(filename) => - val moduleName = TSImport.getModuleName(imp.filename, false) - val dir = TSModuleResolver.dirname(filename) - val rel = TSModuleResolver.dirname(imp.filename) - Some(TSModuleResolver.normalize(s"$dir/$rel/$moduleName.mlsi")) - case _ => resolveTarget(imp.filename) - })(filename :: stack) - }) + otherList.foreach(imp => + generate(`import`(imp.filename), + if (isLocal(imp.filename)) normalize(s"${dirname(outputFilename)}/${basename(imp.filename)}.mlsi") + else TSImport.createInterfaceForNode(imp.filename) + )(filename :: stack) + ) - var writer = JSWriter(s"$targetPath/$outputFilename") + var writer = JSWriter(outputFilename) val imported = new HashSet[String]() otherList.foreach(imp => { - val name = TSImport.getModuleName(imp.filename, true) - if (!imported(name) && !resolve(imp.filename).endsWith(".js")) { + val name = imp.filename.replace(extname(imp.filename), "") + if (!imported(name)) { imported += name writer.writeln(s"""import "$name.mlsi"""") } }) cycleList.foreach(imp => { - writer.writeln(s"declare module ${TSImport.getModuleName(imp.filename, false)} {") - cache(resolve(imp.filename)).generate(writer, " ") + writer.writeln(s"declare module ${basename(imp.filename)} {") + cache(`import`(imp.filename)).generate(writer, " ") writer.writeln("}") }) reExportList.foreach { case TSReExport(alias, imp, memberName) => - val absName = resolve(imp) + val absName = `import`(imp) if (!cache.contains(absName)) throw new AssertionError(s"unexpected re-export from ${imp}") else { val ns = cache(absName) - val moduleName = TSImport.getModuleName(absName, false) + val moduleName = basename(absName) memberName.fold( globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true) )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true))) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 9b743faeb..139bb0392 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -47,11 +47,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def parseRequire(req: TSNodeObject): Unit = { val localName = req.moduleReference.expression.text - val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config) match { - case Some(name) => name - case _ => throw new AssertionError(s"unexpected required module $localName") - } - val moduleName = TSImport.getModuleName(fullname, false) + val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config).getOrElse( + throw new AssertionError(s"unexpected required module $localName") + ) + val moduleName = TSModuleResolver.basename(fullname) val varName = req.name.escapedText val imp = TSSingleImport(localName, List((varName, None))) importList.add(fullname, imp) @@ -196,7 +195,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): List[TSFunctionType] = { val res = getObjectType(node.returnType) val tv = getTypeParameters(node) - def eraseVarParam(tp: TSType, erase: Boolean) = tp match { + def eraseVarParam(tp: TSType, erase: Boolean) = tp match { // TODO: support ... soon case TSArrayType(eleType) if (erase) => eleType case _ => tp } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index da3c4725c..d67cff1ef 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -25,4 +25,6 @@ export declare module Namespace { export module N2 { } } + fun f1(x: N1.C): N1.C + fun f2(x: AA.C): AA.C } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index bedbc4bad..bb81057fa 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -2,6 +2,7 @@ package ts2mls import org.scalatest.funsuite.AnyFunSuite import scala.collection.immutable +import TSModuleResolver.basename class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ @@ -13,7 +14,7 @@ class TSTypeGenerationTest extends AnyFunSuite { !directlyImportedSet.contains(filename), None ) - program.generate("ts2mls/js/src/test/diff") + program.generate(s"ts2mls/js/src/test/diff/${basename(filename)}.mlsi") }) } diff --git a/ts2mls/js/src/test/typescript/Namespace.ts b/ts2mls/js/src/test/typescript/Namespace.ts index f7cf5bc75..ab998336a 100644 --- a/ts2mls/js/src/test/typescript/Namespace.ts +++ b/ts2mls/js/src/test/typescript/Namespace.ts @@ -44,11 +44,10 @@ namespace AA { export namespace N2 {} } -// TODO: support -// function f1(x: N1.C): N1.C { -// return x; -// } - -// function f2(x: AA.C): AA.C { -// return x; -// } +function f1(x: N1.C): N1.C { + return x; +} + +function f2(x: AA.C): AA.C { + return x; +} From b4909e13b61f03b51787c5ff247b7a9af89e1f2d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 14 Jun 2023 16:02:54 +0800 Subject: [PATCH 092/202] WIP: Rename file --- driver/js/src/main/scala/driver/Driver.scala | 11 ++++++----- driver/js/src/main/scala/driver/FileInfo.scala | 9 +++++---- ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala | 3 ++- ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala | 5 +++-- ts2mls/js/src/main/scala/ts2mls/TSModules.scala | 7 ++++--- .../{TSModuleResolver.scala => TSPathResolver.scala} | 2 +- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 3 ++- ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 3 ++- .../src/test/scala/ts2mls/TSTypeGenerationTests.scala | 3 ++- 9 files changed, 27 insertions(+), 19 deletions(-) rename ts2mls/js/src/main/scala/ts2mls/{TSModuleResolver.scala => TSPathResolver.scala} (96%) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 6d14bc65e..d3d991ed0 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -7,7 +7,8 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} -import ts2mls.{TSModuleResolver, TSProgram, TypeScript} +import ts2mls.{TSProgram, TypeScript} +import ts2mls.TSPathResolver import ts2mls.JSFileSystem import ts2mls.JSWriter @@ -34,7 +35,7 @@ class Driver(options: DriverOptions) { private val importedModule = MutSet[String]() private val config = TypeScript.parseOption(options.path, options.tsconfig) - import TSModuleResolver.{normalize, isLocal, dirname} + import TSPathResolver.{normalize, isLocal, dirname} private def checkESModule(filename: String) = if (filename.endsWith(".mls")) None @@ -160,9 +161,9 @@ class Driver(options: DriverOptions) { private def resolveTarget(file: FileInfo, imp: String) = if ((imp.startsWith("./") || imp.startsWith("../")) && !imp.endsWith(".mls") && !imp.endsWith(".mlsi")) { - val tsPath = TypeScript.getOutputFileNames(s"${TSModuleResolver.dirname(file.filename)}/$imp", config) - val outputBase = TSModuleResolver.dirname(TSModuleResolver.normalize(s"${options.outputDir}${file.jsFilename}")) - TSModuleResolver.relative(outputBase, tsPath) + val tsPath = TypeScript.getOutputFileNames(s"${TSPathResolver.dirname(file.filename)}/$imp", config) + val outputBase = TSPathResolver.dirname(TSPathResolver.normalize(s"${options.outputDir}${file.jsFilename}")) + TSPathResolver.relative(outputBase, tsPath) } else imp diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 193fcdfa6..4bcd53e34 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -1,13 +1,14 @@ package driver -import ts2mls.{TSModuleResolver, TypeScript, TSImport} +import ts2mls.{TypeScript, TSImport} +import ts2mls.TSPathResolver final case class FileInfo( workDir: String, // work directory (related to compiler path) localFilename: String, // filename (related to work dir, or in node_modules) interfaceDir: String, // .mlsi file directory (related to output dir) ) { - import TSModuleResolver.{normalize, isLocal, dirname, basename} + import TSPathResolver.{normalize, isLocal, dirname, basename} val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) @@ -36,7 +37,7 @@ final case class FileInfo( relatedPath match { case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) case _ => - val currentPath = TSModuleResolver.dirname(TSImport.createInterfaceForNode(localFilename)) + val currentPath = TSPathResolver.dirname(TSImport.createInterfaceForNode(localFilename)) FileInfo(workDir, s"./$currentPath/$path", interfaceDir) } else FileInfo(workDir, path, interfaceDir) @@ -45,6 +46,6 @@ final case class FileInfo( object FileInfo { def importPath(filename: String): String = if (filename.endsWith(".mls") || filename.endsWith(".ts")) - filename.replace(TSModuleResolver.extname(filename), ".mlsi") + filename.replace(TSPathResolver.extname(filename), ".mlsi") else filename + ".mlsi" } diff --git a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala index 1d297127f..a70a32de1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala @@ -4,6 +4,7 @@ import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ import js.JSConverters._ +import ts2mls.TSPathResolver object JSFileSystem { private val fs = g.require("fs") // must use fs module to manipulate files in JS @@ -15,7 +16,7 @@ object JSFileSystem { else Some(fs.readFileSync(filename).toString) def writeFile(filename: String, content: String): Unit = { - val dir = TSModuleResolver.dirname(filename) + val dir = TSPathResolver.dirname(filename) if (!exists(dir)) fs.mkdirSync(dir, js.Dictionary("recursive" -> true)) fs.writeFileSync(filename, content) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 95d3e0c15..f625ea332 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -6,6 +6,7 @@ import js.DynamicImplicits._ import js.JSConverters._ import ts2mls.types._ import mlscript.utils._ +import ts2mls.TSPathResolver object TypeScript { private def load(moduleName: String) = try g.require(moduleName) catch { @@ -23,7 +24,7 @@ object TypeScript { // tsconfig.json def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { val config = filename.fold[js.Any](js.Dictionary())(filename => { - val content = JSFileSystem.readFile(TSModuleResolver.normalize(s"$basePath/$filename")).getOrElse("") + val content = JSFileSystem.readFile(TSPathResolver.normalize(s"$basePath/$filename")).getOrElse("") json.parse(content) }) val name = filename.getOrElse("tsconfig.json") @@ -32,7 +33,7 @@ object TypeScript { // package.json def parsePackage(path: String): js.Dynamic = { - val content = JSFileSystem.readFile(TSModuleResolver.normalize(path)).getOrElse("") + val content = JSFileSystem.readFile(TSPathResolver.normalize(path)).getOrElse("") json.parse(content) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index c688acf7f..287f52ea5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -3,6 +3,7 @@ package ts2mls import scala.collection.mutable.HashMap import mlscript.utils._ import ts2mls.types.{TSTypeAlias, TSReferenceType, Converter} +import ts2mls.TSPathResolver final case class TSReExport(alias: String, filename: String, memberName: Option[String]) @@ -10,11 +11,11 @@ trait TSImport { self => val filename: String def resolveTypeAlias(name: String): Option[String] = self match { - case TSFullImport(filename, _) => Some(s"${TSModuleResolver.basename(filename)}.$name") + case TSFullImport(filename, _) => Some(s"${TSPathResolver.basename(filename)}.$name") case TSSingleImport(filename, items) => items.collect { case (originalName, _) if (originalName === name) => - s"${TSModuleResolver.basename(filename)}.$name" + s"${TSPathResolver.basename(filename)}.$name" }.headOption } @@ -37,7 +38,7 @@ trait TSImport { self => object TSImport { def createInterfaceForNode(path: String): String = { - val moduleName = TSModuleResolver.basename(path) + val moduleName = TSPathResolver.basename(path) val topLevelModule = if (path.contains("/")) path.substring(0, path.indexOf("/")) else moduleName diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala similarity index 96% rename from ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala rename to ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala index 69dcff704..dfe2d536d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModuleResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala @@ -5,7 +5,7 @@ import js.Dynamic.{global => g} import js.DynamicImplicits._ import js.JSConverters._ -object TSModuleResolver { +object TSPathResolver { private val np: js.Dynamic = g.require("path") // built-in node module def resolve(path: String): String = np.resolve(path).toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 3f4532207..31d18af53 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -4,6 +4,7 @@ import scala.scalajs.js import js.DynamicImplicits._ import ts2mls.types._ import scala.collection.mutable.{HashSet, HashMap} +import ts2mls.TSPathResolver // for general ts, we still consider that there is a top-level module // and in mls we will import ts file like this: @@ -24,7 +25,7 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t private implicit val checker = TSTypeChecker(program.getTypeChecker()) - import TSModuleResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} + import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} def generate(outputFilename: String): Boolean = generate(resolve(fullname), outputFilename)(Nil) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 139bb0392..5d4849ece 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -5,6 +5,7 @@ import js.DynamicImplicits._ import types._ import mlscript.utils._ import scala.collection.mutable.{ListBuffer, HashMap} +import ts2mls.TSPathResolver class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) @@ -50,7 +51,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config).getOrElse( throw new AssertionError(s"unexpected required module $localName") ) - val moduleName = TSModuleResolver.basename(fullname) + val moduleName = TSPathResolver.basename(fullname) val varName = req.name.escapedText val imp = TSSingleImport(localName, List((varName, None))) importList.add(fullname, imp) diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index bb81057fa..05c7fb354 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -2,7 +2,8 @@ package ts2mls import org.scalatest.funsuite.AnyFunSuite import scala.collection.immutable -import TSModuleResolver.basename +import TSPathResolver.basename +import ts2mls.TSPathResolver class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ From 321c9b32d3d696ebc793259cba3c77c471e9ee32 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 14 Jun 2023 16:18:44 +0800 Subject: [PATCH 093/202] WIP: Fix export --- .../projects/.interfaces/node_modules/json5/stringify.mlsi | 2 +- driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi | 2 +- driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi | 2 +- ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala | 3 +++ ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 4 ++++ ts2mls/js/src/main/scala/ts2mls/types/Converter.scala | 7 +++++-- ts2mls/js/src/test/diff/Export.mlsi | 2 +- ts2mls/js/src/test/diff/Namespace.mlsi | 6 +++--- 8 files changed, 19 insertions(+), 9 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi index 4ba65a749..d4cb49302 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi @@ -1,4 +1,4 @@ export declare module stringify { type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) + export fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) } diff --git a/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi b/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi index 37a58fdea..a6f8d081c 100644 --- a/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi @@ -1,4 +1,4 @@ import "json5.mlsi" export declare module ConfigGen { - fun generate(outDir: Str): Str + export fun generate(outDir: Str): Str } diff --git a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi index fe823ae52..0fb176519 100644 --- a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi @@ -1,5 +1,5 @@ export declare module ReadLine { val lines: MutArray val i: Num - fun getStrLn(): Str + export fun getStrLn(): Str } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index f625ea332..38a0c46cc 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -70,6 +70,7 @@ object TypeScript { def isSourceFile(node: js.Dynamic) = ts.isSourceFile(node) def isExportDeclaration(node: js.Dynamic) = ts.isExportDeclaration(node) def isImportEqualsDeclaration(node: js.Dynamic) = ts.isImportEqualsDeclaration(node) + def isExportAssignment(node: js.Dynamic) = ts.isExportAssignment(node) def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) @@ -178,6 +179,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isRequire = TypeScript.isImportEqualsDeclaration(node) lazy val isSourceFile = TypeScript.isSourceFile(node) lazy val isExportDeclaration = TypeScript.isExportDeclaration(node) + lazy val isExportAssignment = TypeScript.isExportAssignment(node) // if a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. @@ -238,6 +240,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val resolvedPath: String = node.resolvedPath.toString() lazy val moduleReference = TSNodeObject(node.moduleReference) lazy val expression = TSTokenObject(node.expression) + lazy val idExpression = TSIdentifierObject(node.expression) lazy val isVarParam = !IsUndefined(node.dotDotDotToken) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 5d4849ece..df49778b3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -41,6 +41,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else parseExportDeclaration(nodeObject.exportClause.elements) } + else if (nodeObject.isExportAssignment) { + val name = nodeObject.idExpression.escapedText + global.export(name) + } }) def getImportList: List[TSImport] = importList.getFilelist diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index da14d531a..5200ba3f5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -29,10 +29,13 @@ object Converter { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" - s"${indent}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + val exp = if (exported) "export " else "" + s"${indent}${exp}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, false)} ${overload.warning}" - case inter: TSIntersectionType => s"${indent}fun ${name}: ${Converter.convert(inter)}" + case inter: TSIntersectionType => + val exp = if (exported) "export " else "" + s"${indent}${exp}fun ${name}: ${Converter.convert(inter)}" case _ => throw new AssertionError("non-function type is not allowed.") } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 6ebacb54c..d13584f38 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -1,7 +1,7 @@ import "./Dependency.mlsi" export declare module Export { export module Foo { - fun Baz(aa: Str): IBar + export fun Baz(aa: Str): IBar declare trait IBar { val a: Str } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index d67cff1ef..535e33d61 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,6 +1,6 @@ export declare module Namespace { module N1 { - fun f(x: anything): Num + export fun f(x: anything): Num fun ff(y: anything): Num export declare class C { fun f(): unit @@ -9,13 +9,13 @@ export declare module Namespace { fun f(): Num } export module N2 { - fun fff(x: (false) | (true)): Num + export fun fff(x: (false) | (true)): Num fun gg(c: C): C declare class BBB extends C {} } } module AA { - fun f(x: anything): Str + export fun f(x: anything): Str export declare class C { fun f(): unit } From d9d49cfb91b12edf96e7d4ad9fdb6a2945dd3018 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 14 Jun 2023 18:00:16 +0800 Subject: [PATCH 094/202] WIP: Generate based on node_modules structures --- driver/js/src/main/scala/driver/Driver.scala | 2 +- .../js/src/main/scala/driver/FileInfo.scala | 19 +++++++++++++------ .../{ => lib}/BoundedMeetSemilattice.mlsi | 0 .../fp-ts/{ => lib}/MeetSemilattice.mlsi | 0 .../node_modules/json5/{ => lib}/json5.mlsi | 0 .../node_modules/json5/{ => lib}/parse.mlsi | 0 .../json5/{ => lib}/stringify.mlsi | 0 .../test/scala/driver/DriverDiffTests.scala | 2 +- .../js/src/main/scala/ts2mls/TSModules.scala | 15 +++++++++------ .../js/src/main/scala/ts2mls/TSProgram.scala | 9 +++++---- 10 files changed, 29 insertions(+), 18 deletions(-) rename driver/js/src/test/projects/.interfaces/node_modules/fp-ts/{ => lib}/BoundedMeetSemilattice.mlsi (100%) rename driver/js/src/test/projects/.interfaces/node_modules/fp-ts/{ => lib}/MeetSemilattice.mlsi (100%) rename driver/js/src/test/projects/.interfaces/node_modules/json5/{ => lib}/json5.mlsi (100%) rename driver/js/src/test/projects/.interfaces/node_modules/json5/{ => lib}/parse.mlsi (100%) rename driver/js/src/test/projects/.interfaces/node_modules/json5/{ => lib}/stringify.mlsi (100%) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index d3d991ed0..2848fb245 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -33,7 +33,7 @@ class Driver(options: DriverOptions) { } private val importedModule = MutSet[String]() - private val config = TypeScript.parseOption(options.path, options.tsconfig) + private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) import TSPathResolver.{normalize, isLocal, dirname} diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala index 4bcd53e34..8d508c6f4 100644 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ b/driver/js/src/main/scala/driver/FileInfo.scala @@ -1,5 +1,6 @@ package driver +import scala.scalajs.js import ts2mls.{TypeScript, TSImport} import ts2mls.TSPathResolver @@ -8,7 +9,7 @@ final case class FileInfo( localFilename: String, // filename (related to work dir, or in node_modules) interfaceDir: String, // .mlsi file directory (related to output dir) ) { - import TSPathResolver.{normalize, isLocal, dirname, basename} + import TSPathResolver.{normalize, isLocal, dirname, basename, extname} val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) @@ -22,22 +23,28 @@ final case class FileInfo( // full filename (related to compiler path, or in node_modules) lazy val filename: String = if (!isNodeModule) normalize(s"./$workDir/$localFilename") - else localFilename + else localFilename.replace(extname(localFilename), "") - val interfaceFilename: String = // interface filename (related to output directory) + private def resolveNodeModule(implicit config: js.Dynamic) = + if (!isNodeModule) throw new AssertionError(s"$filename is not a node module") + else TypeScript.resolveModuleName(filename, "", config).getOrElse( + throw new AssertionError(s"can not find node module $filename") + ) + + def interfaceFilename(implicit config: js.Dynamic): String = // interface filename (related to output directory) relatedPath.fold( - s"$interfaceDir/${TSImport.createInterfaceForNode(localFilename)}" + s"$interfaceDir/${dirname(TSImport.createInterfaceForNode(resolveNodeModule))}/${moduleName}.mlsi" )(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") val jsFilename: String = relatedPath.fold(moduleName)(path => normalize(s"$path/$moduleName.js")) - def `import`(path: String): FileInfo = + def `import`(path: String)(implicit config: js.Dynamic): FileInfo = if (isLocal(path)) relatedPath match { case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) case _ => - val currentPath = TSPathResolver.dirname(TSImport.createInterfaceForNode(localFilename)) + val currentPath = dirname(TSImport.createInterfaceForNode(resolveNodeModule)) FileInfo(workDir, s"./$currentPath/$path", interfaceDir) } else FileInfo(workDir, path, interfaceDir) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/node_modules/fp-ts/BoundedMeetSemilattice.mlsi rename to driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/node_modules/fp-ts/MeetSemilattice.mlsi rename to driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/node_modules/json5/json5.mlsi rename to driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/node_modules/json5/parse.mlsi rename to driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/node_modules/json5/stringify.mlsi rename to driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 8070f41d8..3b9a73669 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -75,7 +75,7 @@ object DriverDiffTests { ts2mlsEntry("Array"), ts2mlsEntry("BasicFunctions"), ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", true), // TODO: ??? + ts2mlsEntry("Cycle1", true), // TODO: Module `Cycle1` is not supported yet. ts2mlsEntry("Dec"), ts2mlsEntry("Enum"), ts2mlsEntry("ES5"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 287f52ea5..3529fd0cb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -37,12 +37,15 @@ trait TSImport { self => } object TSImport { - def createInterfaceForNode(path: String): String = { - val moduleName = TSPathResolver.basename(path) - val topLevelModule = - if (path.contains("/")) path.substring(0, path.indexOf("/")) - else moduleName - s"node_modules/$topLevelModule/$moduleName.mlsi" + def createInterfaceForNode(fullpath: String): String = { + import TSPathResolver.{basename, dirname} + val moduleName = basename(fullpath) + val dir = dirname(fullpath) + val nodeName = "node_modules" + val related = + if (dir.contains(nodeName)) dir.substring(dir.lastIndexOf(nodeName) + nodeName.length()) + else throw new AssertionError(s"$fullpath is not related to $nodeName.") + s"$nodeName/$related/$moduleName.mlsi" } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 31d18af53..561ec2d3c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -45,12 +45,13 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t val (cycleList, otherList) = importList.partition(imp => stack.contains(`import`(imp.filename))) - otherList.foreach(imp => - generate(`import`(imp.filename), + otherList.foreach(imp => { + val fullname = `import`(imp.filename) + generate(fullname, if (isLocal(imp.filename)) normalize(s"${dirname(outputFilename)}/${basename(imp.filename)}.mlsi") - else TSImport.createInterfaceForNode(imp.filename) + else TSImport.createInterfaceForNode(fullname) )(filename :: stack) - ) + }) var writer = JSWriter(outputFilename) val imported = new HashSet[String]() From c65aa2f46bc1f9a4c74082a694235747f249e7d2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 15 Jun 2023 10:24:10 +0800 Subject: [PATCH 095/202] WIP: Fix node_modules entry name --- driver/js/src/main/scala/driver/Driver.scala | 2 +- .../test/projects/.interfaces/mlscript/Output2.mlsi | 4 ++-- .../.interfaces/node_modules/json5/lib/json5.mlsi | 2 +- driver/js/src/test/scala/driver/DriverDiffTests.scala | 2 +- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 10 +++++----- .../src/test/scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 2848fb245..44de8243f 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -181,7 +181,7 @@ class Driver(options: DriverOptions) { if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript val tsprog = TSProgram(file.localFilename, file.workDir, true, options.tsconfig) - return tsprog.generate(mlsiFile) + return tsprog.generate(Some(file.moduleName), mlsiFile) } parseAndRun(file.filename, { case (definitions, _, imports, _) => { diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi index 0d552a5e7..1460aae42 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi @@ -1,6 +1,6 @@ import "json5.mlsi" declare module Output2() { - fun createConfig: (path: Str,) -> error - let config: error + fun createConfig: (path: Str,) -> nothing + let config: nothing undefined } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi index 17f6237d8..51a100e1d 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi @@ -1,6 +1,6 @@ import "./stringify.mlsi" import "./parse.mlsi" -export declare module index { +export declare module json5 { export val parse = parse.parse export val stringify = stringify.stringify } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 3b9a73669..e3d890eb0 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -69,7 +69,7 @@ object DriverDiffTests { entry("C", expectError = true), entry("TS", Some("./tsconfig.json"), true), // TODO: type members entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json"), true), // TODO: ??? + entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), true), // TODO: type traits in modules ts2mlsEntry("Array"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 561ec2d3c..1efc158d7 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -27,10 +27,10 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate(outputFilename: String): Boolean = - generate(resolve(fullname), outputFilename)(Nil) + def generate(module: Option[String], outputFilename: String): Boolean = + generate(resolve(fullname), module, outputFilename)(Nil) - private def generate(filename: String, outputFilename: String)(implicit stack: List[String]): Boolean = { + private def generate(filename: String, module: Option[String], outputFilename: String)(implicit stack: List[String]): Boolean = { val globalNamespace = TSNamespace() val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) val importList = sourceFile.getImportList @@ -40,14 +40,14 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t def `import`(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") - val moduleName = basename(filename) + val moduleName = module.getOrElse(basename(filename)) val (cycleList, otherList) = importList.partition(imp => stack.contains(`import`(imp.filename))) otherList.foreach(imp => { val fullname = `import`(imp.filename) - generate(fullname, + generate(fullname, None, if (isLocal(imp.filename)) normalize(s"${dirname(outputFilename)}/${basename(imp.filename)}.mlsi") else TSImport.createInterfaceForNode(fullname) )(filename :: stack) diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 05c7fb354..87590475b 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -15,7 +15,7 @@ class TSTypeGenerationTest extends AnyFunSuite { !directlyImportedSet.contains(filename), None ) - program.generate(s"ts2mls/js/src/test/diff/${basename(filename)}.mlsi") + program.generate(None, s"ts2mls/js/src/test/diff/${basename(filename)}.mlsi") }) } From 4273e606924950330f13303e5f4ae51297de3e3b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 15 Jun 2023 10:49:14 +0800 Subject: [PATCH 096/202] WIP: Don't show depList if it is empty --- .gitignore | 2 +- compiler/shared/test/diff/LiftType.mls | 2 +- compiler/shared/test/diff/Lifter.mls | 24 ++++++++++---------- compiler/shared/test/diff/LifterBlks.mls | 2 +- shared/src/main/scala/mlscript/helpers.scala | 4 ++++ 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index e4c387bfa..dbfae3e07 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ project/Dependencies.scala project/metals.sbt **.worksheet.sc .DS_Store -!driver/js/src/test/projects/.interfaces/node_modules \ No newline at end of file +!driver/js/src/test/projects/.interfaces/node_modules diff --git a/compiler/shared/test/diff/LiftType.mls b/compiler/shared/test/diff/LiftType.mls index f8c134ff4..bda3a602a 100644 --- a/compiler/shared/test/diff/LiftType.mls +++ b/compiler/shared/test/diff/LiftType.mls @@ -8,7 +8,7 @@ class CTX{ //│ |#class| |CTX|{|→|#class| |A| |{||}|↵|#fun| |foo|(|f|#:| |A| |=>| |A|)|#:| |(|A| |=>| |A|)| |=>| |A| |#=| |f|(|#new| |A|)|←|↵|}| //│ Parsed: {class CTX() {class A() {}; fun foo = (f: (A,) => A,) => f (new A() {},) : (A -> A) -> A}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List(),List())))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List())))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2(par$CTX$1,) {} diff --git a/compiler/shared/test/diff/Lifter.mls b/compiler/shared/test/diff/Lifter.mls index f1570db10..566d12696 100644 --- a/compiler/shared/test/diff/Lifter.mls +++ b/compiler/shared/test/diff/Lifter.mls @@ -28,7 +28,7 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getB1| |#=| |B1|(|y|)|↵|#class| |C|(|z|)| |{|→|#fun| |inc|(||)| |#=| |x| |+| |1|↵|#fun| |getY| |#=| |y|↵|#fun| |getA| |#=| |A|(|z|)|↵|#fun| |getB|(|w|)| |#=| |B|(|w|)|↵|#fun| |getC| |#=| |#new| |C|(|inc|(||)|)|↵|#fun| |getSelf| |#=| |this|←|↵|}|←|↵|}|↵|#class| |B1|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getY| |#=| |y|↵|#fun| |getB| |#=| |#new| |B|(|y|)|↵|#fun| |getB1| |#=| |#new| |B1|(|y|)|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|(|x|)|↵|#fun| |getB2|(|y|)| |#=| |B1|(|y|)|↵|#fun| |getB3|(|z|)| |#=| |getB2|(|z|)|↵|#fun| |getA| |#=| |A|(|x|)|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {fun getX = x; fun getB1 = B1 (y,); class C(z,) {fun inc = () => + (x,) (1,); fun getY = y; fun getA = A (z,); fun getB = (w,) => B (w,); fun getC = new C(inc (),) {}; fun getSelf = this}}; class B1(y,) {fun getX = x; fun getY = y; fun getB = new B(y,) {}; fun getB1 = new B1(y,) {}}; fun getB = new B(x,) {}; fun getB2 = (y,) => B1 (y,); fun getB3 = (z,) => getB2 (z,); fun getA = A (x,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getB1, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, inc, [], Lam(Tup(), App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))))), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, [], New(Some((TypeName(C),inc (),)), TypingUnit(List(),List()))), NuFunDef(None, getSelf, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getB, [], New(Some((TypeName(B),y,)), TypingUnit(List(),List()))), NuFunDef(None, getB1, [], New(Some((TypeName(B1),y,)), TypingUnit(List(),List()))))), NuFunDef(None, getB, [], New(Some((TypeName(B),x,)), TypingUnit(List(),List()))), NuFunDef(None, getB2, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(x))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getB1, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, inc, [], Lam(Tup(), App(App(Var(+), Tup(_: Var(x))), Tup(_: IntLit(1))))), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, [], New(Some((TypeName(C),inc (),)), TypingUnit(List()))), NuFunDef(None, getSelf, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, [], Var(x)), NuFunDef(None, getY, [], Var(y)), NuFunDef(None, getB, [], New(Some((TypeName(B),y,)), TypingUnit(List()))), NuFunDef(None, getB1, [], New(Some((TypeName(B1),y,)), TypingUnit(List()))))), NuFunDef(None, getB, [], New(Some((TypeName(B),x,)), TypingUnit(List()))), NuFunDef(None, getB2, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, [], App(Var(A), Tup(_: Var(x))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2_C$4(par$A$1_B$2, z,) { @@ -106,7 +106,7 @@ new C{ //│ |#class| |A|(|x|)| |{|→|#class| |B|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |11|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |2|↵|#fun| |bar| |#=| |12|←|↵|}|↵|#fun| |bar| |#=| |13|←|↵|}|↵|#class| |C|#:| |A|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |3|↵|#fun| |bar| |#=| |14|←|↵|}|↵|#fun| |bar| |#=| |15|←|↵|}|↵|#new| |C|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |4|↵|#fun| |bar| |#=| |16|←|↵|}|↵|#fun| |bar| |#=| |17|←|↵|}| //│ Parsed: {class A(x,) {class B() {fun foo = 1; fun bar = 11}; fun getB = new B() {fun foo = 2; fun bar = 12}; fun bar = 13}; class C(): A {fun getB = new B() {fun foo = 3; fun bar = 14}; fun bar = 15}; new C() {fun getB = new B() {fun foo = 4; fun bar = 16}; fun bar = 17}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)), NuFunDef(None, bar, [], IntLit(11)))), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 2, fun bar = 12),List()))), NuFunDef(None, bar, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 3, fun bar = 14),List()))), NuFunDef(None, bar, [], IntLit(15)))), New(Some((TypeName(C),)), TypingUnit(List(fun getB = new B() {fun foo = 4; fun bar = 16}, fun bar = 17),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)), NuFunDef(None, bar, [], IntLit(11)))), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 2, fun bar = 12)))), NuFunDef(None, bar, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(fun foo = 3, fun bar = 14)))), NuFunDef(None, bar, [], IntLit(15)))), New(Some((TypeName(C),)), TypingUnit(List(fun getB = new B() {fun foo = 4; fun bar = 16}, fun bar = 17)))) //│ Lifted: //│ Lifting failed: java.util.NoSuchElementException: None.get @@ -144,7 +144,7 @@ class A(x: Int): {a1: Int} & B & D(x){ //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)|#:| |{|a1|#:| |Int|}| |&| |B|‹|T|›| |&| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|#:| |T|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T›() {}; class C() {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): {a1: Int} & B[T] & D[(x,)] {fun getA = () => new C() {fun foo = (x: T,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x: T,) => x),List()))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x: T,) => x)))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]() {} @@ -166,7 +166,7 @@ class A(x: Int) extends {a1: Int}, B, D(x){ //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)| |#extends| |{|a1|#:| |Int|}|,| |B|‹|T|›|,| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T›() {}; class C() {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): '{' {a1: Int} '}', B‹T›, D (x,) {fun getA = () => new C() {fun foo = (x,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x,) => x),List()))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), None, None, TypingUnit(NuFunDef(None, getA, [], Lam(Tup(), New(Some((TypeName(C),)), TypingUnit(List(fun foo = (x,) => x)))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]() {} @@ -186,7 +186,7 @@ class Child(x): { age: T } & { name: String} { //│ |#class| |Child|‹|T|,| |U|›|(|x|)|#:| |{| |age|#:| |T| |}| |&| |{| |name|#:| |String|}| |{|→|#class| |Inner|{|→|#fun| |foo| |#=| |age|←|↵|}|↵|#fun| |bar| |#=| |age|↵|#fun| |boo| |#=| |#new| |Inner|←|↵|}| //│ Parsed: {class Child‹T, U›(x,): {age: T} & {name: String} {class Inner() {fun foo = age}; fun bar = age; fun boo = new Inner() {}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Child, ((None,TypeName(T)), (None,TypeName(U))), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(age)))), NuFunDef(None, bar, [], Var(age)), NuFunDef(None, boo, [], New(Some((TypeName(Inner),)), TypingUnit(List(),List())))))) +//│ TypingUnit(NuTypeDef(class, Child, ((None,TypeName(T)), (None,TypeName(U))), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], Var(age)))), NuFunDef(None, bar, [], Var(age)), NuFunDef(None, boo, [], New(Some((TypeName(Inner),)), TypingUnit(List())))))) //│ Lifted: //│ TypingUnit { //│ class Child$1_Inner$2(par$Child$1, age,) {fun foo = (this).age} @@ -208,7 +208,7 @@ new A(0) { //│ |#class| |A|(|x|#:| |Int|)| |{|→|#fun| |getA|#:| |Int| |#=| |0|↵|#fun| |getA1| |#=| |1|←|↵|}|↵|#new| |A|(|0|)| |{|→|#fun| |getA| |#=| |3|↵|#fun| |getA2| |#=| |2|←|↵|}| //│ Parsed: {class A(x: Int,) {fun getA = 0 : Int; fun getA1 = 1}; new A(0,) {fun getA = 3; fun getA2 = 2}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, [], IntLit(1)))), New(Some((TypeName(A),0,)), TypingUnit(List(fun getA = 3, fun getA2 = 2),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, [], IntLit(1)))), New(Some((TypeName(A),0,)), TypingUnit(List(fun getA = 3, fun getA2 = 2)))) //│ Lifted: //│ TypingUnit { //│ class A$1(x: Int,) {fun getA = 0 : Int; fun getA1 = 1} @@ -228,7 +228,7 @@ new A(1) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{| |}|←|↵|}|↵|#new| |A|(|1|)| |{|→|#fun| |getB| |#=| |#new| |B|(|2|)|{|→|#fun| |getB| |#=| |#new| |B|(|3|)|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {}}; new A(1,) {fun getB = new B(2,) {fun getB = new B(3,) {}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit()))), New(Some((TypeName(A),1,)), TypingUnit(List(fun getB = new B(2,) {fun getB = new B(3,) {}}),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit()))), New(Some((TypeName(A),1,)), TypingUnit(List(fun getB = new B(2,) {fun getB = new B(3,) {}})))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1, y,) {} @@ -260,7 +260,7 @@ new B{ //│ |#class| |A| |{|→|#fun| |getA| |#=| |0|↵|#fun| |funcA| |#=| |10|←|↵|}|↵|#class| |B|#:| |A|{|→|#fun| |getA| |#=| |1|↵|#fun| |funcB| |#=| |11|←|↵|}|↵|#new| |A|↵|#new| |B|↵|#fun| |f|(|x|)| |#=| |#if| |x| |is| |A| |#then| |0| |#else| |1|↵|f|(|#new| |A|{|→|#fun| |getA| |#=| |2|←|↵|}|)|↵|#new| |B|{|→|#fun| |getA| |#=| |funcB|←|↵|}| //│ Parsed: {class A() {fun getA = 0; fun funcA = 10}; class B(): A {fun getA = 1; fun funcB = 11}; new A() {}; new B() {}; fun f = (x,) => if (is (x,) (A,)) then 0 else 1; f (new A() {fun getA = 2},); new B() {fun getA = funcB}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(0)), NuFunDef(None, funcA, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(1)), NuFunDef(None, funcB, [], IntLit(11)))), New(Some((TypeName(A),)), TypingUnit(List(),List())), New(Some((TypeName(B),)), TypingUnit(List(),List())), NuFunDef(None, f, [], Lam(Tup(_: Var(x)), If(IfThen(App(App(Var(is), Tup(_: Var(x))), Tup(_: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List(fun getA = 2),List())))), New(Some((TypeName(B),)), TypingUnit(List(fun getA = funcB),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(0)), NuFunDef(None, funcA, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, [], IntLit(1)), NuFunDef(None, funcB, [], IntLit(11)))), New(Some((TypeName(A),)), TypingUnit(List())), New(Some((TypeName(B),)), TypingUnit(List())), NuFunDef(None, f, [], Lam(Tup(_: Var(x)), If(IfThen(App(App(Var(is), Tup(_: Var(x))), Tup(_: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),)), TypingUnit(List(fun getA = 2))))), New(Some((TypeName(B),)), TypingUnit(List(fun getA = funcB)))) //│ Lifted: //│ TypingUnit { //│ class A$1() {fun getA = 0; fun funcA = 10} @@ -342,7 +342,7 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|↵|#fun| |getB| |#=| |#new| |B|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|↵|#fun| |getD| |#=| |#new| |D|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|↵|#fun| |getE| |#=| |#new| |E|{|→|#fun| |foo| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A() {class B() {fun funB = 1; fun foo = 100}; class C(): B {fun funC = 2; fun foo = 1000; fun getB = new B() {}}; class D() {fun funD = 3; fun foo = 10000; class E(): C {fun funE = 4; fun foo = 100000; fun getD = new D() {}}; class F(): E {fun funF = 5; fun foo = 1000000; fun getE = new E() {fun foo = 0}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List(),List()))))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)), NuFunDef(None, getD, [], New(Some((TypeName(D),)), TypingUnit(List(),List()))))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000)), NuFunDef(None, getE, [], New(Some((TypeName(E),)), TypingUnit(List(fun foo = 0),List())))))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, [], IntLit(1)), NuFunDef(None, foo, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, [], IntLit(2)), NuFunDef(None, foo, [], IntLit(1000)), NuFunDef(None, getB, [], New(Some((TypeName(B),)), TypingUnit(List()))))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, [], IntLit(3)), NuFunDef(None, foo, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, [], IntLit(4)), NuFunDef(None, foo, [], IntLit(100000)), NuFunDef(None, getD, [], New(Some((TypeName(D),)), TypingUnit(List()))))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, [], IntLit(5)), NuFunDef(None, foo, [], IntLit(1000000)), NuFunDef(None, getE, [], New(Some((TypeName(E),)), TypingUnit(List(fun foo = 0))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {fun funB = 1; fun foo = 100} @@ -377,7 +377,7 @@ new A //│ |#class| |A|{|→|#class| |B|{|→|#fun| |foo| |#=| |1|←|↵|}|↵|#fun| |bar| |#=| |#new| |B|←|↵|}|↵|#new| |A| //│ Parsed: {class A() {class B() {fun foo = 1}; fun bar = new B() {}}; new A() {}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)))), NuFunDef(None, bar, [], New(Some((TypeName(B),)), TypingUnit(List(),List()))))), New(Some((TypeName(A),)), TypingUnit(List(),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(1)))), NuFunDef(None, bar, [], New(Some((TypeName(B),)), TypingUnit(List()))))), New(Some((TypeName(A),)), TypingUnit(List()))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2(par$A$1,) {fun foo = 1} @@ -401,7 +401,7 @@ let x = new A{ //│ |#class| |A|(|x|)| |{|→|#fun| |foo| |#=| |0|↵|#fun| |bar| |#=| |x|←|↵|}|↵|#let| |x| |#=| |#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |newFun| |#=| |2|↵|#fun| |bar| |#=| |#new| |A|(|foo|)|{|→|#fun| |foo| |#=| |bar| |+| |1|↵|#fun| |bar2| |#=| |newFun| |+| |1|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {fun foo = 0; fun bar = x}; let x = new A() {fun foo = 1; fun newFun = 2; fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(0)), NuFunDef(None, bar, [], Var(x)))), NuFunDef(Some(false), x, [], New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun newFun = 2, fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}),List())))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, [], IntLit(0)), NuFunDef(None, bar, [], Var(x)))), NuFunDef(Some(false), x, [], New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun newFun = 2, fun bar = new A(foo,) {fun foo = + (bar,) (1,); fun bar2 = + (newFun,) (1,)}))))) //│ Lifted: //│ TypingUnit { //│ class A$1(x,) {fun foo = 0; fun bar = (this).x} @@ -437,7 +437,7 @@ new A{ //│ |#class| |A| |{||}|↵|#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |#new| |A|{|→|#fun| |foo1| |#=| |foo|↵|#fun| |bar1| |#=| |#new| |A|{|→|#fun| |foo2| |#=| |foo|↵|#fun| |bar2| |#=| |#new| |A|{|→|#fun| |foo3| |#=| |foo|↵|#fun| |bar3| |#=| |#new| |A|{|→|#fun| |foo4| |#=| |foo|↵|#fun| |bar4| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A() {}; new A() {fun foo = 1; fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}}),List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), New(Some((TypeName(A),)), TypingUnit(List(fun foo = 1, fun bar = new A() {fun foo1 = foo; fun bar1 = new A() {fun foo2 = foo; fun bar2 = new A() {fun foo3 = foo; fun bar3 = new A() {fun foo4 = foo; fun bar4 = 0}}}})))) //│ Lifted: //│ TypingUnit { //│ class A$1() {} diff --git a/compiler/shared/test/diff/LifterBlks.mls b/compiler/shared/test/diff/LifterBlks.mls index bc81a02d5..6089f1926 100644 --- a/compiler/shared/test/diff/LifterBlks.mls +++ b/compiler/shared/test/diff/LifterBlks.mls @@ -52,7 +52,7 @@ f(0) //│ |#class| |A|(|y|)|{||}|↵|#let| |f| |#=| |x| |=>| |#new| |A|(|0|)|{|#fun| |bar| |#=| |x|+|y|}|↵|f|(|0|)| //│ Parsed: {class A(y,) {}; let f = (x,) => new A(0,) {fun bar = + (x,) (y,)}; f (0,)} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), None, None, TypingUnit()), NuFunDef(Some(false), f, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),0,)), TypingUnit(List(fun bar = + (x,) (y,)),List())))), App(Var(f), Tup(_: IntLit(0)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), None, None, TypingUnit()), NuFunDef(Some(false), f, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),0,)), TypingUnit(List(fun bar = + (x,) (y,)))))), App(Var(f), Tup(_: IntLit(0)))) //│ Lifted: //│ TypingUnit { //│ class A$1(y,) {} diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index ed6177f51..68fd8cf3a 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -435,6 +435,10 @@ trait TypingUnitImpl extends Located { self: TypingUnit => case _ => die }.mkString("{", "; ", "}") lazy val children: List[Located] = entities + + override def toString(): String = + if (depList.isEmpty) s"TypingUnit(${entities.toString()})" + else s"TypingUnit(${entities.toString()}, ${depList.toString()})" } trait TypeNameImpl extends Ordered[TypeName] { self: TypeName => From 93a59c36ebcb622f1c315f1cc263cf7ed94c2edf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 15 Jun 2023 11:05:28 +0800 Subject: [PATCH 097/202] WIP: Fix escape --- .../src/test/scala/driver/DriverDiffTests.scala | 1 + ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala | 6 +++--- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 4 ++-- .../src/main/scala/ts2mls/types/Converter.scala | 14 +++++++------- .../js/src/main/scala/ts2mls/types/TSType.scala | 2 ++ ts2mls/js/src/test/diff/Escape.mlsi | 14 ++++++++++++++ .../test/scala/ts2mls/TSTypeGenerationTests.scala | 1 + ts2mls/js/src/test/typescript/Escape.ts | 15 +++++++++++++++ 8 files changed, 45 insertions(+), 12 deletions(-) create mode 100644 ts2mls/js/src/test/diff/Escape.mlsi create mode 100644 ts2mls/js/src/test/typescript/Escape.ts diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index e3d890eb0..b1dc6adc0 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -79,6 +79,7 @@ object DriverDiffTests { ts2mlsEntry("Dec"), ts2mlsEntry("Enum"), ts2mlsEntry("ES5"), + ts2mlsEntry("Escape"), ts2mlsEntry("Export"), ts2mlsEntry("Heritage"), ts2mlsEntry("HighOrderFunc"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 442350e27..c5db39ed2 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -65,7 +65,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { order.toList.foreach((p) => p match { case Left(subName) => { val ss = subSpace(subName) - writer.writeln(s"${indent}${expStr(ss._2)}module $subName {") + writer.writeln(s"${indent}${expStr(ss._2)}module ${Converter.escapeIdent(subName)} {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") } @@ -83,8 +83,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) case TSRenamedType(name, original) if (exp) => - writer.writeln(s"${indent}export val $name = ${Converter.convert(original)("")}") - case _ => writer.writeln(s"${indent}${expStr(exp)}val $name: ${Converter.convert(mem)("")}") + writer.writeln(s"${indent}export val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") + case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)}: ${Converter.convert(mem)("")}") } } }) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 1efc158d7..f2ec72f17 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -64,7 +64,7 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t } }) cycleList.foreach(imp => { - writer.writeln(s"declare module ${basename(imp.filename)} {") + writer.writeln(s"declare module ${Converter.escapeIdent(basename(imp.filename))} {") cache(`import`(imp.filename)).generate(writer, " ") writer.writeln("}") }) @@ -90,7 +90,7 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String): Unit = if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency else { - writer.writeln(s"export declare module $moduleName {") + writer.writeln(s"export declare module ${Converter.escapeIdent(moduleName)} {") globalNamespace.generate(writer, " ") writer.writeln("}") } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 5200ba3f5..79fd4b9b2 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -19,7 +19,7 @@ object Converter { "symbol" -> "Symbol" ) - private def escapeIdent(name: String) = { + def escapeIdent(name: String) = { import mlscript.NewLexer if (NewLexer.keywords(name)) s"""id"$name"""" else name @@ -35,7 +35,7 @@ object Converter { case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, false)} ${overload.warning}" case inter: TSIntersectionType => val exp = if (exported) "export " else "" - s"${indent}${exp}fun ${name}: ${Converter.convert(inter)}" + s"${indent}${exp}fun ${escapeIdent(name)}: ${Converter.convert(inter)}" case _ => throw new AssertionError("non-function type is not allowed.") } @@ -53,16 +53,16 @@ object Converter { case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members case TSInterfaceType(name, members, typeVars, parents) => - convertRecord(s"trait $name", members, typeVars, parents, Map(), List(), exported)(indent) + convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) case TSClassType(name, members, statics, typeVars, parents, cons) => - convertRecord(s"class $name", members, typeVars, parents, statics, cons, exported)(indent) + convertRecord(s"class ${escapeIdent(name)}", members, typeVars, parents, statics, cons, exported)(indent) case TSSubstitutionType(base, applied) => s"${base}<${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}>" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" - case TSParameterType(name, tp) => s"${name}: ${convert(tp)}" + case TSParameterType(name, tp) => s"${escapeIdent(name)}: ${convert(tp)}" case TSTypeAlias(name, ori, tp) => { val exp = if (exported) "export " else "" - if (tp.isEmpty) s"${indent}${exp}type $name = ${convert(ori)}" - else s"${indent}${exp}type $name<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" + if (tp.isEmpty) s"${indent}${exp}type ${escapeIdent(name)} = ${convert(ori)}" + else s"${indent}${exp}type ${escapeIdent(name)}<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" } case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index 1c43e21d1..1c228571c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -44,7 +44,9 @@ case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType val warning = s"/* warning: the overload of function $name is not supported yet. */" } +// generate type name = ... in mlscript case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType +// generate val name = ... in mlscript case class TSRenamedType(name: String, original: TSType) extends TSType case class TSLiteralType(value: String, isString: Boolean) extends TSType case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType diff --git a/ts2mls/js/src/test/diff/Escape.mlsi b/ts2mls/js/src/test/diff/Escape.mlsi new file mode 100644 index 000000000..a63862a66 --- /dev/null +++ b/ts2mls/js/src/test/diff/Escape.mlsi @@ -0,0 +1,14 @@ +export declare module Escape { + declare class id"fun" { + val id"rec": Num + } + declare trait id"rec" { + val id"fun": Str + } + fun id"mixin"(id"module": Str): unit + val id"forall": Num + module id"trait" { + module id"of" { + } + } +} diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 87590475b..2ea34d659 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -29,6 +29,7 @@ object TSTypeGenerationTest { "./Dom.d.ts", "./Enum.ts", "./ES5.d.ts", + "./Escape.ts", "./Export.ts", "./Heritage.ts", "./HighOrderFunc.ts", diff --git a/ts2mls/js/src/test/typescript/Escape.ts b/ts2mls/js/src/test/typescript/Escape.ts new file mode 100644 index 000000000..5a139c20c --- /dev/null +++ b/ts2mls/js/src/test/typescript/Escape.ts @@ -0,0 +1,15 @@ +class fun { + rec = 42 +} +interface rec { + fun: string +} + +function mixin(module: string) { +} + +const forall = 42 + +namespace trait { + namespace of {} +} From 02c90c2eb5eaec53d62fb1f4be85ec1c1ad6d1e4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 15 Jun 2023 11:47:52 +0800 Subject: [PATCH 098/202] WIP: Refactor code --- driver/js/src/main/scala/driver/Driver.scala | 14 +++++--------- shared/src/main/scala/mlscript/JSBackend.scala | 4 ++-- shared/src/main/scala/mlscript/NewParser.scala | 10 ++++------ shared/src/main/scala/mlscript/helpers.scala | 5 ++++- shared/src/main/scala/mlscript/syntax.scala | 6 +++++- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 44de8243f..885d20d4b 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -185,9 +185,7 @@ class Driver(options: DriverOptions) { } parseAndRun(file.filename, { case (definitions, _, imports, _) => { - val depList = imports.map { - case Import(path) => path - } + val depList = imports.map(_.path) val (cycleList, otherList) = depList.partitionMap { dep => { val depFile = file.`import`(dep) @@ -224,9 +222,7 @@ class Driver(options: DriverOptions) { val filename = s"${options.path}/${file.interfaceFilename}" parseAndRun(filename, { case (_, declarations, imports, _) => { - val depList = imports.map { - case Import(path) => path - } + val depList = imports.map(_.path) depList.foreach(d => importModule(file.`import`(d))) `type`(TypingUnit(declarations, Nil)) } @@ -245,11 +241,11 @@ class Driver(options: DriverOptions) { val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") saveToFile(mlsiFile, interfaces) - generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map { - case Import(path) => new Import(resolveTarget(file, path)) with ModuleType { + generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( + imp => new Import(resolveTarget(file, imp.path)) with ModuleType { val isESModule = checkESModule(path) } - }, exported || importedModule(file.filename)) + ), exported || importedModule(file.filename)) } true } diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 35110f7cf..c51c4fa01 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -236,7 +236,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } case (nt: NuTypeDef, _) => translateLocalNewType(nt)(blkScope) // TODO: find out if we need to support this. - case (_: Def | _: TypeDef | _: NuFunDef | _: DataDefn | _: DatatypeDefn | _: LetS | _: Constructor, _) => + case (_: Def | _: TypeDef | _: NuFunDef | _: DataDefn | _: DatatypeDefn | _: LetS | _: Constructor | _: Import, _) => throw CodeGenError("unsupported definitions in blocks") }.toList)), Nil @@ -1211,7 +1211,7 @@ class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { case fd: NuFunDef => R(fd) case nd: NuTypeDef => L(nd) case _ => die - } + } // don't pass `otherStmts` to the top-level module, because we need to execute them one by one later val topModule = topLevelScope.declareTopModule("TypingUnit", Nil, typeDefs, true) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 73f6226b9..e4edb3c2e 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -217,9 +217,9 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D final def typingUnit: TypingUnit = { val ts = block(false, false) - val (es, dp) = ts.partition{ - case R(imp: Import) => false - case _ => true + val (es, dp) = ts.partitionMap { + case R(imp: Import) => R(imp) + case s => L(s) } match { case (es, dp) => (es.map { @@ -230,9 +230,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case R(e: Term) => e case R(c: Constructor) => c case _ => ??? - }, dp.map { - case R(imp: Import) => imp - }) + }, dp) } TypingUnit(es, dp) } diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index 68fd8cf3a..90dcfc5be 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -736,6 +736,9 @@ trait StatementImpl extends Located { self: Statement => case ctor: Constructor => import Message._ (ErrorReport(msg"constructor must be in a class." -> ctor.toLoc :: Nil) :: Nil) -> Nil + case imp: Import => + import Message._ + (ErrorReport(msg"unexpected import statement." -> imp.toLoc :: Nil) :: Nil) -> Nil case l @ LetS(isrec, pat, rhs) => val (diags, v, args) = desugDefnPattern(pat, Nil) diags -> (Def(isrec, v, L(args.foldRight(rhs)(Lam(_, _))), false).withLocOf(l) :: Nil) // TODO use v, not v.name @@ -917,7 +920,7 @@ trait StatementImpl extends Located { self: Statement => case _: Term => super.toString case d: Decl => d.showDbg case d: NuDecl => d.showDbg - case Import(path) => s"""import "$path"""" + case imp: Import => s"""import "${imp.path}"""" } } diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index faed8a1e5..acccd4f47 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -117,7 +117,11 @@ final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement final case class DataDefn(body: Term) extends Statement final case class DatatypeDefn(head: Term, body: Term) extends Statement final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } -case class Import(path: Str) extends Statement +class Import(val path: Str) extends Statement + +object Import { + def apply(path: Str): Import = new Import(path) +} sealed trait DesugaredStatement extends Statement with DesugaredStatementImpl From c3305cbaa777cbe894162632bcb6a2fcb431aec6 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 15 Jun 2023 16:31:50 +0800 Subject: [PATCH 099/202] WIP: Fix node_modules search --- driver/js/src/main/scala/driver/Driver.scala | 13 ++-- .../js/src/main/scala/driver/FileInfo.scala | 58 -------------- driver/js/src/test/projects/package-lock.json | 41 ++++++++++ driver/js/src/test/projects/package.json | 7 ++ package-lock.json | 11 --- package.json | 1 - .../js/src/main/scala/ts2mls/FileInfo.scala | 77 +++++++++++++++++++ .../main/scala/ts2mls/TSCompilerInfo.scala | 9 ++- .../main/scala/ts2mls/TSPathResolver.scala | 1 + .../js/src/main/scala/ts2mls/TSProgram.scala | 62 +++++++-------- .../src/main/scala/ts2mls/TSSourceFile.scala | 20 ++--- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 6 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 5 +- 14 files changed, 181 insertions(+), 132 deletions(-) delete mode 100644 driver/js/src/main/scala/driver/FileInfo.scala create mode 100644 driver/js/src/test/projects/package-lock.json create mode 100644 driver/js/src/test/projects/package.json create mode 100644 ts2mls/js/src/main/scala/ts2mls/FileInfo.scala diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 885d20d4b..e426bc907 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -7,10 +7,7 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} -import ts2mls.{TSProgram, TypeScript} -import ts2mls.TSPathResolver -import ts2mls.JSFileSystem -import ts2mls.JSWriter +import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo} class Driver(options: DriverOptions) { import Driver._ @@ -42,7 +39,7 @@ class Driver(options: DriverOptions) { else if (isLocal(filename)) Some(TypeScript.isESModule(config, false)) else { - val fullname = TypeScript.resolveModuleName(filename, "", config).getOrElse("node_modules/") + val fullname = TypeScript.resolveModuleName(filename, "", config) def find(path: String): Boolean = { val dir = dirname(path) val pack = s"$dir/package.json" @@ -50,7 +47,7 @@ class Driver(options: DriverOptions) { val config = TypeScript.parsePackage(pack) TypeScript.isESModule(config, true) } - else if (dir.endsWith("node_modules/")) false // TODO: throw? + else if (dir === "." || dir === "/") false else find(dir) } Some(find(fullname)) @@ -180,8 +177,8 @@ class Driver(options: DriverOptions) { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript val tsprog = - TSProgram(file.localFilename, file.workDir, true, options.tsconfig) - return tsprog.generate(Some(file.moduleName), mlsiFile) + TSProgram(file, true, options.tsconfig) + return tsprog.generate } parseAndRun(file.filename, { case (definitions, _, imports, _) => { diff --git a/driver/js/src/main/scala/driver/FileInfo.scala b/driver/js/src/main/scala/driver/FileInfo.scala deleted file mode 100644 index 8d508c6f4..000000000 --- a/driver/js/src/main/scala/driver/FileInfo.scala +++ /dev/null @@ -1,58 +0,0 @@ -package driver - -import scala.scalajs.js -import ts2mls.{TypeScript, TSImport} -import ts2mls.TSPathResolver - -final case class FileInfo( - workDir: String, // work directory (related to compiler path) - localFilename: String, // filename (related to work dir, or in node_modules) - interfaceDir: String, // .mlsi file directory (related to output dir) -) { - import TSPathResolver.{normalize, isLocal, dirname, basename, extname} - - val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) - if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) - else None - - val isNodeModule: Boolean = relatedPath.isEmpty - - // module name in ts/mls - val moduleName = basename(localFilename) - - // full filename (related to compiler path, or in node_modules) - lazy val filename: String = - if (!isNodeModule) normalize(s"./$workDir/$localFilename") - else localFilename.replace(extname(localFilename), "") - - private def resolveNodeModule(implicit config: js.Dynamic) = - if (!isNodeModule) throw new AssertionError(s"$filename is not a node module") - else TypeScript.resolveModuleName(filename, "", config).getOrElse( - throw new AssertionError(s"can not find node module $filename") - ) - - def interfaceFilename(implicit config: js.Dynamic): String = // interface filename (related to output directory) - relatedPath.fold( - s"$interfaceDir/${dirname(TSImport.createInterfaceForNode(resolveNodeModule))}/${moduleName}.mlsi" - )(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") - - val jsFilename: String = - relatedPath.fold(moduleName)(path => normalize(s"$path/$moduleName.js")) - - def `import`(path: String)(implicit config: js.Dynamic): FileInfo = - if (isLocal(path)) - relatedPath match { - case Some(value) => FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir) - case _ => - val currentPath = dirname(TSImport.createInterfaceForNode(resolveNodeModule)) - FileInfo(workDir, s"./$currentPath/$path", interfaceDir) - } - else FileInfo(workDir, path, interfaceDir) -} - -object FileInfo { - def importPath(filename: String): String = - if (filename.endsWith(".mls") || filename.endsWith(".ts")) - filename.replace(TSPathResolver.extname(filename), ".mlsi") - else filename + ".mlsi" -} diff --git a/driver/js/src/test/projects/package-lock.json b/driver/js/src/test/projects/package-lock.json new file mode 100644 index 000000000..d091f9638 --- /dev/null +++ b/driver/js/src/test/projects/package-lock.json @@ -0,0 +1,41 @@ +{ + "name": "projects", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "fp-ts": "^2.16.0", + "json5": "^2.2.3" + } + }, + "node_modules/fp-ts": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", + "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + } + }, + "dependencies": { + "fp-ts": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", + "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + } + } +} diff --git a/driver/js/src/test/projects/package.json b/driver/js/src/test/projects/package.json new file mode 100644 index 000000000..80cb02650 --- /dev/null +++ b/driver/js/src/test/projects/package.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "fp-ts": "^2.16.0", + "json5": "^2.2.3" + }, + "module": "es2015" +} diff --git a/package-lock.json b/package-lock.json index 5cad2ba8d..44596f1b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,16 +5,10 @@ "packages": { "": { "dependencies": { - "fp-ts": "^2.16.0", "json5": "^2.2.3", "typescript": "^4.7.4" } }, - "node_modules/fp-ts": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", - "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" - }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -40,11 +34,6 @@ } }, "dependencies": { - "fp-ts": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", - "integrity": "sha512-bLq+KgbiXdTEoT1zcARrWEpa5z6A/8b7PcDW7Gef3NSisQ+VS7ll2Xbf1E+xsgik0rWub/8u0qP/iTTjj+PhxQ==" - }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", diff --git a/package.json b/package.json index b6c91f883..f33b6f03f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "dependencies": { - "fp-ts": "^2.16.0", "json5": "^2.2.3", "typescript": "^4.7.4" } diff --git a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala new file mode 100644 index 000000000..e0bcf58e2 --- /dev/null +++ b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala @@ -0,0 +1,77 @@ +package ts2mls + +import scala.scalajs.js +import ts2mls.{TypeScript, TSImport} +import ts2mls.TSPathResolver + +final case class FileInfo( + workDir: String, // work directory (related to compiler path) + localFilename: String, // filename (related to work dir, or in node_modules) + interfaceDir: String, // .mlsi file directory (related to output dir) + parent: Option[String] = None, // file that imports this (related to work dir) + nodeModulesNested: Boolean = false // if it is a local file in node_modules +) { + import TSPathResolver.{normalize, isLocal, dirname, basename, extname} + + val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) + if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) + else None + + val isNodeModule: Boolean = nodeModulesNested || relatedPath.isEmpty + + // module name in ts/mls + val moduleName = basename(localFilename) + + // full filename (related to compiler path, or module name in node_modules) + lazy val filename: String = + if (!isNodeModule) normalize(s"./$workDir/$localFilename") + else if (nodeModulesNested) localFilename + else localFilename.replace(extname(localFilename), "") + + lazy val importedMlsi: String = + FileInfo.importPath( + if (!isNodeModule) localFilename + else if (nodeModulesNested) { + val p = dirname(TSImport.createInterfaceForNode(parent.getOrElse(workDir))) + s"./${normalize(TSPathResolver.relative(p, localFilename))}" + } + else filename + ) + + def resolve(implicit config: js.Dynamic) = + if (isNodeModule && !nodeModulesNested) TypeScript.resolveModuleName(filename, parent.getOrElse(""), config) + else if (nodeModulesNested) TypeScript.resolveModuleName(s"./$moduleName", parent.getOrElse(""), config) + else TSPathResolver.resolve(filename) + + def interfaceFilename(implicit config: js.Dynamic): String = // interface filename (related to work directory) + relatedPath.fold( + s"$interfaceDir/${dirname(TSImport.createInterfaceForNode(resolve))}/${moduleName}.mlsi" + )(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") + + val jsFilename: String = + relatedPath.fold(filename)(path => normalize(s"$path/$moduleName.js")) + + def `import`(path: String)(implicit config: js.Dynamic): FileInfo = + if (isLocal(path)) + relatedPath match { + case Some(value) => + if (path.endsWith(".mls") || path.endsWith(".mlsi")) + FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir, Some(resolve)) + else { + val res = TypeScript.resolveModuleName(s"./${dirname(path)}/${basename(path)}", resolve, config) + val absWordDir = TSPathResolver.resolve(workDir) + FileInfo(workDir, s"./${TSPathResolver.relative(absWordDir, res)}", interfaceDir, Some(resolve)) + } + case _ => + val currentPath = dirname(TSImport.createInterfaceForNode(resolve)) + FileInfo(workDir, s"./$currentPath/$path", interfaceDir, Some(resolve), true) + } + else FileInfo(workDir, path, interfaceDir, Some(resolve)) +} + +object FileInfo { + def importPath(filename: String): String = + if (filename.endsWith(".mls") || filename.endsWith(".ts")) + filename.replace(TSPathResolver.extname(filename), ".mlsi") + else filename + ".mlsi" +} diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 38a0c46cc..4703f8376 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -37,11 +37,12 @@ object TypeScript { json.parse(content) } - def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): Option[String] = { + def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): String = { val res = ts.resolveModuleName(importName, containingName, config, sys) if (!IsUndefined(res.resolvedModule) && !IsUndefined(res.resolvedModule.resolvedFileName)) - Some(res.resolvedModule.resolvedFileName.toString()) - else None + res.resolvedModule.resolvedFileName.toString() + else + throw new Exception(s"can not resolve module $importName in $containingName.") } def getOutputFileNames(filename: String, config: js.Dynamic): String = @@ -88,7 +89,7 @@ object TypeScript { ts.createProgram(filenames.toJSArray, js.Dictionary( "maxNodeModuleJsDepth" -> 0, "target" -> ts.ScriptTarget.ES5, - "module" -> ts.ModuleKind.CommonJS, + "module" -> ts.ModuleKind.ES5, "esModuleInterop" -> true )) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala index dfe2d536d..f4f0c97e9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala @@ -20,4 +20,5 @@ object TSPathResolver { else np.extname(path).toString() def basename(filename: String) = np.basename(filename, extname(filename)).toString() + def basenameWithExt(filename: String) = np.basename(filename).toString() } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index f2ec72f17..65f28be5c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -11,67 +11,63 @@ import ts2mls.TSPathResolver // import * as TopLevelModuleName from "filename" // for es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files -class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) { - private implicit val configContent = TypeScript.parseOption(workDir, tsconfig) - private val fullname = - if (JSFileSystem.exists(s"$workDir/$filename")) s"$workDir/$filename" - else TypeScript.resolveModuleName(filename, "", configContent) match { - case Some(path) => path - case _ => throw new Exception(s"file $workDir/$filename doesn't exist.") - } - - private val program = TypeScript.createProgram(Seq(fullname)) +class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String]) { + private implicit val configContent = TypeScript.parseOption(file.workDir, tsconfig) + private val program = TypeScript.createProgram(Seq( + if (file.isNodeModule) file.resolve + else file.filename + )) private val cache = new HashMap[String, TSNamespace]() - private implicit val checker = TSTypeChecker(program.getTypeChecker()) import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate(module: Option[String], outputFilename: String): Boolean = - generate(resolve(fullname), module, outputFilename)(Nil) + def generate: Boolean = generate(file)(Nil) - private def generate(filename: String, module: Option[String], outputFilename: String)(implicit stack: List[String]): Boolean = { + private def generate(file: FileInfo)(implicit stack: List[String]): Boolean = { + val filename = file.resolve val globalNamespace = TSNamespace() - val sourceFile = TSSourceFile(program.getSourceFile(filename), globalNamespace) + val sfObj = program.getSourceFileByPath(filename) + val sourceFile = + if (IsUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") + else TSSourceFile(sfObj, globalNamespace) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList cache.addOne(filename, globalNamespace) - val relatedPath = relative(workDir, dirname(filename)) - - def `import`(imp: String) = TypeScript.resolveModuleName(imp, filename, configContent).getOrElse("") + val relatedPath = relative(file.workDir, dirname(filename)) - val moduleName = module.getOrElse(basename(filename)) + val moduleName = file.moduleName val (cycleList, otherList) = - importList.partition(imp => stack.contains(`import`(imp.filename))) + importList.partitionMap(imp => { + val newFile = file.`import`(imp.filename) + if (stack.contains(newFile.resolve)) Left(newFile) + else Right(newFile) + }) otherList.foreach(imp => { - val fullname = `import`(imp.filename) - generate(fullname, None, - if (isLocal(imp.filename)) normalize(s"${dirname(outputFilename)}/${basename(imp.filename)}.mlsi") - else TSImport.createInterfaceForNode(fullname) - )(filename :: stack) + generate(imp)(filename :: stack) }) - var writer = JSWriter(outputFilename) + var writer = JSWriter(s"${file.workDir}/${file.interfaceFilename}") val imported = new HashSet[String]() otherList.foreach(imp => { - val name = imp.filename.replace(extname(imp.filename), "") + val name = imp.importedMlsi if (!imported(name)) { imported += name - writer.writeln(s"""import "$name.mlsi"""") + writer.writeln(s"""import "$name"""") } }) cycleList.foreach(imp => { - writer.writeln(s"declare module ${Converter.escapeIdent(basename(imp.filename))} {") - cache(`import`(imp.filename)).generate(writer, " ") + writer.writeln(s"declare module ${Converter.escapeIdent(imp.moduleName)} {") + cache(imp.resolve).generate(writer, " ") writer.writeln("}") }) reExportList.foreach { case TSReExport(alias, imp, memberName) => - val absName = `import`(imp) + val absName = file.`import`(imp).resolve if (!cache.contains(absName)) throw new AssertionError(s"unexpected re-export from ${imp}") else { @@ -97,6 +93,6 @@ class TSProgram(filename: String, workDir: String, uesTopLevelModule: Boolean, t } object TSProgram { - def apply(filename: String, workDir: String, uesTopLevelModule: Boolean, tsconfig: Option[String]) = - new TSProgram(filename, workDir, uesTopLevelModule, tsconfig) + def apply(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String]) = + new TSProgram(file, uesTopLevelModule, tsconfig) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index df49778b3..72e50622b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -52,9 +52,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def parseRequire(req: TSNodeObject): Unit = { val localName = req.moduleReference.expression.text - val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config).getOrElse( - throw new AssertionError(s"unexpected required module $localName") - ) + val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config) val moduleName = TSPathResolver.basename(fullname) val varName = req.name.escapedText val imp = TSSingleImport(localName, List((varName, None))) @@ -78,9 +76,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (!clause.isUndefined) { val bindings = clause.namedBindings val importName = moduleSpecifier.text - val fullPath = TypeScript.resolveModuleName(importName, resolvedPath, config).getOrElse( - throw new AssertionError(s"unexpected import $importName.") - ) + val fullPath = TypeScript.resolveModuleName(importName, resolvedPath, config) def run(node: TSNodeObject): Unit = if (!node.elements.isUndefined) { val list = node.elements.mapToList(ele => @@ -125,7 +121,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getObjectType(obj: TSTypeObject)(implicit ns: TSNamespace): TSType = if (obj.isMapped) lineHelper.getPos(obj.pos) match { - case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) + case (line, column) => + TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) } else if (obj.isEnumType) TSEnumType else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) match { @@ -143,7 +140,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else TSReferenceType(getSymbolFullname(obj.symbol)) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) lineHelper.getPos(obj.pos) match { - case (line, column) => TSUnsupportedType(obj.toString(), obj.filename, line, column) + case (line, column) => + TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) } else TSPrimitiveType(obj.intrinsicName) @@ -157,7 +155,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { - case (line, column) => TSUnsupportedType(tn.toString(), tn.filename, line, column) + case (line, column) => + TSUnsupportedType(tn.toString(), TSPathResolver.basenameWithExt(tn.filename), line, column) } case t => t } @@ -177,7 +176,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val res: TSType = if (node.isIndexSignature || node.isCallSignature || node.isConstructSignature) lineHelper.getPos(node.pos) match { - case (line, column) => TSUnsupportedType(node.toString(), node.filename, line, column) + case (line, column) => + TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column) } else if (node.isFunctionLike) getFunctionType(node) match { case head :: Nil => head diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 8547bbe78..b74fc5b33 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -2,7 +2,7 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str fun render: (() => Str) & ((callback: () => unit) => Str) declare trait Get { - val __call: Unsupported<"(id: string): string", "ts2mls/js/src/test/typescript/Dec.d.ts", 4, 22> + val __call: Unsupported<"(id: string): string", "Dec.d.ts", 4, 22> } declare class Person { constructor(name: Str, age: Num) diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index f3d08bade..e2a89cae4 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -14,13 +14,13 @@ export declare module InterfaceMember { fun callback(): (x: Num) => unit } declare trait SearchFunc { - val __call: Unsupported<"(source: string, subString: string): boolean;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 24, 22> + val __call: Unsupported<"(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22> } declare trait StringArray { - val __index: Unsupported<"[index: number]: string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 28, 23> + val __index: Unsupported<"[index: number]: string;", "InterfaceMember.ts", 28, 23> } declare trait Counter { - val __call: Unsupported<"(start: number): string;", "ts2mls/js/src/test/typescript/InterfaceMember.ts", 32, 19> + val __call: Unsupported<"(start: number): string;", "InterfaceMember.ts", 32, 19> val interval: Num fun reset(): unit } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 2ea34d659..c079df990 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -10,12 +10,11 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( - filename, - "./ts2mls/js/src/test/typescript", + FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), !directlyImportedSet.contains(filename), None ) - program.generate(None, s"ts2mls/js/src/test/diff/${basename(filename)}.mlsi") + program.generate }) } From 7c08dfaf5c60b38c70daa0a621b7210af38b83aa Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 10:42:39 +0800 Subject: [PATCH 100/202] WIP: Generate square bracket --- .../fp-ts/lib/BoundedMeetSemilattice.mlsi | 2 +- .../fp-ts/lib/MeetSemilattice.mlsi | 2 +- .../node_modules/json5/lib/parse.mlsi | 2 +- .../node_modules/json5/lib/stringify.mlsi | 4 +-- .../projects/.interfaces/ts/ReadLine.mlsi | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 4 +-- .../main/scala/ts2mls/types/Converter.scala | 12 ++++---- ts2mls/js/src/test/diff/Array.mlsi | 26 ++++++++-------- ts2mls/js/src/test/diff/ClassMember.mlsi | 4 +-- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/Dom.mlsi | 2 +- ts2mls/js/src/test/diff/Heritage.mlsi | 12 ++++---- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 12 ++++---- ts2mls/js/src/test/diff/Intersection.mlsi | 12 ++++---- ts2mls/js/src/test/diff/Optional.mlsi | 8 ++--- ts2mls/js/src/test/diff/Overload.mlsi | 10 +++---- ts2mls/js/src/test/diff/Tuple.mlsi | 4 +-- ts2mls/js/src/test/diff/Type.mlsi | 10 +++---- ts2mls/js/src/test/diff/TypeParameter.mlsi | 30 +++++++++---------- ts2mls/js/src/test/diff/Union.mlsi | 4 +-- 21 files changed, 83 insertions(+), 83 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi index 06a5da8b2..d5f1a32f8 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi @@ -1,6 +1,6 @@ import "./MeetSemilattice.mlsi" export declare module BoundedMeetSemilattice { - export declare trait BoundedMeetSemilattice extends MeetSemilattice { + export declare trait BoundedMeetSemilattice[A] extends MeetSemilattice[A] { val one: A } } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi index 5a81175ab..96c2e453a 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi @@ -1,5 +1,5 @@ export declare module MeetSemilattice { - export declare trait MeetSemilattice { + export declare trait MeetSemilattice[A] { fun meet(x: A, y: A): A } } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi index 1c44eedba..0b75c122c 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi @@ -1,3 +1,3 @@ export declare module parse { - fun parse(text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ + fun parse[T](text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi index d4cb49302..58f04a391 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi @@ -1,4 +1,4 @@ export declare module stringify { - type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - export fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>) => Str)) & ((value: anything, replacer: MutArray<(Str) | (Num)>, space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray<(Str) | (Num)>)) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) + type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} + export fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray[(Str) | (Num)]) => Str)) & ((value: anything, replacer: MutArray[(Str) | (Num)], space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) } diff --git a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi index 0fb176519..f4815e47b 100644 --- a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi @@ -1,5 +1,5 @@ export declare module ReadLine { - val lines: MutArray + val lines: MutArray[Str] val i: Num export fun getStrLn(): Str } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index c5db39ed2..37c0af3fd 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -34,7 +34,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { } else members.update(name, (tp, exported)) - def export(name: String): Unit = + def `export`(name: String): Unit = if (members.contains(name)) members.update(name, (members(name)._1, true)) else if (subSpace.contains(name)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 72e50622b..55eed1d27 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -43,7 +43,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } else if (nodeObject.isExportAssignment) { val name = nodeObject.idExpression.escapedText - global.export(name) + global.`export`(name) } }) @@ -63,7 +63,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def parseExportDeclaration(elements: TSNodeArray): Unit = { elements.foreach(ele => if (ele.propertyName.isUndefined) - global.export(ele.symbol.escapedName) + global.`export`(ele.symbol.escapedName) else { val alias = ele.symbol.escapedName global.getTop(ele.propertyName.escapedText).fold(())(tp => global.put(alias, TSRenamedType(alias, tp), true)) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 79fd4b9b2..6bbbc80d3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -28,7 +28,7 @@ object Converter { def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") - val tpList = if (typeVars.isEmpty) "" else s"<${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}>" + val tpList = if (typeVars.isEmpty) "" else s"[${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}]" val exp = if (exported) "export " else "" s"${indent}${exp}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } @@ -49,24 +49,24 @@ object Converter { case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" case TSTypeParameter(name, _) => name // constraints should be translated where the type parameters were created rather than be used case TSTupleType(lst) => s"(${lst.foldLeft("")((p, t) => s"$p${convert(t)}, ")})" - case TSArrayType(element) => s"MutArray<${convert(element)}>" + case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members case TSInterfaceType(name, members, typeVars, parents) => convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) case TSClassType(name, members, statics, typeVars, parents, cons) => convertRecord(s"class ${escapeIdent(name)}", members, typeVars, parents, statics, cons, exported)(indent) - case TSSubstitutionType(base, applied) => s"${base}<${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}>" + case TSSubstitutionType(base, applied) => s"${base}[${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}]" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${escapeIdent(name)}: ${convert(tp)}" case TSTypeAlias(name, ori, tp) => { val exp = if (exported) "export " else "" if (tp.isEmpty) s"${indent}${exp}type ${escapeIdent(name)} = ${convert(ori)}" - else s"${indent}${exp}type ${escapeIdent(name)}<${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}> = ${convert(ori)}" + else s"${indent}${exp}type ${escapeIdent(name)}[${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}] = ${convert(ori)}" } case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => - s"""Unsupported<"$code", "$filename", $line, $column>""" + s"""Unsupported["$code", "$filename", $line, $column]""" case tp => throw new AssertionError(s"unexpected type $tp.") } @@ -110,7 +110,7 @@ object Converter { else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" else - s"${indent}${exp}declare $typeName<${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}>$inheritance $body" // TODO: add constraints + s"${indent}${exp}declare $typeName[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/Array.mlsi index ab3d27aec..6891e47f3 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/Array.mlsi @@ -1,21 +1,21 @@ export declare module Array { - fun first(x: MutArray): Str - fun getZero3(): MutArray - fun first2(fs: MutArray<(x: Num) => Num>): (x: Num) => Num - fun doEs(e: MutArray): MutArray + fun first(x: MutArray[Str]): Str + fun getZero3(): MutArray[Num] + fun first2(fs: MutArray[(x: Num) => Num]): (x: Num) => Num + fun doEs(e: MutArray[Int]): MutArray[Int] declare class C {} declare trait I { val i: Num } - fun doCs(c: MutArray): MutArray - fun doIs(i: MutArray): MutArray - fun inter(x: MutArray<(U) & (T)>): MutArray<(U) & (T)> - fun clean(x: MutArray<(Str, Num, )>): MutArray<(Str, Num, )> - fun translate(x: MutArray): MutArray - fun uu(x: MutArray<((Num) | (false)) | (true)>): MutArray<((Num) | (false)) | (true)> - declare class Temp { + fun doCs(c: MutArray[C]): MutArray[C] + fun doIs(i: MutArray[I]): MutArray[I] + fun inter[U, T](x: MutArray[(U) & (T)]): MutArray[(U) & (T)] + fun clean(x: MutArray[(Str, Num, )]): MutArray[(Str, Num, )] + fun translate[T, U](x: MutArray[T]): MutArray[U] + fun uu(x: MutArray[((Num) | (false)) | (true)]): MutArray[((Num) | (false)) | (true)] + declare class Temp[T] { val x: T } - fun ta(ts: MutArray>): MutArray> - fun tat(ts: MutArray>): MutArray> + fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] + fun tat[T](ts: MutArray[Temp[T]]): MutArray[Temp[T]] } diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 9a2e0229d..870c67989 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -6,7 +6,7 @@ export declare module ClassMember { fun addScore(sub: Str, score: Num): unit fun getID(): Num } - declare class Foo { + declare class Foo[T] { fun bar(x: T): unit } declare class EZ { @@ -17,7 +17,7 @@ export declare module ClassMember { val a: Num } } - declare class TTT { + declare class TTT[T] { fun ttt(x: T): T fun ttt2(x: T): T } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index b74fc5b33..16f0ffa7e 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -2,7 +2,7 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str fun render: (() => Str) & ((callback: () => unit) => Str) declare trait Get { - val __call: Unsupported<"(id: string): string", "Dec.d.ts", 4, 22> + val __call: Unsupported["(id: string): string", "Dec.d.ts", 4, 22] } declare class Person { constructor(name: Str, age: Num) diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/ts2mls/js/src/test/diff/Dom.mlsi index 9aa8effb8..017ba7476 100644 --- a/ts2mls/js/src/test/diff/Dom.mlsi +++ b/ts2mls/js/src/test/diff/Dom.mlsi @@ -12,7 +12,7 @@ declare trait Console { fun timeLog(data: anything): unit val time: (() => unit) & ((label: Str) => unit) fun group(data: anything): unit - val table: ((() => unit) & ((tabularData: anything) => unit)) & ((tabularData: anything, properties: MutArray) => unit) + val table: ((() => unit) & ((tabularData: anything) => unit)) & ((tabularData: anything, properties: MutArray[Str]) => unit) fun trace(data: anything): unit fun warn(data: anything): unit fun groupCollapsed(data: anything): unit diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 622a8a763..aa435fc64 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -3,11 +3,11 @@ export declare module Heritage { fun foo(): unit } declare class B extends A {} - declare class C { + declare class C[T] { fun set(x: T): unit fun get(): T } - declare class D extends C {} + declare class D extends C[Num] {} declare trait Wu { val x: (false) | (true) } @@ -20,16 +20,16 @@ export declare module Heritage { declare trait Never extends WuWuWu { fun w(): nothing } - declare class VG { + declare class VG[T] { val x: T } - declare class Home extends VG { + declare class Home[T] extends VG[Str] { val y: T } - declare trait O { + declare trait O[I] { fun xx(x: I): I } - declare class OR extends O { + declare class OR[R] extends O[R] { fun xx(x: R): R } module Five { diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index e2a89cae4..7ad0b5fdc 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -5,7 +5,7 @@ export declare module InterfaceMember { fun c(): (false) | (true) fun d(x: Str): unit } - declare trait II { + declare trait II[T] { fun test(x: T): Num } fun create(): {v: Num,} @@ -14,13 +14,13 @@ export declare module InterfaceMember { fun callback(): (x: Num) => unit } declare trait SearchFunc { - val __call: Unsupported<"(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22> + val __call: Unsupported["(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22] } declare trait StringArray { - val __index: Unsupported<"[index: number]: string;", "InterfaceMember.ts", 28, 23> + val __index: Unsupported["[index: number]: string;", "InterfaceMember.ts", 28, 23] } declare trait Counter { - val __call: Unsupported<"(start: number): string;", "InterfaceMember.ts", 32, 19> + val __call: Unsupported["(start: number): string;", "InterfaceMember.ts", 32, 19] val interval: Num fun reset(): unit } @@ -28,11 +28,11 @@ export declare module InterfaceMember { val a: Num fun b(x: (false) | (true)): Str } - declare trait Simple2 { + declare trait Simple2[T] { val abc: T } declare trait Next extends Simple {} - declare trait TTT { + declare trait TTT[T] { fun ttt(x: T): T } } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 1296000be..43596563a 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,6 +1,6 @@ export declare module Intersection { - fun extend(first: T, second: U): (T) & (U) - fun foo(x: (T) & (U)): unit + fun extend[T, U](first: T, second: U): (T) & (U) + fun foo[T, U](x: (T) & (U)): unit fun over(f: ((x: Num) => Str) & ((x: Object) => Str)): Str declare trait IA { val x: Num @@ -9,10 +9,10 @@ export declare module Intersection { val y: Num } fun iii(x: (IA) & (IB)): (IA) & (IB) - fun uu(x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) - fun iiii(x: ((U) & (T)) & (V)): ((U) & (T)) & (V) - fun arr(a: (MutArray) & (MutArray)): (MutArray) & (MutArray) - fun tt(x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) + fun uu[U, V, T, P](x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) + fun iiii[U, T, V](x: ((U) & (T)) & (V)): ((U) & (T)) & (V) + fun arr[U, T](a: (MutArray[U]) & (MutArray[T])): (MutArray[U]) & (MutArray[T]) + fun tt[U, T, V](x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) declare class A {} declare class B {} fun inter(c: (A) & (B)): (A) & (B) diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 221f3565a..cb42936a9 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -8,15 +8,15 @@ export declare module Optional { val width: (Num) | (undefined) } fun did: ((x: Num) => Num) & ((x: Num, f: (x: Num) => Num) => Num) - fun getOrElse: (() => Object) & ((arr: MutArray) => Object) + fun getOrElse: (() => Object) & ((arr: MutArray[Object]) => Object) declare class ABC {} fun testABC: (() => unit) & ((abc: ABC) => unit) fun testSquareConfig: (() => unit) & ((conf: SquareConfig) => unit) fun err: (() => unit) & ((msg: (Num, Str, )) => unit) fun toStr: (() => Str) & ((x: ((Num) | (false)) | (true)) => Str) - fun boo(x: (T) & (U)): unit /* warning: the overload of function boo is not supported yet. */ - declare class B { + fun boo[T, U](x: (T) & (U)): unit /* warning: the overload of function boo is not supported yet. */ + declare class B[T] { val b: T } - fun boom: (() => anything) & ((b: B) => anything) + fun boom: (() => anything) & ((b: B[nothing]) => anything) } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index a56708b6b..453e3803c 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -5,20 +5,20 @@ export declare module Overload { } fun app: ((f: (x: Str) => unit, x: Num) => unit) & ((f: (x: Str) => unit, x: Str) => unit) fun create: ((x: Num) => () => (false) | (true)) & ((x: (false) | (true)) => () => (false) | (true)) - fun g0: ((x: MutArray) => Str) & ((x: MutArray) => Str) - fun db: ((x: Num) => MutArray) & ((x: Object) => MutArray) + fun g0: ((x: MutArray[Str]) => Str) & ((x: MutArray[Object]) => Str) + fun db: ((x: Num) => MutArray[Num]) & ((x: Object) => MutArray[Num]) declare class N {} fun id: ((x: M) => unit) & ((x: N) => unit) fun tst: ((x: {z: Num,}) => {y: Str,}) & ((x: {z: (false) | (true),}) => {y: Str,}) fun op: ((((x: Num) => unit) & ((x: Num, y: Num) => unit)) & ((x: Num) => unit)) & ((x: Num, y: (false) | (true)) => unit) fun swap: ((x: (Num, Str, )) => (Num, Str, )) & ((x: (Str, Num, )) => (Num, Str, )) fun u: ((x: ((Num) | (false)) | (true)) => Str) & ((x: Object) => Str) - fun doSome(x: anything): unit /* warning: the overload of function doSome is not supported yet. */ + fun doSome[T, U](x: anything): unit /* warning: the overload of function doSome is not supported yet. */ module XX { - fun f(x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ + fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { - fun F(x: T): anything /* warning: the overload of function F is not supported yet. */ + fun F[T](x: T): anything /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index a1254554e..fba29602f 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -7,8 +7,8 @@ export declare module Tuple { fun tupleIt(x: Str): (() => Str, ) fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) - fun ex(x: T, y: U): (T, U, (T) & (U), ) - fun foo(x: ((T) & (U), )): unit + fun ex[T, U](x: T, y: U): (T, U, (T) & (U), ) + fun foo[T, U](x: ((T) & (U), )): unit fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) declare class A { val x: Num diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index fca69d0bf..b6cde3674 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -2,21 +2,21 @@ export declare module Type { declare trait None { val _tag: "None" } - declare trait Some { + declare trait Some[A] { val _tag: "Some" val value: A } - type Option = (None) | (Some) + type Option[A] = (None) | (Some[A]) type Func = (x: Num) => Num type S2 = (Str, Str, ) declare trait I1 {} declare trait I2 {} type I3 = (I1) & (I2) - type StringArray = Array + type StringArray = Array[Str] type SomeInterface = {x: Num,y: Num,} declare class ABC {} type DEF = ABC - type TP = (A, B, C, ) + type TP[A, B, C] = (A, B, C, ) module NA { fun fb(b: Str): unit export type B = Str @@ -26,5 +26,5 @@ export declare module Type { } type G = ABC val none: {_tag: "None",} - fun some(a: A): (None) | (Some) + fun some[A](a: A): (None) | (Some[A]) } diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 0e9fd9100..864716a04 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,27 +1,27 @@ export declare module TypeParameter { - fun inc(x: T): Num - declare class CC { + fun inc[T](x: T): Num + declare class CC[T] { fun print(s: T): unit } - fun con(t: T): U - declare class Printer { + fun con[U, T](t: T): U + declare class Printer[T] { fun print(t: T): unit } - fun setStringPrinter(p: Printer): unit - fun getStringPrinter(): Printer - fun foo(p: Printer, x: T): T - fun foo2(p: Printer, x: T): T - declare class F { + fun setStringPrinter(p: Printer[Str]): unit + fun getStringPrinter(): Printer[Str] + fun foo[T](p: Printer[T], x: T): T + fun foo2[T](p: Printer[T], x: T): T + declare class F[T] { val x: T - fun GG(y: U): T + fun GG[U](y: U): T } - declare trait I { + declare trait I[T] { val x: T - fun GG(y: U): T + fun GG[U](y: U): T } - declare class FFF { + declare class FFF[T] { fun fff(x: T): unit } - fun fff(p: FFF, s: Str): unit - fun getFFF(): FFF + fun fff(p: FFF[Str], s: Str): unit + fun getFFF(): FFF[Num] } diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index dd2c291d2..a533249e5 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -2,8 +2,8 @@ export declare module Union { fun getString(x: (((Str) | (Num)) | (false)) | (true)): Str fun test(x: (false) | (true)): (Str) | (Num) fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything - fun get(arr: (MutArray) | (MutArray)): unit + fun get(arr: (MutArray[Num]) | (MutArray[Str])): unit fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str - fun typeVar(x: (T) | (U)): (T) | (U) + fun typeVar[T, U](x: (T) | (U)): (T) | (U) fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) } From a8dca4891b144c252453bfbe3038b521f4d9dbdf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 11:31:27 +0800 Subject: [PATCH 101/202] WIP: Generate last version of overloading --- .../node_modules/json5/lib/parse.mlsi | 2 +- .../node_modules/json5/lib/stringify.mlsi | 2 +- .../test/projects/js/mlscript/MLS2TheMax.js | 2 +- .../src/test/projects/mlscript/MLS2TheMax.mls | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 7 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 93 ++++--------------- .../main/scala/ts2mls/types/Converter.scala | 5 +- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/Dom.mlsi | 36 +++---- ts2mls/js/src/test/diff/ES5.mlsi | 34 +++---- ts2mls/js/src/test/diff/Optional.mlsi | 24 ++--- ts2mls/js/src/test/diff/Overload.mlsi | 28 +++--- ts2mls/js/src/test/typescript/Overload.ts | 22 ++--- 13 files changed, 102 insertions(+), 157 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi index 0b75c122c..27698637a 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi @@ -1,3 +1,3 @@ export declare module parse { - fun parse[T](text: Str, reviver: (key: Str, value: anything) => anything): T /* warning: the overload of function parse is not supported yet. */ + export fun parse[T](text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): T } diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi index 58f04a391..6eafe4666 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi @@ -1,4 +1,4 @@ export declare module stringify { type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - export fun stringify: ((((((value: anything) => Str) & ((value: anything, replacer: (key: Str, value: anything) => anything) => Str)) & ((value: anything, replacer: (key: Str, value: anything) => anything, space: (Str) | (Num)) => Str)) & ((value: anything, replacer: MutArray[(Str) | (Num)]) => Str)) & ((value: anything, replacer: MutArray[(Str) | (Num)], space: (Str) | (Num)) => Str)) & ((value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}) => Str) + export fun stringify(value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}): Str /* warning: the overload of function stringify is not supported yet. */ } diff --git a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js index eae3d4143..124f5e968 100644 --- a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js +++ b/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js @@ -17,7 +17,7 @@ const MLS2TheMax = new class MLS2TheMax { parse(s) { const self = this; return ((() => { - let i = parseInt(s); + let i = parseInt(s, undefined); return isNaN(i) === true ? self.None() : self.Some(i); })()); } diff --git a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls index 7fac60d57..28da0f12c 100644 --- a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls +++ b/driver/js/src/test/projects/mlscript/MLS2TheMax.mls @@ -9,7 +9,7 @@ class Some(value: A) class None() fun parse(s: Str) = - let i = parseInt(s) + let i = parseInt(s, undefined) if isNaN(i) then None() _ then Some(i) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 37c0af3fd..b6e061dec 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -40,10 +40,13 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { else if (subSpace.contains(name)) subSpace.update(name, (subSpace(name)._1, true)) + def exported(name: String): Boolean = + if (members.contains(name)) members(name)._2 + else throw new Exception(s"member $name not found.") + def get(name: String): TSType = if (members.contains(name)) members(name)._1 - else if (!parent.isEmpty) parent.get.get(name) - else throw new Exception(s"member $name not found.") + else parent.fold(throw new Exception(s"member $name not found."))(p => p.get(name)) def getTop(name: String): Option[TSType] = if (members.contains(name)) members(name)._1 match { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 55eed1d27..3468d852d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -125,11 +125,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) } else if (obj.isEnumType) TSEnumType - else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) match { - case head :: Nil => head - case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) - case Nil => throw new AssertionError("empty function type.") - } + else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) @@ -147,11 +143,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // the function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = - if (tn.isFunctionLike) getFunctionType(tn) match { - case head :: Nil => head - case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) - case Nil => throw new AssertionError("empty function type.") - } + if (tn.isFunctionLike) getFunctionType(tn) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { @@ -179,11 +171,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case (line, column) => TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column) } - else if (node.isFunctionLike) getFunctionType(node) match { - case head :: Nil => head - case head :: tail => tail.foldLeft[TSType](head)((res, f) => TSIntersectionType(res, f)) - case Nil => throw new AssertionError("empty function type.") - } + else if (node.isFunctionLike) getFunctionType(node) else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) @@ -197,30 +185,20 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else lst :+ TSTypeParameter(tp.symbol.escapedName, Some(getObjectType(tp.constraint.typeNode))) ) - private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): List[TSFunctionType] = { - val res = getObjectType(node.returnType) - val tv = getTypeParameters(node) + private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): TSFunctionType = { def eraseVarParam(tp: TSType, erase: Boolean) = tp match { // TODO: support ... soon - case TSArrayType(eleType) if (erase) => eleType + case arr @ TSArrayType(eleType) if erase => TSUnionType(eleType, arr) case _ => tp } - node.parameters.foldLeft(TSFunctionType(Nil, res, tv) :: Nil)((funs, p) => ( + + val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => ( // in typescript, you can use `this` to explicitly specifies the callee // but it never appears in the final javascript file - if (p.symbol.escapedName === "this") funs - else if (p.isOptionalParameter) funs.lastOption match { - case Some(TSFunctionType(params, res, tv)) => - funs :+ TSFunctionType(params :+ - TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)), res, tv) - case _ => throw new AssertionError("empty function type.") - } - else funs.headOption match { - case Some(TSFunctionType(params, res, tv)) => - TSFunctionType(params :+ - TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)), res, tv) :: Nil - case _ => throw new AssertionError("empty function type.") - }) - ) + if (p.symbol.escapedName === "this") lst + else if (p.isOptionalParameter) // TODO: support optinal and default value soon + lst :+ TSParameterType(p.symbol.escapedName, TSUnionType(getObjectType(p.symbolType), TSPrimitiveType("undefined"))) + else lst :+ TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)))) + TSFunctionType(pList, getObjectType(node.returnType), getTypeParameters(node)) } @@ -242,20 +220,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType])(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { case func: TSFunctionType => { if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, node.modifier)) - else { // deal with functions overloading - val old = others(name) - val res = old.base match { - case f @ TSFunctionType(_, _, tv) => - if (!tv.isEmpty || !func.typeVars.isEmpty) TSIgnoredOverload(func, name) - else if (!node.isImplementationOfOverload) TSIntersectionType(f, func) - else f - case int: TSIntersectionType => - if (!func.typeVars.isEmpty) TSIgnoredOverload(func, name) - else if (!node.isImplementationOfOverload) TSIntersectionType(int, func) - else int - case TSIgnoredOverload(_, name) => TSIgnoredOverload(func, name) // the implementation is always after declarations - case _ => old.base - } + else { // TODO: handle functions' overloading + val res = TSIgnoredOverload(func, name) // the implementation is always after declarations others.removed(name) ++ Map(name -> TSMemberType(res, node.modifier)) } } @@ -307,36 +273,15 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported) - else { - val old = ns.get(name) - val res = old match { - case f @ TSFunctionType(_, _, tv) => - if (!tv.isEmpty || !fun.typeVars.isEmpty) TSIgnoredOverload(fun, name) - else if (!node.isImplementationOfOverload) TSIntersectionType(f, fun) - else f - case int: TSIntersectionType => - if (!fun.typeVars.isEmpty) TSIgnoredOverload(fun, name) - else if (!node.isImplementationOfOverload) TSIntersectionType(int, fun) - else old - case TSIgnoredOverload(_, name) => TSIgnoredOverload(fun, name) // the implementation is always after declarations - case _ => old - } - - ns.put(name, res, node.isExported) - } + else + ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name)) // the implementation is always after declarations // overload functions in a sub-namespace need to provide an overload array // because the namespace merely exports symbols rather than node objects themselves private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = - if (node.isFunctionLike) overload match { - case None => - getFunctionType(node).foreach(addFunctionIntoNamespace(_, node, name)) - case Some(decs) => { - decs.foreach((d) => - getFunctionType(d).foreach(addFunctionIntoNamespace(_, d, name)) - ) - } - } + if (node.isFunctionLike) overload.fold( + addFunctionIntoNamespace(getFunctionType(node), node, name) + )(decs => decs.foreach(d => addFunctionIntoNamespace(getFunctionType(d), d, name))) else if (node.isClassDeclaration) ns.put(name, parseMembers(name, node, true), exported) else if (node.isInterfaceDeclaration) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 6bbbc80d3..672d33d2b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -32,10 +32,7 @@ object Converter { val exp = if (exported) "export " else "" s"${indent}${exp}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, false)} ${overload.warning}" - case inter: TSIntersectionType => - val exp = if (exported) "export " else "" - s"${indent}${exp}fun ${escapeIdent(name)}: ${Converter.convert(inter)}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, exported)} ${overload.warning}" case _ => throw new AssertionError("non-function type is not allowed.") } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 16f0ffa7e..b87747f7f 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,6 +1,6 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str - fun render: (() => Str) & ((callback: () => unit) => Str) + fun render(callback: (() => unit) | (undefined)): Str declare trait Get { val __call: Unsupported["(id: string): string", "Dec.d.ts", 4, 22] } diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/ts2mls/js/src/test/diff/Dom.mlsi index 017ba7476..c299636a9 100644 --- a/ts2mls/js/src/test/diff/Dom.mlsi +++ b/ts2mls/js/src/test/diff/Dom.mlsi @@ -1,23 +1,23 @@ declare trait Console { - fun assert(data: anything): unit - val count: (() => unit) & ((label: Str) => unit) - val timeEnd: (() => unit) & ((label: Str) => unit) + fun assert(condition: ((false) | (true)) | (undefined), data: (anything) | (MutArray[anything])): unit + fun count(label: (Str) | (undefined)): unit + fun timeEnd(label: (Str) | (undefined)): unit fun clear(): unit - val timeStamp: (() => unit) & ((label: Str) => unit) - fun info(data: anything): unit - fun debug(data: anything): unit - val countReset: (() => unit) & ((label: Str) => unit) - val dir: ((() => unit) & ((item: anything) => unit)) & ((item: anything, options: anything) => unit) - fun error(data: anything): unit - fun timeLog(data: anything): unit - val time: (() => unit) & ((label: Str) => unit) - fun group(data: anything): unit - val table: ((() => unit) & ((tabularData: anything) => unit)) & ((tabularData: anything, properties: MutArray[Str]) => unit) - fun trace(data: anything): unit - fun warn(data: anything): unit - fun groupCollapsed(data: anything): unit - fun dirxml(data: anything): unit - fun log(data: anything): unit + fun timeStamp(label: (Str) | (undefined)): unit + fun info(data: (anything) | (MutArray[anything])): unit + fun debug(data: (anything) | (MutArray[anything])): unit + fun countReset(label: (Str) | (undefined)): unit + fun dir(item: (anything) | (undefined), options: (anything) | (undefined)): unit + fun error(data: (anything) | (MutArray[anything])): unit + fun timeLog(label: (Str) | (undefined), data: (anything) | (MutArray[anything])): unit + fun time(label: (Str) | (undefined)): unit + fun group(data: (anything) | (MutArray[anything])): unit + fun table(tabularData: (anything) | (undefined), properties: (MutArray[Str]) | (undefined)): unit + fun trace(data: (anything) | (MutArray[anything])): unit + fun warn(data: (anything) | (MutArray[anything])): unit + fun groupCollapsed(data: (anything) | (MutArray[anything])): unit + fun dirxml(data: (anything) | (MutArray[anything])): unit + fun log(data: (anything) | (MutArray[anything])): unit fun groupEnd(): unit } val console: Console diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index a469c1941..587d266a9 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,7 +1,7 @@ val NaN: Num val Infinity: Num fun eval(x: Str): anything -fun parseInt: ((string: Str) => Num) & ((string: Str, radix: Num) => Num) +fun parseInt(string: Str, radix: (Num) | (undefined)): Num fun parseFloat(string: Str): Num fun isNaN(number: Num): (false) | (true) fun isFinite(number: Num): (false) | (true) @@ -25,10 +25,10 @@ declare trait PropertyDescriptor { val value: (anything) | (undefined) } declare trait Function { - fun bind(thisArg: anything, argArray: anything): anything - val apply: ((thisArg: anything) => anything) & ((thisArg: anything, argArray: anything) => anything) + fun bind(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything + fun apply(thisArg: anything, argArray: (anything) | (undefined)): anything val prototype: anything - fun call(thisArg: anything, argArray: anything): anything + fun call(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything fun toString(): Str val length: Num val caller: Function @@ -41,7 +41,7 @@ declare trait Math { fun random(): Num fun asin(x: Num): Num val LOG2E: Num - fun min(values: Num): Num + fun min(values: (Num) | (MutArray[Num])): Num fun cos(x: Num): Num val LOG10E: Num val PI: Num @@ -56,7 +56,7 @@ declare trait Math { fun atan(x: Num): Num fun pow(x: Num, y: Num): Num fun ceil(x: Num): Num - fun max(values: Num): Num + fun max(values: (Num) | (MutArray[Num])): Num fun atan2(y: Num, x: Num): Num fun sqrt(x: Num): Num fun tan(x: Num): Num @@ -74,31 +74,31 @@ declare trait Date { fun getDate(): Num fun getUTCDate(): Num fun setDate(date: Num): Num - val setFullYear: (((year: Num) => Num) & ((year: Num, month: Num) => Num)) & ((year: Num, month: Num, date: Num) => Num) + fun setFullYear(year: Num, month: (Num) | (undefined), date: (Num) | (undefined)): Num fun getMinutes(): Num fun getFullYear(): Num fun setUTCDate(date: Num): Num - val setMinutes: (((min: Num) => Num) & ((min: Num, sec: Num) => Num)) & ((min: Num, sec: Num, ms: Num) => Num) + fun setMinutes(min: Num, sec: (Num) | (undefined), ms: (Num) | (undefined)): Num fun setTime(time: Num): Num fun toUTCString(): Str fun toLocaleDateString(): Str - val setUTCMonth: ((month: Num) => Num) & ((month: Num, date: Num) => Num) - val setUTCFullYear: (((year: Num) => Num) & ((year: Num, month: Num) => Num)) & ((year: Num, month: Num, date: Num) => Num) - val setHours: ((((hours: Num) => Num) & ((hours: Num, min: Num) => Num)) & ((hours: Num, min: Num, sec: Num) => Num)) & ((hours: Num, min: Num, sec: Num, ms: Num) => Num) + fun setUTCMonth(month: Num, date: (Num) | (undefined)): Num + fun setUTCFullYear(year: Num, month: (Num) | (undefined), date: (Num) | (undefined)): Num + fun setHours(hours: Num, min: (Num) | (undefined), sec: (Num) | (undefined), ms: (Num) | (undefined)): Num fun getTime(): Num - val setSeconds: ((sec: Num) => Num) & ((sec: Num, ms: Num) => Num) - val setUTCSeconds: ((sec: Num) => Num) & ((sec: Num, ms: Num) => Num) + fun setSeconds(sec: Num, ms: (Num) | (undefined)): Num + fun setUTCSeconds(sec: Num, ms: (Num) | (undefined)): Num fun getUTCFullYear(): Num fun getUTCHours(): Num fun getUTCDay(): Num - val setUTCMinutes: (((min: Num) => Num) & ((min: Num, sec: Num) => Num)) & ((min: Num, sec: Num, ms: Num) => Num) + fun setUTCMinutes(min: Num, sec: (Num) | (undefined), ms: (Num) | (undefined)): Num fun getHours(): Num fun toISOString(): Str fun toTimeString(): Str fun setUTCMilliseconds(ms: Num): Num fun getUTCSeconds(): Num fun getMilliseconds(): Num - val setMonth: ((month: Num) => Num) & ((month: Num, date: Num) => Num) + fun setMonth(month: Num, date: (Num) | (undefined)): Num fun getDay(): Num fun toLocaleTimeString(): Str fun getSeconds(): Num @@ -107,6 +107,6 @@ declare trait Date { fun toString(): Str fun getMonth(): Num fun getTimezoneOffset(): Num - val setUTCHours: ((((hours: Num) => Num) & ((hours: Num, min: Num) => Num)) & ((hours: Num, min: Num, sec: Num) => Num)) & ((hours: Num, min: Num, sec: Num, ms: Num) => Num) - val toJSON: (() => Str) & ((key: anything) => Str) + fun setUTCHours(hours: Num, min: (Num) | (undefined), sec: (Num) | (undefined), ms: (Num) | (undefined)): Num + fun toJSON(key: (anything) | (undefined)): Str } diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index cb42936a9..ce190e93c 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,22 +1,22 @@ export declare module Optional { - fun buildName: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) - fun buildName2: ((firstName: Str) => Str) & ((firstName: Str, lastName: Str) => Str) - fun buildName3(firstName: Str, lastName: Str): Str - fun buildName4(firstName: Str, lastName: anything): Str + fun buildName(firstName: Str, lastName: (Str) | (undefined)): Str + fun buildName2(firstName: Str, lastName: (Str) | (undefined)): Str + fun buildName3(firstName: Str, lastName: (Str) | (MutArray[Str])): Str + fun buildName4(firstName: Str, lastName: (anything) | (MutArray[anything])): Str declare trait SquareConfig { val color: (Str) | (undefined) val width: (Num) | (undefined) } - fun did: ((x: Num) => Num) & ((x: Num, f: (x: Num) => Num) => Num) - fun getOrElse: (() => Object) & ((arr: MutArray[Object]) => Object) + fun did(x: Num, f: ((x: Num) => Num) | (undefined)): Num + fun getOrElse(arr: (MutArray[Object]) | (undefined)): Object declare class ABC {} - fun testABC: (() => unit) & ((abc: ABC) => unit) - fun testSquareConfig: (() => unit) & ((conf: SquareConfig) => unit) - fun err: (() => unit) & ((msg: (Num, Str, )) => unit) - fun toStr: (() => Str) & ((x: ((Num) | (false)) | (true)) => Str) - fun boo[T, U](x: (T) & (U)): unit /* warning: the overload of function boo is not supported yet. */ + fun testABC(abc: (ABC) | (undefined)): unit + fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit + fun err(msg: ((Num, Str, )) | (undefined)): unit + fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str + fun boo[T, U](x: ((T) & (U)) | (undefined)): unit declare class B[T] { val b: T } - fun boom: (() => anything) & ((b: B[nothing]) => anything) + fun boom(b: (B[nothing]) | (undefined)): anything } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 453e3803c..5ff98ba7a 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,24 +1,24 @@ export declare module Overload { - fun f: ((x: Num) => Str) & ((x: Str) => Str) + fun f(x: anything): Str /* warning: the overload of function f is not supported yet. */ declare class M { - val foo: ((x: Num) => Str) & ((x: Str) => Str) + fun foo(x: anything): Str /* warning: the overload of function foo is not supported yet. */ } - fun app: ((f: (x: Str) => unit, x: Num) => unit) & ((f: (x: Str) => unit, x: Str) => unit) - fun create: ((x: Num) => () => (false) | (true)) & ((x: (false) | (true)) => () => (false) | (true)) - fun g0: ((x: MutArray[Str]) => Str) & ((x: MutArray[Object]) => Str) - fun db: ((x: Num) => MutArray[Num]) & ((x: Object) => MutArray[Num]) + fun app(f: anything, x: anything): unit /* warning: the overload of function app is not supported yet. */ + fun create(x: anything): () => (false) | (true) /* warning: the overload of function create is not supported yet. */ + fun g0(x: anything): Str /* warning: the overload of function g0 is not supported yet. */ + fun db(x: anything): MutArray[Num] /* warning: the overload of function db is not supported yet. */ declare class N {} - fun id: ((x: M) => unit) & ((x: N) => unit) - fun tst: ((x: {z: Num,}) => {y: Str,}) & ((x: {z: (false) | (true),}) => {y: Str,}) - fun op: ((((x: Num) => unit) & ((x: Num, y: Num) => unit)) & ((x: Num) => unit)) & ((x: Num, y: (false) | (true)) => unit) - fun swap: ((x: (Num, Str, )) => (Num, Str, )) & ((x: (Str, Num, )) => (Num, Str, )) - fun u: ((x: ((Num) | (false)) | (true)) => Str) & ((x: Object) => Str) - fun doSome[T, U](x: anything): unit /* warning: the overload of function doSome is not supported yet. */ + fun id(x: anything): unit /* warning: the overload of function id is not supported yet. */ + fun tst(x: anything): {y: Str,} /* warning: the overload of function tst is not supported yet. */ + fun op(x: anything, y: anything): unit /* warning: the overload of function op is not supported yet. */ + fun swap(x: anything): MutArray[anything] /* warning: the overload of function swap is not supported yet. */ + fun u(x: anything): Str /* warning: the overload of function u is not supported yet. */ + fun doSome[T, U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ module XX { - fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ + export fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { - fun F[T](x: T): anything /* warning: the overload of function F is not supported yet. */ + fun F[T](x: T): T /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } diff --git a/ts2mls/js/src/test/typescript/Overload.ts b/ts2mls/js/src/test/typescript/Overload.ts index d0c26274b..fc4b0dd12 100644 --- a/ts2mls/js/src/test/typescript/Overload.ts +++ b/ts2mls/js/src/test/typescript/Overload.ts @@ -10,7 +10,7 @@ class M { foo(x: number): string; foo(x: string): string; - foo(x) { + foo(x): string { return x.toString(); } } @@ -25,21 +25,21 @@ function app(f, x): void { function create(x: number): () => boolean; function create(x: boolean): () => boolean; -function create(x) { +function create(x): () => boolean { return function() { return x == 0; } } function g0(x: string[]): string; function g0(x: object[]): string; -function g0(x) { +function g0(x): string { return x[0].toString(); } function db(x: number): number[]; function db(x: object): number[]; -function db(x) { +function db(x): number[] { return [0, 1]; } @@ -53,16 +53,16 @@ function id(x) {} function tst(x: {z: number}): {y: string}; function tst(x: {z: boolean}): {y: string}; -function tst(x) { +function tst(x): {y: string} { return {y: x.z.toString()} } function op(x: number, y?: number): void; function op(x: number, y?: boolean): void; -function op(x, y) {} +function op(x, y): void {} -function swap(x: [number, string]): [number, string]; +function swap(x: [number, string]): [string, number]; function swap(x: [string, number]): [number, string]; function swap(x) { @@ -72,14 +72,14 @@ function swap(x) { function u(x: number | boolean): string; function u(x: object): string; -function u(x) { +function u(x): string { return x.toString(); } function doSome(x: T & U): never; function doSome(x: string): never; -function doSome(x) { +function doSome(x): never { while (true); } @@ -87,7 +87,7 @@ namespace XX { export function f(x: T, n: number): string; export function f(x: T, n: boolean): string; - export function f(x: T, n) { + export function f(x: T, n): string { return ""; } } @@ -96,7 +96,7 @@ class WWW { F(x: string): T; F(x: number): T; - F(x: T) { + F(x: T): T { return null; } } From 69bf8689d098d637bbfc4f8f2ac5c6e42f5c5840 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 14:03:16 +0800 Subject: [PATCH 102/202] WIP: Fix ts2mls test and allow to ignore type errors --- driver/js/src/main/scala/driver/Driver.scala | 19 ++++--- .../src/main/scala/driver/DriverOptions.scala | 1 + .../test/scala/driver/DriverDiffTests.scala | 52 +++++++++++-------- shared/src/test/diff/nu/AbstractClasses.mls | 2 - .../src/main/scala/ts2mls/TSNamespace.scala | 2 +- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/Escape.mlsi | 4 +- ts2mls/js/src/test/diff/Export.mlsi | 2 +- ts2mls/js/src/test/diff/Heritage.mlsi | 2 +- ts2mls/js/src/test/diff/Namespace.mlsi | 8 +-- ts2mls/js/src/test/diff/Overload.mlsi | 2 +- ts2mls/js/src/test/diff/Type.mlsi | 2 +- ts2mls/js/src/test/diff/Variables.mlsi | 4 +- 13 files changed, 55 insertions(+), 47 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index e426bc907..37770fdff 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -58,7 +58,7 @@ class Driver(options: DriverOptions) { try { Driver.totalErrors = 0 implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = report + implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.ignoreTypeError) implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() @@ -68,7 +68,7 @@ class Driver(options: DriverOptions) { } catch { case err: Diagnostic => - report(err) + report(err, options.ignoreTypeError) false case t : Throwable => report(s"unexpected error: ${t.toString()}") @@ -77,7 +77,7 @@ class Driver(options: DriverOptions) { def genPackageJson(): Unit = if (!exists(s"${options.outputDir}/package.json")) { - val content = """{ "type": "module" }""" // TODO: more settings? + val content = "{ 'type': 'module' }\n" // TODO: more settings? saveToFile(s"${options.outputDir}/package.json", content) } @@ -181,7 +181,7 @@ class Driver(options: DriverOptions) { return tsprog.generate } parseAndRun(file.filename, { - case (definitions, _, imports, _) => { + case (definitions, declarations, imports, _) => { val depList = imports.map(_.path) val (cycleList, otherList) = depList.partitionMap { dep => { @@ -244,6 +244,7 @@ class Driver(options: DriverOptions) { } ), exported || importedModule(file.filename)) } + else `type`(TypingUnit(declarations, Nil)) true } else false @@ -264,7 +265,7 @@ class Driver(options: DriverOptions) { val code = lines.mkString("", "\n", "\n") saveToFile(filename, code) } catch { - case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation)) + case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation), options.ignoreTypeError) } } @@ -288,17 +289,19 @@ object Driver { } // TODO factor with duplicated logic in DiffTests - private def report(diag: Diagnostic): Unit = { + private def report(diag: Diagnostic, ignoreTypeError: Boolean): Unit = { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") val headStr = diag match { case ErrorReport(msg, loco, src) => - totalErrors += 1 src match { case Diagnostic.Lexing => + totalErrors += 1 s"╔══[LEXICAL ERROR] " case Diagnostic.Parsing => + totalErrors += 1 s"╔══[PARSE ERROR] " - case _ => // TODO customize too + case _ => + if (!ignoreTypeError) totalErrors += 1 s"╔══[ERROR] " } case WarningReport(msg, loco, src) => diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index 68dec013b..af3f347ea 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -11,5 +11,6 @@ final case class DriverOptions( outputDir: String, tsconfig: Option[String], interfaceDir: String, + ignoreTypeError: Boolean, force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index b1dc6adc0..0fa9a5020 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -11,8 +11,8 @@ class DriverDiffTests extends AnyFunSuite { import ts2mls.JSFileSystem._ testCases.foreach { - case TestOption(filename, workDir, interfaceDir, execution, tsconfig, expectError) => test(filename) { - val options = DriverOptions(filename, workDir, jsPath, tsconfig, interfaceDir, forceCompiling) + case TestOption(filename, workDir, interfaceDir, execution, tsconfig, ignoreTypeError, expectError) => test(filename) { + val options = DriverOptions(filename, workDir, jsPath, tsconfig, interfaceDir, ignoreTypeError, forceCompiling) val driver = Driver(options) driver.genPackageJson() val success = driver.execute @@ -46,55 +46,61 @@ object DriverDiffTests { interfaceDir: String, execution: Option[(String, String)], tsconfig: Option[String], + ignoreTypeError: Boolean, expectError: Boolean ) - private def entry(entryModule: String, tsconfig: Option[String] = None, expectError: Boolean = false) = + private def entry( + entryModule: String, + tsconfig: Option[String] = None, + ignoreTypeError: Boolean = false, + expectError: Boolean = false + ) = TestOption( s"./mlscript/${entryModule}.mls", diffPath, ".interfaces", Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), tsconfig, + ignoreTypeError, expectError ) - private def ts2mlsEntry(entryModule: String, expectError: Boolean = false) = - TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, expectError) + private def ts2mlsEntry(entryModule: String, ignoreTypeError: Boolean = false, expectError: Boolean = false) = + TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, ignoreTypeError, expectError) private val testCases = List[TestOption]( entry("Simple"), entry("Cycle2"), entry("Self", expectError = true), entry("C", expectError = true), - entry("TS", Some("./tsconfig.json"), true), // TODO: type members + entry("TS", Some("./tsconfig.json"), expectError = true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), - entry("MyPartialOrder", Some("./tsconfig.json"), true), // TODO: type traits in modules - ts2mlsEntry("Array"), - ts2mlsEntry("BasicFunctions"), + entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + ts2mlsEntry("Array", ignoreTypeError = true), + ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", true), // TODO: Module `Cycle1` is not supported yet. - ts2mlsEntry("Dec"), + ts2mlsEntry("Cycle1", expectError = true), + ts2mlsEntry("Dec", ignoreTypeError = true), ts2mlsEntry("Enum"), - ts2mlsEntry("ES5"), ts2mlsEntry("Escape"), - ts2mlsEntry("Export"), - ts2mlsEntry("Heritage"), + ts2mlsEntry("Export", ignoreTypeError = true), + ts2mlsEntry("Heritage", ignoreTypeError = true), ts2mlsEntry("HighOrderFunc"), ts2mlsEntry("Import"), - ts2mlsEntry("InterfaceMember"), - ts2mlsEntry("Intersection"), + ts2mlsEntry("InterfaceMember", ignoreTypeError = true), + ts2mlsEntry("Intersection", ignoreTypeError = true), ts2mlsEntry("Literal"), - ts2mlsEntry("Namespace"), - ts2mlsEntry("Optional"), - ts2mlsEntry("Overload"), - ts2mlsEntry("Tuple"), - ts2mlsEntry("Type"), - ts2mlsEntry("TypeParameter"), + ts2mlsEntry("Namespace", expectError = true), + ts2mlsEntry("Optional", ignoreTypeError = true), + ts2mlsEntry("Overload", ignoreTypeError = true), + ts2mlsEntry("Tuple", ignoreTypeError = true), + ts2mlsEntry("Type", ignoreTypeError = true), + ts2mlsEntry("TypeParameter", ignoreTypeError = true), ts2mlsEntry("Union"), - ts2mlsEntry("Variables"), + ts2mlsEntry("Variables", expectError = true), ) private val cp = g.require("child_process") diff --git a/shared/src/test/diff/nu/AbstractClasses.mls b/shared/src/test/diff/nu/AbstractClasses.mls index c693dfdf2..b8749319e 100644 --- a/shared/src/test/diff/nu/AbstractClasses.mls +++ b/shared/src/test/diff/nu/AbstractClasses.mls @@ -167,5 +167,3 @@ class C { //│ } //│ Code generation encountered an error: //│ unresolved symbol x - - diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index b6e061dec..998a95084 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -68,7 +68,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { order.toList.foreach((p) => p match { case Left(subName) => { val ss = subSpace(subName) - writer.writeln(s"${indent}${expStr(ss._2)}module ${Converter.escapeIdent(subName)} {") + writer.writeln(s"${indent}${expStr(ss._2)}declare module ${Converter.escapeIdent(subName)} {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index b87747f7f..03a2520a0 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -8,6 +8,6 @@ export declare module Dec { constructor(name: Str, age: Num) fun getName(id: Num): Str } - module OOO { + declare module OOO { } } diff --git a/ts2mls/js/src/test/diff/Escape.mlsi b/ts2mls/js/src/test/diff/Escape.mlsi index a63862a66..668a76998 100644 --- a/ts2mls/js/src/test/diff/Escape.mlsi +++ b/ts2mls/js/src/test/diff/Escape.mlsi @@ -7,8 +7,8 @@ export declare module Escape { } fun id"mixin"(id"module": Str): unit val id"forall": Num - module id"trait" { - module id"of" { + declare module id"trait" { + declare module id"of" { } } } diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index d13584f38..fb23f1e11 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -1,6 +1,6 @@ import "./Dependency.mlsi" export declare module Export { - export module Foo { + export declare module Foo { export fun Baz(aa: Str): IBar declare trait IBar { val a: Str diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index aa435fc64..814d11c9e 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -32,7 +32,7 @@ export declare module Heritage { declare class OR[R] extends O[R] { fun xx(x: R): R } - module Five { + declare module Five { export declare class ROTK { val wu: Str } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 535e33d61..e204e92d3 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,5 +1,5 @@ export declare module Namespace { - module N1 { + declare module N1 { export fun f(x: anything): Num fun ff(y: anything): Num export declare class C { @@ -8,13 +8,13 @@ export declare module Namespace { declare trait I { fun f(): Num } - export module N2 { + export declare module N2 { export fun fff(x: (false) | (true)): Num fun gg(c: C): C declare class BBB extends C {} } } - module AA { + declare module AA { export fun f(x: anything): Str export declare class C { fun f(): unit @@ -22,7 +22,7 @@ export declare module Namespace { export declare trait I { fun f(): Num } - export module N2 { + export declare module N2 { } } fun f1(x: N1.C): N1.C diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 5ff98ba7a..390bb23f1 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -14,7 +14,7 @@ export declare module Overload { fun swap(x: anything): MutArray[anything] /* warning: the overload of function swap is not supported yet. */ fun u(x: anything): Str /* warning: the overload of function u is not supported yet. */ fun doSome[T, U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ - module XX { + declare module XX { export fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index b6cde3674..3094ef5f1 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -17,7 +17,7 @@ export declare module Type { declare class ABC {} type DEF = ABC type TP[A, B, C] = (A, B, C, ) - module NA { + declare module NA { fun fb(b: Str): unit export type B = Str } diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index a099af375..6741892d2 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -5,11 +5,11 @@ export declare module Variables { val bar: false declare class FooBar {} val fb: FooBar - module ABC { + declare module ABC { export declare class DEF {} } val d: ABC.DEF - module DD { + declare module DD { export val foo: Num val bar: Num } From 2557cbf2f4d8f6d5cdaa454d58968c2384228a11 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 14:32:33 +0800 Subject: [PATCH 103/202] WIP: Rerun test --- driver/js/src/main/scala/driver/Driver.scala | 2 ++ driver/js/src/test/output/TS.check | 1 + driver/js/src/test/projects/.interfaces/mlscript/C.mlsi | 2 +- driver/js/src/test/projects/mlscript/C.mls | 2 +- driver/js/src/test/scala/driver/DriverDiffTests.scala | 2 +- 5 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 driver/js/src/test/output/TS.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 37770fdff..b63b10c3f 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -266,6 +266,8 @@ class Driver(options: DriverOptions) { saveToFile(filename, code) } catch { case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation), options.ignoreTypeError) + case t : Throwable => + report(s"unexpected error: ${t.toString()}") } } diff --git a/driver/js/src/test/output/TS.check b/driver/js/src/test/output/TS.check new file mode 100644 index 000000000..87cffa027 --- /dev/null +++ b/driver/js/src/test/output/TS.check @@ -0,0 +1 @@ +[love from ts] hello world!. (Sun Apr 16 2006 06:58:39 GMT+0800 (China Standard Time)) diff --git a/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi index 9bce5c6ad..8d8ba6285 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi @@ -2,5 +2,5 @@ import "./B.mlsi" declare module C() { let a: error let b: error - undefined + unit } diff --git a/driver/js/src/test/projects/mlscript/C.mls b/driver/js/src/test/projects/mlscript/C.mls index 2cdb50f85..207de4e8c 100644 --- a/driver/js/src/test/projects/mlscript/C.mls +++ b/driver/js/src/test/projects/mlscript/C.mls @@ -2,4 +2,4 @@ import "./B.mls" let a = B.foo let b = A.Foo(0) // not allowed, unless we import "A.mls" -log(a.x) +console.log(a.x) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 0fa9a5020..ee9c1e86d 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -74,7 +74,7 @@ object DriverDiffTests { entry("Cycle2"), entry("Self", expectError = true), entry("C", expectError = true), - entry("TS", Some("./tsconfig.json"), expectError = true), // TODO: type members + entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), From 267f1e5e4f60f6eeea1390f9ff3e2d138d52e8a2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 14:36:58 +0800 Subject: [PATCH 104/202] WIP: Refactor backend --- driver/js/src/main/scala/driver/Driver.scala | 4 +- .../src/main/scala/driver/DriverBackend.scala | 77 +++++++++++++++++++ .../src/main/scala/mlscript/JSBackend.scala | 71 ----------------- 3 files changed, 79 insertions(+), 73 deletions(-) create mode 100644 driver/js/src/main/scala/driver/DriverBackend.scala diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index b63b10c3f..09523f7bd 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -12,7 +12,7 @@ import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, Fi class Driver(options: DriverOptions) { import Driver._ import ts2mls.JSFileSystem._ - import JSCompilerBackend.ModuleType + import JSDriverBackend.ModuleType private val typer = new mlscript.Typer( @@ -259,7 +259,7 @@ class Driver(options: DriverOptions) { imports: Ls[Import with ModuleType], exported: Boolean ): Unit = try { - val backend = new JSCompilerBackend() + val backend = new JSDriverBackend() jsBuiltinDecs.foreach(lst => backend.declareJSBuiltin(Pgrm(lst))) val lines = backend(program, moduleName, imports, exported) val code = lines.mkString("", "\n", "\n") diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala new file mode 100644 index 000000000..1c3237e3f --- /dev/null +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -0,0 +1,77 @@ +package driver + +import mlscript._ +import mlscript.codegen._ +import mlscript.utils._, shorthands._, algorithms._ +import mlscript.codegen.Helpers._ + +class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { + def declareJSBuiltin(pgrm: Pgrm): Unit = { + val (typeDefs, otherStmts) = pgrm.tops.partitionMap { + case ot: Terms => R(ot) + case fd: NuFunDef => R(fd) + case nd: NuTypeDef => L(nd) + case _ => die + } + + declareNewTypeDefs(typeDefs, true)(topLevelScope) + otherStmts.foreach { + case NuFunDef(_, Var(name), _, _) => + topLevelScope.declareStubValue(name)(true) + case _ => () + } + } + + private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool): Ls[Str] = { + val (typeDefs, otherStmts) = pgrm.tops.partitionMap { + case ot: Terms => R(ot) + case fd: NuFunDef => R(fd) + case nd: NuTypeDef => L(nd) + case _ => die + } + + val topModule = topLevelScope.declareTopModule(topModuleName, otherStmts, typeDefs, false) + val moduleDecl = translateTopModuleDeclaration(topModule, false, true)(topLevelScope) + val initMethod = moduleDecl.methods.lastOption match { + case Some(JSClassMethod(name, _, _)) => name + case _ => throw new CodeGenError(s"can not get $$init method of module $topModuleName.") + } + val invoke = JSInvoke(JSIdent(topModuleName).member(initMethod), Nil).stmt + val insDecl = JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl))) + + val ins = + if (exported) JSExport(insDecl) :: invoke :: Nil + else insDecl :: invoke :: Nil + + SourceCode.fromStmts(polyfill.emit() ++ ins).toLines + } + + import JSDriverBackend.ModuleType + + private def translateImport(imp: Import with ModuleType) = { + val path = imp.path + val last = path.lastIndexOf(".") + JSImport( + path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), + path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), + imp.isESModule + ) + } + + def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool): Ls[Str] = { + imports.flatMap (imp => { + val path = imp.path + val last = path.lastIndexOf(".") + val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) + topLevelScope.declareValue(moduleName, Some(false), false) + translateImport(imp).toSourceCode.toLines + }) ::: generateNewDef(pgrm, topModuleName, exported) + } +} + +object JSDriverBackend { + // N -> mls module, S(true) -> ES module, S(false) -> CommonJS module + trait ModuleType { + val isESModule: Opt[Bool] + } +} diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index c51c4fa01..00da14ce1 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -1077,77 +1077,6 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } -class JSCompilerBackend extends JSBackend(allowUnresolvedSymbols = false) { - def declareJSBuiltin(pgrm: Pgrm): Unit = { - val (typeDefs, otherStmts) = pgrm.tops.partitionMap { - case ot: Terms => R(ot) - case fd: NuFunDef => R(fd) - case nd: NuTypeDef => L(nd) - case _ => die - } - - declareNewTypeDefs(typeDefs, true)(topLevelScope) - otherStmts.foreach { - case NuFunDef(_, Var(name), _, _) => - topLevelScope.declareStubValue(name)(true) - case _ => () - } - } - - private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool): Ls[Str] = { - val (typeDefs, otherStmts) = pgrm.tops.partitionMap { - case ot: Terms => R(ot) - case fd: NuFunDef => R(fd) - case nd: NuTypeDef => L(nd) - case _ => die - } - - val topModule = topLevelScope.declareTopModule(topModuleName, otherStmts, typeDefs, false) - val moduleDecl = translateTopModuleDeclaration(topModule, false, true)(topLevelScope) - val initMethod = moduleDecl.methods.lastOption match { - case Some(JSClassMethod(name, _, _)) => name - case _ => throw new CodeGenError(s"can not get $$init method of module $topModuleName.") - } - val invoke = JSInvoke(JSIdent(topModuleName).member(initMethod), Nil).stmt - val insDecl = JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl))) - - val ins = - if (exported) JSExport(insDecl) :: invoke :: Nil - else insDecl :: invoke :: Nil - - SourceCode.fromStmts(polyfill.emit() ++ ins).toLines - } - - import JSCompilerBackend.ModuleType - - private def translateImport(imp: Import with ModuleType) = { - val path = imp.path - val last = path.lastIndexOf(".") - JSImport( - path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), - path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), - imp.isESModule - ) - } - - def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool): Ls[Str] = { - imports.flatMap (imp => { - val path = imp.path - val last = path.lastIndexOf(".") - val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) - topLevelScope.declareValue(moduleName, Some(false), false) - translateImport(imp).toSourceCode.toLines - }) ::: generateNewDef(pgrm, topModuleName, exported) - } -} - -object JSCompilerBackend { - // N -> mls module, S(true) -> ES module, S(false) -> CommonJS module - trait ModuleType { - val isESModule: Opt[Bool] - } -} - class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { // Name of the array that contains execution results val resultsName: Str = topLevelScope declareRuntimeSymbol "results" From c3486f6a258cb4d2b65187c28a752430ab507687 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 16 Jun 2023 14:53:24 +0800 Subject: [PATCH 105/202] WIP: Add Unsupported type(not ready) --- shared/src/main/scala/mlscript/TyperDatatypes.scala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index 673f08def..596457ce8 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -293,16 +293,26 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = MinLevel override def toString = if (pol) "⊥" else "⊤" } + + sealed abstract class UnusableLike extends AbstractTag /** Represents a type variable skolem that was extruded outsdie its polym level. * The goal is to retain precise information to produce good errors, * but still have this be functionally equivalent to `ExtrType(pol)`. */ - case class Extruded(pol: Bool, underlying: SkolemTag)(val prov: TypeProvenance, val reason: Ls[Ls[ST]]) extends AbstractTag with TypeVarOrRigidVar { + case class Extruded(pol: Bool, underlying: SkolemTag)(val prov: TypeProvenance, val reason: Ls[Ls[ST]]) extends UnusableLike with TypeVarOrRigidVar { val level: Level = MinLevel val id = underlying.id def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = 0 override def toString = if (pol) s"⊥(${underlying})" else s"⊤(${underlying})" } + + // TODO: implement Unsupported + case class Unsupported(underlying: SkolemTag)(val prov: TypeProvenance) extends UnusableLike { + val level: Level = MinLevel + val id = underlying.id + def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = 0 + override def toString = "" + } /** Polarity `pol` being `true` means union; `false` means intersection. */ case class ComposedType(pol: Bool, lhs: SimpleType, rhs: SimpleType)(val prov: TypeProvenance) extends SimpleType { From 5068d9b10e98c689be9b64d188363c4c8d67387a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 17 Jun 2023 11:10:17 +0800 Subject: [PATCH 106/202] WIP: Fix codegen error swallowing --- driver/js/src/main/scala/driver/Driver.scala | 4 +++- driver/js/src/test/scala/driver/DriverDiffTests.scala | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 09523f7bd..a36a624bd 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -265,7 +265,9 @@ class Driver(options: DriverOptions) { val code = lines.mkString("", "\n", "\n") saveToFile(filename, code) } catch { - case CodeGenError(err) => report(ErrorReport(err, Nil, Diagnostic.Compilation), options.ignoreTypeError) + case CodeGenError(err) => + totalErrors += 1 + report(s"codegen error: $err") case t : Throwable => report(s"unexpected error: ${t.toString()}") } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index ee9c1e86d..f1644bbcc 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -73,7 +73,7 @@ object DriverDiffTests { entry("Simple"), entry("Cycle2"), entry("Self", expectError = true), - entry("C", expectError = true), + entry("C", ignoreTypeError = true, expectError = true), entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), From 91e4875ede29b27f85a807a6df8c7d487562df2c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 19 Jun 2023 11:19:20 +0800 Subject: [PATCH 107/202] WIP: Parse but not type yet --- .../main/scala/mlscript/ConstraintSolver.scala | 7 +++++-- shared/src/main/scala/mlscript/NewLexer.scala | 7 +++++++ .../main/scala/mlscript/TypeSimplifier.scala | 2 +- shared/src/main/scala/mlscript/Typer.scala | 1 + .../main/scala/mlscript/TyperDatatypes.scala | 9 +++++---- .../src/main/scala/mlscript/TyperHelpers.scala | 8 ++++---- shared/src/test/diff/nu/Unsupported.mls | 17 +++++++++++++++++ 7 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 shared/src/test/diff/nu/Unsupported.mls diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 085e87cb2..126f7352c 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -1040,6 +1040,7 @@ class ConstraintSolver extends NormalForms { self: Typer => def doesntMatch(ty: SimpleType) = msg"does not match type `${ty.expNeg}`" def doesntHaveField(n: Str) = msg"does not have field '$n'" + def doesntSupport(uns: Unsupported) = msg"does not support TypeScript type ${uns.showTSType} " val lhsChain: List[ST] = cctx._1 val rhsChain: List[ST] = cctx._2 @@ -1166,6 +1167,8 @@ class ConstraintSolver extends NormalForms { self: Typer => } ) return raise(ErrorReport(msgs ::: mk_constraintProvenanceHints)) + case (lhs: Unsupported, _) => doesntSupport(lhs) + case (_, rhs: Unsupported) => doesntSupport(rhs) case (_: TV | _: ProxyType, _) => doesntMatch(rhs) case (RecordType(fs0), RecordType(fs1)) => (fs1.map(_._1).toSet -- fs0.map(_._1).toSet) @@ -1337,7 +1340,7 @@ class ConstraintSolver extends NormalForms { self: Typer => new Extruded(!pol, tt)( tt.prov.copy(desc = "extruded type variable reference"), reason) } else ty - case _: ClassTag | _: TraitTag | _: Extruded => ty + case _: ClassTag | _: TraitTag | _: UnusableLike => ty case tr @ TypeRef(d, ts) => TypeRef(d, tr.mapTargs(S(pol)) { case (N, targ) => @@ -1544,7 +1547,7 @@ class ConstraintSolver extends NormalForms { self: Typer => case p @ ProxyType(und) => freshen(und) case SkolemTag(level, id) if level > above && level <= below => freshen(id) - case _: ClassTag | _: TraitTag | _: SkolemTag | _: Extruded => ty + case _: ClassTag | _: TraitTag | _: SkolemTag | _: UnusableLike => ty case w @ Without(b, ns) => Without(freshen(b), ns)(w.prov) case tr @ TypeRef(d, ts) => TypeRef(d, ts.map(freshen(_)))(tr.prov) case pt @ PolymorphicType(polyLvl, bod) if pt.level <= above => pt // is this really useful? diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 9131451fa..a3d17e3e2 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -120,6 +120,13 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { } // go(k2, LITVAL(StrLit(chars))) lex(k2, ind, next(k2, LITVAL(StrLit(chars)))) + case '$' => + val (n, j) = takeWhile(i + 1)(isIdentChar) + if (n === "Unsupported") lex(j, ind, next(j, IDENT("$Unsupported", false))) + else { + pe(msg"unexpected character $$") + lex(i + 1, ind, next(i + 1, ERROR)) + } case '/' if bytes.lift(i + 1).contains('/') => val j = i + 2 val (txt, k) = diff --git a/shared/src/main/scala/mlscript/TypeSimplifier.scala b/shared/src/main/scala/mlscript/TypeSimplifier.scala index d088eba87..843c0a515 100644 --- a/shared/src/main/scala/mlscript/TypeSimplifier.scala +++ b/shared/src/main/scala/mlscript/TypeSimplifier.scala @@ -944,7 +944,7 @@ trait TypeSimplifier { self: Typer => case ot @ Overload(as) => ot.mapAltsPol(pol)((p, t) => transform(t, p, parents, canDistribForall)) case SkolemTag(lvl, id) => transform(id, pol, parents) - case _: ObjectTag | _: Extruded | ExtrType(_) => st + case _: ObjectTag | _: UnusableLike | ExtrType(_) => st case tv: TypeVariable if parents.exists(_ === tv) => if (pol(tv).getOrElse(lastWords(s"parent in invariant position $tv $parents"))) BotType else TopType case tv: TypeVariable => diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index b70548327..73bf2acfb 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -1479,6 +1479,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, var ne } case ex @ Extruded(p, SkolemTag(_, tv)) => if (p) tv.asPosExtrudedTypeVar else tv.asNegExtrudedTypeVar + case _: Unsupported => Bot // TODO: do we need pol? case TypeRef(td, Nil) => td case tr @ TypeRef(td, targs) => AppliedType(td, tr.mapTargs(S(true)) { case ta @ ((S(true), TopType) | (S(false), BotType)) => Bounds(Bot, Top) diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index 596457ce8..501ce4d85 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -307,11 +307,11 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => } // TODO: implement Unsupported - case class Unsupported(underlying: SkolemTag)(val prov: TypeProvenance) extends UnusableLike { + case class Unsupported(id: Var, tp: Str, file: Str, line: Int, col: Int)(val prov: TypeProvenance) extends UnusableLike { val level: Level = MinLevel - val id = underlying.id def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = 0 - override def toString = "" + override def toString = s"Unsupported(${id.name}: $showTSType)" + def showTSType: Str = s"$tp at $file, $line, $col" } /** Polarity `pol` being `true` means union; `false` means intersection. */ @@ -389,9 +389,10 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => case (obj1: ObjectTag, obj2: ObjectTag) => obj1.id compare obj2.id case (SkolemTag(_, id1), SkolemTag(_, id2)) => id1 compare id2 case (Extruded(_, id1), Extruded(_, id2)) => id1 compare id2 + case (uns1: Unsupported, uns2: Unsupported) => uns1.id compare uns2.id case (_: ObjectTag, _) => 0 case (_: SkolemTag, _) => 1 - case (_: Extruded, _) => 2 + case (_: UnusableLike, _) => 2 } } diff --git a/shared/src/main/scala/mlscript/TyperHelpers.scala b/shared/src/main/scala/mlscript/TyperHelpers.scala index 994173245..87e2873d4 100644 --- a/shared/src/main/scala/mlscript/TyperHelpers.scala +++ b/shared/src/main/scala/mlscript/TyperHelpers.scala @@ -689,7 +689,7 @@ abstract class TyperHelpers { Typer: Typer => case ExtrType(_) => Nil case ProxyType(und) => pol -> und :: Nil // case _: TypeTag => Nil - case _: ObjectTag | _: Extruded => Nil + case _: ObjectTag | _: UnusableLike => Nil case SkolemTag(_, tv) => pol -> tv :: Nil case tr: TypeRef => tr.mapTargs(pol)(_ -> _) case Without(b, ns) => pol -> b :: Nil @@ -775,7 +775,7 @@ abstract class TyperHelpers { Typer: Typer => case ExtrType(_) => Nil case ProxyType(und) => pol -> und :: Nil // case _: TypeTag => Nil - case _: ObjectTag | _: Extruded => Nil + case _: ObjectTag | _: UnusableLike => Nil case SkolemTag(_, tv) => pol -> tv :: Nil case tr: TypeRef => tr.mapTargs(pol)(_ -> _) case Without(b, ns) => pol -> b :: Nil @@ -877,7 +877,7 @@ abstract class TyperHelpers { Typer: Typer => case ExtrType(_) => Nil case ProxyType(und) => und :: Nil // case _: TypeTag => Nil - case _: ObjectTag | _: Extruded => Nil + case _: ObjectTag | _: UnusableLike => Nil case SkolemTag(_, tv) => tv :: Nil case TypeRef(d, ts) => ts case Without(b, ns) => b :: Nil @@ -1262,7 +1262,7 @@ abstract class TyperHelpers { Typer: Typer => case ExtrType(_) => () case ProxyType(und) => apply(pol)(und) // case _: TypeTag => () - case _: ObjectTag | _: Extruded => () + case _: ObjectTag | _: UnusableLike => () case SkolemTag(_, tv) => apply(pol)(tv) case tr: TypeRef => tr.mapTargs(pol)(apply(_)(_)); () case Without(b, ns) => apply(pol)(b) diff --git a/shared/src/test/diff/nu/Unsupported.mls b/shared/src/test/diff/nu/Unsupported.mls new file mode 100644 index 000000000..454ec0e6e --- /dev/null +++ b/shared/src/test/diff/nu/Unsupported.mls @@ -0,0 +1,17 @@ +:NewDefs + +// TODO +:e +declare fun call: $Unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] +//│ ╔══[ERROR] type identifier not found: $Unsupported +//│ ║ l.5: declare fun call: $Unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ fun call: error + +// TODO +:re +call() +//│ error +//│ res +//│ Runtime error: +//│ ReferenceError: call is not defined From a8de13ad78836181996fc5a298c939f3b1263fe6 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 19 Jun 2023 15:30:19 +0800 Subject: [PATCH 108/202] WIP: Implement unsupported type --- .../scala/mlscript/ConstraintSolver.scala | 2 +- shared/src/main/scala/mlscript/Typer.scala | 5 ++ .../main/scala/mlscript/TyperDatatypes.scala | 8 +-- shared/src/test/diff/nu/Unsupported.mls | 55 ++++++++++++++++--- 4 files changed, 58 insertions(+), 12 deletions(-) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 126f7352c..ed7dc37e4 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -1040,7 +1040,7 @@ class ConstraintSolver extends NormalForms { self: Typer => def doesntMatch(ty: SimpleType) = msg"does not match type `${ty.expNeg}`" def doesntHaveField(n: Str) = msg"does not have field '$n'" - def doesntSupport(uns: Unsupported) = msg"does not support TypeScript type ${uns.showTSType} " + def doesntSupport(uns: Unsupported) = msg"(TypeScript type ${uns.showTSType}) is not supported" val lhsChain: List[ST] = cctx._1 val rhsChain: List[ST] = cctx._2 diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 73bf2acfb..2ee17528f 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -515,6 +515,11 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, var ne (outerCtxLvl)) // * Type variables not explicily bound are assigned the widest (the outer context's) level ).withProv(tyTp(ty.toLoc, "type variable")) }) + case app @ AppliedType(base, targs) if (base.name === "$Unsupported") => targs match { + case Literal(StrLit(tp)) :: Literal(StrLit(file)) :: Literal(IntLit(line)) :: Literal(IntLit(col)) :: Nil => + Unsupported(tp, file, line, col)(noProv) + case _ => err(msg"$$Unsupported type information missing", app.toLoc)(raise) + } case AppliedType(base, targs) => val prov = tyTp(ty.toLoc, "applied type reference") typeNamed(ty.toLoc, base.name) match { diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index 501ce4d85..58bb3d1ae 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -306,12 +306,12 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => override def toString = if (pol) s"⊥(${underlying})" else s"⊤(${underlying})" } - // TODO: implement Unsupported - case class Unsupported(id: Var, tp: Str, file: Str, line: Int, col: Int)(val prov: TypeProvenance) extends UnusableLike { + case class Unsupported(tp: Str, file: Str, line: BigInt, col: BigInt)(val prov: TypeProvenance) extends UnusableLike { + val id = StrLit(showTSType) val level: Level = MinLevel def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = 0 - override def toString = s"Unsupported(${id.name}: $showTSType)" - def showTSType: Str = s"$tp at $file, $line, $col" + override def toString = s"Unsupported($showTSType)" + def showTSType: Str = s"\"$tp\" at $file, $line, $col" } /** Polarity `pol` being `true` means union; `false` means intersection. */ diff --git a/shared/src/test/diff/nu/Unsupported.mls b/shared/src/test/diff/nu/Unsupported.mls index 454ec0e6e..8e8ec6a6a 100644 --- a/shared/src/test/diff/nu/Unsupported.mls +++ b/shared/src/test/diff/nu/Unsupported.mls @@ -1,16 +1,57 @@ :NewDefs -// TODO -:e +declare class Foo() { + val index: $Unsupported["(id: string): string;", "Invoker.ts", 11, 4] + val x = 42 +} +//│ declare class Foo() { +//│ let index: nothing +//│ let x: 42 +//│ } + declare fun call: $Unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] -//│ ╔══[ERROR] type identifier not found: $Unsupported -//│ ║ l.5: declare fun call: $Unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ fun call: error +//│ fun call: nothing + +:re +let foo = Foo() +//│ let foo: Foo +//│ foo +//│ Runtime error: +//│ ReferenceError: Foo is not defined + +:re +foo.x // ok! 42 is supported! +//│ 42 +//│ res +//│ Runtime error: +//│ ReferenceError: foo is not defined + +:e +:re +foo.index("abc") +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.31: foo.index("abc") +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ╟── signature of member `index` of type `nothing` (TypeScript type "(id: string): string;" at Invoker.ts, 11, 4) is not supported +//│ ║ l.4: val index: $Unsupported["(id: string): string;", "Invoker.ts", 11, 4] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── but it flows into field selection with expected type `"abc" -> ?a` +//│ ║ l.31: foo.index("abc") +//│ ╙── ^^^^^^^^^ +//│ error +//│ res +//│ Runtime error: +//│ ReferenceError: foo is not defined -// TODO +:e :re call() +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.48: call() +//│ ║ ^^^^^^ +//│ ╟── reference of type `nothing` (TypeScript type "(source: string, subString: string): boolean;" at Invoker.ts, 31, 54) is not supported +//│ ║ l.48: call() +//│ ╙── ^^^^ //│ error //│ res //│ Runtime error: From 26f2a26df0f55120124a08de459efd142de44091 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 19 Jun 2023 15:40:35 +0800 Subject: [PATCH 109/202] WIP: Make unsupported keyword --- shared/src/main/scala/mlscript/NewLexer.scala | 10 ++-------- shared/src/main/scala/mlscript/NewParser.scala | 3 +++ shared/src/main/scala/mlscript/Typer.scala | 4 ++-- shared/src/test/diff/nu/Unsupported.mls | 8 ++++---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index a3d17e3e2..8a222cac1 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -120,13 +120,6 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { } // go(k2, LITVAL(StrLit(chars))) lex(k2, ind, next(k2, LITVAL(StrLit(chars)))) - case '$' => - val (n, j) = takeWhile(i + 1)(isIdentChar) - if (n === "Unsupported") lex(j, ind, next(j, IDENT("$Unsupported", false))) - else { - pe(msg"unexpected character $$") - lex(i + 1, ind, next(i + 1, ERROR)) - } case '/' if bytes.lift(i + 1).contains('/') => val j = i + 2 val (txt, k) = @@ -339,7 +332,8 @@ object NewLexer { "null", "undefined", "abstract", - "constructor" + "constructor", + "unsupported" ) def printToken(tl: TokLoc): Str = tl match { diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index e4edb3c2e..3e501218c 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -603,6 +603,9 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case (KEYWORD("super"), l0) :: _ => consume exprCont(Super().withLoc(S(l0)), prec, allowNewlines = false) + case (KEYWORD("unsupported"), l0) :: _ => + consume + exprCont(Var("unsupported").withLoc(S(l0)), prec, allowNewlines = false) case (br @ BRACKETS(bk @ (Round | Square | Curly), toks), loc) :: _ => consume val res = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.argsMaybeIndented()) // TODO diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 2ee17528f..70347d0fb 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -515,10 +515,10 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, var ne (outerCtxLvl)) // * Type variables not explicily bound are assigned the widest (the outer context's) level ).withProv(tyTp(ty.toLoc, "type variable")) }) - case app @ AppliedType(base, targs) if (base.name === "$Unsupported") => targs match { + case app @ AppliedType(base, targs) if (base.name === "unsupported") => targs match { case Literal(StrLit(tp)) :: Literal(StrLit(file)) :: Literal(IntLit(line)) :: Literal(IntLit(col)) :: Nil => Unsupported(tp, file, line, col)(noProv) - case _ => err(msg"$$Unsupported type information missing", app.toLoc)(raise) + case _ => err(msg"unsupported type information missing", app.toLoc)(raise) } case AppliedType(base, targs) => val prov = tyTp(ty.toLoc, "applied type reference") diff --git a/shared/src/test/diff/nu/Unsupported.mls b/shared/src/test/diff/nu/Unsupported.mls index 8e8ec6a6a..abd78c31c 100644 --- a/shared/src/test/diff/nu/Unsupported.mls +++ b/shared/src/test/diff/nu/Unsupported.mls @@ -1,7 +1,7 @@ :NewDefs declare class Foo() { - val index: $Unsupported["(id: string): string;", "Invoker.ts", 11, 4] + val index: unsupported["(id: string): string;", "Invoker.ts", 11, 4] val x = 42 } //│ declare class Foo() { @@ -9,7 +9,7 @@ declare class Foo() { //│ let x: 42 //│ } -declare fun call: $Unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] +declare fun call: unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] //│ fun call: nothing :re @@ -33,8 +33,8 @@ foo.index("abc") //│ ║ l.31: foo.index("abc") //│ ║ ^^^^^^^^^^^^^^^^ //│ ╟── signature of member `index` of type `nothing` (TypeScript type "(id: string): string;" at Invoker.ts, 11, 4) is not supported -//│ ║ l.4: val index: $Unsupported["(id: string): string;", "Invoker.ts", 11, 4] -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.4: val index: unsupported["(id: string): string;", "Invoker.ts", 11, 4] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── but it flows into field selection with expected type `"abc" -> ?a` //│ ║ l.31: foo.index("abc") //│ ╙── ^^^^^^^^^ From 7c80f6bbacc7911d019f22d95350789e5cd74841 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 19 Jun 2023 15:42:18 +0800 Subject: [PATCH 110/202] Update ts2mls converter --- ts2mls/js/src/main/scala/ts2mls/types/Converter.scala | 2 +- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 672d33d2b..b25347a82 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -63,7 +63,7 @@ object Converter { } case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => - s"""Unsupported["$code", "$filename", $line, $column]""" + s"""unsupported["$code", "$filename", $line, $column]""" case tp => throw new AssertionError(s"unexpected type $tp.") } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 03a2520a0..46b112c49 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -2,7 +2,7 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str fun render(callback: (() => unit) | (undefined)): Str declare trait Get { - val __call: Unsupported["(id: string): string", "Dec.d.ts", 4, 22] + val __call: unsupported["(id: string): string", "Dec.d.ts", 4, 22] } declare class Person { constructor(name: Str, age: Num) diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 7ad0b5fdc..7bcdc9755 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -14,13 +14,13 @@ export declare module InterfaceMember { fun callback(): (x: Num) => unit } declare trait SearchFunc { - val __call: Unsupported["(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22] + val __call: unsupported["(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22] } declare trait StringArray { - val __index: Unsupported["[index: number]: string;", "InterfaceMember.ts", 28, 23] + val __index: unsupported["[index: number]: string;", "InterfaceMember.ts", 28, 23] } declare trait Counter { - val __call: Unsupported["(start: number): string;", "InterfaceMember.ts", 32, 19] + val __call: unsupported["(start: number): string;", "InterfaceMember.ts", 32, 19] val interval: Num fun reset(): unit } From 4d640fa3838d12b749d4cb84777ff2aef454d747 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 20 Jun 2023 11:53:09 +0800 Subject: [PATCH 111/202] WIP: Allow more content in es5 --- shared/src/main/scala/mlscript/NewLexer.scala | 2 +- shared/src/test/diff/nu/IdentEscape.mls | 5 + .../main/scala/ts2mls/types/Converter.scala | 3 +- ts2mls/js/src/test/diff/ES5.mlsi | 464 ++ ts2mls/js/src/test/typescript/ES5.d.ts | 4998 ++++++++--------- 5 files changed, 2971 insertions(+), 2501 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 8a222cac1..764d5c7d3 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -97,7 +97,7 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { def next(j: Int, tok: Token) = (tok, loc(i, j)) :: acc def isIdentEscape(i: Int): Bool = i + 2 < length && bytes(i) === 'i' && bytes(i + 1) === 'd' && bytes(i + 2) === '"' def takeIdentFromEscape(i: Int, ctor: Str => Token) = { - val (n, j) = takeWhile(i + 3)(isIdentChar) + val (n, j) = takeWhile(i + 3)(_ != '"') if (j < length && bytes(j) === '"') (ctor(n), j + 1) else { pe(msg"unfinished identifier escape"); (ERROR, j + 1) } } diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls index be9ba1fec..b16e7c6b0 100644 --- a/shared/src/test/diff/nu/IdentEscape.mls +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -74,3 +74,8 @@ class id"class" //│ class class //│ Code generation encountered an error: //│ class is a reserved keyword in ECMAScript and can not be used as type name. + +let id"$4" = 4 +//│ let $4: 4 +//│ $4 +//│ = 4 diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index b25347a82..63e8e1ddf 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -21,7 +21,8 @@ object Converter { def escapeIdent(name: String) = { import mlscript.NewLexer - if (NewLexer.keywords(name)) s"""id"$name"""" + if (NewLexer.keywords(name) || name.contains("$") || (!name.isEmpty() && name(0) >= '0' && name(0) <= '9')) + s"""id"$name"""" else name } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 587d266a9..f311d6853 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -24,6 +24,9 @@ declare trait PropertyDescriptor { val writable: ((false) | (true)) | (undefined) val value: (anything) | (undefined) } +declare trait PropertyDescriptorMap { + val __index: unsupported["[key: PropertyKey]: PropertyDescriptor;", "ES5.d.ts", 101, 33] +} declare trait Function { fun bind(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything fun apply(thisArg: anything, argArray: (anything) | (undefined)): anything @@ -34,9 +37,36 @@ declare trait Function { val caller: Function val arguments: anything } +declare trait FunctionConstructor { + val __new: unsupported["new(...args: string[]): Function;", "ES5.d.ts", 292, 31] + val __call: unsupported["(...args: string[]): Function;", "ES5.d.ts", 297, 37] + val prototype: Function +} +type ThisParameterType[T] = unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ES5.d.ts", 307, 27] +type OmitThisParameter[T] = unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ES5.d.ts", 312, 27] +declare trait IArguments { + val __index: unsupported["[index: number]: any;", "ES5.d.ts", 374, 22] + val length: Num + val callee: Function +} declare trait Boolean { fun valueOf(): (false) | (true) } +declare trait BooleanConstructor { + val __new: unsupported["new(value?: any): Boolean;", "ES5.d.ts", 521, 30] + val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 522, 30] + val prototype: Boolean +} +declare trait TemplateStringsArray extends ReadonlyArray[Str] { + val raw: ReadonlyArray[Str] +} +declare trait ImportMeta {} +declare trait ImportCallOptions { + val assert: (ImportAssertions) | (undefined) +} +declare trait ImportAssertions { + val __index: unsupported["[key: string]: string;", "ES5.d.ts", 617, 28] +} declare trait Math { fun random(): Num fun asin(x: Num): Num @@ -110,3 +140,437 @@ declare trait Date { fun setUTCHours(hours: Num, min: (Num) | (undefined), sec: (Num) | (undefined), ms: (Num) | (undefined)): Num fun toJSON(key: (anything) | (undefined)): Str } +declare trait DateConstructor { + val __call: unsupported["(): string;", "ES5.d.ts", 899, 128] + fun UTC(year: Num, monthIndex: Num, date: (Num) | (undefined), hours: (Num) | (undefined), minutes: (Num) | (undefined), seconds: (Num) | (undefined), ms: (Num) | (undefined)): Num + val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 888, 38] + fun now(): Num + fun parse(s: Str): Num + val prototype: Date +} +declare trait JSON { + fun parse(text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): anything + fun stringify(value: anything, replacer: (MutArray[(Str) | (Num)]) | (undefined), space: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ +} +declare trait ReadonlyArray[T] { + fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun forEach(callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => unit, thisArg: (anything) | (undefined)): unit + fun filter(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1274, 136] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun join(separator: (Str) | (undefined)): Str + fun map[U](callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => U, thisArg: (anything) | (undefined)): MutArray[U] + fun concat(items: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun toLocaleString(): Str + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] + fun reduce[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num +} +declare trait ConcatArray[T] { + val length: Num + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1280, 28] + fun join(separator: (Str) | (undefined)): Str + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] +} +declare trait TypedPropertyDescriptor[T] { + val configurable: ((false) | (true)) | (undefined) + val set: ((value: T) => unit) | (undefined) + val enumerable: ((false) | (true)) | (undefined) + val get: (() => T) | (undefined) + val writable: ((false) | (true)) | (undefined) + val value: (T) | (undefined) +} +type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike[T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike[T] +declare trait PromiseLike[T] { + fun id"then"[TResult1, TResult2](onfulfilled: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), onrejected: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): PromiseLike[(TResult1) | (TResult2)] +} +declare trait Promise[T] { + fun id"then"[TResult1, TResult2](onfulfilled: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), onrejected: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] + fun catch[TResult](onrejected: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] +} +type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1527, 17] +declare trait ArrayLike[T] { + val length: Num + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1536, 28] +} +type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1543, 17] +type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1550, 18] +type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1557, 18] +type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1564, 33] +type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1571, 37] +type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1578, 20] +type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1583, 20] +type Omit[T, K] = __type +type NonNullable[T] = (T) & ({}) +type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1598, 50] +type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1603, 74] +type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1608, 50] +type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1613, 65] +type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1618, 34] +type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1623, 34] +type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1628, 35] +type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1633, 37] +declare trait ThisType[T] {} +declare trait ArrayBuffer { + val byteLength: Num + fun slice(begin: Num, end: (Num) | (undefined)): ArrayBuffer +} +declare trait Int8Array { + fun valueOf(): Int8Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2067, 25] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int8Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array + fun find(predicate: (value: Num, index: Num, obj: Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int8Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Int8Array) => Num, thisArg: (anything) | (undefined)): Int8Array + fun forEach(callbackfn: (value: Num, index: Num, array: Int8Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Int8Array + fun filter(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Uint8Array { + fun valueOf(): Uint8Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2349, 26] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun find(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: (anything) | (undefined)): Uint8Array + fun forEach(callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Uint8Array + fun filter(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Uint8ClampedArray { + fun valueOf(): Uint8ClampedArray + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2631, 33] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray + fun find(predicate: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Uint8ClampedArray) => Num, thisArg: (anything) | (undefined)): Uint8ClampedArray + fun forEach(callbackfn: (value: Num, index: Num, array: Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Uint8ClampedArray + fun filter(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Int16Array { + fun valueOf(): Int16Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2911, 26] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int16Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array + fun find(predicate: (value: Num, index: Num, obj: Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int16Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Int16Array) => Num, thisArg: (anything) | (undefined)): Int16Array + fun forEach(callbackfn: (value: Num, index: Num, array: Int16Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Int16Array + fun filter(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Uint16Array { + fun valueOf(): Uint16Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3194, 27] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array + fun find(predicate: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Uint16Array) => Num, thisArg: (anything) | (undefined)): Uint16Array + fun forEach(callbackfn: (value: Num, index: Num, array: Uint16Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Uint16Array + fun filter(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Int32Array { + fun valueOf(): Int32Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3477, 26] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int32Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array + fun find(predicate: (value: Num, index: Num, obj: Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int32Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Int32Array) => Num, thisArg: (anything) | (undefined)): Int32Array + fun forEach(callbackfn: (value: Num, index: Num, array: Int32Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Int32Array + fun filter(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Uint32Array { + fun valueOf(): Uint32Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3758, 27] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array + fun find(predicate: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Uint32Array) => Num, thisArg: (anything) | (undefined)): Uint32Array + fun forEach(callbackfn: (value: Num, index: Num, array: Uint32Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Uint32Array + fun filter(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Float32Array { + fun valueOf(): Float32Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun toLocaleString(): Str + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4040, 28] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float32Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array + fun find(predicate: (value: Num, index: Num, obj: Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Float32Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Float32Array) => Num, thisArg: (anything) | (undefined)): Float32Array + fun forEach(callbackfn: (value: Num, index: Num, array: Float32Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Float32Array + fun filter(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare trait Float64Array { + fun valueOf(): Float64Array + fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4314, 28] + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array + fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float64Array + val BYTES_PER_ELEMENT: Num + fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array + fun find(predicate: (value: Num, index: Num, obj: Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Float64Array + fun join(separator: (Str) | (undefined)): Str + fun map(callbackfn: (value: Num, index: Num, array: Float64Array) => Num, thisArg: (anything) | (undefined)): Float64Array + fun forEach(callbackfn: (value: Num, index: Num, array: Float64Array) => unit, thisArg: (anything) | (undefined)): unit + val buffer: ArrayBuffer + fun findIndex(predicate: (value: Num, index: Num, obj: Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun reverse(): Float64Array + fun filter(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array + val byteLength: Num + fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + val byteOffset: Num +} +declare module Intl { + export declare trait CollatorOptions { + val sensitivity: (Str) | (undefined) + val ignorePunctuation: ((false) | (true)) | (undefined) + val usage: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val numeric: ((false) | (true)) | (undefined) + val caseFirst: (Str) | (undefined) + } + export declare trait ResolvedCollatorOptions { + val sensitivity: Str + val ignorePunctuation: (false) | (true) + val usage: Str + val locale: Str + val numeric: (false) | (true) + val caseFirst: Str + val collation: Str + } + export declare trait Collator { + fun compare(x: Str, y: Str): Num + fun resolvedOptions(): ResolvedCollatorOptions + } + export declare trait NumberFormatOptions { + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: ((false) | (true)) | (undefined) + val style: (Str) | (undefined) + val localeMatcher: (Str) | (undefined) + val currency: (Str) | (undefined) + val minimumIntegerDigits: (Num) | (undefined) + val maximumFractionDigits: (Num) | (undefined) + val currencySign: (Str) | (undefined) + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: (Num) | (undefined) + } + export declare trait ResolvedNumberFormatOptions { + val numberingSystem: Str + val minimumSignificantDigits: (Num) | (undefined) + val useGrouping: (false) | (true) + val style: Str + val locale: Str + val currency: (Str) | (undefined) + val minimumIntegerDigits: Num + val maximumFractionDigits: Num + val maximumSignificantDigits: (Num) | (undefined) + val minimumFractionDigits: Num + } + export declare trait NumberFormat { + fun format(value: Num): Str + fun resolvedOptions(): ResolvedNumberFormatOptions + } + export declare trait DateTimeFormatOptions { + val minute: ((Str) | (Str)) | (undefined) + val year: ((Str) | (Str)) | (undefined) + val hour: ((Str) | (Str)) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (((Str) | (Str)) | (Str)) | (undefined) + val formatMatcher: ((Str) | (Str)) | (undefined) + val day: ((Str) | (Str)) | (undefined) + val timeZone: (Str) | (undefined) + val month: (((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val second: ((Str) | (Str)) | (undefined) + val localeMatcher: ((Str) | (Str)) | (undefined) + val timeZoneName: ((((((Str) | (Str)) | (Str)) | (Str)) | (Str)) | (Str)) | (undefined) + val era: (((Str) | (Str)) | (Str)) | (undefined) + } + export declare trait ResolvedDateTimeFormatOptions { + val numberingSystem: Str + val minute: (Str) | (undefined) + val year: (Str) | (undefined) + val hour: (Str) | (undefined) + val second: (Str) | (undefined) + val hour12: ((false) | (true)) | (undefined) + val weekday: (Str) | (undefined) + val day: (Str) | (undefined) + val timeZone: Str + val month: (Str) | (undefined) + val locale: Str + val calendar: Str + val timeZoneName: (Str) | (undefined) + val era: (Str) | (undefined) + } + export declare trait DateTimeFormat { + fun format(date: ((Num) | (Date)) | (undefined)): Str + fun resolvedOptions(): ResolvedDateTimeFormatOptions + } +} diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 947287d35..96db49d05 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -98,9 +98,9 @@ interface PropertyDescriptor { set?(v: any): void; } -// interface PropertyDescriptorMap { -// [key: PropertyKey]: PropertyDescriptor; -// } +interface PropertyDescriptorMap { + [key: PropertyKey]: PropertyDescriptor; +} // interface Object { // /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ @@ -289,27 +289,27 @@ interface Function { caller: Function; } -// interface FunctionConstructor { -// /** -// * Creates a new function. -// * @param args A list of arguments the function accepts. -// */ -// new(...args: string[]): Function; -// (...args: string[]): Function; -// readonly prototype: Function; -// } +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new(...args: string[]): Function; + (...args: string[]): Function; + readonly prototype: Function; +} // declare var Function: FunctionConstructor; -// /** -// * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. -// */ -// type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; +/** + * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. + */ +type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown; -// /** -// * Removes the 'this' parameter from a function type. -// */ -// type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; +/** + * Removes the 'this' parameter from a function type. + */ +type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; // interface CallableFunction extends Function { // /** @@ -371,11 +371,11 @@ interface Function { // bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; // } -// interface IArguments { -// [index: number]: any; -// length: number; -// callee: Function; -// } +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} // interface String { // /** Returns a string representation of a string. */ @@ -518,11 +518,11 @@ interface Boolean { valueOf(): boolean; } -// interface BooleanConstructor { -// new(value?: any): Boolean; -// (value?: T): boolean; -// readonly prototype: Boolean; -// } +interface BooleanConstructor { + new(value?: any): Boolean; + (value?: T): boolean; + readonly prototype: Boolean; +} // declare var Boolean: BooleanConstructor; @@ -588,35 +588,35 @@ interface Boolean { // /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ // declare var Number: NumberConstructor; -// interface TemplateStringsArray extends ReadonlyArray { -// readonly raw: readonly string[]; -// } +interface TemplateStringsArray extends ReadonlyArray { + readonly raw: readonly string[]; +} -// /** -// * The type of `import.meta`. -// * -// * If you need to declare that a given property exists on `import.meta`, -// * this type may be augmented via interface merging. -// */ -// interface ImportMeta { -// } +/** + * The type of `import.meta`. + * + * If you need to declare that a given property exists on `import.meta`, + * this type may be augmented via interface merging. + */ +interface ImportMeta { +} -// /** -// * The type for the optional second argument to `import()`. -// * -// * If your host environment supports additional options, this type may be -// * augmented via interface merging. -// */ -// interface ImportCallOptions { -// assert?: ImportAssertions; -// } +/** + * The type for the optional second argument to `import()`. + * + * If your host environment supports additional options, this type may be + * augmented via interface merging. + */ +interface ImportCallOptions { + assert?: ImportAssertions; +} -// /** -// * The type for the `assert` property of the optional second argument to `import()`. -// */ -// interface ImportAssertions { -// [key: string]: string; -// } +/** + * The type for the `assert` property of the optional second argument to `import()`. + */ +interface ImportAssertions { + [key: string]: string; +} interface Math { /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ @@ -883,74 +883,74 @@ interface Date { toJSON(key?: any): string; } -// interface DateConstructor { -// new(): Date; -// new(value: number | string): Date; -// /** -// * Creates a new Date. -// * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. -// * @param monthIndex The month as a number between 0 and 11 (January to December). -// * @param date The date as a number between 1 and 31. -// * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. -// * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. -// * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. -// * @param ms A number from 0 to 999 that specifies the milliseconds. -// */ -// new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; -// (): string; -// readonly prototype: Date; -// /** -// * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. -// * @param s A date string -// */ -// parse(s: string): number; -// /** -// * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. -// * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. -// * @param monthIndex The month as a number between 0 and 11 (January to December). -// * @param date The date as a number between 1 and 31. -// * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. -// * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. -// * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. -// * @param ms A number from 0 to 999 that specifies the milliseconds. -// */ -// UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; -// /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ -// now(): number; -// } +interface DateConstructor { + new(): Date; + new(value: number | string): Date; + /** + * Creates a new Date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + readonly prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ + now(): number; +} // declare var Date: DateConstructor; -// // TODO: 0? -// // interface RegExpMatchArray extends Array { -// // /** -// // * The index of the search at which the result was found. -// // */ -// // index?: number; -// // /** -// // * A copy of the search string. -// // */ -// // input?: string; -// // /** -// // * The first match. This will always be present because `null` will be returned if there are no matches. -// // */ -// // 0: string; -// // } +// TODO: 0? +// interface RegExpMatchArray extends Array { +// /** +// * The index of the search at which the result was found. +// */ +// index?: number; +// /** +// * A copy of the search string. +// */ +// input?: string; +// /** +// * The first match. This will always be present because `null` will be returned if there are no matches. +// */ +// 0: string; +// } -// // interface RegExpExecArray extends Array { -// // /** -// // * The index of the search at which the result was found. -// // */ -// // index: number; -// // /** -// // * A copy of the search string. -// // */ -// // input: string; -// // /** -// // * The first match. This will always be present because `null` will be returned if there are no matches. -// // */ -// // 0: string; -// // } +// interface RegExpExecArray extends Array { +// /** +// * The index of the search at which the result was found. +// */ +// index: number; +// /** +// * A copy of the search string. +// */ +// input: string; +// /** +// * The first match. This will always be present because `null` will be returned if there are no matches. +// */ +// 0: string; +// } // interface RegExp { // /** @@ -1115,173 +1115,173 @@ interface Date { // declare var URIError: URIErrorConstructor; -// interface JSON { -// /** -// * Converts a JavaScript Object Notation (JSON) string into an object. -// * @param text A valid JSON string. -// * @param reviver A function that transforms the results. This function is called for each member of the object. -// * If a member contains nested objects, the nested objects are transformed before the parent object is. -// */ -// parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; -// /** -// * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. -// * @param value A JavaScript value, usually an object or array, to be converted. -// * @param replacer A function that transforms the results. -// * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. -// */ -// stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; -// /** -// * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. -// * @param value A JavaScript value, usually an object or array, to be converted. -// * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. -// * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. -// */ -// stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; -// } +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (this: any, key: string, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (this: any, key: string, value: any) => any, space?: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer?: (number | string)[] | null, space?: string | number): string; +} -// /** -// * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. -// */ +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ // declare var JSON: JSON; -// ///////////////////////////// -// /// ECMAScript Array API (specially handled by compiler) -// ///////////////////////////// +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// -// interface ReadonlyArray { -// /** -// * Gets the length of the array. This is a number one higher than the highest element defined in an array. -// */ -// readonly length: number; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; -// /** -// * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. -// */ -// toLocaleString(): string; -// /** -// * Combines two or more arrays. -// * @param items Additional items to add to the end of array1. -// */ -// concat(...items: ConcatArray[]): T[]; -// /** -// * Combines two or more arrays. -// * @param items Additional items to add to the end of array1. -// */ -// concat(...items: (T | ConcatArray)[]): T[]; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): T[]; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. -// */ -// indexOf(searchElement: T, fromIndex?: number): number; -// /** -// * Returns the index of the last occurrence of a specified value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. -// */ -// lastIndexOf(searchElement: T, fromIndex?: number): number; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; -// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; -// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; +interface ReadonlyArray { + /** + * Gets the length of the array. This is a number one higher than the highest element defined in an array. + */ + readonly length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + */ + toLocaleString(): string; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: ConcatArray[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: (T | ConcatArray)[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): T[]; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): this is readonly S[]; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: readonly T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: readonly T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: readonly T[]) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: readonly T[]) => unknown, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: readonly T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: readonly T[]) => U, initialValue: U): U; -// readonly [n: number]: T; -// } + readonly [n: number]: T; +} -// interface ConcatArray { -// readonly length: number; -// readonly [n: number]: T; -// join(separator?: string): string; -// slice(start?: number, end?: number): T[]; -// } +interface ConcatArray { + readonly length: number; + readonly [n: number]: T; + join(separator?: string): string; + slice(start?: number, end?: number): T[]; +} // interface Array { // /** @@ -1480,180 +1480,180 @@ interface Date { // declare var Array: ArrayConstructor; -// interface TypedPropertyDescriptor { -// enumerable?: boolean; -// configurable?: boolean; -// writable?: boolean; -// value?: T; -// get?: () => T; -// set?: (value: T) => void; -// } +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} -// declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; +declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; -// // interface PromiseLike { -// // /** -// // * Attaches callbacks for the resolution and/or rejection of the Promise. -// // * @param onfulfilled The callback to execute when the Promise is resolved. -// // * @param onrejected The callback to execute when the Promise is rejected. -// // * @returns A Promise for the completion of which ever callback is executed. -// // */ -// // then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; -// // } +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): PromiseLike; +} -// // /** -// // * Represents the completion of an asynchronous operation -// // */ -// // interface Promise { -// // /** -// // * Attaches callbacks for the resolution and/or rejection of the Promise. -// // * @param onfulfilled The callback to execute when the Promise is resolved. -// // * @param onrejected The callback to execute when the Promise is rejected. -// // * @returns A Promise for the completion of which ever callback is executed. -// // */ -// // then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; - -// // /** -// // * Attaches a callback for only the rejection of the Promise. -// // * @param onrejected The callback to execute when the Promise is rejected. -// // * @returns A Promise for the completion of the callback. -// // */ -// // catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; -// // } +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: ((value: T) => TResult1 | PromiseLike) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | undefined | null): Promise; -// /** -// * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. -// */ -// type Awaited = -// T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode -// T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped -// F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument -// Awaited : // recursively unwrap the value -// never : // the argument to `then` was not callable -// T; // non-object or non-thenable - -// interface ArrayLike { -// readonly length: number; -// readonly [n: number]: T; -// } + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: ((reason: any) => TResult | PromiseLike) | undefined | null): Promise; +} -// /** -// * Make all properties in T optional -// */ -// type Partial = { -// [P in keyof T]?: T[P]; -// }; +/** + * Recursively unwraps the "awaited type" of a type. Non-promise "thenables" should resolve to `never`. This emulates the behavior of `await`. + */ +type Awaited = + T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode + T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped + F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument + Awaited : // recursively unwrap the value + never : // the argument to `then` was not callable + T; // non-object or non-thenable + +interface ArrayLike { + readonly length: number; + readonly [n: number]: T; +} -// /** -// * Make all properties in T required -// */ -// type Required = { -// [P in keyof T]-?: T[P]; -// }; +/** + * Make all properties in T optional + */ +type Partial = { + [P in keyof T]?: T[P]; +}; -// /** -// * Make all properties in T readonly -// */ -// type Readonly = { -// readonly [P in keyof T]: T[P]; -// }; +/** + * Make all properties in T required + */ +type Required = { + [P in keyof T]-?: T[P]; +}; -// /** -// * From T, pick a set of properties whose keys are in the union K -// */ -// type Pick = { -// [P in K]: T[P]; -// }; +/** + * Make all properties in T readonly + */ +type Readonly = { + readonly [P in keyof T]: T[P]; +}; -// /** -// * Construct a type with a set of properties K of type T -// */ -// type Record = { -// [P in K]: T; -// }; +/** + * From T, pick a set of properties whose keys are in the union K + */ +type Pick = { + [P in K]: T[P]; +}; -// /** -// * Exclude from T those types that are assignable to U -// */ -// type Exclude = T extends U ? never : T; +/** + * Construct a type with a set of properties K of type T + */ +type Record = { + [P in K]: T; +}; -// /** -// * Extract from T those types that are assignable to U -// */ -// type Extract = T extends U ? T : never; +/** + * Exclude from T those types that are assignable to U + */ +type Exclude = T extends U ? never : T; -// /** -// * Construct a type with the properties of T except for those in type K. -// */ -// type Omit = Pick>; +/** + * Extract from T those types that are assignable to U + */ +type Extract = T extends U ? T : never; -// /** -// * Exclude null and undefined from T -// */ -// type NonNullable = T & {}; +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick>; -// /** -// * Obtain the parameters of a function type in a tuple -// */ -// type Parameters any> = T extends (...args: infer P) => any ? P : never; +/** + * Exclude null and undefined from T + */ +type NonNullable = T & {}; -// /** -// * Obtain the parameters of a constructor function type in a tuple -// */ -// type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; +/** + * Obtain the parameters of a function type in a tuple + */ +type Parameters any> = T extends (...args: infer P) => any ? P : never; -// /** -// * Obtain the return type of a function type -// */ -// type ReturnType any> = T extends (...args: any) => infer R ? R : any; +/** + * Obtain the parameters of a constructor function type in a tuple + */ +type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never; -// /** -// * Obtain the return type of a constructor function type -// */ -// type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; +/** + * Obtain the return type of a function type + */ +type ReturnType any> = T extends (...args: any) => infer R ? R : any; -// /** -// * Convert string literal type to uppercase -// */ -// type Uppercase = intrinsic; +/** + * Obtain the return type of a constructor function type + */ +type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any; -// /** -// * Convert string literal type to lowercase -// */ -// type Lowercase = intrinsic; +/** + * Convert string literal type to uppercase + */ +type Uppercase = intrinsic; -// /** -// * Convert first character of string literal type to uppercase -// */ -// type Capitalize = intrinsic; +/** + * Convert string literal type to lowercase + */ +type Lowercase = intrinsic; -// /** -// * Convert first character of string literal type to lowercase -// */ -// type Uncapitalize = intrinsic; +/** + * Convert first character of string literal type to uppercase + */ +type Capitalize = intrinsic; -// /** -// * Marker for contextual 'this' type -// */ -// interface ThisType { } +/** + * Convert first character of string literal type to lowercase + */ +type Uncapitalize = intrinsic; -// /** -// * Represents a raw buffer of binary data, which is used to store data for the -// * different typed arrays. ArrayBuffers cannot be read from or written to directly, -// * but can be passed to a typed array or DataView Object to interpret the raw -// * buffer as needed. -// */ -// interface ArrayBuffer { -// /** -// * Read-only. The length of the ArrayBuffer (in bytes). -// */ -// readonly byteLength: number; +/** + * Marker for contextual 'this' type + */ +interface ThisType { } -// /** -// * Returns a section of an ArrayBuffer. -// */ -// slice(begin: number, end?: number): ArrayBuffer; -// } +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + readonly byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin: number, end?: number): ArrayBuffer; +} // /** // * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. @@ -1821,253 +1821,253 @@ interface Date { // } // declare var DataView: DataViewConstructor; -// /** -// * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested -// * number of bytes could not be allocated an exception is raised. -// */ -// interface Int8Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int8Array) => any, thisArg?: any): Int8Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int8Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Int8Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Int8Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int8Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int8Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Int8Array; + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int8Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Int8Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Int8Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Int8ArrayConstructor { // readonly prototype: Int8Array; // new(length: number): Int8Array; @@ -2103,253 +2103,253 @@ interface Date { // } // declare var Int8Array: Int8ArrayConstructor; -// /** -// * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the -// * requested number of bytes could not be allocated an exception is raised. -// */ -// interface Uint8Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint8Array) => any, thisArg?: any): Uint8Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Uint8Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Uint8Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint8Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Uint8Array; + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint8Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Uint8Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Uint8Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Uint8ArrayConstructor { // readonly prototype: Uint8Array; @@ -2385,253 +2385,253 @@ interface Date { // } // // declare var Uint8Array: Uint8ArrayConstructor; -// /** -// * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. -// * If the requested number of bytes could not be allocated an exception is raised. -// */ -// interface Uint8ClampedArray { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint8ClampedArray) => any, thisArg?: any): Uint8ClampedArray; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint8ClampedArray) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Uint8ClampedArray; + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Uint8ClampedArray; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint8ClampedArray; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint8ClampedArray) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Uint8ClampedArray; + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint8ClampedArray; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Uint8ClampedArray; + /** Returns the primitive value of the specified object. */ + valueOf(): Uint8ClampedArray; -// [index: number]: number; -// } + [index: number]: number; +} // interface Uint8ClampedArrayConstructor { // readonly prototype: Uint8ClampedArray; @@ -2666,252 +2666,252 @@ interface Date { // } // declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; -// /** -// * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the -// * requested number of bytes could not be allocated an exception is raised. -// */ -// interface Int16Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int16Array) => any, thisArg?: any): Int16Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int16Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Int16Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Int16Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int16Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int16Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Int16Array; + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int16Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Int16Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Int16Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Int16ArrayConstructor { // readonly prototype: Int16Array; @@ -2948,253 +2948,253 @@ interface Date { // } // declare var Int16Array: Int16ArrayConstructor; -// /** -// * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the -// * requested number of bytes could not be allocated an exception is raised. -// */ -// interface Uint16Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint16Array) => any, thisArg?: any): Uint16Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint16Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Uint16Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Uint16Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint16Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint16Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Uint16Array; + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint16Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Uint16Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Uint16Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Uint16ArrayConstructor { // readonly prototype: Uint16Array; @@ -3231,253 +3231,253 @@ interface Date { // } // declare var Uint16Array: Uint16ArrayConstructor; -// /** -// * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the -// * requested number of bytes could not be allocated an exception is raised. -// */ -// interface Int32Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Int32Array) => any, thisArg?: any): Int32Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Int32Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Int32Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Int32Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Int32Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Int32Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Int32Array; + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Int32Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Int32Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Int32Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Int32ArrayConstructor { // readonly prototype: Int32Array; @@ -3513,252 +3513,252 @@ interface Date { // } // declare var Int32Array: Int32ArrayConstructor; -// /** -// * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the -// * requested number of bytes could not be allocated an exception is raised. -// */ -// interface Uint32Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Uint32Array) => any, thisArg?: any): Uint32Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Uint32Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Uint32Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Uint32Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Uint32Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Uint32Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Uint32Array; + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Uint32Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Uint32Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Uint32Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Uint32ArrayConstructor { // readonly prototype: Uint32Array; @@ -3794,253 +3794,253 @@ interface Date { // } // declare var Uint32Array: Uint32ArrayConstructor; -// /** -// * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number -// * of bytes could not be allocated an exception is raised. -// */ -// interface Float32Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Float32Array) => any, thisArg?: any): Float32Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float32Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Float32Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Float32Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float32Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Float32Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Float32Array; + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Float32Array; -// /** -// * Converts a number to a string by using the current locale. -// */ -// toLocaleString(): string; + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; + /** + * Returns a string representation of an array. + */ + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Float32Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Float32Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Float32ArrayConstructor { // readonly prototype: Float32Array; @@ -4077,244 +4077,244 @@ interface Date { // } // declare var Float32Array: Float32ArrayConstructor; -// /** -// * A typed array of 64-bit float values. The contents are initialized to 0. If the requested -// * number of bytes could not be allocated an exception is raised. -// */ -// interface Float64Array { -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// readonly buffer: ArrayBufferLike; + /** + * The ArrayBuffer instance referenced by the array. + */ + readonly buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// readonly byteLength: number; + /** + * The length in bytes of the array. + */ + readonly byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// readonly byteOffset: number; + /** + * The offset in bytes of the array. + */ + readonly byteOffset: number; -// /** -// * Returns the this object after copying a section of the array identified by start and end -// * to the same array starting at position target -// * @param target If target is negative, it is treated as length+target where length is the -// * length of the array. -// * @param start If start is negative, it is treated as length+start. If end is negative, it -// * is treated as length+end. If start is omitted, `0` is used. -// * @param end If not specified, length of the this object is used as its default value. -// */ -// copyWithin(target: number, start?: number, end?: number): this; + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. If start is omitted, `0` is used. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start?: number, end?: number): this; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; -// /** -// * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array -// * @param value value to fill array section with -// * @param start index to start filling the array at. If start is negative, it is treated as -// * length+start where length is the length of the array. -// * @param end index to stop filling the array at. If end is negative, it is treated as -// * length+end. -// */ -// fill(value: number, start?: number, end?: number): this; + /** + * Changes all array elements from `start` to `end` index to a static `value` and returns the modified array + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): this; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls -// * the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls + * the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: number, index: number, array: Float64Array) => any, thisArg?: any): Float64Array; -// /** -// * Returns the value of the first element in the array where predicate is true, and undefined -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, find -// * immediately returns that element value. Otherwise, find returns undefined. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number | undefined; -// /** -// * Returns the index of the first element in the array where predicate is true, and -1 -// * otherwise. -// * @param predicate find calls predicate once for each element of the array, in ascending -// * order, until it finds one where predicate returns true. If such an element is found, -// * findIndex immediately returns that element index. Otherwise, findIndex returns -1. -// * @param thisArg If provided, it will be used as the this value for each invocation of -// * predicate. If it is not provided, undefined is used instead. -// */ -// findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; + /** + * Returns the index of the first element in the array where predicate is true, and -1 + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, + * findIndex immediately returns that element index. Otherwise, findIndex returns -1. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number, index: number, obj: Float64Array) => boolean, thisArg?: any): number; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; -// /** -// * Returns the index of the first occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// indexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; -// /** -// * Adds all the elements of an array separated by the specified separator string. -// * @param separator A string used to separate one element of an array from the next in the -// * resulting String. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; + /** + * Adds all the elements of an array separated by the specified separator string. + * @param separator A string used to separate one element of an array from the next in the + * resulting String. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; -// /** -// * Returns the index of the last occurrence of a value in an array. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the -// * search starts at index 0. -// */ -// lastIndexOf(searchElement: number, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; -// /** -// * The length of the array. -// */ -// readonly length: number; + /** + * The length of the array. + */ + readonly length: number; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that -// * contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the -// * callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the + * callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. + * If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; -// reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of -// * the callback function is the accumulated result, and is provided as an argument in the next -// * call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the -// * callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array. The return value of + * the callback function is the accumulated result, and is provided as an argument in the next + * call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the + * callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an -// * argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; -// reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an + * argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number): number; + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue: number): number; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. -// * The return value of the callback function is the accumulated result, and is provided as an -// * argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls -// * the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start -// * the accumulation. The first call to the callbackfn function provides this value as an argument -// * instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. + * The return value of the callback function is the accumulated result, and is provided as an + * argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls + * the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start + * the accumulation. The first call to the callbackfn function provides this value as an argument + * instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; -// /** -// * Reverses the elements in an Array. -// */ -// reverse(): Float64Array; + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; -// /** -// * Sets a value or an array of values. -// * @param array A typed or untyped array of values to set. -// * @param offset The index in the current array at which the values are to be written. -// */ -// set(array: ArrayLike, offset?: number): void; + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; -// /** -// * Returns a section of an array. -// * @param start The beginning of the specified portion of the array. -// * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. -// */ -// slice(start?: number, end?: number): Float64Array; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'. + */ + slice(start?: number, end?: number): Float64Array; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: number, index: number, array: Float64Array) => unknown, thisArg?: any): boolean; -// /** -// * Sorts an array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if first argument is less than second argument, zero if they're equal and a positive -// * value otherwise. If omitted, the elements are sorted in ascending order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: number, b: number) => number): this; + /** + * Sorts an array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if first argument is less than second argument, zero if they're equal and a positive + * value otherwise. If omitted, the elements are sorted in ascending order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: number, b: number) => number): this; -// /** -// * at begin, inclusive, up to end, exclusive. -// * @param begin The index of the beginning of the array. -// * @param end The index of the end of the array. -// */ -// subarray(begin?: number, end?: number): Float64Array; + /** + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin?: number, end?: number): Float64Array; -// toString(): string; + toString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Float64Array; + /** Returns the primitive value of the specified object. */ + valueOf(): Float64Array; -// [index: number]: number; -// } + [index: number]: number; +} // interface Float64ArrayConstructor { // readonly prototype: Float64Array; @@ -4350,121 +4350,121 @@ interface Date { // } // declare var Float64Array: Float64ArrayConstructor; -// ///////////////////////////// -// /// ECMAScript Internationalization API -// ///////////////////////////// - -// declare namespace Intl { -// interface CollatorOptions { -// usage?: string | undefined; -// localeMatcher?: string | undefined; -// numeric?: boolean | undefined; -// caseFirst?: string | undefined; -// sensitivity?: string | undefined; -// ignorePunctuation?: boolean | undefined; -// } - -// interface ResolvedCollatorOptions { -// locale: string; -// usage: string; -// sensitivity: string; -// ignorePunctuation: boolean; -// collation: string; -// caseFirst: string; -// numeric: boolean; -// } - -// interface Collator { -// compare(x: string, y: string): number; -// resolvedOptions(): ResolvedCollatorOptions; -// } -// var Collator: { -// new(locales?: string | string[], options?: CollatorOptions): Collator; -// (locales?: string | string[], options?: CollatorOptions): Collator; -// supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; -// }; - -// interface NumberFormatOptions { -// localeMatcher?: string | undefined; -// style?: string | undefined; -// currency?: string | undefined; -// currencySign?: string | undefined; -// useGrouping?: boolean | undefined; -// minimumIntegerDigits?: number | undefined; -// minimumFractionDigits?: number | undefined; -// maximumFractionDigits?: number | undefined; -// minimumSignificantDigits?: number | undefined; -// maximumSignificantDigits?: number | undefined; -// } - -// interface ResolvedNumberFormatOptions { -// locale: string; -// numberingSystem: string; -// style: string; -// currency?: string; -// minimumIntegerDigits: number; -// minimumFractionDigits: number; -// maximumFractionDigits: number; -// minimumSignificantDigits?: number; -// maximumSignificantDigits?: number; -// useGrouping: boolean; -// } - -// interface NumberFormat { -// format(value: number): string; -// resolvedOptions(): ResolvedNumberFormatOptions; -// } -// var NumberFormat: { -// new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; -// (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; -// supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; -// readonly prototype: NumberFormat; -// }; - -// interface DateTimeFormatOptions { -// localeMatcher?: "best fit" | "lookup" | undefined; -// weekday?: "long" | "short" | "narrow" | undefined; -// era?: "long" | "short" | "narrow" | undefined; -// year?: "numeric" | "2-digit" | undefined; -// month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; -// day?: "numeric" | "2-digit" | undefined; -// hour?: "numeric" | "2-digit" | undefined; -// minute?: "numeric" | "2-digit" | undefined; -// second?: "numeric" | "2-digit" | undefined; -// timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; -// formatMatcher?: "best fit" | "basic" | undefined; -// hour12?: boolean | undefined; -// timeZone?: string | undefined; -// } - -// interface ResolvedDateTimeFormatOptions { -// locale: string; -// calendar: string; -// numberingSystem: string; -// timeZone: string; -// hour12?: boolean; -// weekday?: string; -// era?: string; -// year?: string; -// month?: string; -// day?: string; -// hour?: string; -// minute?: string; -// second?: string; -// timeZoneName?: string; -// } - -// interface DateTimeFormat { -// format(date?: Date | number): string; -// resolvedOptions(): ResolvedDateTimeFormatOptions; -// } -// var DateTimeFormat: { -// new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; -// (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; -// supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; -// readonly prototype: DateTimeFormat; -// }; -// } +///////////////////////////// +/// ECMAScript Internationalization API +///////////////////////////// + +declare namespace Intl { + interface CollatorOptions { + usage?: string | undefined; + localeMatcher?: string | undefined; + numeric?: boolean | undefined; + caseFirst?: string | undefined; + sensitivity?: string | undefined; + ignorePunctuation?: boolean | undefined; + } + + interface ResolvedCollatorOptions { + locale: string; + usage: string; + sensitivity: string; + ignorePunctuation: boolean; + collation: string; + caseFirst: string; + numeric: boolean; + } + + interface Collator { + compare(x: string, y: string): number; + resolvedOptions(): ResolvedCollatorOptions; + } + var Collator: { + new(locales?: string | string[], options?: CollatorOptions): Collator; + (locales?: string | string[], options?: CollatorOptions): Collator; + supportedLocalesOf(locales: string | string[], options?: CollatorOptions): string[]; + }; + + interface NumberFormatOptions { + localeMatcher?: string | undefined; + style?: string | undefined; + currency?: string | undefined; + currencySign?: string | undefined; + useGrouping?: boolean | undefined; + minimumIntegerDigits?: number | undefined; + minimumFractionDigits?: number | undefined; + maximumFractionDigits?: number | undefined; + minimumSignificantDigits?: number | undefined; + maximumSignificantDigits?: number | undefined; + } + + interface ResolvedNumberFormatOptions { + locale: string; + numberingSystem: string; + style: string; + currency?: string; + minimumIntegerDigits: number; + minimumFractionDigits: number; + maximumFractionDigits: number; + minimumSignificantDigits?: number; + maximumSignificantDigits?: number; + useGrouping: boolean; + } + + interface NumberFormat { + format(value: number): string; + resolvedOptions(): ResolvedNumberFormatOptions; + } + var NumberFormat: { + new(locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + (locales?: string | string[], options?: NumberFormatOptions): NumberFormat; + supportedLocalesOf(locales: string | string[], options?: NumberFormatOptions): string[]; + readonly prototype: NumberFormat; + }; + + interface DateTimeFormatOptions { + localeMatcher?: "best fit" | "lookup" | undefined; + weekday?: "long" | "short" | "narrow" | undefined; + era?: "long" | "short" | "narrow" | undefined; + year?: "numeric" | "2-digit" | undefined; + month?: "numeric" | "2-digit" | "long" | "short" | "narrow" | undefined; + day?: "numeric" | "2-digit" | undefined; + hour?: "numeric" | "2-digit" | undefined; + minute?: "numeric" | "2-digit" | undefined; + second?: "numeric" | "2-digit" | undefined; + timeZoneName?: "short" | "long" | "shortOffset" | "longOffset" | "shortGeneric" | "longGeneric" | undefined; + formatMatcher?: "best fit" | "basic" | undefined; + hour12?: boolean | undefined; + timeZone?: string | undefined; + } + + interface ResolvedDateTimeFormatOptions { + locale: string; + calendar: string; + numberingSystem: string; + timeZone: string; + hour12?: boolean; + weekday?: string; + era?: string; + year?: string; + month?: string; + day?: string; + hour?: string; + minute?: string; + second?: string; + timeZoneName?: string; + } + + interface DateTimeFormat { + format(date?: Date | number): string; + resolvedOptions(): ResolvedDateTimeFormatOptions; + } + var DateTimeFormat: { + new(locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + (locales?: string | string[], options?: DateTimeFormatOptions): DateTimeFormat; + supportedLocalesOf(locales: string | string[], options?: DateTimeFormatOptions): string[]; + readonly prototype: DateTimeFormat; + }; +} // interface String { // /** From 2bd9f0fbaa09e9b1f9014a1ef664ea38aa548114 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 20 Jun 2023 12:14:11 +0800 Subject: [PATCH 112/202] WIP: Minor changes --- shared/src/main/scala/mlscript/NewLexer.scala | 16 +++++++++------- .../src/main/scala/ts2mls/types/Converter.scala | 6 ++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 764d5c7d3..2cb62d324 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -43,13 +43,7 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { // ">", ) - private val isAlphaOp = Set( - "with", - "and", - "or", - "is", - "as", - ) + private val isAlphaOp = alpahOp @tailrec final def takeWhile(i: Int, cur: Ls[Char] = Nil)(pred: Char => Bool): (Str, Int) = @@ -335,6 +329,14 @@ object NewLexer { "constructor", "unsupported" ) + + val alpahOp: Set[Str] = Set( + "with", + "and", + "or", + "is", + "as", + ) def printToken(tl: TokLoc): Str = tl match { case (SPACE, _) => " " diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 63e8e1ddf..0cad27673 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -16,12 +16,14 @@ object Converter { "object" -> "Object", "true" -> "true", "false" -> "false", - "symbol" -> "Symbol" + "symbol" -> "Symbol", + "error" -> "error" ) def escapeIdent(name: String) = { import mlscript.NewLexer - if (NewLexer.keywords(name) || name.contains("$") || (!name.isEmpty() && name(0) >= '0' && name(0) <= '9')) + if (NewLexer.keywords(name) || NewLexer.alpahOp(name) || name.contains("$") || + (!name.isEmpty() && name(0) >= '0' && name(0) <= '9')) s"""id"$name"""" else name } From 19bb7354b3f7573e6f6c498b8a684192f869f156 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 20 Jun 2023 16:46:33 +0800 Subject: [PATCH 113/202] WIP: Override builtin types in es5(not ready) --- driver/js/src/main/scala/driver/Driver.scala | 12 +- driver/js/src/test/output/Builtin.check | 4 + .../.interfaces/mlscript/Builtin.mlsi | 5 + .../src/test/projects/js/mlscript/Builtin.js | 19 + .../js/src/test/projects/mlscript/Builtin.mls | 7 + .../test/scala/driver/DriverDiffTests.scala | 3 +- .../src/main/scala/mlscript/NuTypeDefs.scala | 4 +- ts2mls/js/src/test/diff/ES5.mlsi | 119 +++ ts2mls/js/src/test/typescript/ES5.d.ts | 984 +++++++++--------- 9 files changed, 656 insertions(+), 501 deletions(-) create mode 100644 driver/js/src/test/output/Builtin.check create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi create mode 100644 driver/js/src/test/projects/js/mlscript/Builtin.js create mode 100644 driver/js/src/test/projects/mlscript/Builtin.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index a36a624bd..cd1494f34 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -134,13 +134,13 @@ class Driver(options: DriverOptions) { NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N, N) :: Nil, Nil) }) - private def `type`(tu: TypingUnit)( + private def `type`(tu: TypingUnit, usingES5: Boolean)( implicit ctx: Ctx, raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] ) = { - val tpd = typer.typeTypingUnit(tu, N) + val tpd = typer.typeTypingUnit(tu, N, usingES5) val sim = SimplifyPipeline(tpd, all = false) typer.expandType(sim) } @@ -154,7 +154,7 @@ class Driver(options: DriverOptions) { raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] - ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst, Nil))) + ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst, Nil), true)) private def resolveTarget(file: FileInfo, imp: String) = if ((imp.startsWith("./") || imp.startsWith("../")) && !imp.endsWith(".mls") && !imp.endsWith(".mlsi")) { @@ -221,7 +221,7 @@ class Driver(options: DriverOptions) { case (_, declarations, imports, _) => { val depList = imports.map(_.path) depList.foreach(d => importModule(file.`import`(d))) - `type`(TypingUnit(declarations, Nil)) + `type`(TypingUnit(declarations, Nil), false) } }) } @@ -229,7 +229,7 @@ class Driver(options: DriverOptions) { otherList.foreach(d => importModule(file.`import`(d))) if (file.filename.endsWith(".mls")) { def generateInterface(moduleName: Option[String], tu: TypingUnit) = { - val exp = `type`(tu) + val exp = `type`(tu, false) packTopModule(moduleName, exp.show) } @@ -244,7 +244,7 @@ class Driver(options: DriverOptions) { } ), exported || importedModule(file.filename)) } - else `type`(TypingUnit(declarations, Nil)) + else `type`(TypingUnit(declarations, Nil), false) true } else false diff --git a/driver/js/src/test/output/Builtin.check b/driver/js/src/test/output/Builtin.check new file mode 100644 index 000000000..1d3c982d5 --- /dev/null +++ b/driver/js/src/test/output/Builtin.check @@ -0,0 +1,4 @@ +b +2 +@ +52 diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi new file mode 100644 index 000000000..eb6ef7b85 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi @@ -0,0 +1,5 @@ +declare module Builtin() { + let s: Str + let n: Num + unit +} diff --git a/driver/js/src/test/projects/js/mlscript/Builtin.js b/driver/js/src/test/projects/js/mlscript/Builtin.js new file mode 100644 index 000000000..a89b1d70e --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/Builtin.js @@ -0,0 +1,19 @@ +const Builtin = new class Builtin { + #s; + get s() { return this.#s; } + #n; + get n() { return this.#n; } + constructor() { + } + $init() { + this.#s = "abc"; + const s = this.#s; + this.#n = 42; + const n = this.#n; + console.log(s.charAt(1)); + console.log(s.indexOf("c", undefined)); + console.log(String.fromCharCode(64)); + console.log(n.toString(8)); + } +}; +Builtin.$init(); diff --git a/driver/js/src/test/projects/mlscript/Builtin.mls b/driver/js/src/test/projects/mlscript/Builtin.mls new file mode 100644 index 000000000..6b14a19a1 --- /dev/null +++ b/driver/js/src/test/projects/mlscript/Builtin.mls @@ -0,0 +1,7 @@ +let s: Str = "abc" +let n: Num = 42 + +console.log(s.charAt(1)) +console.log(s.indexOf("c", undefined)) +console.log(String.fromCharCode(64)) +console.log(n.toString(8)) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index f1644bbcc..02f322edb 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -77,8 +77,9 @@ object DriverDiffTests { entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), - entry("MLS2TheMax", Some("./tsconfig.json")), + entry("MLS2TheMax", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type mismatch??? entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + entry("Builtin"), ts2mlsEntry("Array", ignoreTypeError = true), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index 343b19c41..d187b6f4a 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -463,7 +463,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => /** Type checks a typing unit, which is a sequence of possibly-mutually-recursive type and function definitions * interleaved with plain statements. */ - def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer]) + def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer], usingES5: Bool = false) (implicit ctx: Ctx, raise: Raise, vars: Map[Str, SimpleType]): TypedTypingUnit = trace(s"${ctx.lvl}. Typing $tu") { @@ -506,7 +506,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => fd.copy()(fd.declareLoc, fd.exportLoc, fd.signature, outer) } case td: NuTypeDef => - if (td.nme.name in reservedTypeNames) + if ((td.nme.name in reservedTypeNames) && !usingES5) err(msg"Type name '${td.nme.name}' is reserved", td.toLoc) td } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index f311d6853..84aaa23d4 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -27,6 +27,33 @@ declare trait PropertyDescriptor { declare trait PropertyDescriptorMap { val __index: unsupported["[key: PropertyKey]: PropertyDescriptor;", "ES5.d.ts", 101, 33] } +declare trait Object { + fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun valueOf(): Object + fun toLocaleString(): Str + val id"constructor": Function + fun isPrototypeOf(v: Object): (false) | (true) + fun toString(): Str +} +declare trait ObjectConstructor { + val __call: unsupported["(value: any): any;", "ES5.d.ts", 139, 12] + fun getOwnPropertyNames(o: anything): MutArray[Str] + fun isFrozen(o: anything): (false) | (true) + fun getPrototypeOf(o: anything): anything + fun defineProperty[T](o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType[anything])): T + val prototype: Object + fun isSealed(o: anything): (false) | (true) + fun defineProperties[T](o: T, properties: (PropertyDescriptorMap) & (ThisType[anything])): T + fun preventExtensions[T](o: T): T + fun create(o: Object, properties: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ + fun freeze[T](f: T): T + val __new: unsupported["new(value?: any): Object;", "ES5.d.ts", 137, 29] + fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor + fun seal[T](o: T): T + fun keys(o: Object): MutArray[Str] + fun isExtensible(o: anything): (false) | (true) +} declare trait Function { fun bind(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything fun apply(thisArg: anything, argArray: (anything) | (undefined)): anything @@ -49,6 +76,33 @@ declare trait IArguments { val length: Num val callee: Function } +declare trait Str { + fun valueOf(): Str + fun toLocaleUpperCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str + fun lastIndexOf(searchString: Str, position: (Num) | (undefined)): Num + fun localeCompare(that: Str): Num + fun toLocaleLowerCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str + fun toUpperCase(): Str + fun indexOf(searchString: Str, position: (Num) | (undefined)): Num + fun charAt(pos: Num): Str + fun toLowerCase(): Str + fun concat(strings: (Str) | (MutArray[Str])): Str + val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 499, 22] + fun charCodeAt(index: Num): Num + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Str + fun substr(from: Num, length: (Num) | (undefined)): Str + fun toString(): Str + val length: Num + fun substring(start: Num, end: (Num) | (undefined)): Str + fun trim(): Str +} +declare trait StringConstructor { + val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 504, 29] + val __call: unsupported["(value?: any): string;", "ES5.d.ts", 505, 26] + val prototype: Str + fun fromCharCode(codes: (Num) | (MutArray[Num])): Str +} +val String: StringConstructor declare trait Boolean { fun valueOf(): (false) | (true) } @@ -57,6 +111,23 @@ declare trait BooleanConstructor { val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 522, 30] val prototype: Boolean } +declare trait Num { + fun toExponential(fractionDigits: (Num) | (undefined)): Str + fun valueOf(): Num + fun toString(radix: (Num) | (undefined)): Str + fun toFixed(fractionDigits: (Num) | (undefined)): Str + fun toPrecision(precision: (Num) | (undefined)): Str +} +declare trait NumberConstructor { + val __call: unsupported["(value?: any): number;", "ES5.d.ts", 559, 26] + val NaN: Num + val MIN_VALUE: Num + val __new: unsupported["new(value?: any): Num;", "ES5.d.ts", 558, 29] + val NEGATIVE_INFINITY: Num + val POSITIVE_INFINITY: Num + val MAX_VALUE: Num + val prototype: Num +} declare trait TemplateStringsArray extends ReadonlyArray[Str] { val raw: ReadonlyArray[Str] } @@ -148,6 +219,22 @@ declare trait DateConstructor { fun parse(s: Str): Num val prototype: Date } +declare trait Error { + val name: Str + val message: Str + val stack: (Str) | (undefined) +} +declare trait ErrorConstructor { + val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1044, 28] + val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1045, 33] + val prototype: Error +} +declare trait EvalError extends Error {} +declare trait RangeError extends Error {} +declare trait ReferenceError extends Error {} +declare trait SyntaxError extends Error {} +declare trait TypeError extends Error {} +declare trait URIError extends Error {} declare trait JSON { fun parse(text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): anything fun stringify(value: anything, replacer: (MutArray[(Str) | (Num)]) | (undefined), space: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ @@ -176,6 +263,38 @@ declare trait ConcatArray[T] { fun join(separator: (Str) | (undefined)): Str fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] } +declare trait MutArray[T] { + fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + fun every(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun push(items: (T) | (MutArray[T])): Num + fun forEach(callbackfn: (value: T, index: Num, array: MutArray[T]) => unit, thisArg: (anything) | (undefined)): unit + fun reduceRight[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun unshift(items: (T) | (MutArray[T])): Num + fun sort(compareFn: ((a: T, b: T) => Num) | (undefined)): MutArray + fun join(separator: (Str) | (undefined)): Str + fun map[U](callbackfn: (value: T, index: Num, array: MutArray[T]) => U, thisArg: (anything) | (undefined)): MutArray[U] + fun pop(): T + fun shift(): T + fun concat(items: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun toLocaleString(): Str + fun reverse(): MutArray[T] + fun filter(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ + val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1465, 127] + fun splice(start: Num, deleteCount: Num, items: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ + fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] + fun reduce[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun toString(): Str + val length: Num + fun some(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) + fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num +} +declare trait ArrayConstructor { + val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1472, 38] + val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1475, 34] + fun isArray(arg: anything): (false) | (true) + val prototype: MutArray[anything] +} +val Array: ArrayConstructor declare trait TypedPropertyDescriptor[T] { val configurable: ((false) | (true)) | (undefined) val set: ((value: T) => unit) | (undefined) diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 96db49d05..e8fde5022 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -102,149 +102,149 @@ interface PropertyDescriptorMap { [key: PropertyKey]: PropertyDescriptor; } -// interface Object { -// /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ -// constructor: Function; +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; -// /** Returns a string representation of an object. */ -// toString(): string; + /** Returns a string representation of an object. */ + toString(): string; -// /** Returns a date converted to a string using the current locale. */ -// toLocaleString(): string; + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): Object; + /** Returns the primitive value of the specified object. */ + valueOf(): Object; -// /** -// * Determines whether an object has a property with the specified name. -// * @param v A property name. -// */ -// hasOwnProperty(v: PropertyKey): boolean; + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; -// /** -// * Determines whether an object exists in another object's prototype chain. -// * @param v Another object whose prototype chain is to be checked. -// */ -// isPrototypeOf(v: Object): boolean; + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; -// /** -// * Determines whether a specified property is enumerable. -// * @param v A property name. -// */ -// propertyIsEnumerable(v: PropertyKey): boolean; -// } + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} -// interface ObjectConstructor { -// new(value?: any): Object; -// (): any; -// (value: any): any; +interface ObjectConstructor { + new(value?: any): Object; + (): any; + (value: any): any; -// /** A reference to the prototype for a class of objects. */ -// readonly prototype: Object; + /** A reference to the prototype for a class of objects. */ + readonly prototype: Object; -// /** -// * Returns the prototype of an object. -// * @param o The object that references the prototype. -// */ -// getPrototypeOf(o: any): any; + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; -// /** -// * Gets the own property descriptor of the specified object. -// * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. -// * @param o Object that contains the property. -// * @param p Name of the property. -// */ -// getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: PropertyKey): PropertyDescriptor | undefined; -// /** -// * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly -// * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. -// * @param o Object that contains the own properties. -// */ -// getOwnPropertyNames(o: any): string[]; + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; -// /** -// * Creates an object that has the specified prototype or that has null prototype. -// * @param o Object to use as a prototype. May be null. -// */ -// create(o: object | null): any; + /** + * Creates an object that has the specified prototype or that has null prototype. + * @param o Object to use as a prototype. May be null. + */ + create(o: object | null): any; -// /** -// * Creates an object that has the specified prototype, and that optionally contains specified properties. -// * @param o Object to use as a prototype. May be null -// * @param properties JavaScript object that contains one or more property descriptors. -// */ -// create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: object | null, properties: PropertyDescriptorMap & ThisType): any; -// /** -// * Adds a property to an object, or modifies attributes of an existing property. -// * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. -// * @param p The property name. -// * @param attributes Descriptor for the property. It can be for a data property or an accessor property. -// */ -// defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType): T; -// /** -// * Adds one or more properties to an object, and/or modifies attributes of existing properties. -// * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. -// * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. -// */ -// defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: T, properties: PropertyDescriptorMap & ThisType): T; -// /** -// * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// seal(o: T): T; + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param f Object on which to lock the attributes. -// */ -// freeze(f: T): T; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param f Object on which to lock the attributes. + */ + freeze(f: T): T; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// freeze(o: T): Readonly; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + // freeze(o: T): Readonly; -// /** -// * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. -// * @param o Object on which to lock the attributes. -// */ -// freeze(o: T): Readonly; + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + // freeze(o: T): Readonly; -// /** -// * Prevents the addition of new properties to an object. -// * @param o Object to make non-extensible. -// */ -// preventExtensions(o: T): T; + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; -// /** -// * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. -// * @param o Object to test. -// */ -// isSealed(o: any): boolean; + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; -// /** -// * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. -// * @param o Object to test. -// */ -// isFrozen(o: any): boolean; + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; -// /** -// * Returns a value that indicates whether new properties can be added to an object. -// * @param o Object to test. -// */ -// isExtensible(o: any): boolean; + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; -// /** -// * Returns the names of the enumerable string properties and methods of an object. -// * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. -// */ -// keys(o: object): string[]; -// } + /** + * Returns the names of the enumerable string properties and methods of an object. + * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. + */ + keys(o: object): string[]; +} // // TODO: name clash? // /** @@ -377,141 +377,141 @@ interface IArguments { callee: Function; } -// interface String { -// /** Returns a string representation of a string. */ -// toString(): string; +interface Str { + /** Returns a string representation of a string. */ + toString(): string; -// /** -// * Returns the character at the specified index. -// * @param pos The zero-based index of the desired character. -// */ -// charAt(pos: number): string; + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; -// /** -// * Returns the Unicode value of the character at the specified location. -// * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. -// */ -// charCodeAt(index: number): number; + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; -// /** -// * Returns a string that contains the concatenation of two or more strings. -// * @param strings The strings to append to the end of the string. -// */ -// concat(...strings: string[]): string; + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; -// /** -// * Returns the position of the first occurrence of a substring. -// * @param searchString The substring to search for in the string -// * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. -// */ -// indexOf(searchString: string, position?: number): number; + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; -// /** -// * Returns the last occurrence of a substring in the string. -// * @param searchString The substring to search for. -// * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. -// */ -// lastIndexOf(searchString: string, position?: number): number; + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; -// /** -// * Determines whether two strings are equivalent in the current locale. -// * @param that String to compare to target string -// */ -// localeCompare(that: string): number; + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; -// /** -// * Matches a string with a regular expression, and returns an array containing the results of that search. -// * @param regexp A variable name or string literal containing the regular expression pattern and flags. -// */ -// match(regexp: string | RegExp): RegExpMatchArray | null; + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + // match(regexp: string | RegExp): RegExpMatchArray | null; -// /** -// * Replaces text in a string, using a regular expression or search string. -// * @param searchValue A string or regular expression to search for. -// * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. -// */ -// replace(searchValue: string | RegExp, replaceValue: string): string; + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string or regular expression to search for. + * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. + */ + // replace(searchValue: string | RegExp, replaceValue: string): string; -// /** -// * Replaces text in a string, using a regular expression or search string. -// * @param searchValue A string to search for. -// * @param replacer A function that returns the replacement text. -// */ -// replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + // replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; -// /** -// * Finds the first substring match in a regular expression search. -// * @param regexp The regular expression pattern and applicable flags. -// */ -// search(regexp: string | RegExp): number; + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + // search(regexp: string | RegExp): number; -// /** -// * Returns a section of a string. -// * @param start The index to the beginning of the specified portion of stringObj. -// * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. -// * If this value is not specified, the substring continues to the end of stringObj. -// */ -// slice(start?: number, end?: number): string; + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; -// /** -// * Split a string into substrings using the specified separator and return them as an array. -// * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. -// * @param limit A value used to limit the number of elements returned in the array. -// */ -// split(separator: string | RegExp, limit?: number): string[]; + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + // split(separator: string | RegExp, limit?: number): string[]; -// /** -// * Returns the substring at the specified location within a String object. -// * @param start The zero-based index number indicating the beginning of the substring. -// * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. -// * If end is omitted, the characters from start through the end of the original string are returned. -// */ -// substring(start: number, end?: number): string; + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; -// /** Converts all the alphabetic characters in a string to lowercase. */ -// toLowerCase(): string; + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; -// /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ -// toLocaleLowerCase(locales?: string | string[]): string; + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(locales?: string | string[]): string; -// /** Converts all the alphabetic characters in a string to uppercase. */ -// toUpperCase(): string; + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; -// /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ -// toLocaleUpperCase(locales?: string | string[]): string; + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(locales?: string | string[]): string; -// /** Removes the leading and trailing white space and line terminator characters from a string. */ -// trim(): string; + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; -// /** Returns the length of a String object. */ -// readonly length: number; + /** Returns the length of a String object. */ + readonly length: number; -// // IE extensions -// /** -// * Gets a substring beginning at the specified location and having the specified length. -// * @deprecated A legacy feature for browser compatibility -// * @param from The starting position of the desired substring. The index of the first character in the string is zero. -// * @param length The number of characters to include in the returned substring. -// */ -// substr(from: number, length?: number): string; + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @deprecated A legacy feature for browser compatibility + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): string; + /** Returns the primitive value of the specified object. */ + valueOf(): string; -// readonly [index: number]: string; -// } + readonly [index: number]: string; +} -// interface StringConstructor { -// new(value?: any): String; -// (value?: any): string; -// readonly prototype: String; -// fromCharCode(...codes: number[]): string; -// } +interface StringConstructor { + new(value?: any): Str; + (value?: any): string; + readonly prototype: Str; + fromCharCode(...codes: number[]): string; +} // /** // * Allows manipulation and formatting of text strings and determination and location of substrings within strings. // */ -// declare var String: StringConstructor; +declare var String: StringConstructor; interface Boolean { /** Returns the primitive value of the specified object. */ @@ -526,64 +526,64 @@ interface BooleanConstructor { // declare var Boolean: BooleanConstructor; -// interface Number { -// /** -// * Returns a string representation of an object. -// * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. -// */ -// toString(radix?: number): string; +interface Num { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; -// /** -// * Returns a string representing a number in fixed-point notation. -// * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. -// */ -// toFixed(fractionDigits?: number): string; + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; -// /** -// * Returns a string containing a number represented in exponential notation. -// * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. -// */ -// toExponential(fractionDigits?: number): string; + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; -// /** -// * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. -// * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. -// */ -// toPrecision(precision?: number): string; + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; -// /** Returns the primitive value of the specified object. */ -// valueOf(): number; -// } + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} -// interface NumberConstructor { -// new(value?: any): Number; -// (value?: any): number; -// readonly prototype: Number; +interface NumberConstructor { + new(value?: any): Num; + (value?: any): number; + readonly prototype: Num; -// /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ -// readonly MAX_VALUE: number; + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + readonly MAX_VALUE: number; -// /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ -// readonly MIN_VALUE: number; + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + readonly MIN_VALUE: number; -// /** -// * A value that is not a number. -// * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. -// */ -// readonly NaN: number; + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + readonly NaN: number; -// /** -// * A value that is less than the largest negative number that can be represented in JavaScript. -// * JavaScript displays NEGATIVE_INFINITY values as -infinity. -// */ -// readonly NEGATIVE_INFINITY: number; + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + readonly NEGATIVE_INFINITY: number; -// /** -// * A value greater than the largest number that can be represented in JavaScript. -// * JavaScript displays POSITIVE_INFINITY values as infinity. -// */ -// readonly POSITIVE_INFINITY: number; -// } + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + readonly POSITIVE_INFINITY: number; +} // /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ // declare var Number: NumberConstructor; @@ -922,7 +922,7 @@ interface DateConstructor { // declare var Date: DateConstructor; // TODO: 0? -// interface RegExpMatchArray extends Array { +// interface RegExpMatchArray extends MutArray { // /** // * The index of the search at which the result was found. // */ @@ -937,7 +937,7 @@ interface DateConstructor { // 0: string; // } -// interface RegExpExecArray extends Array { +// interface RegExpExecArray extends MutArray { // /** // * The index of the search at which the result was found. // */ @@ -1035,22 +1035,22 @@ interface DateConstructor { // // declare var RegExp: RegExpConstructor; -// interface Error { -// name: string; -// message: string; -// stack?: string; -// } +interface Error { + name: string; + message: string; + stack?: string; +} -// interface ErrorConstructor { -// new(message?: string): Error; -// (message?: string): Error; -// readonly prototype: Error; -// } +interface ErrorConstructor { + new(message?: string): Error; + (message?: string): Error; + readonly prototype: Error; +} // declare var Error: ErrorConstructor; -// interface EvalError extends Error { -// } +interface EvalError extends Error { +} // interface EvalErrorConstructor extends ErrorConstructor { // new(message?: string): EvalError; @@ -1060,8 +1060,8 @@ interface DateConstructor { // declare var EvalError: EvalErrorConstructor; -// interface RangeError extends Error { -// } +interface RangeError extends Error { +} // interface RangeErrorConstructor extends ErrorConstructor { // new(message?: string): RangeError; @@ -1071,8 +1071,8 @@ interface DateConstructor { // declare var RangeError: RangeErrorConstructor; -// interface ReferenceError extends Error { -// } +interface ReferenceError extends Error { +} // interface ReferenceErrorConstructor extends ErrorConstructor { // new(message?: string): ReferenceError; @@ -1082,8 +1082,8 @@ interface DateConstructor { // declare var ReferenceError: ReferenceErrorConstructor; -// interface SyntaxError extends Error { -// } +interface SyntaxError extends Error { +} // interface SyntaxErrorConstructor extends ErrorConstructor { // new(message?: string): SyntaxError; @@ -1093,8 +1093,8 @@ interface DateConstructor { // declare var SyntaxError: SyntaxErrorConstructor; -// interface TypeError extends Error { -// } +interface TypeError extends Error { +} // interface TypeErrorConstructor extends ErrorConstructor { // new(message?: string): TypeError; @@ -1104,8 +1104,8 @@ interface DateConstructor { // declare var TypeError: TypeErrorConstructor; -// interface URIError extends Error { -// } +interface URIError extends Error { +} // interface URIErrorConstructor extends ErrorConstructor { // new(message?: string): URIError; @@ -1283,202 +1283,202 @@ interface ConcatArray { slice(start?: number, end?: number): T[]; } -// interface Array { -// /** -// * Gets or sets the length of the array. This is a number one higher than the highest index in the array. -// */ -// length: number; -// /** -// * Returns a string representation of an array. -// */ -// toString(): string; -// /** -// * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. -// */ -// toLocaleString(): string; -// /** -// * Removes the last element from an array and returns it. -// * If the array is empty, undefined is returned and the array is not modified. -// */ -// pop(): T | undefined; -// /** -// * Appends new elements to the end of an array, and returns the new length of the array. -// * @param items New elements to add to the array. -// */ -// push(...items: T[]): number; -// /** -// * Combines two or more arrays. -// * This method returns a new array without modifying any existing arrays. -// * @param items Additional arrays and/or items to add to the end of the array. -// */ -// concat(...items: ConcatArray[]): T[]; -// /** -// * Combines two or more arrays. -// * This method returns a new array without modifying any existing arrays. -// * @param items Additional arrays and/or items to add to the end of the array. -// */ -// concat(...items: (T | ConcatArray)[]): T[]; -// /** -// * Adds all the elements of an array into a string, separated by the specified separator string. -// * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. -// */ -// join(separator?: string): string; -// /** -// * Reverses the elements in an array in place. -// * This method mutates the array and returns a reference to the same array. -// */ -// reverse(): T[]; -// /** -// * Removes the first element from an array and returns it. -// * If the array is empty, undefined is returned and the array is not modified. -// */ -// shift(): T | undefined; -// /** -// * Returns a copy of a section of an array. -// * For both start and end, a negative index can be used to indicate an offset from the end of the array. -// * For example, -2 refers to the second to last element of the array. -// * @param start The beginning index of the specified portion of the array. -// * If start is undefined, then the slice begins at index 0. -// * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. -// * If end is undefined, then the slice extends to the end of the array. -// */ -// slice(start?: number, end?: number): T[]; -// /** -// * Sorts an array in place. -// * This method mutates the array and returns a reference to the same array. -// * @param compareFn Function used to determine the order of the elements. It is expected to return -// * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive -// * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. -// * ```ts -// * [11,2,22,1].sort((a, b) => a - b) -// * ``` -// */ -// sort(compareFn?: (a: T, b: T) => number): this; -// /** -// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. -// * @param start The zero-based location in the array from which to start removing elements. -// * @param deleteCount The number of elements to remove. -// * @returns An array containing the elements that were deleted. -// */ -// splice(start: number, deleteCount?: number): T[]; -// /** -// * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. -// * @param start The zero-based location in the array from which to start removing elements. -// * @param deleteCount The number of elements to remove. -// * @param items Elements to insert into the array in place of the deleted elements. -// * @returns An array containing the elements that were deleted. -// */ -// splice(start: number, deleteCount: number, ...items: T[]): T[]; -// /** -// * Inserts new elements at the start of an array, and returns the new length of the array. -// * @param items Elements to insert at the start of the array. -// */ -// unshift(...items: T[]): number; -// /** -// * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. -// */ -// indexOf(searchElement: T, fromIndex?: number): number; -// /** -// * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. -// * @param searchElement The value to locate in the array. -// * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. -// */ -// lastIndexOf(searchElement: T, fromIndex?: number): number; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; -// /** -// * Determines whether all the members of an array satisfy the specified test. -// * @param predicate A function that accepts up to three arguments. The every method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value false, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; -// /** -// * Determines whether the specified callback function returns true for any element of an array. -// * @param predicate A function that accepts up to three arguments. The some method calls -// * the predicate function for each element in the array until the predicate returns a value -// * which is coercible to the Boolean value true, or until the end of the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. -// * If thisArg is omitted, undefined is used as the this value. -// */ -// some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; -// /** -// * Performs the specified action for each element in an array. -// * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. -// */ -// forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; -// /** -// * Calls a defined callback function on each element of an array, and returns an array that contains the results. -// * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. -// */ -// map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; -// /** -// * Returns the elements of an array that meet the condition specified in a callback function. -// * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. -// * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. -// */ -// filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; -// reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; -// /** -// * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; -// reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; -// /** -// * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. -// * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. -// * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. -// */ -// reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; +interface MutArray { + /** + * Gets or sets the length of the array. This is a number one higher than the highest index in the array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + /** + * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods. + */ + toLocaleString(): string; + /** + * Removes the last element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + pop(): T | undefined; + /** + * Appends new elements to the end of an array, and returns the new length of the array. + * @param items New elements to add to the array. + */ + push(...items: T[]): number; + /** + * Combines two or more arrays. + * This method returns a new array without modifying any existing arrays. + * @param items Additional arrays and/or items to add to the end of the array. + */ + concat(...items: ConcatArray[]): T[]; + /** + * Combines two or more arrays. + * This method returns a new array without modifying any existing arrays. + * @param items Additional arrays and/or items to add to the end of the array. + */ + concat(...items: (T | ConcatArray)[]): T[]; + /** + * Adds all the elements of an array into a string, separated by the specified separator string. + * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma. + */ + join(separator?: string): string; + /** + * Reverses the elements in an array in place. + * This method mutates the array and returns a reference to the same array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + * If the array is empty, undefined is returned and the array is not modified. + */ + shift(): T | undefined; + /** + * Returns a copy of a section of an array. + * For both start and end, a negative index can be used to indicate an offset from the end of the array. + * For example, -2 refers to the second to last element of the array. + * @param start The beginning index of the specified portion of the array. + * If start is undefined, then the slice begins at index 0. + * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'. + * If end is undefined, then the slice extends to the end of the array. + */ + slice(start?: number, end?: number): T[]; + /** + * Sorts an array in place. + * This method mutates the array and returns a reference to the same array. + * @param compareFn Function used to determine the order of the elements. It is expected to return + * a negative value if the first argument is less than the second argument, zero if they're equal, and a positive + * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order. + * ```ts + * [11,2,22,1].sort((a, b) => a - b) + * ``` + */ + sort(compareFn?: (a: T, b: T) => number): this; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @returns An array containing the elements that were deleted. + */ + splice(start: number, deleteCount?: number): T[]; + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + * @returns An array containing the elements that were deleted. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + /** + * Inserts new elements at the start of an array, and returns the new length of the array. + * @param items Elements to insert at the start of the array. + */ + unshift(...items: T[]): number; + /** + * Returns the index of the first occurrence of a value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + /** + * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): this is S[]; + /** + * Determines whether all the members of an array satisfy the specified test. + * @param predicate A function that accepts up to three arguments. The every method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value false, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + every(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param predicate A function that accepts up to three arguments. The some method calls + * the predicate function for each element in the array until the predicate returns a value + * which is coercible to the Boolean value true, or until the end of the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. + * If thisArg is omitted, undefined is used as the this value. + */ + some(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean; + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: T[]) => value is S, thisArg?: any): S[]; + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array. + * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value. + */ + filter(predicate: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[]; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T): T; + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue: T): T; + /** + * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. + * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array. + * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; -// [n: number]: T; -// } + [n: number]: T; +} -// interface ArrayConstructor { -// new(arrayLength?: number): any[]; -// new (arrayLength: number): T[]; -// new (...items: T[]): T[]; -// (arrayLength?: number): any[]; -// (arrayLength: number): T[]; -// (...items: T[]): T[]; -// isArray(arg: any): arg is any[]; -// readonly prototype: any[]; -// } +interface ArrayConstructor { + new(arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is any[]; + readonly prototype: any[]; +} -// declare var Array: ArrayConstructor; +declare var Array: ArrayConstructor; interface TypedPropertyDescriptor { enumerable?: boolean; From e0997559e418897fe35ad91cf5cdf2d0045ce5fc Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 20 Jun 2023 17:15:23 +0800 Subject: [PATCH 114/202] WIP: Use classes --- driver/js/src/test/output/Builtin.check | 2 ++ .../js/src/test/projects/js/mlscript/Builtin.js | 2 ++ .../js/src/test/projects/mlscript/Builtin.mls | 2 ++ .../src/test/scala/driver/DriverDiffTests.scala | 2 +- ts2mls/js/src/test/diff/ES5.mlsi | 17 +++++++++-------- ts2mls/js/src/test/typescript/ES5.d.ts | 16 ++++++++-------- 6 files changed, 24 insertions(+), 17 deletions(-) diff --git a/driver/js/src/test/output/Builtin.check b/driver/js/src/test/output/Builtin.check index 1d3c982d5..b662cd9da 100644 --- a/driver/js/src/test/output/Builtin.check +++ b/driver/js/src/test/output/Builtin.check @@ -2,3 +2,5 @@ b 2 @ 52 +1.7976931348623157e+308 +false diff --git a/driver/js/src/test/projects/js/mlscript/Builtin.js b/driver/js/src/test/projects/js/mlscript/Builtin.js index a89b1d70e..f61f55e8c 100644 --- a/driver/js/src/test/projects/js/mlscript/Builtin.js +++ b/driver/js/src/test/projects/js/mlscript/Builtin.js @@ -14,6 +14,8 @@ const Builtin = new class Builtin { console.log(s.indexOf("c", undefined)); console.log(String.fromCharCode(64)); console.log(n.toString(8)); + console.log(Number["MAX_VALUE"]); + console.log(s.hasOwnProperty("foo")); } }; Builtin.$init(); diff --git a/driver/js/src/test/projects/mlscript/Builtin.mls b/driver/js/src/test/projects/mlscript/Builtin.mls index 6b14a19a1..9c9467c76 100644 --- a/driver/js/src/test/projects/mlscript/Builtin.mls +++ b/driver/js/src/test/projects/mlscript/Builtin.mls @@ -5,3 +5,5 @@ console.log(s.charAt(1)) console.log(s.indexOf("c", undefined)) console.log(String.fromCharCode(64)) console.log(n.toString(8)) +console.log(Number.MAX_VALUE) +console.log(s.hasOwnProperty("foo")) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 02f322edb..83e7fe2eb 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -77,7 +77,7 @@ object DriverDiffTests { entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members entry("Output", Some("./tsconfig.json")), entry("Output2", Some("./tsconfig.json")), - entry("MLS2TheMax", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type mismatch??? + entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules entry("Builtin"), ts2mlsEntry("Array", ignoreTypeError = true), diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 84aaa23d4..69e07f51c 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -27,12 +27,11 @@ declare trait PropertyDescriptor { declare trait PropertyDescriptorMap { val __index: unsupported["[key: PropertyKey]: PropertyDescriptor;", "ES5.d.ts", 101, 33] } -declare trait Object { +declare class Object { fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) fun valueOf(): Object fun toLocaleString(): Str - val id"constructor": Function fun isPrototypeOf(v: Object): (false) | (true) fun toString(): Str } @@ -76,7 +75,7 @@ declare trait IArguments { val length: Num val callee: Function } -declare trait Str { +declare class Str extends Object { fun valueOf(): Str fun toLocaleUpperCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str fun lastIndexOf(searchString: Str, position: (Num) | (undefined)): Num @@ -103,15 +102,16 @@ declare trait StringConstructor { fun fromCharCode(codes: (Num) | (MutArray[Num])): Str } val String: StringConstructor -declare trait Boolean { +declare class Bool { fun valueOf(): (false) | (true) } declare trait BooleanConstructor { - val __new: unsupported["new(value?: any): Boolean;", "ES5.d.ts", 521, 30] - val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 522, 30] - val prototype: Boolean + val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 521, 30] + val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 522, 27] + val prototype: Bool } -declare trait Num { +val Boolean: BooleanConstructor +declare class Num { fun toExponential(fractionDigits: (Num) | (undefined)): Str fun valueOf(): Num fun toString(radix: (Num) | (undefined)): Str @@ -128,6 +128,7 @@ declare trait NumberConstructor { val MAX_VALUE: Num val prototype: Num } +val Number: NumberConstructor declare trait TemplateStringsArray extends ReadonlyArray[Str] { val raw: ReadonlyArray[Str] } diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index e8fde5022..160ac7903 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -102,7 +102,7 @@ interface PropertyDescriptorMap { [key: PropertyKey]: PropertyDescriptor; } -interface Object { +class Object { /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ constructor: Function; @@ -377,7 +377,7 @@ interface IArguments { callee: Function; } -interface Str { +class Str extends Object { /** Returns a string representation of a string. */ toString(): string; @@ -513,20 +513,20 @@ interface StringConstructor { // */ declare var String: StringConstructor; -interface Boolean { +class Bool { /** Returns the primitive value of the specified object. */ valueOf(): boolean; } interface BooleanConstructor { - new(value?: any): Boolean; + new(value?: any): Bool; (value?: T): boolean; - readonly prototype: Boolean; + readonly prototype: Bool; } -// declare var Boolean: BooleanConstructor; +declare var Boolean: BooleanConstructor; -interface Num { +class Num { /** * Returns a string representation of an object. * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. @@ -586,7 +586,7 @@ interface NumberConstructor { } // /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ -// declare var Number: NumberConstructor; +declare var Number: NumberConstructor; interface TemplateStringsArray extends ReadonlyArray { readonly raw: readonly string[]; From 728880acca5fe111bbfb2a5b64406a3a0488b2aa Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 20 Jun 2023 17:21:57 +0800 Subject: [PATCH 115/202] WIP: Add more content in es5 --- ts2mls/js/src/test/diff/ES5.mlsi | 118 ++++++++++---- ts2mls/js/src/test/typescript/ES5.d.ts | 211 ++++++++++++------------- 2 files changed, 188 insertions(+), 141 deletions(-) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 69e07f51c..04984654b 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -76,14 +76,16 @@ declare trait IArguments { val callee: Function } declare class Str extends Object { + fun replace(searchValue: (Str) | (RegExp), replacer: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ fun valueOf(): Str fun toLocaleUpperCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str fun lastIndexOf(searchString: Str, position: (Num) | (undefined)): Num fun localeCompare(that: Str): Num fun toLocaleLowerCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str + fun match(regexp: (Str) | (RegExp)): RegExpMatchArray + fun split(separator: (Str) | (RegExp), limit: (Num) | (undefined)): MutArray[Str] fun toUpperCase(): Str fun indexOf(searchString: Str, position: (Num) | (undefined)): Num - fun charAt(pos: Num): Str fun toLowerCase(): Str fun concat(strings: (Str) | (MutArray[Str])): Str val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 499, 22] @@ -94,6 +96,8 @@ declare class Str extends Object { val length: Num fun substring(start: Num, end: (Num) | (undefined)): Str fun trim(): Str + fun search(regexp: (Str) | (RegExp)): Num + fun charAt(pos: Num): Str } declare trait StringConstructor { val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 504, 29] @@ -220,14 +224,58 @@ declare trait DateConstructor { fun parse(s: Str): Num val prototype: Date } +declare trait RegExpMatchArray extends MutArray[Str] { + val index: (Num) | (undefined) + val input: (Str) | (undefined) + val id"0": Str +} +declare trait RegExpExecArray extends MutArray[Str] { + val index: Num + val input: Str + val id"0": Str +} +declare trait RegExp { + fun test(string: Str): (false) | (true) + val multiline: (false) | (true) + val source: Str + fun compile(pattern: Str, flags: (Str) | (undefined)): RegExp + val global: (false) | (true) + val lastIndex: Num + val ignoreCase: (false) | (true) + fun exec(string: Str): RegExpExecArray +} +declare trait RegExpConstructor { + val id"$4": Str + val rightContext: Str + val lastParen: Str + val id"$5": Str + val id"$+": Str + val __new: unsupported["new(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 988, 42] + val id"$'": Str + val id"$&": Str + val id"$7": Str + val prototype: RegExp + val id"$`": Str + val id"$_": Str + val __call: unsupported["(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 990, 39] + val lastMatch: Str + val id"$9": Str + val id"$6": Str + val id"$3": Str + val id"$2": Str + val leftContext: Str + val id"$8": Str + val id"$1": Str + val input: Str +} declare trait Error { val name: Str val message: Str val stack: (Str) | (undefined) } declare trait ErrorConstructor { - val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1044, 28] - val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1045, 33] + val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1043, 28] + val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1044, 33] val prototype: Error } declare trait EvalError extends Error {} @@ -245,7 +293,7 @@ declare trait ReadonlyArray[T] { fun every(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => unit, thisArg: (anything) | (undefined)): unit fun filter(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1274, 136] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1273, 136] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun join(separator: (Str) | (undefined)): Str fun map[U](callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => U, thisArg: (anything) | (undefined)): MutArray[U] @@ -260,7 +308,7 @@ declare trait ReadonlyArray[T] { } declare trait ConcatArray[T] { val length: Num - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1280, 28] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1279, 28] fun join(separator: (Str) | (undefined)): Str fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] } @@ -280,7 +328,7 @@ declare trait MutArray[T] { fun toLocaleString(): Str fun reverse(): MutArray[T] fun filter(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ - val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1465, 127] + val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1464, 127] fun splice(start: Num, deleteCount: Num, items: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] fun reduce[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ @@ -290,8 +338,8 @@ declare trait MutArray[T] { fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num } declare trait ArrayConstructor { - val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1472, 38] - val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1475, 34] + val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1471, 38] + val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1474, 34] fun isArray(arg: anything): (false) | (true) val prototype: MutArray[anything] } @@ -312,28 +360,28 @@ declare trait Promise[T] { fun id"then"[TResult1, TResult2](onfulfilled: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), onrejected: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] fun catch[TResult](onrejected: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] } -type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1527, 17] +type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1526, 17] declare trait ArrayLike[T] { val length: Num - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1536, 28] -} -type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1543, 17] -type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1550, 18] -type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1557, 18] -type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1564, 33] -type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1571, 37] -type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1578, 20] -type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1583, 20] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1535, 28] +} +type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1542, 17] +type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1549, 18] +type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1556, 18] +type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1563, 33] +type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1570, 37] +type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1577, 20] +type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1582, 20] type Omit[T, K] = __type type NonNullable[T] = (T) & ({}) -type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1598, 50] -type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1603, 74] -type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1608, 50] -type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1613, 65] -type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1618, 34] -type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1623, 34] -type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1628, 35] -type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1633, 37] +type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1597, 50] +type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1602, 74] +type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1607, 50] +type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1612, 65] +type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1617, 34] +type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1622, 34] +type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1627, 35] +type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1632, 37] declare trait ThisType[T] {} declare trait ArrayBuffer { val byteLength: Num @@ -345,7 +393,7 @@ declare trait Int8Array { fun every(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2067, 25] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2066, 25] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int8Array @@ -375,7 +423,7 @@ declare trait Uint8Array { fun every(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2349, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2348, 26] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array @@ -405,7 +453,7 @@ declare trait Uint8ClampedArray { fun every(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2631, 33] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2630, 33] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray @@ -435,7 +483,7 @@ declare trait Int16Array { fun every(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2911, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2910, 26] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int16Array @@ -465,7 +513,7 @@ declare trait Uint16Array { fun every(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3194, 27] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3193, 27] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array @@ -495,7 +543,7 @@ declare trait Int32Array { fun every(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3477, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3476, 26] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int32Array @@ -525,7 +573,7 @@ declare trait Uint32Array { fun every(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3758, 27] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3757, 27] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array @@ -555,7 +603,7 @@ declare trait Float32Array { fun every(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4040, 28] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4039, 28] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float32Array @@ -584,7 +632,7 @@ declare trait Float64Array { fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num fun every(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4314, 28] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4313, 28] fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float64Array diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 160ac7903..d7abf650e 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -423,27 +423,27 @@ class Str extends Object { * Matches a string with a regular expression, and returns an array containing the results of that search. * @param regexp A variable name or string literal containing the regular expression pattern and flags. */ - // match(regexp: string | RegExp): RegExpMatchArray | null; + match(regexp: string | RegExp): RegExpMatchArray | null; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A string or regular expression to search for. * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. */ - // replace(searchValue: string | RegExp, replaceValue: string): string; + replace(searchValue: string | RegExp, replaceValue: string): string; /** * Replaces text in a string, using a regular expression or search string. * @param searchValue A string to search for. * @param replacer A function that returns the replacement text. */ - // replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + replace(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; /** * Finds the first substring match in a regular expression search. * @param regexp The regular expression pattern and applicable flags. */ - // search(regexp: string | RegExp): number; + search(regexp: string | RegExp): number; /** * Returns a section of a string. @@ -458,7 +458,7 @@ class Str extends Object { * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. * @param limit A value used to limit the number of elements returned in the array. */ - // split(separator: string | RegExp, limit?: number): string[]; + split(separator: string | RegExp, limit?: number): string[]; /** * Returns the substring at the specified location within a String object. @@ -921,117 +921,116 @@ interface DateConstructor { // declare var Date: DateConstructor; -// TODO: 0? -// interface RegExpMatchArray extends MutArray { -// /** -// * The index of the search at which the result was found. -// */ -// index?: number; -// /** -// * A copy of the search string. -// */ -// input?: string; -// /** -// * The first match. This will always be present because `null` will be returned if there are no matches. -// */ -// 0: string; -// } +interface RegExpMatchArray extends MutArray { + /** + * The index of the search at which the result was found. + */ + index?: number; + /** + * A copy of the search string. + */ + input?: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; +} -// interface RegExpExecArray extends MutArray { -// /** -// * The index of the search at which the result was found. -// */ -// index: number; -// /** -// * A copy of the search string. -// */ -// input: string; -// /** -// * The first match. This will always be present because `null` will be returned if there are no matches. -// */ -// 0: string; -// } +interface RegExpExecArray extends MutArray { + /** + * The index of the search at which the result was found. + */ + index: number; + /** + * A copy of the search string. + */ + input: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; +} -// interface RegExp { -// /** -// * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. -// * @param string The String object or string literal on which to perform the search. -// */ -// exec(string: string): RegExpExecArray | null; +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray | null; -// /** -// * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. -// * @param string String on which to perform the search. -// */ -// test(string: string): boolean; + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; -// /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ -// readonly source: string; + /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */ + readonly source: string; -// /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ -// readonly global: boolean; + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + readonly global: boolean; -// /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ -// readonly ignoreCase: boolean; + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + readonly ignoreCase: boolean; -// /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ -// readonly multiline: boolean; + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + readonly multiline: boolean; -// lastIndex: number; + lastIndex: number; -// // Non-standard extensions -// /** @deprecated A legacy feature for browser compatibility */ -// compile(pattern: string, flags?: string): this; -// } + // Non-standard extensions + /** @deprecated A legacy feature for browser compatibility */ + compile(pattern: string, flags?: string): this; +} + + +interface RegExpConstructor { + new(pattern: RegExp | string): RegExp; + new(pattern: string, flags?: string): RegExp; + (pattern: RegExp | string): RegExp; + (pattern: string, flags?: string): RegExp; + readonly prototype: RegExp; -// // TODO: $+ -// // interface RegExpConstructor { -// // new(pattern: RegExp | string): RegExp; -// // new(pattern: string, flags?: string): RegExp; -// // (pattern: RegExp | string): RegExp; -// // (pattern: string, flags?: string): RegExp; -// // readonly prototype: RegExp; - -// // // Non-standard extensions -// // /** @deprecated A legacy feature for browser compatibility */ -// // $1: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $2: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $3: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $4: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $5: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $6: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $7: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $8: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $9: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // input: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // $_: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // lastMatch: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // "$&": string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // lastParen: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // "$+": string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // leftContext: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // "$`": string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // rightContext: string; -// // /** @deprecated A legacy feature for browser compatibility */ -// // "$'": string; -// // } + // Non-standard extensions + /** @deprecated A legacy feature for browser compatibility */ + $1: string; + /** @deprecated A legacy feature for browser compatibility */ + $2: string; + /** @deprecated A legacy feature for browser compatibility */ + $3: string; + /** @deprecated A legacy feature for browser compatibility */ + $4: string; + /** @deprecated A legacy feature for browser compatibility */ + $5: string; + /** @deprecated A legacy feature for browser compatibility */ + $6: string; + /** @deprecated A legacy feature for browser compatibility */ + $7: string; + /** @deprecated A legacy feature for browser compatibility */ + $8: string; + /** @deprecated A legacy feature for browser compatibility */ + $9: string; + /** @deprecated A legacy feature for browser compatibility */ + input: string; + /** @deprecated A legacy feature for browser compatibility */ + $_: string; + /** @deprecated A legacy feature for browser compatibility */ + lastMatch: string; + /** @deprecated A legacy feature for browser compatibility */ + "$&": string; + /** @deprecated A legacy feature for browser compatibility */ + lastParen: string; + /** @deprecated A legacy feature for browser compatibility */ + "$+": string; + /** @deprecated A legacy feature for browser compatibility */ + leftContext: string; + /** @deprecated A legacy feature for browser compatibility */ + "$`": string; + /** @deprecated A legacy feature for browser compatibility */ + rightContext: string; + /** @deprecated A legacy feature for browser compatibility */ + "$'": string; +} // // declare var RegExp: RegExpConstructor; From ac3431593559a4e6fa8b12f357776fb61fc72cd9 Mon Sep 17 00:00:00 2001 From: Lionel Parreaux Date: Tue, 20 Jun 2023 17:53:56 +0800 Subject: [PATCH 116/202] WIP: Cherry pick for literals --- shared/src/main/scala/mlscript/ConstraintSolver.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index ed7dc37e4..fda3ce609 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -551,7 +551,13 @@ class ConstraintSolver extends NormalForms { self: Typer => if (pts.contains(pt) || pts.exists(p => pt.parentsST.contains(p.id))) println(s"OK $pt <: ${pts.mkString(" | ")}") // else f.fold(reportError())(f => annoying(Nil, done_ls, Nil, f)) - else annoying(Nil, LhsRefined(N, ts, r, trs), Nil, RhsBases(Nil, bf, trs2)) + else annoying(pt.id match { + case _: IntLit => IntType :: Nil + case _: DecLit => DecType :: Nil + case _: StrLit => StrType :: Nil + case _: UnitLit => Nil + case _: Var => Nil + }, LhsRefined(N, ts, r, trs), Nil, RhsBases(Nil, bf, trs2)) case (lr @ LhsRefined(bo, ts, r, _), rf @ RhsField(n, t2)) => // Reuse the case implemented below: (this shortcut adds a few more annoying calls in stats) annoying(Nil, lr, Nil, RhsBases(Nil, S(R(rf)), SortedMap.empty)) From 5d493cdb571b2d3b9d94a5cf8d279ad7d55aee0d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 21 Jun 2023 10:02:38 +0800 Subject: [PATCH 117/202] WIP: Erase member functions' names to avoid clash --- .../test/projects/.interfaces/ts/MyPrint.mlsi | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 21 +- .../main/scala/ts2mls/types/Converter.scala | 10 +- .../src/main/scala/ts2mls/types/TSType.scala | 2 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 10 +- ts2mls/js/src/test/diff/Dec.mlsi | 2 +- ts2mls/js/src/test/diff/Dom.mlsi | 36 +- ts2mls/js/src/test/diff/ES5.mlsi | 570 +++++++++--------- ts2mls/js/src/test/diff/Heritage.mlsi | 4 +- ts2mls/js/src/test/diff/Overload.mlsi | 4 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 10 +- ts2mls/js/src/test/typescript/ES5.d.ts | 118 ++-- 12 files changed, 404 insertions(+), 385 deletions(-) diff --git a/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi b/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi index 9dd7ecfe5..7ff6f120e 100644 --- a/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi +++ b/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi @@ -1,6 +1,6 @@ export declare module MyPrint { export declare class DatePrint { constructor(p: Str) - fun print(msg: Str): unit + fun print(args0: Str): unit } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 3468d852d..681ba192f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -125,7 +125,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) } else if (obj.isEnumType) TSEnumType - else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration) + else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration, true) else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) @@ -143,7 +143,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // the function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = - if (tn.isFunctionLike) getFunctionType(tn) + if (tn.isFunctionLike) getFunctionType(tn, true) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { @@ -171,7 +171,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case (line, column) => TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column) } - else if (node.isFunctionLike) getFunctionType(node) + else if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) @@ -185,19 +185,22 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else lst :+ TSTypeParameter(tp.symbol.escapedName, Some(getObjectType(tp.constraint.typeNode))) ) - private def getFunctionType(node: TSNodeObject)(implicit ns: TSNamespace): TSFunctionType = { + private def getFunctionType(node: TSNodeObject, keepNames: Boolean)(implicit ns: TSNamespace): TSFunctionType = { def eraseVarParam(tp: TSType, erase: Boolean) = tp match { // TODO: support ... soon case arr @ TSArrayType(eleType) if erase => TSUnionType(eleType, arr) case _ => tp } - val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => ( + val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => { + // erase name to avoid name clash when overriding methods in ts + val name = if (keepNames) p.symbol.escapedName else s"args${lst.length}" // in typescript, you can use `this` to explicitly specifies the callee // but it never appears in the final javascript file if (p.symbol.escapedName === "this") lst else if (p.isOptionalParameter) // TODO: support optinal and default value soon - lst :+ TSParameterType(p.symbol.escapedName, TSUnionType(getObjectType(p.symbolType), TSPrimitiveType("undefined"))) - else lst :+ TSParameterType(p.symbol.escapedName, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)))) + lst :+ TSParameterType(name, TSUnionType(getObjectType(p.symbolType), TSPrimitiveType("undefined"))) + else lst :+ TSParameterType(name, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)) + }) TSFunctionType(pList, getObjectType(node.returnType), getTypeParameters(node)) } @@ -280,8 +283,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // because the namespace merely exports symbols rather than node objects themselves private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = if (node.isFunctionLike) overload.fold( - addFunctionIntoNamespace(getFunctionType(node), node, name) - )(decs => decs.foreach(d => addFunctionIntoNamespace(getFunctionType(d), d, name))) + addFunctionIntoNamespace(getFunctionType(node, true), node, name) + )(decs => decs.foreach(d => addFunctionIntoNamespace(getFunctionType(d, true), d, name))) else if (node.isClassDeclaration) ns.put(name, parseMembers(name, node, true), exported) else if (node.isInterfaceDeclaration) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 0cad27673..b091923a4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -28,9 +28,15 @@ object Converter { else name } + private def generateFunParamsList(params: List[TSParameterType]) = + if (params.isEmpty) "" + else params.iterator.zipWithIndex.map{ + case (tp, i) => convert(tp)("") + }.reduceLeft((r, p) => s"$r, $p") + def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { - val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") + val pList = generateFunParamsList(params) val tpList = if (typeVars.isEmpty) "" else s"[${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}]" val exp = if (exported) "export " else "" s"${indent}${exp}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" @@ -43,7 +49,7 @@ object Converter { case TSPrimitiveType(typeName) => primitiveName(typeName) case TSReferenceType(name) => name case TSFunctionType(params, res, _) => - val pList = if (params.isEmpty) "" else params.map(p => s"${convert(p)("")}").reduceLeft((r, p) => s"$r, $p") + val pList = generateFunParamsList(params) s"($pList) => ${convert(res)}" case TSUnionType(lhs, rhs) => s"(${convert(lhs)}) | (${convert(rhs)})" case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index 1c228571c..d6c7ea847 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -13,7 +13,7 @@ case class TSPrimitiveType(typeName: String) extends TSType case class TSReferenceType(name: String) extends TSType case object TSEnumType extends TSType case class TSTupleType(types: List[TSType]) extends TSType -case class TSFunctionType(params: List[TSParameterType], res: TSType, val typeVars: List[TSTypeParameter]) extends TSType +case class TSFunctionType(params: List[TSParameterType], res: TSType, typeVars: List[TSTypeParameter]) extends TSType case class TSArrayType(eleType: TSType) extends TSType case class TSSubstitutionType(base: String, applied: List[TSType]) extends TSType diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 870c67989..938cc47af 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -2,15 +2,15 @@ export declare module ClassMember { declare class Student { constructor(s: Str, age: Num) val name: Str - fun isFriend(other: Student): (false) | (true) - fun addScore(sub: Str, score: Num): unit + fun isFriend(args0: Student): (false) | (true) + fun addScore(args0: Str, args1: Num): unit fun getID(): Num } declare class Foo[T] { - fun bar(x: T): unit + fun bar(args0: T): unit } declare class EZ { - fun inc(x: Num): Num + fun inc(args0: Num): Num } declare class Outer { declare class Inner { @@ -18,7 +18,7 @@ export declare module ClassMember { } } declare class TTT[T] { - fun ttt(x: T): T + fun ttt(args0: T): T fun ttt2(x: T): T } } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 46b112c49..21a9b6319 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -6,7 +6,7 @@ export declare module Dec { } declare class Person { constructor(name: Str, age: Num) - fun getName(id: Num): Str + fun getName(args0: Num): Str } declare module OOO { } diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/ts2mls/js/src/test/diff/Dom.mlsi index c299636a9..f03bb2a2e 100644 --- a/ts2mls/js/src/test/diff/Dom.mlsi +++ b/ts2mls/js/src/test/diff/Dom.mlsi @@ -1,23 +1,23 @@ declare trait Console { - fun assert(condition: ((false) | (true)) | (undefined), data: (anything) | (MutArray[anything])): unit - fun count(label: (Str) | (undefined)): unit - fun timeEnd(label: (Str) | (undefined)): unit + fun assert(args0: ((false) | (true)) | (undefined), args1: (anything) | (MutArray[anything])): unit + fun count(args0: (Str) | (undefined)): unit + fun timeEnd(args0: (Str) | (undefined)): unit fun clear(): unit - fun timeStamp(label: (Str) | (undefined)): unit - fun info(data: (anything) | (MutArray[anything])): unit - fun debug(data: (anything) | (MutArray[anything])): unit - fun countReset(label: (Str) | (undefined)): unit - fun dir(item: (anything) | (undefined), options: (anything) | (undefined)): unit - fun error(data: (anything) | (MutArray[anything])): unit - fun timeLog(label: (Str) | (undefined), data: (anything) | (MutArray[anything])): unit - fun time(label: (Str) | (undefined)): unit - fun group(data: (anything) | (MutArray[anything])): unit - fun table(tabularData: (anything) | (undefined), properties: (MutArray[Str]) | (undefined)): unit - fun trace(data: (anything) | (MutArray[anything])): unit - fun warn(data: (anything) | (MutArray[anything])): unit - fun groupCollapsed(data: (anything) | (MutArray[anything])): unit - fun dirxml(data: (anything) | (MutArray[anything])): unit - fun log(data: (anything) | (MutArray[anything])): unit + fun timeStamp(args0: (Str) | (undefined)): unit + fun info(args0: (anything) | (MutArray[anything])): unit + fun debug(args0: (anything) | (MutArray[anything])): unit + fun countReset(args0: (Str) | (undefined)): unit + fun dir(args0: (anything) | (undefined), args1: (anything) | (undefined)): unit + fun error(args0: (anything) | (MutArray[anything])): unit + fun timeLog(args0: (Str) | (undefined), args1: (anything) | (MutArray[anything])): unit + fun time(args0: (Str) | (undefined)): unit + fun group(args0: (anything) | (MutArray[anything])): unit + fun table(args0: (anything) | (undefined), args1: (MutArray[Str]) | (undefined)): unit + fun trace(args0: (anything) | (MutArray[anything])): unit + fun warn(args0: (anything) | (MutArray[anything])): unit + fun groupCollapsed(args0: (anything) | (MutArray[anything])): unit + fun dirxml(args0: (anything) | (MutArray[anything])): unit + fun log(args0: (anything) | (MutArray[anything])): unit fun groupEnd(): unit } val console: Console diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 04984654b..af7c213dc 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -18,7 +18,7 @@ declare trait Symbol { type PropertyKey = ((Str) | (Num)) | (Symbol) declare trait PropertyDescriptor { val configurable: ((false) | (true)) | (undefined) - val set: ((v: anything) => unit) | (undefined) + val set: ((args0: anything) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) val get: (() => anything) | (undefined) val writable: ((false) | (true)) | (undefined) @@ -28,36 +28,36 @@ declare trait PropertyDescriptorMap { val __index: unsupported["[key: PropertyKey]: PropertyDescriptor;", "ES5.d.ts", 101, 33] } declare class Object { - fun hasOwnProperty(v: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun propertyIsEnumerable(v: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun hasOwnProperty(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) + fun propertyIsEnumerable(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) fun valueOf(): Object fun toLocaleString(): Str - fun isPrototypeOf(v: Object): (false) | (true) + fun isPrototypeOf(args0: Object): (false) | (true) fun toString(): Str } declare trait ObjectConstructor { val __call: unsupported["(value: any): any;", "ES5.d.ts", 139, 12] - fun getOwnPropertyNames(o: anything): MutArray[Str] - fun isFrozen(o: anything): (false) | (true) - fun getPrototypeOf(o: anything): anything - fun defineProperty[T](o: T, p: ((Str) | (Num)) | (Symbol), attributes: (PropertyDescriptor) & (ThisType[anything])): T + fun getOwnPropertyNames(args0: anything): MutArray[Str] + fun isFrozen(args0: anything): (false) | (true) + fun getPrototypeOf(args0: anything): anything + fun defineProperty[T](args0: T, args1: ((Str) | (Num)) | (Symbol), args2: (PropertyDescriptor) & (ThisType[anything])): T val prototype: Object - fun isSealed(o: anything): (false) | (true) - fun defineProperties[T](o: T, properties: (PropertyDescriptorMap) & (ThisType[anything])): T - fun preventExtensions[T](o: T): T - fun create(o: Object, properties: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ - fun freeze[T](f: T): T + fun isSealed(args0: anything): (false) | (true) + fun defineProperties[T](args0: T, args1: (PropertyDescriptorMap) & (ThisType[anything])): T + fun preventExtensions[T](args0: T): T + fun create(args0: Object, args1: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ + fun freeze[T](args0: T): T val __new: unsupported["new(value?: any): Object;", "ES5.d.ts", 137, 29] - fun getOwnPropertyDescriptor(o: anything, p: ((Str) | (Num)) | (Symbol)): PropertyDescriptor - fun seal[T](o: T): T - fun keys(o: Object): MutArray[Str] - fun isExtensible(o: anything): (false) | (true) + fun getOwnPropertyDescriptor(args0: anything, args1: ((Str) | (Num)) | (Symbol)): PropertyDescriptor + fun seal[T](args0: T): T + fun keys(args0: Object): MutArray[Str] + fun isExtensible(args0: anything): (false) | (true) } declare trait Function { - fun bind(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything - fun apply(thisArg: anything, argArray: (anything) | (undefined)): anything + fun bind(args0: anything, args1: (anything) | (MutArray[anything])): anything + fun apply(args0: anything, args1: (anything) | (undefined)): anything val prototype: anything - fun call(thisArg: anything, argArray: (anything) | (MutArray[anything])): anything + fun call(args0: anything, args1: (anything) | (MutArray[anything])): anything fun toString(): Str val length: Num val caller: Function @@ -70,40 +70,50 @@ declare trait FunctionConstructor { } type ThisParameterType[T] = unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ES5.d.ts", 307, 27] type OmitThisParameter[T] = unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ES5.d.ts", 312, 27] +declare trait CallableFunction extends Function { + fun apply[T, A, R](args0: T, args1: A): R /* warning: the overload of function apply is not supported yet. */ + fun call[T, A, R](args0: T, args1: A): R + fun bind[T, AX, R](args0: T, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ +} +declare trait NewableFunction extends Function { + fun apply[T, A](args0: T, args1: A): unit /* warning: the overload of function apply is not supported yet. */ + fun call[T, A](args0: T, args1: A): unit + fun bind[AX, R](args0: anything, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ +} declare trait IArguments { val __index: unsupported["[index: number]: any;", "ES5.d.ts", 374, 22] val length: Num val callee: Function } declare class Str extends Object { - fun replace(searchValue: (Str) | (RegExp), replacer: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ + fun replace(args0: (Str) | (RegExp), args1: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ fun valueOf(): Str - fun toLocaleUpperCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str - fun lastIndexOf(searchString: Str, position: (Num) | (undefined)): Num - fun localeCompare(that: Str): Num - fun toLocaleLowerCase(locales: ((Str) | (MutArray[Str])) | (undefined)): Str - fun match(regexp: (Str) | (RegExp)): RegExpMatchArray - fun split(separator: (Str) | (RegExp), limit: (Num) | (undefined)): MutArray[Str] + fun toLocaleUpperCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str + fun lastIndexOf(args0: Str, args1: (Num) | (undefined)): Num + fun localeCompare(args0: Str): Num + fun toLocaleLowerCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str + fun match(args0: (Str) | (RegExp)): RegExpMatchArray + fun split(args0: (Str) | (RegExp), args1: (Num) | (undefined)): MutArray[Str] fun toUpperCase(): Str - fun indexOf(searchString: Str, position: (Num) | (undefined)): Num + fun indexOf(args0: Str, args1: (Num) | (undefined)): Num fun toLowerCase(): Str - fun concat(strings: (Str) | (MutArray[Str])): Str + fun concat(args0: (Str) | (MutArray[Str])): Str val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 499, 22] - fun charCodeAt(index: Num): Num - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Str - fun substr(from: Num, length: (Num) | (undefined)): Str + fun charCodeAt(args0: Num): Num + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Str + fun substr(args0: Num, args1: (Num) | (undefined)): Str fun toString(): Str val length: Num - fun substring(start: Num, end: (Num) | (undefined)): Str + fun substring(args0: Num, args1: (Num) | (undefined)): Str fun trim(): Str - fun search(regexp: (Str) | (RegExp)): Num - fun charAt(pos: Num): Str + fun search(args0: (Str) | (RegExp)): Num + fun charAt(args0: Num): Str } declare trait StringConstructor { val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 504, 29] val __call: unsupported["(value?: any): string;", "ES5.d.ts", 505, 26] val prototype: Str - fun fromCharCode(codes: (Num) | (MutArray[Num])): Str + fun fromCharCode(args0: (Num) | (MutArray[Num])): Str } val String: StringConstructor declare class Bool { @@ -116,11 +126,11 @@ declare trait BooleanConstructor { } val Boolean: BooleanConstructor declare class Num { - fun toExponential(fractionDigits: (Num) | (undefined)): Str + fun toExponential(args0: (Num) | (undefined)): Str fun valueOf(): Num - fun toString(radix: (Num) | (undefined)): Str - fun toFixed(fractionDigits: (Num) | (undefined)): Str - fun toPrecision(precision: (Num) | (undefined)): Str + fun toString(args0: (Num) | (undefined)): Str + fun toFixed(args0: (Num) | (undefined)): Str + fun toPrecision(args0: (Num) | (undefined)): Str } declare trait NumberConstructor { val __call: unsupported["(value?: any): number;", "ES5.d.ts", 559, 26] @@ -145,66 +155,66 @@ declare trait ImportAssertions { } declare trait Math { fun random(): Num - fun asin(x: Num): Num + fun asin(args0: Num): Num val LOG2E: Num - fun min(values: (Num) | (MutArray[Num])): Num - fun cos(x: Num): Num + fun min(args0: (Num) | (MutArray[Num])): Num + fun cos(args0: Num): Num val LOG10E: Num val PI: Num - fun floor(x: Num): Num + fun floor(args0: Num): Num val SQRT2: Num - fun round(x: Num): Num - fun sin(x: Num): Num + fun round(args0: Num): Num + fun sin(args0: Num): Num val E: Num val LN10: Num - fun exp(x: Num): Num + fun exp(args0: Num): Num val LN2: Num - fun atan(x: Num): Num - fun pow(x: Num, y: Num): Num - fun ceil(x: Num): Num - fun max(values: (Num) | (MutArray[Num])): Num - fun atan2(y: Num, x: Num): Num - fun sqrt(x: Num): Num - fun tan(x: Num): Num + fun atan(args0: Num): Num + fun pow(args0: Num, args1: Num): Num + fun ceil(args0: Num): Num + fun max(args0: (Num) | (MutArray[Num])): Num + fun atan2(args0: Num, args1: Num): Num + fun sqrt(args0: Num): Num + fun tan(args0: Num): Num val SQRT1_2: Num - fun abs(x: Num): Num - fun log(x: Num): Num - fun acos(x: Num): Num + fun abs(args0: Num): Num + fun log(args0: Num): Num + fun acos(args0: Num): Num } declare trait Date { fun getUTCMonth(): Num fun valueOf(): Num fun getUTCMinutes(): Num - fun setMilliseconds(ms: Num): Num + fun setMilliseconds(args0: Num): Num fun toLocaleString(): Str fun getDate(): Num fun getUTCDate(): Num - fun setDate(date: Num): Num - fun setFullYear(year: Num, month: (Num) | (undefined), date: (Num) | (undefined)): Num + fun setDate(args0: Num): Num + fun setFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num fun getMinutes(): Num fun getFullYear(): Num - fun setUTCDate(date: Num): Num - fun setMinutes(min: Num, sec: (Num) | (undefined), ms: (Num) | (undefined)): Num - fun setTime(time: Num): Num + fun setUTCDate(args0: Num): Num + fun setMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + fun setTime(args0: Num): Num fun toUTCString(): Str fun toLocaleDateString(): Str - fun setUTCMonth(month: Num, date: (Num) | (undefined)): Num - fun setUTCFullYear(year: Num, month: (Num) | (undefined), date: (Num) | (undefined)): Num - fun setHours(hours: Num, min: (Num) | (undefined), sec: (Num) | (undefined), ms: (Num) | (undefined)): Num + fun setUTCMonth(args0: Num, args1: (Num) | (undefined)): Num + fun setUTCFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + fun setHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num fun getTime(): Num - fun setSeconds(sec: Num, ms: (Num) | (undefined)): Num - fun setUTCSeconds(sec: Num, ms: (Num) | (undefined)): Num + fun setSeconds(args0: Num, args1: (Num) | (undefined)): Num + fun setUTCSeconds(args0: Num, args1: (Num) | (undefined)): Num fun getUTCFullYear(): Num fun getUTCHours(): Num fun getUTCDay(): Num - fun setUTCMinutes(min: Num, sec: (Num) | (undefined), ms: (Num) | (undefined)): Num + fun setUTCMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num fun getHours(): Num fun toISOString(): Str fun toTimeString(): Str - fun setUTCMilliseconds(ms: Num): Num + fun setUTCMilliseconds(args0: Num): Num fun getUTCSeconds(): Num fun getMilliseconds(): Num - fun setMonth(month: Num, date: (Num) | (undefined)): Num + fun setMonth(args0: Num, args1: (Num) | (undefined)): Num fun getDay(): Num fun toLocaleTimeString(): Str fun getSeconds(): Num @@ -213,15 +223,15 @@ declare trait Date { fun toString(): Str fun getMonth(): Num fun getTimezoneOffset(): Num - fun setUTCHours(hours: Num, min: (Num) | (undefined), sec: (Num) | (undefined), ms: (Num) | (undefined)): Num - fun toJSON(key: (anything) | (undefined)): Str + fun setUTCHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num + fun toJSON(args0: (anything) | (undefined)): Str } declare trait DateConstructor { val __call: unsupported["(): string;", "ES5.d.ts", 899, 128] - fun UTC(year: Num, monthIndex: Num, date: (Num) | (undefined), hours: (Num) | (undefined), minutes: (Num) | (undefined), seconds: (Num) | (undefined), ms: (Num) | (undefined)): Num + fun UTC(args0: Num, args1: Num, args2: (Num) | (undefined), args3: (Num) | (undefined), args4: (Num) | (undefined), args5: (Num) | (undefined), args6: (Num) | (undefined)): Num val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 888, 38] fun now(): Num - fun parse(s: Str): Num + fun parse(args0: Str): Num val prototype: Date } declare trait RegExpMatchArray extends MutArray[Str] { @@ -235,14 +245,14 @@ declare trait RegExpExecArray extends MutArray[Str] { val id"0": Str } declare trait RegExp { - fun test(string: Str): (false) | (true) + fun test(args0: Str): (false) | (true) val multiline: (false) | (true) val source: Str - fun compile(pattern: Str, flags: (Str) | (undefined)): RegExp + fun compile(args0: Str, args1: (Str) | (undefined)): RegExp val global: (false) | (true) val lastIndex: Num val ignoreCase: (false) | (true) - fun exec(string: Str): RegExpExecArray + fun exec(args0: Str): RegExpExecArray } declare trait RegExpConstructor { val id"$4": Str @@ -285,62 +295,62 @@ declare trait SyntaxError extends Error {} declare trait TypeError extends Error {} declare trait URIError extends Error {} declare trait JSON { - fun parse(text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): anything - fun stringify(value: anything, replacer: (MutArray[(Str) | (Num)]) | (undefined), space: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ + fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything + fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ } declare trait ReadonlyArray[T] { - fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun forEach(callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => unit, thisArg: (anything) | (undefined)): unit - fun filter(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ + fun lastIndexOf(args0: T, args1: (Num) | (undefined)): Num + fun every(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun forEach(args0: (value: T, index: Num, array: ReadonlyArray[T]) => unit, args1: (anything) | (undefined)): unit + fun filter(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1273, 136] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun join(separator: (Str) | (undefined)): Str - fun map[U](callbackfn: (value: T, index: Num, array: ReadonlyArray[T]) => U, thisArg: (anything) | (undefined)): MutArray[U] - fun concat(items: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun join(args0: (Str) | (undefined)): Str + fun map[U](args0: (value: T, index: Num, array: ReadonlyArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] + fun concat(args0: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ fun toLocaleString(): Str - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] - fun reduce[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] + fun reduce[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: T, index: Num, array: ReadonlyArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: T, args1: (Num) | (undefined)): Num } declare trait ConcatArray[T] { val length: Num val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1279, 28] - fun join(separator: (Str) | (undefined)): Str - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] + fun join(args0: (Str) | (undefined)): Str + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] } declare trait MutArray[T] { - fun lastIndexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun push(items: (T) | (MutArray[T])): Num - fun forEach(callbackfn: (value: T, index: Num, array: MutArray[T]) => unit, thisArg: (anything) | (undefined)): unit - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun unshift(items: (T) | (MutArray[T])): Num - fun sort(compareFn: ((a: T, b: T) => Num) | (undefined)): MutArray - fun join(separator: (Str) | (undefined)): Str - fun map[U](callbackfn: (value: T, index: Num, array: MutArray[T]) => U, thisArg: (anything) | (undefined)): MutArray[U] + fun lastIndexOf(args0: T, args1: (Num) | (undefined)): Num + fun every(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun push(args0: (T) | (MutArray[T])): Num + fun forEach(args0: (value: T, index: Num, array: MutArray[T]) => unit, args1: (anything) | (undefined)): unit + fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun unshift(args0: (T) | (MutArray[T])): Num + fun sort(args0: ((a: T, b: T) => Num) | (undefined)): MutArray + fun join(args0: (Str) | (undefined)): Str + fun map[U](args0: (value: T, index: Num, array: MutArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] fun pop(): T fun shift(): T - fun concat(items: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun concat(args0: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ fun toLocaleString(): Str fun reverse(): MutArray[T] - fun filter(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ + fun filter(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1464, 127] - fun splice(start: Num, deleteCount: Num, items: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): MutArray[T] - fun reduce[U](callbackfn: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun splice(args0: Num, args1: Num, args2: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] + fun reduce[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: T, index: Num, array: MutArray[T]) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: T, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: T, args1: (Num) | (undefined)): Num } declare trait ArrayConstructor { val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1471, 38] val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1474, 34] - fun isArray(arg: anything): (false) | (true) + fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } val Array: ArrayConstructor @@ -354,11 +364,11 @@ declare trait TypedPropertyDescriptor[T] { } type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike[T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike[T] declare trait PromiseLike[T] { - fun id"then"[TResult1, TResult2](onfulfilled: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), onrejected: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): PromiseLike[(TResult1) | (TResult2)] + fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): PromiseLike[(TResult1) | (TResult2)] } declare trait Promise[T] { - fun id"then"[TResult1, TResult2](onfulfilled: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), onrejected: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] - fun catch[TResult](onrejected: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] + fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] + fun catch[TResult](args0: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] } type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1526, 17] declare trait ArrayLike[T] { @@ -385,275 +395,275 @@ type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1632, 37] declare trait ThisType[T] {} declare trait ArrayBuffer { val byteLength: Num - fun slice(begin: Num, end: (Num) | (undefined)): ArrayBuffer + fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer } declare trait Int8Array { fun valueOf(): Int8Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2066, 25] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int8Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int8Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array - fun find(predicate: (value: Num, index: Num, obj: Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int8Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Int8Array) => Num, thisArg: (anything) | (undefined)): Int8Array - fun forEach(callbackfn: (value: Num, index: Num, array: Int8Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int8Array + fun find(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Int8Array) => Num, args1: (anything) | (undefined)): Int8Array + fun forEach(args0: (value: Num, index: Num, array: Int8Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Int8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Int8Array - fun filter(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): Int8Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int8Array + fun filter(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): Int8Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Int8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint8Array { fun valueOf(): Uint8Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2348, 26] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun find(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Uint8Array) => Num, thisArg: (anything) | (undefined)): Uint8Array - fun forEach(callbackfn: (value: Num, index: Num, array: Uint8Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8Array + fun find(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Uint8Array) => Num, args1: (anything) | (undefined)): Uint8Array + fun forEach(args0: (value: Num, index: Num, array: Uint8Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Uint8Array - fun filter(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): Uint8Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8Array + fun filter(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): Uint8Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Uint8Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint8ClampedArray { fun valueOf(): Uint8ClampedArray - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2630, 33] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8ClampedArray + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray - fun find(predicate: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Uint8ClampedArray) => Num, thisArg: (anything) | (undefined)): Uint8ClampedArray - fun forEach(callbackfn: (value: Num, index: Num, array: Uint8ClampedArray) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8ClampedArray + fun find(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Uint8ClampedArray) => Num, args1: (anything) | (undefined)): Uint8ClampedArray + fun forEach(args0: (value: Num, index: Num, array: Uint8ClampedArray) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Uint8ClampedArray - fun filter(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): Uint8ClampedArray - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint8ClampedArray + fun filter(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): Uint8ClampedArray + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Uint8ClampedArray) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Int16Array { fun valueOf(): Int16Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2910, 26] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int16Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int16Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array - fun find(predicate: (value: Num, index: Num, obj: Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int16Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Int16Array) => Num, thisArg: (anything) | (undefined)): Int16Array - fun forEach(callbackfn: (value: Num, index: Num, array: Int16Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int16Array + fun find(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Int16Array) => Num, args1: (anything) | (undefined)): Int16Array + fun forEach(args0: (value: Num, index: Num, array: Int16Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Int16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Int16Array - fun filter(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): Int16Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int16Array + fun filter(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): Int16Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Int16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint16Array { fun valueOf(): Uint16Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3193, 27] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint16Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array - fun find(predicate: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Uint16Array) => Num, thisArg: (anything) | (undefined)): Uint16Array - fun forEach(callbackfn: (value: Num, index: Num, array: Uint16Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint16Array + fun find(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Uint16Array) => Num, args1: (anything) | (undefined)): Uint16Array + fun forEach(args0: (value: Num, index: Num, array: Uint16Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Uint16Array - fun filter(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): Uint16Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint16Array + fun filter(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): Uint16Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Uint16Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Int32Array { fun valueOf(): Int32Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3476, 26] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Int32Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array - fun find(predicate: (value: Num, index: Num, obj: Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Int32Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Int32Array) => Num, thisArg: (anything) | (undefined)): Int32Array - fun forEach(callbackfn: (value: Num, index: Num, array: Int32Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int32Array + fun find(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Int32Array) => Num, args1: (anything) | (undefined)): Int32Array + fun forEach(args0: (value: Num, index: Num, array: Int32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Int32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Int32Array - fun filter(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): Int32Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Int32Array + fun filter(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): Int32Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Int32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint32Array { fun valueOf(): Uint32Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3757, 27] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array - fun find(predicate: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Uint32Array) => Num, thisArg: (anything) | (undefined)): Uint32Array - fun forEach(callbackfn: (value: Num, index: Num, array: Uint32Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint32Array + fun find(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Uint32Array) => Num, args1: (anything) | (undefined)): Uint32Array + fun forEach(args0: (value: Num, index: Num, array: Uint32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Uint32Array - fun filter(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): Uint32Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Uint32Array + fun filter(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): Uint32Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Uint32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Float32Array { fun valueOf(): Float32Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4039, 28] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float32Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array - fun find(predicate: (value: Num, index: Num, obj: Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Float32Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Float32Array) => Num, thisArg: (anything) | (undefined)): Float32Array - fun forEach(callbackfn: (value: Num, index: Num, array: Float32Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float32Array + fun find(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Float32Array) => Num, args1: (anything) | (undefined)): Float32Array + fun forEach(args0: (value: Num, index: Num, array: Float32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Float32Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Float32Array - fun filter(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): Float32Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Float32Array + fun filter(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): Float32Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Float32Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Float64Array { fun valueOf(): Float64Array - fun lastIndexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num - fun every(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun set(array: ArrayLike[Num], offset: (Num) | (undefined)): unit + fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + fun every(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4313, 28] - fun reduceRight[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, initialValue: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(value: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array - fun sort(compareFn: ((a: Num, b: Num) => Num) | (undefined)): Float64Array + fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float64Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float64Array val BYTES_PER_ELEMENT: Num - fun copyWithin(target: Num, start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array - fun find(predicate: (value: Num, index: Num, obj: Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): Num - fun subarray(begin: (Num) | (undefined), end: (Num) | (undefined)): Float64Array - fun join(separator: (Str) | (undefined)): Str - fun map(callbackfn: (value: Num, index: Num, array: Float64Array) => Num, thisArg: (anything) | (undefined)): Float64Array - fun forEach(callbackfn: (value: Num, index: Num, array: Float64Array) => unit, thisArg: (anything) | (undefined)): unit + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float64Array + fun find(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num + fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array + fun join(args0: (Str) | (undefined)): Str + fun map(args0: (value: Num, index: Num, array: Float64Array) => Num, args1: (anything) | (undefined)): Float64Array + fun forEach(args0: (value: Num, index: Num, array: Float64Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(predicate: (value: Num, index: Num, obj: Float64Array) => (false) | (true), thisArg: (anything) | (undefined)): Num + fun findIndex(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num fun reverse(): Float64Array - fun filter(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): Float64Array - fun slice(start: (Num) | (undefined), end: (Num) | (undefined)): Float64Array + fun filter(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): Float64Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array val byteLength: Num - fun reduce[U](callbackfn: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, initialValue: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(predicate: (value: Num, index: Num, array: Float64Array) => anything, thisArg: (anything) | (undefined)): (false) | (true) - fun indexOf(searchElement: Num, fromIndex: (Num) | (undefined)): Num + fun some(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare module Intl { @@ -675,7 +685,7 @@ declare module Intl { val collation: Str } export declare trait Collator { - fun compare(x: Str, y: Str): Num + fun compare(args0: Str, args1: Str): Num fun resolvedOptions(): ResolvedCollatorOptions } export declare trait NumberFormatOptions { @@ -703,7 +713,7 @@ declare module Intl { val minimumFractionDigits: Num } export declare trait NumberFormat { - fun format(value: Num): Str + fun format(args0: Num): Str fun resolvedOptions(): ResolvedNumberFormatOptions } export declare trait DateTimeFormatOptions { @@ -738,7 +748,7 @@ declare module Intl { val era: (Str) | (undefined) } export declare trait DateTimeFormat { - fun format(date: ((Num) | (Date)) | (undefined)): Str + fun format(args0: ((Num) | (Date)) | (undefined)): Str fun resolvedOptions(): ResolvedDateTimeFormatOptions } } diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 814d11c9e..ec9574977 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -4,7 +4,7 @@ export declare module Heritage { } declare class B extends A {} declare class C[T] { - fun set(x: T): unit + fun set(args0: T): unit fun get(): T } declare class D extends C[Num] {} @@ -30,7 +30,7 @@ export declare module Heritage { fun xx(x: I): I } declare class OR[R] extends O[R] { - fun xx(x: R): R + fun xx(args0: R): R } declare module Five { export declare class ROTK { diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 390bb23f1..8bde45d3b 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,7 +1,7 @@ export declare module Overload { fun f(x: anything): Str /* warning: the overload of function f is not supported yet. */ declare class M { - fun foo(x: anything): Str /* warning: the overload of function foo is not supported yet. */ + fun foo(args0: anything): Str /* warning: the overload of function foo is not supported yet. */ } fun app(f: anything, x: anything): unit /* warning: the overload of function app is not supported yet. */ fun create(x: anything): () => (false) | (true) /* warning: the overload of function create is not supported yet. */ @@ -18,7 +18,7 @@ export declare module Overload { export fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { - fun F[T](x: T): T /* warning: the overload of function F is not supported yet. */ + fun F[T](args0: T): T /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 864716a04..9d7c7ea9e 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,11 +1,11 @@ export declare module TypeParameter { fun inc[T](x: T): Num declare class CC[T] { - fun print(s: T): unit + fun print(args0: T): unit } fun con[U, T](t: T): U declare class Printer[T] { - fun print(t: T): unit + fun print(args0: T): unit } fun setStringPrinter(p: Printer[Str]): unit fun getStringPrinter(): Printer[Str] @@ -13,14 +13,14 @@ export declare module TypeParameter { fun foo2[T](p: Printer[T], x: T): T declare class F[T] { val x: T - fun GG[U](y: U): T + fun GG[U](args0: U): T } declare trait I[T] { val x: T - fun GG[U](y: U): T + fun GG[U](args0: U): T } declare class FFF[T] { - fun fff(x: T): unit + fun fff(args0: T): unit } fun fff(p: FFF[Str], s: Str): unit fun getFFF(): FFF[Num] diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index d7abf650e..c631dc098 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -246,11 +246,11 @@ interface ObjectConstructor { keys(o: object): string[]; } -// // TODO: name clash? -// /** -// * Provides functionality common to all JavaScript objects. -// */ -// // declare var Object: ObjectConstructor; +// TODO: name clash? +/** + * Provides functionality common to all JavaScript objects. + */ +// declare var Object: ObjectConstructor; /** * Creates a new function. @@ -311,65 +311,65 @@ type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U */ type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T; -// interface CallableFunction extends Function { -// /** -// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args An array of argument values to be passed to the function. -// */ -// apply(this: (this: T) => R, thisArg: T): R; -// apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; +interface CallableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: (this: T) => R, thisArg: T): R; + apply(this: (this: T, ...args: A) => R, thisArg: T, args: A): R; -// /** -// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args Argument values to be passed to the function. -// */ -// call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: (this: T, ...args: A) => R, thisArg: T, ...args: A): R; -// /** -// * For a given function, creates a bound function that has the same body as the original function. -// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. -// * @param thisArg The object to be used as the this object. -// * @param args Arguments to bind to the parameters of the function. -// */ -// bind(this: T, thisArg: ThisParameterType): OmitThisParameter; -// bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; -// bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; -// bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; -// } + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: T, thisArg: ThisParameterType): OmitThisParameter; + bind(this: (this: T, arg0: A0, ...args: A) => R, thisArg: T, arg0: A0): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2): (...args: A) => R; + bind(this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3): (...args: A) => R; + bind(this: (this: T, ...args: AX[]) => R, thisArg: T, ...args: AX[]): (...args: AX[]) => R; +} -// interface NewableFunction extends Function { -// /** -// * Calls the function with the specified object as the this value and the elements of specified array as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args An array of argument values to be passed to the function. -// */ -// apply(this: new () => T, thisArg: T): void; -// apply(this: new (...args: A) => T, thisArg: T, args: A): void; +interface NewableFunction extends Function { + /** + * Calls the function with the specified object as the this value and the elements of specified array as the arguments. + * @param thisArg The object to be used as the this object. + * @param args An array of argument values to be passed to the function. + */ + apply(this: new () => T, thisArg: T): void; + apply(this: new (...args: A) => T, thisArg: T, args: A): void; -// /** -// * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. -// * @param thisArg The object to be used as the this object. -// * @param args Argument values to be passed to the function. -// */ -// call(this: new (...args: A) => T, thisArg: T, ...args: A): void; + /** + * Calls the function with the specified object as the this value and the specified rest arguments as the arguments. + * @param thisArg The object to be used as the this object. + * @param args Argument values to be passed to the function. + */ + call(this: new (...args: A) => T, thisArg: T, ...args: A): void; -// /** -// * For a given function, creates a bound function that has the same body as the original function. -// * The this object of the bound function is associated with the specified object, and has the specified initial parameters. -// * @param thisArg The object to be used as the this object. -// * @param args Arguments to bind to the parameters of the function. -// */ -// bind(this: T, thisArg: any): T; -// bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; -// bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; -// bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; -// } + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg The object to be used as the this object. + * @param args Arguments to bind to the parameters of the function. + */ + bind(this: T, thisArg: any): T; + bind(this: new (arg0: A0, ...args: A) => R, thisArg: any, arg0: A0): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2): new (...args: A) => R; + bind(this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R, thisArg: any, arg0: A0, arg1: A1, arg2: A2, arg3: A3): new (...args: A) => R; + bind(this: new (...args: AX[]) => R, thisArg: any, ...args: AX[]): new (...args: AX[]) => R; +} interface IArguments { [index: number]: any; From aeb904cd51067493beb0fb61b7c4a1b1e9a16a1d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 21 Jun 2023 10:26:45 +0800 Subject: [PATCH 118/202] WIP: Fix member name clash --- .../src/main/scala/ts2mls/TSSourceFile.scala | 11 +- ts2mls/js/src/test/diff/ES5.mlsi | 102 +++ ts2mls/js/src/test/typescript/ES5.d.ts | 774 +++++++++--------- 3 files changed, 499 insertions(+), 388 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 681ba192f..e55dc4136 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -228,7 +228,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType others.removed(name) ++ Map(name -> TSMemberType(res, node.modifier)) } } - case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) + case _ => mem match { + case TSReferenceType(ref) if name === ref => lineHelper.getPos(node.pos) match { + case (line, column) => + others ++ Map(name -> TSMemberType( + TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column), + node.modifier + )) + } + case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) + } } private def getClassMembersType(list: TSNodeArray, requireStatic: Boolean)(implicit ns: TSNamespace): Map[String, TSMemberType] = diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index af7c213dc..5dc795dee 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -397,6 +397,45 @@ declare trait ArrayBuffer { val byteLength: Num fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer } +declare trait ArrayBufferTypes { + val ArrayBuffer: unsupported["ArrayBuffer: ArrayBuffer;", "ES5.d.ts", 1660, 28] +} +type ArrayBufferLike = ArrayBuffer +declare trait ArrayBufferConstructor { + val prototype: ArrayBuffer + val __new: unsupported["new(byteLength: number): ArrayBuffer;", "ES5.d.ts", 1666, 36] + fun isView(args0: anything): (false) | (true) +} +declare trait ArrayBufferView { + val buffer: ArrayBuffer + val byteLength: Num + val byteOffset: Num +} +declare trait DataView { + fun setInt32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun setUint32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun setFloat64(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun getInt8(args0: Num): Num + val buffer: ArrayBuffer + fun setInt16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun getUint8(args0: Num): Num + val byteLength: Num + fun getFloat64(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun getFloat32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun getUint16(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun setInt8(args0: Num, args1: Num): unit + fun setUint16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun setFloat32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + fun getUint32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun getInt32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun getInt16(args0: Num, args1: ((false) | (true)) | (undefined)): Num + fun setUint8(args0: Num, args1: Num): unit + val byteOffset: Num +} +declare trait DataViewConstructor { + val prototype: DataView + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ES5.d.ts", 1818, 33] +} declare trait Int8Array { fun valueOf(): Int8Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -427,6 +466,13 @@ declare trait Int8Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Int8ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ES5.d.ts", 2073, 63] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int8Array + fun id"of"(args0: (Num) | (MutArray[Num])): Int8Array + val BYTES_PER_ELEMENT: Num +} declare trait Uint8Array { fun valueOf(): Uint8Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -457,6 +503,13 @@ declare trait Uint8Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Uint8ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ES5.d.ts", 2356, 64] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint8Array + fun id"of"(args0: (Num) | (MutArray[Num])): Uint8Array + val BYTES_PER_ELEMENT: Num +} declare trait Uint8ClampedArray { fun valueOf(): Uint8ClampedArray fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -487,6 +540,13 @@ declare trait Uint8ClampedArray { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Uint8ClampedArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ES5.d.ts", 2638, 71] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + val prototype: Uint8ClampedArray + fun id"of"(args0: (Num) | (MutArray[Num])): Uint8ClampedArray + val BYTES_PER_ELEMENT: Num +} declare trait Int16Array { fun valueOf(): Int16Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -517,6 +577,13 @@ declare trait Int16Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Int16ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ES5.d.ts", 2918, 64] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int16Array + fun id"of"(args0: (Num) | (MutArray[Num])): Int16Array + val BYTES_PER_ELEMENT: Num +} declare trait Uint16Array { fun valueOf(): Uint16Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -547,6 +614,13 @@ declare trait Uint16Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Uint16ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ES5.d.ts", 3201, 65] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint16Array + fun id"of"(args0: (Num) | (MutArray[Num])): Uint16Array + val BYTES_PER_ELEMENT: Num +} declare trait Int32Array { fun valueOf(): Int32Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -577,6 +651,13 @@ declare trait Int32Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Int32ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ES5.d.ts", 3484, 64] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Int32Array + fun id"of"(args0: (Num) | (MutArray[Num])): Int32Array + val BYTES_PER_ELEMENT: Num +} declare trait Uint32Array { fun valueOf(): Uint32Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -607,6 +688,13 @@ declare trait Uint32Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Uint32ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ES5.d.ts", 3765, 65] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Uint32Array + fun id"of"(args0: (Num) | (MutArray[Num])): Uint32Array + val BYTES_PER_ELEMENT: Num +} declare trait Float32Array { fun valueOf(): Float32Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -637,6 +725,13 @@ declare trait Float32Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Float32ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ES5.d.ts", 4047, 66] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + val prototype: Float32Array + fun id"of"(args0: (Num) | (MutArray[Num])): Float32Array + val BYTES_PER_ELEMENT: Num +} declare trait Float64Array { fun valueOf(): Float64Array fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num @@ -666,6 +761,13 @@ declare trait Float64Array { fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } +declare trait Float64ArrayConstructor { + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ES5.d.ts", 4321, 66] + fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + val prototype: Float64Array + fun id"of"(args0: (Num) | (MutArray[Num])): Float64Array + val BYTES_PER_ELEMENT: Num +} declare module Intl { export declare trait CollatorOptions { val sensitivity: (Str) | (undefined) diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index c631dc098..7447d12a4 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -1654,170 +1654,170 @@ interface ArrayBuffer { slice(begin: number, end?: number): ArrayBuffer; } -// /** -// * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. -// */ -// interface ArrayBufferTypes { -// ArrayBuffer: ArrayBuffer; -// } -// type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; +/** + * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays. + */ +interface ArrayBufferTypes { + ArrayBuffer: ArrayBuffer; +} +type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]; -// interface ArrayBufferConstructor { -// readonly prototype: ArrayBuffer; -// new(byteLength: number): ArrayBuffer; -// isView(arg: any): arg is ArrayBufferView; -// } +interface ArrayBufferConstructor { + readonly prototype: ArrayBuffer; + new(byteLength: number): ArrayBuffer; + isView(arg: any): arg is ArrayBufferView; +} // declare var ArrayBuffer: ArrayBufferConstructor; -// interface ArrayBufferView { -// /** -// * The ArrayBuffer instance referenced by the array. -// */ -// buffer: ArrayBufferLike; +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBufferLike; -// /** -// * The length in bytes of the array. -// */ -// byteLength: number; + /** + * The length in bytes of the array. + */ + byteLength: number; -// /** -// * The offset in bytes of the array. -// */ -// byteOffset: number; -// } + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} -// interface DataView { -// readonly buffer: ArrayBuffer; -// readonly byteLength: number; -// readonly byteOffset: number; -// /** -// * Gets the Float32 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getFloat32(byteOffset: number, littleEndian?: boolean): number; +interface DataView { + readonly buffer: ArrayBuffer; + readonly byteLength: number; + readonly byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Gets the Float64 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getFloat64(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Gets the Int8 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// */ -// getInt8(byteOffset: number): number; + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; -// /** -// * Gets the Int16 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getInt16(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Gets the Int32 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getInt32(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Gets the Uint8 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// */ -// getUint8(byteOffset: number): number; + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; -// /** -// * Gets the Uint16 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getUint16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Gets the Uint32 value at the specified byte offset from the start of the view. There is -// * no alignment constraint; multi-byte values may be fetched from any offset. -// * @param byteOffset The place in the buffer at which the value should be retrieved. -// * @param littleEndian If false or undefined, a big-endian value should be read. -// */ -// getUint32(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + * @param littleEndian If false or undefined, a big-endian value should be read. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; -// /** -// * Stores an Float32 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; -// /** -// * Stores an Float64 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; -// /** -// * Stores an Int8 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// */ -// setInt8(byteOffset: number, value: number): void; + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; -// /** -// * Stores an Int16 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; -// /** -// * Stores an Int32 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; -// /** -// * Stores an Uint8 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// */ -// setUint8(byteOffset: number, value: number): void; + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; -// /** -// * Stores an Uint16 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; -// /** -// * Stores an Uint32 value at the specified byte offset from the start of the view. -// * @param byteOffset The place in the buffer at which the value should be set. -// * @param value The value to set. -// * @param littleEndian If false or undefined, a big-endian value should be written. -// */ -// setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; -// } + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} -// interface DataViewConstructor { -// readonly prototype: DataView; -// new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; -// } +interface DataViewConstructor { + readonly prototype: DataView; + new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; +} // declare var DataView: DataViewConstructor; /** @@ -2067,39 +2067,39 @@ interface Int8Array { [index: number]: number; } -// interface Int8ArrayConstructor { -// readonly prototype: Int8Array; -// new(length: number): Int8Array; -// new(array: ArrayLike | ArrayBufferLike): Int8Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; +interface Int8ArrayConstructor { + readonly prototype: Int8Array; + new(length: number): Int8Array; + new(array: ArrayLike | ArrayBufferLike): Int8Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int8Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int8Array; -// } +} // declare var Int8Array: Int8ArrayConstructor; /** @@ -2350,39 +2350,39 @@ interface Uint8Array { [index: number]: number; } -// interface Uint8ArrayConstructor { -// readonly prototype: Uint8Array; -// new(length: number): Uint8Array; -// new(array: ArrayLike | ArrayBufferLike): Uint8Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; +interface Uint8ArrayConstructor { + readonly prototype: Uint8Array; + new(length: number): Uint8Array; + new(array: ArrayLike | ArrayBufferLike): Uint8Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint8Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint8Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; -// } -// // declare var Uint8Array: Uint8ArrayConstructor; +} +// declare var Uint8Array: Uint8ArrayConstructor; /** * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. @@ -2632,37 +2632,37 @@ interface Uint8ClampedArray { [index: number]: number; } -// interface Uint8ClampedArrayConstructor { -// readonly prototype: Uint8ClampedArray; -// new(length: number): Uint8ClampedArray; -// new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; +interface Uint8ClampedArrayConstructor { + readonly prototype: Uint8ClampedArray; + new(length: number): Uint8ClampedArray; + new(array: ArrayLike | ArrayBufferLike): Uint8ClampedArray; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint8ClampedArray; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint8ClampedArray; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint8ClampedArray; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; -// } + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; +} // declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** @@ -2912,39 +2912,39 @@ interface Int16Array { [index: number]: number; } -// interface Int16ArrayConstructor { -// readonly prototype: Int16Array; -// new(length: number): Int16Array; -// new(array: ArrayLike | ArrayBufferLike): Int16Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; +interface Int16ArrayConstructor { + readonly prototype: Int16Array; + new(length: number): Int16Array; + new(array: ArrayLike | ArrayBufferLike): Int16Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int16Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int16Array; -// } +} // declare var Int16Array: Int16ArrayConstructor; /** @@ -3195,39 +3195,39 @@ interface Uint16Array { [index: number]: number; } -// interface Uint16ArrayConstructor { -// readonly prototype: Uint16Array; -// new(length: number): Uint16Array; -// new(array: ArrayLike | ArrayBufferLike): Uint16Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; +interface Uint16ArrayConstructor { + readonly prototype: Uint16Array; + new(length: number): Uint16Array; + new(array: ArrayLike | ArrayBufferLike): Uint16Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint16Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint16Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint16Array; -// } +} // declare var Uint16Array: Uint16ArrayConstructor; /** @@ -3478,38 +3478,38 @@ interface Int32Array { [index: number]: number; } -// interface Int32ArrayConstructor { -// readonly prototype: Int32Array; -// new(length: number): Int32Array; -// new(array: ArrayLike | ArrayBufferLike): Int32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; +interface Int32ArrayConstructor { + readonly prototype: Int32Array; + new(length: number): Int32Array; + new(array: ArrayLike | ArrayBufferLike): Int32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Int32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Int32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Int32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; -// } +} // declare var Int32Array: Int32ArrayConstructor; /** @@ -3759,38 +3759,38 @@ interface Uint32Array { [index: number]: number; } -// interface Uint32ArrayConstructor { -// readonly prototype: Uint32Array; -// new(length: number): Uint32Array; -// new(array: ArrayLike | ArrayBufferLike): Uint32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; +interface Uint32ArrayConstructor { + readonly prototype: Uint32Array; + new(length: number): Uint32Array; + new(array: ArrayLike | ArrayBufferLike): Uint32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Uint32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Uint32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Uint32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; -// } +} // declare var Uint32Array: Uint32ArrayConstructor; /** @@ -4041,39 +4041,39 @@ interface Float32Array { [index: number]: number; } -// interface Float32ArrayConstructor { -// readonly prototype: Float32Array; -// new(length: number): Float32Array; -// new(array: ArrayLike | ArrayBufferLike): Float32Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; +interface Float32ArrayConstructor { + readonly prototype: Float32Array; + new(length: number): Float32Array; + new(array: ArrayLike | ArrayBufferLike): Float32Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Float32Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Float32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Float32Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float32Array; -// } +} // declare var Float32Array: Float32ArrayConstructor; /** @@ -4315,38 +4315,38 @@ interface Float64Array { [index: number]: number; } -// interface Float64ArrayConstructor { -// readonly prototype: Float64Array; -// new(length: number): Float64Array; -// new(array: ArrayLike | ArrayBufferLike): Float64Array; -// new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; +interface Float64ArrayConstructor { + readonly prototype: Float64Array; + new(length: number): Float64Array; + new(array: ArrayLike | ArrayBufferLike): Float64Array; + new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array; -// /** -// * The size in bytes of each element in the array. -// */ -// readonly BYTES_PER_ELEMENT: number; + /** + * The size in bytes of each element in the array. + */ + readonly BYTES_PER_ELEMENT: number; -// /** -// * Returns a new array from a set of elements. -// * @param items A set of elements to include in the new array object. -// */ -// of(...items: number[]): Float64Array; + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// */ -// from(arrayLike: ArrayLike): Float64Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + */ + from(arrayLike: ArrayLike): Float64Array; -// /** -// * Creates an array from an array-like or iterable object. -// * @param arrayLike An array-like or iterable object to convert to an array. -// * @param mapfn A mapping function to call on every element of the array. -// * @param thisArg Value of 'this' used to invoke the mapfn. -// */ -// from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; -// } +} // declare var Float64Array: Float64ArrayConstructor; ///////////////////////////// From cf2f8dd2e1d9349e62a5cd27728b862581c2a1f8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 21 Jun 2023 16:57:52 +0800 Subject: [PATCH 119/202] WIP: Add more checks and update block for tail-recursion --- driver/js/src/main/scala/driver/Driver.scala | 2 ++ .../src/main/scala/mlscript/NewParser.scala | 27 ++++++++++--------- .../main/scala/ts2mls/TSCompilerInfo.scala | 10 ++++--- ts2mls/js/src/main/scala/ts2mls/TSData.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 10 ++++++- 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index cd1494f34..99606202a 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -72,6 +72,7 @@ class Driver(options: DriverOptions) { false case t : Throwable => report(s"unexpected error: ${t.toString()}") + t.printStackTrace() false } @@ -270,6 +271,7 @@ class Driver(options: DriverOptions) { report(s"codegen error: $err") case t : Throwable => report(s"unexpected error: ${t.toString()}") + t.printStackTrace() } } diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 3e501218c..11c8e9952 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -216,7 +216,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D */ final def typingUnit: TypingUnit = { - val ts = block(false, false) + val ts = block(Nil)(false, false) val (es, dp) = ts.partitionMap { case R(imp: Import) => R(imp) case s => L(s) @@ -307,11 +307,12 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D S(res, _cur) } } - final def block(implicit et: ExpectThen, fe: FoundErr): Ls[IfBody \/ Statement] = + + final def block(prev: Ls[IfBody \/ Statement])(implicit et: ExpectThen, fe: FoundErr): Ls[IfBody \/ Statement] = cur match { - case Nil => Nil - case (NEWLINE, _) :: _ => consume; block - case (SPACE, _) :: _ => consume; block + case Nil => prev + case (NEWLINE, _) :: _ => consume; block(prev) + case (SPACE, _) :: _ => consume; block(prev) case (KEYWORD("constructor"), l0) :: _ => consume val res = yeetSpaces match { @@ -326,8 +327,8 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D } val t = R(res.withLoc(S(l0 ++ res.getLoc))) yeetSpaces match { - case (NEWLINE, _) :: _ => consume; t :: block - case _ => t :: Nil + case (NEWLINE, _) :: _ => consume; block(prev :+ t) + case _ => prev :+ t } case c => val t = c match { @@ -529,12 +530,12 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case (KEYWORD("="), l0) :: _ => t match { case R(v: Var) => consume - R(Eqn(v, expr(0))) :: block - case _ => t :: Nil + block(prev :+ R(Eqn(v, expr(0)))) + case _ => prev :+ t } - case (KEYWORD(";"), _) :: _ => consume; t :: block - case (NEWLINE, _) :: _ => consume; t :: block - case _ => t :: Nil + case (KEYWORD(";"), _) :: _ => consume; block(prev :+ t) + case (NEWLINE, _) :: _ => consume; block(prev :+ t) + case _ => prev :+ t } } @@ -584,7 +585,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case _ => true }) => consume - val ts = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.block) + val ts = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.block(Nil)) val es = ts.map { case L(t) => return L(IfBlock(ts)); case R(e) => e } R(Blk(es)) case (LITVAL(lit), l0) :: _ => diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 4703f8376..57a0e2bec 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -147,6 +147,7 @@ class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends T lazy val `type` = TSTypeObject(sym.selectDynamic("type")) lazy val isOptionalMember = (flags & TypeScript.symbolFlagsOptional) > 0 + lazy val valueDeclaration = TSNodeObject(sym.valueDeclaration) } object TSSymbolObject { @@ -226,7 +227,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val name = TSIdentifierObject(node.name) // TODO: multiline string support - override def toString(): String = node.getText().toString().replaceAll("\n", " ") + override def toString(): String = + if (IsUndefined(node)) "" else node.getText().toString().replaceAll("\n", " ") lazy val filename: String = if (parent.isUndefined) node.fileName.toString() else parent.filename @@ -272,6 +274,8 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) private lazy val root = if (!IsUndefined(obj.root)) TSNodeObject(obj.root.node) + else if (!symbol.isUndefined && !symbol.valueDeclaration.isUndefined) + `type`.symbol.valueDeclaration else if (!`type`.isUndefined && !`type`.symbol.isUndefined && !`type`.symbol.declaration.isUndefined) `type`.symbol.declaration else TSNodeObject(obj.declaration) @@ -304,8 +308,8 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isIndexedAccessType = flags == TypeScript.typeFlagsIndexedAccess override def toString(): String = root.toString() - lazy val filename = root.filename - lazy val pos = root.pos + lazy val filename = if (root.isUndefined) "" else root.filename + lazy val pos = if (root.isUndefined) g.undefined else root.pos } object TSTypeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index f9527794f..e3be3c4fb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -85,7 +85,7 @@ class TSLineStartsHelper(arr: js.Dynamic) extends TSAny(arr) { if (isUndefined) throw new AssertionError("can not read line starts from the source file.") // line, column in string - def getPos(pos: js.Dynamic): (String, String) = { + def getPos(pos: js.Dynamic): (String, String) = if (IsUndefined(pos)) ("-1", "-1") else { val len = arr.length def run(index: Int): (String, String) = if (index >= len) throw new AssertionError(s"invalid pos parameter $pos.") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index e55dc4136..118090fc8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -132,7 +132,15 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) else if (obj.isTypeParameterSubstitution) TSSubstitutionType(obj.symbol.escapedName, getSubstitutionArguments(obj.typeArguments)) else if (obj.isObject) - if (obj.isAnonymous) TSInterfaceType("", getAnonymousPropertiesType(obj.properties), List(), List()) + if (obj.isAnonymous) { + val props = getAnonymousPropertiesType(obj.properties) + if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) + TSInterfaceType("", props, List(), List()) + else lineHelper.getPos(obj.pos) match { + case (line, column) => + TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) + } + } else TSReferenceType(getSymbolFullname(obj.symbol)) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) lineHelper.getPos(obj.pos) match { From 797e11f1d9b1f54579d1c0aa736ccfbff6b984f4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 22 Jun 2023 10:47:20 +0800 Subject: [PATCH 120/202] WIP: Fix list building --- shared/src/main/scala/mlscript/NewParser.scala | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 11c8e9952..a1640fc78 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -310,7 +310,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D final def block(prev: Ls[IfBody \/ Statement])(implicit et: ExpectThen, fe: FoundErr): Ls[IfBody \/ Statement] = cur match { - case Nil => prev + case Nil => prev.reverse case (NEWLINE, _) :: _ => consume; block(prev) case (SPACE, _) :: _ => consume; block(prev) case (KEYWORD("constructor"), l0) :: _ => @@ -327,8 +327,8 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D } val t = R(res.withLoc(S(l0 ++ res.getLoc))) yeetSpaces match { - case (NEWLINE, _) :: _ => consume; block(prev :+ t) - case _ => prev :+ t + case (NEWLINE, _) :: _ => consume; block(t :: prev) + case _ => (t :: prev).reverse } case c => val t = c match { @@ -530,12 +530,12 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case (KEYWORD("="), l0) :: _ => t match { case R(v: Var) => consume - block(prev :+ R(Eqn(v, expr(0)))) - case _ => prev :+ t + block(R(Eqn(v, expr(0))) :: prev) + case _ => (t :: prev).reverse } - case (KEYWORD(";"), _) :: _ => consume; block(prev :+ t) - case (NEWLINE, _) :: _ => consume; block(prev :+ t) - case _ => prev :+ t + case (KEYWORD(";"), _) :: _ => consume; block(t :: prev) + case (NEWLINE, _) :: _ => consume; block(t :: prev) + case _ => (t :: prev).reverse } } From 12ddafbbfd2d06253dafb41bd8cb6622f5aaa0bd Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 23 Jun 2023 10:04:33 +0800 Subject: [PATCH 121/202] WIP: Ban unexpected updating in ts2mls --- .../src/main/scala/ts2mls/TSNamespace.scala | 4 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 4 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 18 +-- ts2mls/js/src/test/diff/ES5.mlsi | 126 +++++++++--------- ts2mls/js/src/test/typescript/ES5.d.ts | 121 +++++++++-------- 5 files changed, 136 insertions(+), 137 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 998a95084..1fc6ee3f6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -27,12 +27,12 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { sub } - def put(name: String, tp: TSType, exported: Boolean): Unit = + def put(name: String, tp: TSType, exported: Boolean, overrided: Boolean): Unit = if (!members.contains(name)) { order += Right(name) members.put(name, (tp, exported)) } - else members.update(name, (tp, exported)) + else if (overrided) members.update(name, (tp, exported)) def `export`(name: String): Unit = if (members.contains(name)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 65f28be5c..ddb8f524a 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -74,8 +74,8 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str val ns = cache(absName) val moduleName = basename(absName) memberName.fold( - globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true) - )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true))) + globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true, false) + )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true, false))) } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 118090fc8..2f1490137 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -57,7 +57,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val varName = req.name.escapedText val imp = TSSingleImport(localName, List((varName, None))) importList.add(fullname, imp) - global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName.$varName")), false) + global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName.$varName")), false, false) } private def parseExportDeclaration(elements: TSNodeArray): Unit = { @@ -66,7 +66,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType global.`export`(ele.symbol.escapedName) else { val alias = ele.symbol.escapedName - global.getTop(ele.propertyName.escapedText).fold(())(tp => global.put(alias, TSRenamedType(alias, tp), true)) + global.getTop(ele.propertyName.escapedText).fold(())(tp => global.put(alias, TSRenamedType(alias, tp), true, false)) } ) } @@ -292,9 +292,9 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = - if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported) + if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) else - ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name)) // the implementation is always after declarations + ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // the implementation is always after declarations // overload functions in a sub-namespace need to provide an overload array // because the namespace merely exports symbols rather than node objects themselves @@ -303,14 +303,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType addFunctionIntoNamespace(getFunctionType(node, true), node, name) )(decs => decs.foreach(d => addFunctionIntoNamespace(getFunctionType(d, true), d, name))) else if (node.isClassDeclaration) - ns.put(name, parseMembers(name, node, true), exported) + ns.put(name, parseMembers(name, node, true), exported, false) else if (node.isInterfaceDeclaration) - ns.put(name, parseMembers(name, node, false), exported) + ns.put(name, parseMembers(name, node, false), exported, false) else if (node.isTypeAliasDeclaration) - ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node)), exported) + ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node)), exported, false) else if (node.isObjectLiteral) - ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()), exported) - else if (node.isVariableDeclaration) ns.put(name, getMemberType(node), exported) + ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()), exported, false) + else if (node.isVariableDeclaration) ns.put(name, getMemberType(node), exported, false) else if (node.isNamespace) parseNamespace(node) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 5dc795dee..596e27345 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -64,12 +64,12 @@ declare trait Function { val arguments: anything } declare trait FunctionConstructor { - val __new: unsupported["new(...args: string[]): Function;", "ES5.d.ts", 292, 31] - val __call: unsupported["(...args: string[]): Function;", "ES5.d.ts", 297, 37] + val __new: unsupported["new(...args: string[]): Function;", "ES5.d.ts", 291, 31] + val __call: unsupported["(...args: string[]): Function;", "ES5.d.ts", 296, 37] val prototype: Function } -type ThisParameterType[T] = unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ES5.d.ts", 307, 27] -type OmitThisParameter[T] = unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ES5.d.ts", 312, 27] +type ThisParameterType[T] = unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ES5.d.ts", 306, 27] +type OmitThisParameter[T] = unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ES5.d.ts", 311, 27] declare trait CallableFunction extends Function { fun apply[T, A, R](args0: T, args1: A): R /* warning: the overload of function apply is not supported yet. */ fun call[T, A, R](args0: T, args1: A): R @@ -81,7 +81,7 @@ declare trait NewableFunction extends Function { fun bind[AX, R](args0: anything, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ } declare trait IArguments { - val __index: unsupported["[index: number]: any;", "ES5.d.ts", 374, 22] + val __index: unsupported["[index: number]: any;", "ES5.d.ts", 373, 22] val length: Num val callee: Function } @@ -98,7 +98,7 @@ declare class Str extends Object { fun indexOf(args0: Str, args1: (Num) | (undefined)): Num fun toLowerCase(): Str fun concat(args0: (Str) | (MutArray[Str])): Str - val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 499, 22] + val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 498, 22] fun charCodeAt(args0: Num): Num fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Str fun substr(args0: Num, args1: (Num) | (undefined)): Str @@ -110,8 +110,8 @@ declare class Str extends Object { fun charAt(args0: Num): Str } declare trait StringConstructor { - val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 504, 29] - val __call: unsupported["(value?: any): string;", "ES5.d.ts", 505, 26] + val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 503, 29] + val __call: unsupported["(value?: any): string;", "ES5.d.ts", 504, 26] val prototype: Str fun fromCharCode(args0: (Num) | (MutArray[Num])): Str } @@ -120,8 +120,8 @@ declare class Bool { fun valueOf(): (false) | (true) } declare trait BooleanConstructor { - val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 521, 30] - val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 522, 27] + val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 520, 30] + val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 521, 27] val prototype: Bool } val Boolean: BooleanConstructor @@ -133,10 +133,10 @@ declare class Num { fun toPrecision(args0: (Num) | (undefined)): Str } declare trait NumberConstructor { - val __call: unsupported["(value?: any): number;", "ES5.d.ts", 559, 26] + val __call: unsupported["(value?: any): number;", "ES5.d.ts", 558, 26] val NaN: Num val MIN_VALUE: Num - val __new: unsupported["new(value?: any): Num;", "ES5.d.ts", 558, 29] + val __new: unsupported["new(value?: any): Num;", "ES5.d.ts", 557, 29] val NEGATIVE_INFINITY: Num val POSITIVE_INFINITY: Num val MAX_VALUE: Num @@ -151,7 +151,7 @@ declare trait ImportCallOptions { val assert: (ImportAssertions) | (undefined) } declare trait ImportAssertions { - val __index: unsupported["[key: string]: string;", "ES5.d.ts", 617, 28] + val __index: unsupported["[key: string]: string;", "ES5.d.ts", 616, 28] } declare trait Math { fun random(): Num @@ -227,9 +227,9 @@ declare trait Date { fun toJSON(args0: (anything) | (undefined)): Str } declare trait DateConstructor { - val __call: unsupported["(): string;", "ES5.d.ts", 899, 128] + val __call: unsupported["(): string;", "ES5.d.ts", 898, 128] fun UTC(args0: Num, args1: Num, args2: (Num) | (undefined), args3: (Num) | (undefined), args4: (Num) | (undefined), args5: (Num) | (undefined), args6: (Num) | (undefined)): Num - val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 888, 38] + val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 887, 38] fun now(): Num fun parse(args0: Str): Num val prototype: Date @@ -260,14 +260,14 @@ declare trait RegExpConstructor { val lastParen: Str val id"$5": Str val id"$+": Str - val __new: unsupported["new(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 988, 42] + val __new: unsupported["new(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 987, 42] val id"$'": Str val id"$&": Str val id"$7": Str val prototype: RegExp val id"$`": Str val id"$_": Str - val __call: unsupported["(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 990, 39] + val __call: unsupported["(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 989, 39] val lastMatch: Str val id"$9": Str val id"$6": Str @@ -284,8 +284,8 @@ declare trait Error { val stack: (Str) | (undefined) } declare trait ErrorConstructor { - val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1043, 28] - val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1044, 33] + val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1042, 28] + val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1043, 33] val prototype: Error } declare trait EvalError extends Error {} @@ -303,7 +303,7 @@ declare trait ReadonlyArray[T] { fun every(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun forEach(args0: (value: T, index: Num, array: ReadonlyArray[T]) => unit, args1: (anything) | (undefined)): unit fun filter(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1273, 136] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1272, 136] fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun join(args0: (Str) | (undefined)): Str fun map[U](args0: (value: T, index: Num, array: ReadonlyArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] @@ -318,7 +318,7 @@ declare trait ReadonlyArray[T] { } declare trait ConcatArray[T] { val length: Num - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1279, 28] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1278, 28] fun join(args0: (Str) | (undefined)): Str fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] } @@ -338,7 +338,7 @@ declare trait MutArray[T] { fun toLocaleString(): Str fun reverse(): MutArray[T] fun filter(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ - val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1464, 127] + val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1463, 127] fun splice(args0: Num, args1: Num, args2: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] fun reduce[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ @@ -348,8 +348,8 @@ declare trait MutArray[T] { fun indexOf(args0: T, args1: (Num) | (undefined)): Num } declare trait ArrayConstructor { - val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1471, 38] - val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1474, 34] + val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1470, 38] + val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1473, 34] fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } @@ -370,40 +370,40 @@ declare trait Promise[T] { fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] fun catch[TResult](args0: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] } -type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1526, 17] +type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1525, 17] declare trait ArrayLike[T] { val length: Num - val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1535, 28] -} -type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1542, 17] -type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1549, 18] -type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1556, 18] -type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1563, 33] -type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1570, 37] -type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1577, 20] -type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1582, 20] + val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1534, 28] +} +type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1541, 17] +type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1548, 18] +type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1555, 18] +type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1562, 33] +type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1569, 37] +type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1576, 20] +type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1581, 20] type Omit[T, K] = __type type NonNullable[T] = (T) & ({}) -type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1597, 50] -type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1602, 74] -type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1607, 50] -type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1612, 65] -type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1617, 34] -type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1622, 34] -type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1627, 35] -type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1632, 37] +type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1596, 50] +type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1601, 74] +type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1606, 50] +type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1611, 65] +type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1616, 34] +type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1621, 34] +type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1626, 35] +type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1631, 37] declare trait ThisType[T] {} declare trait ArrayBuffer { val byteLength: Num fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer } declare trait ArrayBufferTypes { - val ArrayBuffer: unsupported["ArrayBuffer: ArrayBuffer;", "ES5.d.ts", 1660, 28] + val ArrayBuffer: unsupported["ArrayBuffer: ArrayBuffer;", "ES5.d.ts", 1659, 28] } type ArrayBufferLike = ArrayBuffer declare trait ArrayBufferConstructor { val prototype: ArrayBuffer - val __new: unsupported["new(byteLength: number): ArrayBuffer;", "ES5.d.ts", 1666, 36] + val __new: unsupported["new(byteLength: number): ArrayBuffer;", "ES5.d.ts", 1665, 36] fun isView(args0: anything): (false) | (true) } declare trait ArrayBufferView { @@ -434,7 +434,7 @@ declare trait DataView { } declare trait DataViewConstructor { val prototype: DataView - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ES5.d.ts", 1818, 33] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ES5.d.ts", 1817, 33] } declare trait Int8Array { fun valueOf(): Int8Array @@ -442,7 +442,7 @@ declare trait Int8Array { fun every(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2066, 25] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2065, 25] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int8Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int8Array @@ -467,7 +467,7 @@ declare trait Int8Array { val byteOffset: Num } declare trait Int8ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ES5.d.ts", 2073, 63] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ES5.d.ts", 2072, 63] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array fun id"of"(args0: (Num) | (MutArray[Num])): Int8Array @@ -479,7 +479,7 @@ declare trait Uint8Array { fun every(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2348, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2347, 26] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array @@ -504,7 +504,7 @@ declare trait Uint8Array { val byteOffset: Num } declare trait Uint8ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ES5.d.ts", 2356, 64] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ES5.d.ts", 2355, 64] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint8Array @@ -516,7 +516,7 @@ declare trait Uint8ClampedArray { fun every(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2630, 33] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2629, 33] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8ClampedArray fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray @@ -541,7 +541,7 @@ declare trait Uint8ClampedArray { val byteOffset: Num } declare trait Uint8ClampedArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ES5.d.ts", 2638, 71] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ES5.d.ts", 2637, 71] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray fun id"of"(args0: (Num) | (MutArray[Num])): Uint8ClampedArray @@ -553,7 +553,7 @@ declare trait Int16Array { fun every(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2910, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2909, 26] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int16Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int16Array @@ -578,7 +578,7 @@ declare trait Int16Array { val byteOffset: Num } declare trait Int16ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ES5.d.ts", 2918, 64] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ES5.d.ts", 2917, 64] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array fun id"of"(args0: (Num) | (MutArray[Num])): Int16Array @@ -590,7 +590,7 @@ declare trait Uint16Array { fun every(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3193, 27] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3192, 27] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint16Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array @@ -615,7 +615,7 @@ declare trait Uint16Array { val byteOffset: Num } declare trait Uint16ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ES5.d.ts", 3201, 65] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ES5.d.ts", 3200, 65] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint16Array @@ -627,7 +627,7 @@ declare trait Int32Array { fun every(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3476, 26] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3475, 26] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int32Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int32Array @@ -652,7 +652,7 @@ declare trait Int32Array { val byteOffset: Num } declare trait Int32ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ES5.d.ts", 3484, 64] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ES5.d.ts", 3483, 64] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array fun id"of"(args0: (Num) | (MutArray[Num])): Int32Array @@ -664,7 +664,7 @@ declare trait Uint32Array { fun every(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3757, 27] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3756, 27] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint32Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array @@ -689,7 +689,7 @@ declare trait Uint32Array { val byteOffset: Num } declare trait Uint32ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ES5.d.ts", 3765, 65] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ES5.d.ts", 3764, 65] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint32Array @@ -701,7 +701,7 @@ declare trait Float32Array { fun every(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4039, 28] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4038, 28] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float32Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float32Array @@ -726,7 +726,7 @@ declare trait Float32Array { val byteOffset: Num } declare trait Float32ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ES5.d.ts", 4047, 66] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ES5.d.ts", 4046, 66] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array fun id"of"(args0: (Num) | (MutArray[Num])): Float32Array @@ -737,7 +737,7 @@ declare trait Float64Array { fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num fun every(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4313, 28] + val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4312, 28] fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float64Array fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float64Array @@ -762,7 +762,7 @@ declare trait Float64Array { val byteOffset: Num } declare trait Float64ArrayConstructor { - val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ES5.d.ts", 4321, 66] + val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ES5.d.ts", 4320, 66] fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array fun id"of"(args0: (Num) | (MutArray[Num])): Float64Array diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 7447d12a4..7b8a4574b 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -246,11 +246,10 @@ interface ObjectConstructor { keys(o: object): string[]; } -// TODO: name clash? /** * Provides functionality common to all JavaScript objects. */ -// declare var Object: ObjectConstructor; +declare var Object: ObjectConstructor; /** * Creates a new function. @@ -299,7 +298,7 @@ interface FunctionConstructor { readonly prototype: Function; } -// declare var Function: FunctionConstructor; +declare var Function: FunctionConstructor; /** * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter. @@ -508,9 +507,9 @@ interface StringConstructor { fromCharCode(...codes: number[]): string; } -// /** -// * Allows manipulation and formatting of text strings and determination and location of substrings within strings. -// */ +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ declare var String: StringConstructor; class Bool { @@ -585,7 +584,7 @@ interface NumberConstructor { readonly POSITIVE_INFINITY: number; } -// /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ declare var Number: NumberConstructor; interface TemplateStringsArray extends ReadonlyArray { @@ -727,7 +726,7 @@ interface Math { tan(x: number): number; } /** An intrinsic object that provides basic mathematics functionality and constants. */ -// declare var Math: Math; +declare var Math: Math; /** Enables basic storage and retrieval of dates and times. */ interface Date { @@ -919,7 +918,7 @@ interface DateConstructor { now(): number; } -// declare var Date: DateConstructor; +declare var Date: DateConstructor; interface RegExpMatchArray extends MutArray { /** @@ -1032,7 +1031,7 @@ interface RegExpConstructor { "$'": string; } -// // declare var RegExp: RegExpConstructor; +declare var RegExp: RegExpConstructor; interface Error { name: string; @@ -1046,7 +1045,7 @@ interface ErrorConstructor { readonly prototype: Error; } -// declare var Error: ErrorConstructor; +declare var Error: ErrorConstructor; interface EvalError extends Error { } @@ -1141,7 +1140,7 @@ interface JSON { /** * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. */ -// declare var JSON: JSON; +declare var JSON: JSON; ///////////////////////////// @@ -1667,7 +1666,7 @@ interface ArrayBufferConstructor { new(byteLength: number): ArrayBuffer; isView(arg: any): arg is ArrayBufferView; } -// declare var ArrayBuffer: ArrayBufferConstructor; +declare var ArrayBuffer: ArrayBufferConstructor; interface ArrayBufferView { /** @@ -1818,7 +1817,7 @@ interface DataViewConstructor { readonly prototype: DataView; new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView; } -// declare var DataView: DataViewConstructor; +declare var DataView: DataViewConstructor; /** * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested @@ -2100,7 +2099,7 @@ interface Int8ArrayConstructor { } -// declare var Int8Array: Int8ArrayConstructor; +declare var Int8Array: Int8ArrayConstructor; /** * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the @@ -2382,7 +2381,7 @@ interface Uint8ArrayConstructor { from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8Array; } -// declare var Uint8Array: Uint8ArrayConstructor; +declare var Uint8Array: Uint8ArrayConstructor; /** * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. @@ -2663,7 +2662,7 @@ interface Uint8ClampedArrayConstructor { */ from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint8ClampedArray; } -// declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; /** * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the @@ -2945,7 +2944,7 @@ interface Int16ArrayConstructor { } -// declare var Int16Array: Int16ArrayConstructor; +declare var Int16Array: Int16ArrayConstructor; /** * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the @@ -3228,7 +3227,7 @@ interface Uint16ArrayConstructor { } -// declare var Uint16Array: Uint16ArrayConstructor; +declare var Uint16Array: Uint16ArrayConstructor; /** * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the @@ -3510,7 +3509,7 @@ interface Int32ArrayConstructor { from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Int32Array; } -// declare var Int32Array: Int32ArrayConstructor; +declare var Int32Array: Int32ArrayConstructor; /** * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the @@ -3791,7 +3790,7 @@ interface Uint32ArrayConstructor { from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Uint32Array; } -// declare var Uint32Array: Uint32ArrayConstructor; +declare var Uint32Array: Uint32ArrayConstructor; /** * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number @@ -4074,7 +4073,7 @@ interface Float32ArrayConstructor { } -// declare var Float32Array: Float32ArrayConstructor; +declare var Float32Array: Float32ArrayConstructor; /** * A typed array of 64-bit float values. The contents are initialized to 0. If the requested @@ -4347,7 +4346,7 @@ interface Float64ArrayConstructor { from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => number, thisArg?: any): Float64Array; } -// declare var Float64Array: Float64ArrayConstructor; +declare var Float64Array: Float64ArrayConstructor; ///////////////////////////// /// ECMAScript Internationalization API @@ -4465,43 +4464,43 @@ declare namespace Intl { }; } -// interface String { -// /** -// * Determines whether two strings are equivalent in the current or specified locale. -// * @param that String to compare to target string -// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. -// * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. -// */ -// localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -// } +interface String { + /** + * Determines whether two strings are equivalent in the current or specified locale. + * @param that String to compare to target string + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. + * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. + */ + localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; +} -// interface Number { -// /** -// * Converts a number to a string by using the current or specified locale. -// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. -// * @param options An object that contains one or more properties that specify comparison options. -// */ -// toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -// } +interface Number { + /** + * Converts a number to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; +} -// interface Date { -// /** -// * Converts a date and time to a string by using the current or specified locale. -// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. -// * @param options An object that contains one or more properties that specify comparison options. -// */ -// toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -// /** -// * Converts a date to a string by using the current or specified locale. -// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. -// * @param options An object that contains one or more properties that specify comparison options. -// */ -// toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - -// /** -// * Converts a time to a string by using the current or specified locale. -// * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. -// * @param options An object that contains one or more properties that specify comparison options. -// */ -// toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -// } +interface Date { + /** + * Converts a date and time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + /** + * Converts a date to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; + + /** + * Converts a time to a string by using the current or specified locale. + * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. + * @param options An object that contains one or more properties that specify comparison options. + */ + toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; +} From a26f13537cf48d3367dfefbd9da5b43af7e41971 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 23 Jun 2023 13:45:34 +0800 Subject: [PATCH 122/202] WIP: Fix unsupported parents --- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 11 -- .../src/main/scala/ts2mls/TSNamespace.scala | 17 +++ .../src/main/scala/ts2mls/TSSourceFile.scala | 138 ++++++++++++------ .../main/scala/ts2mls/types/Converter.scala | 2 +- .../src/main/scala/ts2mls/types/TSType.scala | 105 +++++++++---- ts2mls/js/src/test/diff/ES5.mlsi | 60 ++++---- ts2mls/js/src/test/diff/Heritage.mlsi | 34 ----- ts2mls/js/src/test/typescript/ES5.d.ts | 84 +++++------ ts2mls/js/src/test/typescript/Heritage.ts | 84 +++++------ 10 files changed, 311 insertions(+), 226 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 83e7fe2eb..cf902ec44 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -79,7 +79,7 @@ object DriverDiffTests { entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - entry("Builtin"), + entry("Builtin", expectError = true), // TODO: Predef.mlsi ts2mlsEntry("Array", ignoreTypeError = true), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 57a0e2bec..67ef1edc1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -272,13 +272,6 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA private lazy val flags = obj.flags private lazy val objectFlags = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) - private lazy val root = - if (!IsUndefined(obj.root)) TSNodeObject(obj.root.node) - else if (!symbol.isUndefined && !symbol.valueDeclaration.isUndefined) - `type`.symbol.valueDeclaration - else if (!`type`.isUndefined && !`type`.symbol.isUndefined && !`type`.symbol.declaration.isUndefined) - `type`.symbol.declaration - else TSNodeObject(obj.declaration) lazy val symbol = TSSymbolObject(obj.symbol) lazy val typeArguments = TSTypeArray(checker.getTypeArguments(obj)) @@ -306,10 +299,6 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isConditionalType = flags == TypeScript.typeFlagsConditional lazy val isIndexType = flags == TypeScript.typeFlagsIndex lazy val isIndexedAccessType = flags == TypeScript.typeFlagsIndexedAccess - - override def toString(): String = root.toString() - lazy val filename = if (root.isUndefined) "" else root.filename - lazy val pos = if (root.isUndefined) g.undefined else root.pos } object TSTypeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 1fc6ee3f6..4c08df3ce 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -44,10 +44,27 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { if (members.contains(name)) members(name)._2 else throw new Exception(s"member $name not found.") + private def getNS(name: String): TSNamespace = + if (subSpace.contains(name)) subSpace(name)._1 + else parent.fold(throw new Exception(s"namespace $name not found."))(p => p.getNS(name)) + def get(name: String): TSType = if (members.contains(name)) members(name)._1 else parent.fold(throw new Exception(s"member $name not found."))(p => p.get(name)) + def get(names: List[String]): TSType = names match { + case head :: Nil => get(head) + case head :: tails => + def run(ns: TSNamespace, list: List[String]): TSType = + list match { + case head :: Nil => ns.members(head)._1 + case head :: tails => run(ns.subSpace(name)._1, tails) + case _ => throw new Exception(s"member ${names.mkString(".")} not found.") + } + run(getNS(head), tails) + case _ => throw new Exception(s"member ${names.mkString(".")} not found.") + } + def getTop(name: String): Option[TSType] = if (members.contains(name)) members(name)._1 match { case cls: TSClassType => Some(TSReferenceType(cls.name)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 2f1490137..f4436031b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -13,6 +13,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() + // parse import TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isRequire) @@ -21,6 +22,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) }) + // parse main body TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { @@ -33,6 +35,20 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) + // handle parents + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken) { + if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces + handleParents(nodeObject, nodeObject.symbol.escapedName)(global) + else if (!nodeObject.declarationList.isUndefined) { // for variables + val decNode = nodeObject.declarationList.declaration + handleParents(decNode, decNode.symbol.escapedName)(global) + } + } + }) + + // check export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isExportDeclaration) { @@ -119,34 +135,31 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) } + private def markUnsupported(node: TSNodeObject): TSUnsupportedType = + lineHelper.getPos(node.pos) match { + case (line, column) => + TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column) + } + private def getObjectType(obj: TSTypeObject)(implicit ns: TSNamespace): TSType = - if (obj.isMapped) lineHelper.getPos(obj.pos) match { - case (line, column) => - TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) - } + if (obj.isMapped) TSPartialUnsupportedType else if (obj.isEnumType) TSEnumType else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration, true) else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) - else if (obj.isTypeParameterSubstitution) TSSubstitutionType(obj.symbol.escapedName, getSubstitutionArguments(obj.typeArguments)) + else if (obj.isTypeParameterSubstitution) TSSubstitutionType(TSReferenceType(obj.symbol.escapedName), getSubstitutionArguments(obj.typeArguments)) else if (obj.isObject) if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) TSInterfaceType("", props, List(), List()) - else lineHelper.getPos(obj.pos) match { - case (line, column) => - TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) - } + else TSPartialUnsupportedType } else TSReferenceType(getSymbolFullname(obj.symbol)) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) - else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) lineHelper.getPos(obj.pos) match { - case (line, column) => - TSUnsupportedType(obj.toString(), TSPathResolver.basenameWithExt(obj.filename), line, column) - } + else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) TSPartialUnsupportedType else TSPrimitiveType(obj.intrinsicName) // the function `getMemberType` can't process function/tuple type alias correctly @@ -154,10 +167,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (tn.isFunctionLike) getFunctionType(tn, true) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { - case TSPrimitiveType("intrinsic") => lineHelper.getPos(tn.pos) match { - case (line, column) => - TSUnsupportedType(tn.toString(), TSPathResolver.basenameWithExt(tn.filename), line, column) - } + case TSPrimitiveType("intrinsic") => markUnsupported(tn) case t => t } @@ -175,14 +185,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = { val res: TSType = if (node.isIndexSignature || node.isCallSignature || node.isConstructSignature) - lineHelper.getPos(node.pos) match { - case (line, column) => - TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column) - } + markUnsupported(node) else if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) + if (res.unsupported) markUnsupported(node) if (node.symbol.isOptionalMember) TSUnionType(res, TSPrimitiveType("undefined")) else res } @@ -223,10 +231,27 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getTupleElements(elements: TSTypeArray)(implicit ns: TSNamespace): List[TSType] = elements.foldLeft(List[TSType]())((lst, ele) => lst :+ getObjectType(ele)) - private def getHeritageList(node: TSNodeObject)(implicit ns: TSNamespace): List[TSType] = - node.heritageClauses.foldLeftIndexed(List[TSType]())((lst, h, index) => - lst :+ getObjectType(h.types.get(index).typeNode) - ) + private def getHeritageList(node: TSNodeObject, members: Set[String])(implicit ns: TSNamespace): List[TSType] = + node.heritageClauses.foldLeftIndexed(List[TSType]())((lst, h, index) => { + def run(ref: TSReferenceType) = ns.get(ref.names) match { + case itf: TSInterfaceType + if (itf.members.foldLeft(itf.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => + TSPartialUnsupportedType + case cls: TSClassType + if (cls.members.foldLeft(cls.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => + TSPartialUnsupportedType + case t if (t.unsupported) => TSPartialUnsupportedType + case t => ref + } + lst :+ (getObjectType(h.types.get(index).typeNode) match { + case ref: TSReferenceType => run(ref) + case TSSubstitutionType(base, app) => run(base) match { + case ref: TSReferenceType => TSSubstitutionType(ref, app) + case t => t + } + case t => t + }) + }) private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType])(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { case func: TSFunctionType => { @@ -237,13 +262,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } } case _ => mem match { - case TSReferenceType(ref) if name === ref => lineHelper.getPos(node.pos) match { - case (line, column) => - others ++ Map(name -> TSMemberType( - TSUnsupportedType(node.toString(), TSPathResolver.basenameWithExt(node.filename), line, column), - node.modifier - )) - } + // if the member's name is the same as the type name, we need to mark it unsupported + case TSReferenceType(ref) if name === ref => + others ++ Map(name -> TSMemberType( + markUnsupported(node), + node.modifier + )) case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) } } @@ -277,11 +301,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType list.foldLeft(Map[String, TSMemberType]())((mp, p) => mp ++ Map(p.escapedName -> TSMemberType(if (p.`type`.isUndefined) getMemberType(p.declaration) else getObjectType(p.`type`)))) - private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean)(implicit ns: TSNamespace): TSType = - if (isClass) - TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), - getTypeParameters(node), getHeritageList(node), getConstructorList(node.members)) - else TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), getHeritageList(node)) + private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean)(implicit ns: TSNamespace): TSType = { + val res = // do not handle parents here. we have not had enough information so far. + if (isClass) + TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), + getTypeParameters(node), Nil, getConstructorList(node.members)) + else TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), Nil) + if (res.unsupported) markUnsupported(node) else res + } private def parseNamespaceLocals(map: TSSymbolMap, exports: TSSymbolMap)(implicit ns: TSNamespace) = map.foreach((sym) => { @@ -292,7 +319,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = - if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) + if (fun.unsupported) ns.put(name, markUnsupported(node), node.isExported, false) + else if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) else ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // the implementation is always after declarations @@ -306,14 +334,40 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType ns.put(name, parseMembers(name, node, true), exported, false) else if (node.isInterfaceDeclaration) ns.put(name, parseMembers(name, node, false), exported, false) - else if (node.isTypeAliasDeclaration) - ns.put(name, TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node)), exported, false) - else if (node.isObjectLiteral) - ns.put(name, TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()), exported, false) + else if (node.isTypeAliasDeclaration) { + val alias = TSTypeAlias(name, getTypeAlias(node.`type`), getTypeParameters(node)) + ns.put(name, if (alias.unsupported) TSTypeAlias(name, markUnsupported(node), Nil) else alias, exported, false) + } + else if (node.isObjectLiteral) { + val obj = TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()) + ns.put(name, if (obj.unsupported) markUnsupported(node) else obj, exported, false) + } else if (node.isVariableDeclaration) ns.put(name, getMemberType(node), exported, false) else if (node.isNamespace) parseNamespace(node) + private def handleParents(node: TSNodeObject, name: String)(implicit ns: TSNamespace): Unit = + if (node.isClassDeclaration) ns.get(name) match { + case TSClassType(name, members, statics, typeVars, _, constructor) => + val cls = TSClassType(name, members, statics, typeVars, getHeritageList(node, members.keySet), constructor) + ns.put(name, if (cls.unsupported) markUnsupported(node) else cls, ns.exported(name), true) + case _ => throw new AssertionError(s"$name is not a class") + } + else if (node.isInterfaceDeclaration) ns.get(name) match { + case TSInterfaceType(name, members, typeVars, parents) => + val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet)) + ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) + case _ => throw new AssertionError(s"$name is not an interface") + } + else if (node.isNamespace) { + val sub = ns.derive(node.symbol.escapedName, false) + node.locals.foreach((sym) => { + val node = sym.declaration + val name = sym.escapedName + if (!node.isToken) handleParents(node, name)(sub) + }) + } + private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = parseNamespaceLocals(node.locals, node.exports)(ns.derive(node.symbol.escapedName, node.isExported)) } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index b091923a4..22479179f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -62,7 +62,7 @@ object Converter { convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) case TSClassType(name, members, statics, typeVars, parents, cons) => convertRecord(s"class ${escapeIdent(name)}", members, typeVars, parents, statics, cons, exported)(indent) - case TSSubstitutionType(base, applied) => s"${base}[${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}]" + case TSSubstitutionType(TSReferenceType(base), applied) => s"${base}[${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}]" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${escapeIdent(name)}: ${convert(tp)}" case TSTypeAlias(name, ori, tp) => { diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index d6c7ea847..d8b02c080 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -1,39 +1,83 @@ package ts2mls.types +import ts2mls.TSNamespace + sealed abstract class TSAccessModifier case object Public extends TSAccessModifier case object Private extends TSAccessModifier case object Protected extends TSAccessModifier -sealed abstract class TSType -case class TSParameterType(name: String, val tp: TSType) extends TSType // record both parameter's name and parameter's type -case class TSMemberType(val base: TSType, val modifier: TSAccessModifier = Public) extends TSType -case class TSTypeParameter(val name: String, constraint: Option[TSType] = None) extends TSType +sealed abstract class TSType { + val unsupported = false +} + +// record both parameter's name and parameter's type +case class TSParameterType(name: String, val tp: TSType) extends TSType { + override val unsupported: Boolean = tp.unsupported +} +case class TSMemberType(val base: TSType, val modifier: TSAccessModifier = Public) extends TSType { + override val unsupported: Boolean = base.unsupported +} + +case class TSTypeParameter(val name: String, constraint: Option[TSType] = None) extends TSType { + override val unsupported: Boolean = constraint.fold(false)(c => c.unsupported) +} + case class TSPrimitiveType(typeName: String) extends TSType -case class TSReferenceType(name: String) extends TSType +case class TSReferenceType(name: String) extends TSType { + val names = if (name.contains(".")) name.split("\\.").toList else name :: Nil +} case object TSEnumType extends TSType -case class TSTupleType(types: List[TSType]) extends TSType -case class TSFunctionType(params: List[TSParameterType], res: TSType, typeVars: List[TSTypeParameter]) extends TSType -case class TSArrayType(eleType: TSType) extends TSType -case class TSSubstitutionType(base: String, applied: List[TSType]) extends TSType +case class TSTupleType(types: List[TSType]) extends TSType { + override val unsupported: Boolean = types.foldLeft(false)((r, t) => r || t.unsupported) +} + +case class TSFunctionType(params: List[TSParameterType], res: TSType, typeVars: List[TSTypeParameter]) extends TSType { + override val unsupported: Boolean = + res.unsupported || params.foldLeft(false)((r, t) => r || t.unsupported) || + typeVars.foldLeft(false)((r, t) => r || t.unsupported) +} + +case class TSArrayType(eleType: TSType) extends TSType { + override val unsupported: Boolean = eleType.unsupported +} +case class TSSubstitutionType(base: TSReferenceType, applied: List[TSType]) extends TSType { + override val unsupported: Boolean = base.unsupported || applied.foldLeft(false)((r, t) => r || t.unsupported) +} case class TSClassType( - name: String, - members: Map[String, TSMemberType], - statics: Map[String, TSMemberType], - typeVars: List[TSTypeParameter], - parents: List[TSType], - constructor: List[TSParameterType] - ) extends TSType + name: String, + members: Map[String, TSMemberType], + statics: Map[String, TSMemberType], + typeVars: List[TSTypeParameter], + parents: List[TSType], + constructor: List[TSParameterType] +) extends TSType { + override val unsupported: Boolean = + typeVars.foldLeft(false)((r, t) => r || t.unsupported) || parents.foldLeft(false)((r, t) => t match { + case cls: TSClassType => cls.members.values.foldLeft(r || cls.unsupported)((r, t) => r || t.unsupported) + case itf: TSInterfaceType => itf.members.values.foldLeft(r || itf.unsupported)((r, t) => r || t.unsupported) + case _ => r || t.unsupported + }) +} case class TSInterfaceType( - name: String, - members: Map[String, TSMemberType], - typeVars: List[TSTypeParameter], - parents: List[TSType], - ) extends TSType + name: String, + members: Map[String, TSMemberType], + typeVars: List[TSTypeParameter], + parents: List[TSType], +) extends TSType { + override val unsupported: Boolean = + typeVars.foldLeft(false)((r, t) => r || t.unsupported) || parents.foldLeft(false)((r, t) => t match { + case cls: TSClassType => cls.members.values.foldLeft(r || cls.unsupported)((r, t) => r || t.unsupported) + case itf: TSInterfaceType => itf.members.values.foldLeft(r || itf.unsupported)((r, t) => r || t.unsupported) + case _ => r || t.unsupported + }) +} -sealed abstract class TSStructuralType(lhs: TSType, rhs: TSType, notion: String) extends TSType +sealed abstract class TSStructuralType(lhs: TSType, rhs: TSType, notion: String) extends TSType { + override val unsupported: Boolean = lhs.unsupported || rhs.unsupported +} case class TSUnionType(lhs: TSType, rhs: TSType) extends TSStructuralType(lhs, rhs, "|") case class TSIntersectionType(lhs: TSType, rhs: TSType) extends TSStructuralType(lhs, rhs, "&") @@ -42,11 +86,22 @@ case class TSIntersectionType(lhs: TSType, rhs: TSType) extends TSStructuralType // only the most general overloading form would be stored case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType { val warning = s"/* warning: the overload of function $name is not supported yet. */" + override val unsupported: Boolean = base.unsupported } // generate type name = ... in mlscript -case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType +case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType { + override val unsupported: Boolean = + original.unsupported || tp.foldLeft(false)((r, t) => r || t.unsupported) +} // generate val name = ... in mlscript -case class TSRenamedType(name: String, original: TSType) extends TSType +case class TSRenamedType(name: String, original: TSType) extends TSType { + override val unsupported: Boolean = original.unsupported +} case class TSLiteralType(value: String, isString: Boolean) extends TSType -case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType +case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType { + override val unsupported: Boolean = true +} +object TSPartialUnsupportedType extends TSType { + override val unsupported: Boolean = true +} diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 596e27345..c1e9e9bcc 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -68,8 +68,8 @@ declare trait FunctionConstructor { val __call: unsupported["(...args: string[]): Function;", "ES5.d.ts", 296, 37] val prototype: Function } -type ThisParameterType[T] = unsupported["T extends (this: infer U, ...args: never) => any ? U : unknown", "ES5.d.ts", 306, 27] -type OmitThisParameter[T] = unsupported["unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T", "ES5.d.ts", 311, 27] +type ThisParameterType = unsupported["type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;", "ES5.d.ts", 301, 42] +type OmitThisParameter = unsupported["type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;", "ES5.d.ts", 306, 91] declare trait CallableFunction extends Function { fun apply[T, A, R](args0: T, args1: A): R /* warning: the overload of function apply is not supported yet. */ fun call[T, A, R](args0: T, args1: A): R @@ -85,7 +85,7 @@ declare trait IArguments { val length: Num val callee: Function } -declare class Str extends Object { +declare trait String { fun replace(args0: (Str) | (RegExp), args1: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ fun valueOf(): Str fun toLocaleUpperCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str @@ -110,12 +110,11 @@ declare class Str extends Object { fun charAt(args0: Num): Str } declare trait StringConstructor { - val __new: unsupported["new(value?: any): Str;", "ES5.d.ts", 503, 29] - val __call: unsupported["(value?: any): string;", "ES5.d.ts", 504, 26] - val prototype: Str + val __new: unsupported["new(value?: any): String;", "ES5.d.ts", 503, 29] + val __call: unsupported["(value?: any): string;", "ES5.d.ts", 504, 29] + val prototype: String fun fromCharCode(args0: (Num) | (MutArray[Num])): Str } -val String: StringConstructor declare class Bool { fun valueOf(): (false) | (true) } @@ -125,7 +124,7 @@ declare trait BooleanConstructor { val prototype: Bool } val Boolean: BooleanConstructor -declare class Num { +declare trait Number { fun toExponential(args0: (Num) | (undefined)): Str fun valueOf(): Num fun toString(args0: (Num) | (undefined)): Str @@ -133,16 +132,15 @@ declare class Num { fun toPrecision(args0: (Num) | (undefined)): Str } declare trait NumberConstructor { - val __call: unsupported["(value?: any): number;", "ES5.d.ts", 558, 26] + val __call: unsupported["(value?: any): number;", "ES5.d.ts", 558, 29] val NaN: Num val MIN_VALUE: Num - val __new: unsupported["new(value?: any): Num;", "ES5.d.ts", 557, 29] + val __new: unsupported["new(value?: any): Number;", "ES5.d.ts", 557, 29] val NEGATIVE_INFINITY: Num val POSITIVE_INFINITY: Num val MAX_VALUE: Num - val prototype: Num + val prototype: Number } -val Number: NumberConstructor declare trait TemplateStringsArray extends ReadonlyArray[Str] { val raw: ReadonlyArray[Str] } @@ -289,11 +287,17 @@ declare trait ErrorConstructor { val prototype: Error } declare trait EvalError extends Error {} +val EvalErrorConstructor: unsupported["interface EvalErrorConstructor extends ErrorConstructor { new(message?: string): EvalError; (message?: string): EvalError; readonly prototype: EvalError; }", "ES5.d.ts", 1051, 1] declare trait RangeError extends Error {} +val RangeErrorConstructor: unsupported["interface RangeErrorConstructor extends ErrorConstructor { new(message?: string): RangeError; (message?: string): RangeError; readonly prototype: RangeError; }", "ES5.d.ts", 1062, 1] declare trait ReferenceError extends Error {} +val ReferenceErrorConstructor: unsupported["interface ReferenceErrorConstructor extends ErrorConstructor { new(message?: string): ReferenceError; (message?: string): ReferenceError; readonly prototype: ReferenceError; }", "ES5.d.ts", 1073, 1] declare trait SyntaxError extends Error {} +val SyntaxErrorConstructor: unsupported["interface SyntaxErrorConstructor extends ErrorConstructor { new(message?: string): SyntaxError; (message?: string): SyntaxError; readonly prototype: SyntaxError; }", "ES5.d.ts", 1084, 1] declare trait TypeError extends Error {} +val TypeErrorConstructor: unsupported["interface TypeErrorConstructor extends ErrorConstructor { new(message?: string): TypeError; (message?: string): TypeError; readonly prototype: TypeError; }", "ES5.d.ts", 1095, 1] declare trait URIError extends Error {} +val URIErrorConstructor: unsupported["interface URIErrorConstructor extends ErrorConstructor { new(message?: string): URIError; (message?: string): URIError; readonly prototype: URIError; }", "ES5.d.ts", 1106, 1] declare trait JSON { fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ @@ -370,28 +374,28 @@ declare trait Promise[T] { fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] fun catch[TResult](args0: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] } -type Awaited[T] = unsupported["T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T", "ES5.d.ts", 1525, 17] +type Awaited = unsupported["type Awaited = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T;", "ES5.d.ts", 1520, 1] declare trait ArrayLike[T] { val length: Num val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1534, 28] } -type Partial[T] = unsupported["{ [P in keyof T]?: T[P]; }", "ES5.d.ts", 1541, 17] -type Required[T] = unsupported["{ [P in keyof T]-?: T[P]; }", "ES5.d.ts", 1548, 18] -type Readonly[T] = unsupported["{ readonly [P in keyof T]: T[P]; }", "ES5.d.ts", 1555, 18] -type Pick[T, K] = unsupported["{ [P in K]: T[P]; }", "ES5.d.ts", 1562, 33] -type Record[K, T] = unsupported["{ [P in K]: T; }", "ES5.d.ts", 1569, 37] -type Exclude[T, U] = unsupported["T extends U ? never : T", "ES5.d.ts", 1576, 20] -type Extract[T, U] = unsupported["T extends U ? T : never", "ES5.d.ts", 1581, 20] +type Partial = unsupported["type Partial = { [P in keyof T]?: T[P]; };", "ES5.d.ts", 1536, 1] +type Required = unsupported["type Required = { [P in keyof T]-?: T[P]; };", "ES5.d.ts", 1543, 2] +type Readonly = unsupported["type Readonly = { readonly [P in keyof T]: T[P]; };", "ES5.d.ts", 1550, 2] +type Pick = unsupported["type Pick = { [P in K]: T[P]; };", "ES5.d.ts", 1557, 2] +type Record = unsupported["type Record = { [P in K]: T; };", "ES5.d.ts", 1564, 2] +type Exclude = unsupported["type Exclude = T extends U ? never : T;", "ES5.d.ts", 1571, 2] +type Extract = unsupported["type Extract = T extends U ? T : never;", "ES5.d.ts", 1576, 45] type Omit[T, K] = __type type NonNullable[T] = (T) & ({}) -type Parameters[T] = unsupported["T extends (...args: infer P) => any ? P : never", "ES5.d.ts", 1596, 50] -type ConstructorParameters[T] = unsupported["T extends abstract new (...args: infer P) => any ? P : never", "ES5.d.ts", 1601, 74] -type ReturnType[T] = unsupported["T extends (...args: any) => infer R ? R : any", "ES5.d.ts", 1606, 50] -type InstanceType[T] = unsupported["T extends abstract new (...args: any) => infer R ? R : any", "ES5.d.ts", 1611, 65] -type Uppercase[S] = unsupported["intrinsic", "ES5.d.ts", 1616, 34] -type Lowercase[S] = unsupported["intrinsic", "ES5.d.ts", 1621, 34] -type Capitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1626, 35] -type Uncapitalize[S] = unsupported["intrinsic", "ES5.d.ts", 1631, 37] +type Parameters = unsupported["type Parameters any> = T extends (...args: infer P) => any ? P : never;", "ES5.d.ts", 1591, 29] +type ConstructorParameters = unsupported["type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never;", "ES5.d.ts", 1596, 99] +type ReturnType = unsupported["type ReturnType any> = T extends (...args: any) => infer R ? R : any;", "ES5.d.ts", 1601, 136] +type InstanceType = unsupported["type InstanceType any> = T extends abstract new (...args: any) => infer R ? R : any;", "ES5.d.ts", 1606, 97] +type Uppercase = unsupported["type Uppercase = intrinsic;", "ES5.d.ts", 1611, 125] +type Lowercase = unsupported["type Lowercase = intrinsic;", "ES5.d.ts", 1616, 45] +type Capitalize = unsupported["type Capitalize = intrinsic;", "ES5.d.ts", 1621, 45] +type Uncapitalize = unsupported["type Uncapitalize = intrinsic;", "ES5.d.ts", 1626, 46] declare trait ThisType[T] {} declare trait ArrayBuffer { val byteLength: Num diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index ec9574977..8a36b93f6 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -1,42 +1,8 @@ export declare module Heritage { - declare class A { - fun foo(): unit - } - declare class B extends A {} - declare class C[T] { - fun set(args0: T): unit - fun get(): T - } - declare class D extends C[Num] {} - declare trait Wu { - val x: (false) | (true) - } - declare class WuWu extends Wu { - val y: (false) | (true) - } - declare trait WuWuWu extends WuWu { - val z: (false) | (true) - } - declare trait Never extends WuWuWu { - fun w(): nothing - } - declare class VG[T] { - val x: T - } - declare class Home[T] extends VG[Str] { - val y: T - } - declare trait O[I] { - fun xx(x: I): I - } - declare class OR[R] extends O[R] { - fun xx(args0: R): R - } declare module Five { export declare class ROTK { val wu: Str } - export declare class Y extends ROTK {} } declare class Y extends Five.ROTK {} } diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 7b8a4574b..b825976cf 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -376,7 +376,7 @@ interface IArguments { callee: Function; } -class Str extends Object { +interface String { /** Returns a string representation of a string. */ toString(): string; @@ -501,9 +501,9 @@ class Str extends Object { } interface StringConstructor { - new(value?: any): Str; + new(value?: any): String; (value?: any): string; - readonly prototype: Str; + readonly prototype: String; fromCharCode(...codes: number[]): string; } @@ -525,7 +525,7 @@ interface BooleanConstructor { declare var Boolean: BooleanConstructor; -class Num { +interface Number { /** * Returns a string representation of an object. * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. @@ -555,9 +555,9 @@ class Num { } interface NumberConstructor { - new(value?: any): Num; + new(value?: any): Number; (value?: any): number; - readonly prototype: Num; + readonly prototype: Number; /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ readonly MAX_VALUE: number; @@ -1050,68 +1050,68 @@ declare var Error: ErrorConstructor; interface EvalError extends Error { } -// interface EvalErrorConstructor extends ErrorConstructor { -// new(message?: string): EvalError; -// (message?: string): EvalError; -// readonly prototype: EvalError; -// } +interface EvalErrorConstructor extends ErrorConstructor { + new(message?: string): EvalError; + (message?: string): EvalError; + readonly prototype: EvalError; +} -// declare var EvalError: EvalErrorConstructor; +declare var EvalError: EvalErrorConstructor; interface RangeError extends Error { } -// interface RangeErrorConstructor extends ErrorConstructor { -// new(message?: string): RangeError; -// (message?: string): RangeError; -// readonly prototype: RangeError; -// } +interface RangeErrorConstructor extends ErrorConstructor { + new(message?: string): RangeError; + (message?: string): RangeError; + readonly prototype: RangeError; +} -// declare var RangeError: RangeErrorConstructor; +declare var RangeError: RangeErrorConstructor; interface ReferenceError extends Error { } -// interface ReferenceErrorConstructor extends ErrorConstructor { -// new(message?: string): ReferenceError; -// (message?: string): ReferenceError; -// readonly prototype: ReferenceError; -// } +interface ReferenceErrorConstructor extends ErrorConstructor { + new(message?: string): ReferenceError; + (message?: string): ReferenceError; + readonly prototype: ReferenceError; +} -// declare var ReferenceError: ReferenceErrorConstructor; +declare var ReferenceError: ReferenceErrorConstructor; interface SyntaxError extends Error { } -// interface SyntaxErrorConstructor extends ErrorConstructor { -// new(message?: string): SyntaxError; -// (message?: string): SyntaxError; -// readonly prototype: SyntaxError; -// } +interface SyntaxErrorConstructor extends ErrorConstructor { + new(message?: string): SyntaxError; + (message?: string): SyntaxError; + readonly prototype: SyntaxError; +} -// declare var SyntaxError: SyntaxErrorConstructor; +declare var SyntaxError: SyntaxErrorConstructor; interface TypeError extends Error { } -// interface TypeErrorConstructor extends ErrorConstructor { -// new(message?: string): TypeError; -// (message?: string): TypeError; -// readonly prototype: TypeError; -// } +interface TypeErrorConstructor extends ErrorConstructor { + new(message?: string): TypeError; + (message?: string): TypeError; + readonly prototype: TypeError; +} -// declare var TypeError: TypeErrorConstructor; +declare var TypeError: TypeErrorConstructor; interface URIError extends Error { } -// interface URIErrorConstructor extends ErrorConstructor { -// new(message?: string): URIError; -// (message?: string): URIError; -// readonly prototype: URIError; -// } +interface URIErrorConstructor extends ErrorConstructor { + new(message?: string): URIError; + (message?: string): URIError; + readonly prototype: URIError; +} -// declare var URIError: URIErrorConstructor; +declare var URIError: URIErrorConstructor; interface JSON { /** diff --git a/ts2mls/js/src/test/typescript/Heritage.ts b/ts2mls/js/src/test/typescript/Heritage.ts index a4d8386fe..c931e4811 100644 --- a/ts2mls/js/src/test/typescript/Heritage.ts +++ b/ts2mls/js/src/test/typescript/Heritage.ts @@ -1,65 +1,65 @@ -class A { - constructor() {} +// class A { +// constructor() {} - foo() { - console.log("foo") - } -} +// foo() { +// console.log("foo") +// } +// } -class B extends A {} +// class B extends A {} -class C { - constructor() {} +// class C { +// constructor() {} - private t: T +// private t: T - set(x: T) { this.t = x; } - get() { return this.t; } -} +// set(x: T) { this.t = x; } +// get() { return this.t; } +// } -class D extends C { -} +// class D extends C { +// } -interface Wu { - x: boolean -} +// interface Wu { +// x: boolean +// } -class WuWu extends Wu { - y: boolean -} +// class WuWu extends Wu { +// y: boolean +// } -interface WuWuWu extends WuWu { - z: boolean -} +// interface WuWuWu extends WuWu { +// z: boolean +// } -interface Never extends WuWuWu { - w: () => never -} +// interface Never extends WuWuWu { +// w: () => never +// } -class VG { - x: T -} +// class VG { +// x: T +// } -class Home extends VG { - y: T -} +// class Home extends VG { +// y: T +// } -interface O { - xx: (x: I) => I -} +// interface O { +// xx: (x: I) => I +// } -class OR implements O { - xx(x: R): R { - return x; - } -} +// class OR implements O { +// xx(x: R): R { +// return x; +// } +// } namespace Five { export class ROTK { wu: string } - export class Y extends Five.ROTK {} + // export class Y extends Five.ROTK {} } class Y extends Five.ROTK {} From 307b76c1e5e0937d4274a29ab5a2fc54286e8c65 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 23 Jun 2023 13:57:12 +0800 Subject: [PATCH 123/202] WIP: Fix object flag check and unsupported check --- ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala | 6 +++--- ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 2 +- ts2mls/js/src/test/diff/ES5.mlsi | 4 ++-- ts2mls/js/src/test/typescript/ES5.d.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 67ef1edc1..66489e2c7 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -270,7 +270,7 @@ object TSTokenObject { class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAny(obj) { private lazy val flags = obj.flags - private lazy val objectFlags = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags + private lazy val objectFlags: js.Dynamic = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) lazy val symbol = TSSymbolObject(obj.symbol) @@ -291,8 +291,8 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isUnionType = obj.isUnion() lazy val isIntersectionType = obj.isIntersection() lazy val isFunctionLike = node.isFunctionLike - lazy val isAnonymous = objectFlags == TypeScript.objectFlagsAnonymous - lazy val isMapped = objectFlags == TypeScript.objectFlagsMapped // mapping a type to another by using `keyof` and so on + lazy val isAnonymous = (objectFlags & TypeScript.objectFlagsAnonymous) > 0 + lazy val isMapped = (objectFlags & TypeScript.objectFlagsMapped) > 0 // mapping a type to another by using `keyof` and so on lazy val isTypeParameter = flags == TypeScript.typeFlagsTypeParameter lazy val isObject = flags == TypeScript.typeFlagsObject lazy val isTypeParameterSubstitution = isObject && typeArguments.length > 0 diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index f4436031b..ce59e8165 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -191,7 +191,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) if (res.unsupported) markUnsupported(node) - if (node.symbol.isOptionalMember) TSUnionType(res, TSPrimitiveType("undefined")) + else if (node.symbol.isOptionalMember) TSUnionType(res, TSPrimitiveType("undefined")) else res } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index c1e9e9bcc..9a448165b 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -46,7 +46,7 @@ declare trait ObjectConstructor { fun defineProperties[T](args0: T, args1: (PropertyDescriptorMap) & (ThisType[anything])): T fun preventExtensions[T](args0: T): T fun create(args0: Object, args1: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ - fun freeze[T](args0: T): T + val freeze: unsupported["freeze(o: T): Readonly;", "ES5.d.ts", 210, 143] val __new: unsupported["new(value?: any): Object;", "ES5.d.ts", 137, 29] fun getOwnPropertyDescriptor(args0: anything, args1: ((Str) | (Num)) | (Symbol)): PropertyDescriptor fun seal[T](args0: T): T @@ -386,7 +386,7 @@ type Pick = unsupported["type Pick = { [P in K]: T[P]; type Record = unsupported["type Record = { [P in K]: T; };", "ES5.d.ts", 1564, 2] type Exclude = unsupported["type Exclude = T extends U ? never : T;", "ES5.d.ts", 1571, 2] type Extract = unsupported["type Extract = T extends U ? T : never;", "ES5.d.ts", 1576, 45] -type Omit[T, K] = __type +type Omit = unsupported["type Omit = Pick>;", "ES5.d.ts", 1581, 45] type NonNullable[T] = (T) & ({}) type Parameters = unsupported["type Parameters any> = T extends (...args: infer P) => any ? P : never;", "ES5.d.ts", 1591, 29] type ConstructorParameters = unsupported["type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never;", "ES5.d.ts", 1596, 99] diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index b825976cf..3d2163bda 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -207,13 +207,13 @@ interface ObjectConstructor { * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - // freeze(o: T): Readonly; + freeze(o: T): Readonly; /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param o Object on which to lock the attributes. */ - // freeze(o: T): Readonly; + freeze(o: T): Readonly; /** * Prevents the addition of new properties to an object. From ea9b063fa763a318851829314377460933d3ef33 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 23 Jun 2023 14:26:21 +0800 Subject: [PATCH 124/202] WIP: Rename test cases --- driver/js/src/test/scala/driver/DriverDiffTests.scala | 4 ++-- ts2mls/js/src/test/diff/{Array.mlsi => TSArray.mlsi} | 2 +- ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala | 2 +- ts2mls/js/src/test/typescript/{Array.ts => TSArray.ts} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename ts2mls/js/src/test/diff/{Array.mlsi => TSArray.mlsi} (95%) rename ts2mls/js/src/test/typescript/{Array.ts => TSArray.ts} (100%) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index cf902ec44..7324ed542 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -80,10 +80,9 @@ object DriverDiffTests { entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules entry("Builtin", expectError = true), // TODO: Predef.mlsi - ts2mlsEntry("Array", ignoreTypeError = true), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", expectError = true), + ts2mlsEntry("Cycle1", ignoreTypeError = true), ts2mlsEntry("Dec", ignoreTypeError = true), ts2mlsEntry("Enum"), ts2mlsEntry("Escape"), @@ -97,6 +96,7 @@ object DriverDiffTests { ts2mlsEntry("Namespace", expectError = true), ts2mlsEntry("Optional", ignoreTypeError = true), ts2mlsEntry("Overload", ignoreTypeError = true), + ts2mlsEntry("TSArray", ignoreTypeError = true), ts2mlsEntry("Tuple", ignoreTypeError = true), ts2mlsEntry("Type", ignoreTypeError = true), ts2mlsEntry("TypeParameter", ignoreTypeError = true), diff --git a/ts2mls/js/src/test/diff/Array.mlsi b/ts2mls/js/src/test/diff/TSArray.mlsi similarity index 95% rename from ts2mls/js/src/test/diff/Array.mlsi rename to ts2mls/js/src/test/diff/TSArray.mlsi index 6891e47f3..2cfcc0131 100644 --- a/ts2mls/js/src/test/diff/Array.mlsi +++ b/ts2mls/js/src/test/diff/TSArray.mlsi @@ -1,4 +1,4 @@ -export declare module Array { +export declare module TSArray { fun first(x: MutArray[Str]): Str fun getZero3(): MutArray[Num] fun first2(fs: MutArray[(x: Num) => Num]): (x: Num) => Num diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index c079df990..42383d5fd 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -20,7 +20,6 @@ class TSTypeGenerationTest extends AnyFunSuite { object TSTypeGenerationTest { private val testsData = List( - "./Array.ts", "./BasicFunctions.ts", "./ClassMember.ts", "./Cycle1.ts", @@ -39,6 +38,7 @@ object TSTypeGenerationTest { "./Namespace.ts", "./Optional.ts", "./Overload.ts", + "./TSArray.ts", "./Tuple.ts", "./Type.ts", "./TypeParameter.ts", diff --git a/ts2mls/js/src/test/typescript/Array.ts b/ts2mls/js/src/test/typescript/TSArray.ts similarity index 100% rename from ts2mls/js/src/test/typescript/Array.ts rename to ts2mls/js/src/test/typescript/TSArray.ts From cf85ab88b7d1ebce4ad44fe4b485e34d17815d6d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 23 Jun 2023 15:32:22 +0800 Subject: [PATCH 125/202] WIP: Add Predef.mlsi --- driver/js/src/main/scala/driver/Driver.scala | 3 +- .../src/main/scala/driver/DriverBackend.scala | 2 +- driver/js/src/test/output/Builtin.check | 1 + driver/js/src/test/predefs/Predef.mlsi | 134 ++++++++++++++++++ .../.interfaces/mlscript/Builtin.mlsi | 2 +- .../src/test/projects/js/mlscript/Builtin.js | 1 + .../js/src/test/projects/mlscript/Builtin.mls | 3 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- 8 files changed, 143 insertions(+), 5 deletions(-) create mode 100644 driver/js/src/test/predefs/Predef.mlsi diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 99606202a..8a12ad002 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -280,7 +280,8 @@ object Driver { private val jsBuiltinPaths = List( "./ts2mls/js/src/test/diff/ES5.mlsi", - "./ts2mls/js/src/test/diff/Dom.mlsi" + "./ts2mls/js/src/test/diff/Dom.mlsi", + "./driver/js/src/test/predefs/Predef.mlsi" ) private def report(msg: String): Unit = diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala index 1c3237e3f..191bf03b2 100644 --- a/driver/js/src/main/scala/driver/DriverBackend.scala +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -14,7 +14,7 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { case _ => die } - declareNewTypeDefs(typeDefs, true)(topLevelScope) + declareNewTypeDefs(typeDefs, false)(topLevelScope) otherStmts.foreach { case NuFunDef(_, Var(name), _, _) => topLevelScope.declareStubValue(name)(true) diff --git a/driver/js/src/test/output/Builtin.check b/driver/js/src/test/output/Builtin.check index b662cd9da..430fc8d84 100644 --- a/driver/js/src/test/output/Builtin.check +++ b/driver/js/src/test/output/Builtin.check @@ -4,3 +4,4 @@ b 52 1.7976931348623157e+308 false +3.141592653589793 diff --git a/driver/js/src/test/predefs/Predef.mlsi b/driver/js/src/test/predefs/Predef.mlsi new file mode 100644 index 000000000..05056a23d --- /dev/null +++ b/driver/js/src/test/predefs/Predef.mlsi @@ -0,0 +1,134 @@ +// Re-declare some types in es5 + +declare type PropertyKey = Str | Num | Symbol + +declare class Object { + fun toString(): Str + fun toLocaleString(): Str + fun valueOf(): Str + fun hasOwnProperty(v: PropertyKey): Bool + fun isPrototypeOf(v: Object): Bool + fun propertyIsEnumerable(v: PropertyKey): Bool +} + +declare class Str extends Object { + fun toString(): Str + fun charAt(pos: Num): Str + fun charCodeAt(index: Num): Num + fun concat(strings: Str | Array[Str]): Str + fun indexOf(searchString: Str, position: Num | undefined): Num + fun lastIndexOf(searchString: Str, position: Num | undefined): Num + fun localeCompare(that: Str): Num + fun match(regexp: Str | RegExp): RegExpMatchArray | null + fun replace(searchValue: Str | RegExp, replaceValue: Str): Str + fun search(regexp: Str | RegExp): Num + fun slice(start: Num | undefined, end: Num | undefined): Str + fun split(separator: Str | RegExp, limit: Num | undefined): Array[Str] + fun substring(start: Num, end: Num | undefined): Str + fun toLowerCase(): Str + fun toLocaleLowerCase(locales: Str | Array[Str] | undefined): Str + fun toUpperCase(): Str + fun toLocaleUpperCase(locales: Str | Array[Str] | undefined): Str + fun trim(): Str + val length: Num +} + +declare module String { + fun fromCharCode(codes: Num | Array[Num]): Str +} + +declare class Num { + fun toString(radix: Num | undefined): Str + fun toFixed(fractionDigits: Num | undefined): Str + fun toExponential(fractionDigits: Num | undefined): Str + fun toPrecision(precision: Num | undefined): Str +} + +declare module Number { + val MAX_VALUE: Num + val MIN_VALUE: Num + val NaN: Num + val NEGATIVE_INFINITY: Num + val POSITIVE_INFINITY: Num +} + +declare module Math { + val E: Num + val LN10: Num + val LN2: Num + val LOG2E: Num + val LOG10E: Num + val PI: Num + val SQRT1_2: Num + val SQRT2: Num + fun abs(x: Num): Num + fun acos(x: Num): Num + fun asin(x: Num): Num + fun atan(x: Num): Num + fun atan2(y: Num, x: Num): Num + fun ceil(x: Num): Num + fun cos(x: Num): Num + fun exp(x: Num): Num + fun floor(x: Num): Num + fun log(x: Num): Num + fun max(values: Num | Array[Num]): Num + fun min(values: Num | Array[Num]): Num + fun pow(x: Num, y: Num): Num + fun random(): Num + fun round(x: Num): Num + fun sin(x: Num): Num + fun sqrt(x: Num): Num + fun tan(x: Num): Num +} + +class Date { + constructor(value: Num | Str | undefined) + toString(): Str + toDateString(): Str + toTimeString(): Str + toLocaleString(): Str + toLocaleDateString(): Str + toLocaleTimeString(): Str + valueOf(): Num + getTime(): Num + getFullYear(): Num + getUTCFullYear(): Num + getMonth(): Num + getUTCMonth(): Num + getDate(): Num + getUTCDate(): Num + getDay(): Num + getUTCDay(): Num + getHours(): Num + getUTCHours(): Num + getMinutes(): Num + getUTCMinutes(): Num + getSeconds(): Num + getUTCSeconds(): Num + getMilliseconds(): Num + getUTCMilliseconds(): Num + getTimezoneOffset(): Num + setTime(time: Num): Num + setMilliseconds(ms: Num): Num + setUTCMilliseconds(ms: Num): Num + setSeconds(sec: Num, ms: Num | undefined): Num + setUTCSeconds(sec: Num, ms: Num | undefined): Num + setMinutes(min: Num, sec: Num | undefined, ms: Num | undefined): Num + setUTCMinutes(min: Num, sec: Num | undefined, ms: Num | undefined): Num + setHours(hours: Num, min: Num | undefined, sec: Num | undefined, ms: Num | undefined): Num + setUTCHours(hours: Num, min: Num | undefined, sec: Num | undefined, ms: Num | undefined): Num + setDate(date: Num): Num + setUTCDate(date: Num): Num + setMonth(month: Num, date: Num): Num + setUTCMonth(month: Num, date: Num | undefined): Num + setFullYear(year: Num, month: Num | undefined, date: Num | undefined): Num + setUTCFullYear(year: Num, month: Num | undefined, date: Num | undefined): Num + toUTCString(): Str + toISOString(): Str + toJSON(key: anything | undefined): Str +} + +declare module JSON { + fun parse(text: Str, reviver: ((this: anything, key: Str, value: anything) => anything) | undefined): anything + fun stringify(value: anything, replacer: Array[(Num | Str)] | null, space: Str | Num | undefined): Str +} diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi index eb6ef7b85..b3c7ce3af 100644 --- a/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi +++ b/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi @@ -1,5 +1,5 @@ declare module Builtin() { - let s: Str + let s: "abc" let n: Num unit } diff --git a/driver/js/src/test/projects/js/mlscript/Builtin.js b/driver/js/src/test/projects/js/mlscript/Builtin.js index f61f55e8c..c8d90d203 100644 --- a/driver/js/src/test/projects/js/mlscript/Builtin.js +++ b/driver/js/src/test/projects/js/mlscript/Builtin.js @@ -16,6 +16,7 @@ const Builtin = new class Builtin { console.log(n.toString(8)); console.log(Number["MAX_VALUE"]); console.log(s.hasOwnProperty("foo")); + console.log(Math.PI); } }; Builtin.$init(); diff --git a/driver/js/src/test/projects/mlscript/Builtin.mls b/driver/js/src/test/projects/mlscript/Builtin.mls index 9c9467c76..a0cbe8986 100644 --- a/driver/js/src/test/projects/mlscript/Builtin.mls +++ b/driver/js/src/test/projects/mlscript/Builtin.mls @@ -1,4 +1,4 @@ -let s: Str = "abc" +let s = "abc" let n: Num = 42 console.log(s.charAt(1)) @@ -7,3 +7,4 @@ console.log(String.fromCharCode(64)) console.log(n.toString(8)) console.log(Number.MAX_VALUE) console.log(s.hasOwnProperty("foo")) +console.log(Math.PI) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 7324ed542..2e3f4e298 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -79,7 +79,7 @@ object DriverDiffTests { entry("Output2", Some("./tsconfig.json")), entry("MLS2TheMax", Some("./tsconfig.json")), entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - entry("Builtin", expectError = true), // TODO: Predef.mlsi + entry("Builtin"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), ts2mlsEntry("Cycle1", ignoreTypeError = true), From 0f25e5d5baed6d13ca360180008cde05f7b08a3f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 24 Jun 2023 11:23:15 +0800 Subject: [PATCH 126/202] WIP: Fix array name in es5 --- .../test/scala/driver/DriverDiffTests.scala | 62 +++++++++---------- .../src/main/scala/ts2mls/TSSourceFile.scala | 1 + ts2mls/js/src/test/diff/ES5.mlsi | 9 ++- ts2mls/js/src/test/typescript/ES5.d.ts | 6 +- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 2e3f4e298..183f6e5e8 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -70,38 +70,38 @@ object DriverDiffTests { TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, ignoreTypeError, expectError) private val testCases = List[TestOption]( - entry("Simple"), - entry("Cycle2"), - entry("Self", expectError = true), - entry("C", ignoreTypeError = true, expectError = true), - entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members - entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json")), - entry("MLS2TheMax", Some("./tsconfig.json")), - entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + // entry("Simple"), + // entry("Cycle2"), + // entry("Self", expectError = true), + // entry("C", ignoreTypeError = true, expectError = true), + // entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members + // entry("Output", Some("./tsconfig.json")), + // entry("Output2", Some("./tsconfig.json")), + // entry("MLS2TheMax", Some("./tsconfig.json")), + // entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules entry("Builtin"), - ts2mlsEntry("BasicFunctions", ignoreTypeError = true), - ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", ignoreTypeError = true), - ts2mlsEntry("Dec", ignoreTypeError = true), - ts2mlsEntry("Enum"), - ts2mlsEntry("Escape"), - ts2mlsEntry("Export", ignoreTypeError = true), - ts2mlsEntry("Heritage", ignoreTypeError = true), - ts2mlsEntry("HighOrderFunc"), - ts2mlsEntry("Import"), - ts2mlsEntry("InterfaceMember", ignoreTypeError = true), - ts2mlsEntry("Intersection", ignoreTypeError = true), - ts2mlsEntry("Literal"), - ts2mlsEntry("Namespace", expectError = true), - ts2mlsEntry("Optional", ignoreTypeError = true), - ts2mlsEntry("Overload", ignoreTypeError = true), - ts2mlsEntry("TSArray", ignoreTypeError = true), - ts2mlsEntry("Tuple", ignoreTypeError = true), - ts2mlsEntry("Type", ignoreTypeError = true), - ts2mlsEntry("TypeParameter", ignoreTypeError = true), - ts2mlsEntry("Union"), - ts2mlsEntry("Variables", expectError = true), + // ts2mlsEntry("BasicFunctions", ignoreTypeError = true), + // ts2mlsEntry("ClassMember"), + // ts2mlsEntry("Cycle1", ignoreTypeError = true), + // ts2mlsEntry("Dec", ignoreTypeError = true), + // ts2mlsEntry("Enum"), + // ts2mlsEntry("Escape"), + // ts2mlsEntry("Export", ignoreTypeError = true), + // ts2mlsEntry("Heritage", ignoreTypeError = true), + // ts2mlsEntry("HighOrderFunc"), + // ts2mlsEntry("Import"), + // ts2mlsEntry("InterfaceMember", ignoreTypeError = true), + // ts2mlsEntry("Intersection", ignoreTypeError = true), + // ts2mlsEntry("Literal"), + // ts2mlsEntry("Namespace", expectError = true), + // ts2mlsEntry("Optional", ignoreTypeError = true), + // ts2mlsEntry("Overload", ignoreTypeError = true), + // ts2mlsEntry("TSArray", ignoreTypeError = true), + // ts2mlsEntry("Tuple", ignoreTypeError = true), + // ts2mlsEntry("Type", ignoreTypeError = true), + // ts2mlsEntry("TypeParameter", ignoreTypeError = true), + // ts2mlsEntry("Union"), + // ts2mlsEntry("Variables", expectError = true), ) private val cp = g.require("child_process") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index ce59e8165..a9c58e3a7 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -244,6 +244,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case t => ref } lst :+ (getObjectType(h.types.get(index).typeNode) match { + case TSArrayType(ele) => TSSubstitutionType(TSReferenceType("Array"), ele :: Nil) case ref: TSReferenceType => run(ref) case TSSubstitutionType(base, app) => run(base) match { case ref: TSReferenceType => TSSubstitutionType(ref, app) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 9a448165b..e764f17c7 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -232,12 +232,12 @@ declare trait DateConstructor { fun parse(args0: Str): Num val prototype: Date } -declare trait RegExpMatchArray extends MutArray[Str] { +declare trait RegExpMatchArray extends Array[Str] { val index: (Num) | (undefined) val input: (Str) | (undefined) val id"0": Str } -declare trait RegExpExecArray extends MutArray[Str] { +declare trait RegExpExecArray extends Array[Str] { val index: Num val input: Str val id"0": Str @@ -326,14 +326,14 @@ declare trait ConcatArray[T] { fun join(args0: (Str) | (undefined)): Str fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] } -declare trait MutArray[T] { +declare trait Array[T] { fun lastIndexOf(args0: T, args1: (Num) | (undefined)): Num fun every(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ fun push(args0: (T) | (MutArray[T])): Num fun forEach(args0: (value: T, index: Num, array: MutArray[T]) => unit, args1: (anything) | (undefined)): unit fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ fun unshift(args0: (T) | (MutArray[T])): Num - fun sort(args0: ((a: T, b: T) => Num) | (undefined)): MutArray + fun sort(args0: ((a: T, b: T) => Num) | (undefined)): Array fun join(args0: (Str) | (undefined)): Str fun map[U](args0: (value: T, index: Num, array: MutArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] fun pop(): T @@ -357,7 +357,6 @@ declare trait ArrayConstructor { fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } -val Array: ArrayConstructor declare trait TypedPropertyDescriptor[T] { val configurable: ((false) | (true)) | (undefined) val set: ((value: T) => unit) | (undefined) diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 3d2163bda..44e51c6c2 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -920,7 +920,7 @@ interface DateConstructor { declare var Date: DateConstructor; -interface RegExpMatchArray extends MutArray { +interface RegExpMatchArray extends Array { /** * The index of the search at which the result was found. */ @@ -935,7 +935,7 @@ interface RegExpMatchArray extends MutArray { 0: string; } -interface RegExpExecArray extends MutArray { +interface RegExpExecArray extends Array { /** * The index of the search at which the result was found. */ @@ -1281,7 +1281,7 @@ interface ConcatArray { slice(start?: number, end?: number): T[]; } -interface MutArray { +interface Array { /** * Gets or sets the length of the array. This is a number one higher than the highest index in the array. */ From c4b7db5e976d888409b41aa418ab12d7d3ea12b2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 24 Jun 2023 15:08:32 +0800 Subject: [PATCH 127/202] WIP: Fix several bugs --- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 ++- .../src/main/scala/ts2mls/TSNamespace.scala | 4 ++-- .../src/main/scala/ts2mls/TSSourceFile.scala | 20 +++++++++++++++---- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 66489e2c7..0e50b0d96 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -228,7 +228,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS // TODO: multiline string support override def toString(): String = - if (IsUndefined(node)) "" else node.getText().toString().replaceAll("\n", " ") + if (IsUndefined(node)) "" else node.getText().toString().replaceAll("\n", " ").replaceAll("\"", "'") lazy val filename: String = if (parent.isUndefined) node.fileName.toString() else parent.filename @@ -245,6 +245,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val expression = TSTokenObject(node.expression) lazy val idExpression = TSIdentifierObject(node.expression) lazy val isVarParam = !IsUndefined(node.dotDotDotToken) + lazy val hasmoduleReference = !IsUndefined(node.moduleReference) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 4c08df3ce..a4cff0985 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -102,8 +102,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { case TSInterfaceType(name, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) - case TSRenamedType(name, original) if (exp) => - writer.writeln(s"${indent}export val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") + case TSRenamedType(name, original) => + writer.writeln(s"${indent}${if (exp) "export " else ""}val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)}: ${Converter.convert(mem)("")}") } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index a9c58e3a7..0d0cd4435 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -71,9 +71,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config) val moduleName = TSPathResolver.basename(fullname) val varName = req.name.escapedText - val imp = TSSingleImport(localName, List((varName, None))) - importList.add(fullname, imp) - global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName.$varName")), false, false) + if (req.hasmoduleReference) { + val imp = TSFullImport(localName, varName) + importList.add(fullname, imp) + global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName")), false, false) + } + else { + val imp = TSSingleImport(localName, List((varName, None))) + importList.add(fullname, imp) + global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName.$varName")), false, false) + } } private def parseExportDeclaration(elements: TSNodeArray): Unit = { @@ -164,7 +171,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // the function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = - if (tn.isFunctionLike) getFunctionType(tn, true) + if (tn.isFunctionLike) { + if (tn.typeParameters.isUndefined) getFunctionType(tn, true) + else markUnsupported(tn) // type parameters in lambda functions are not supported + } else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => markUnsupported(tn) @@ -352,12 +362,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case TSClassType(name, members, statics, typeVars, _, constructor) => val cls = TSClassType(name, members, statics, typeVars, getHeritageList(node, members.keySet), constructor) ns.put(name, if (cls.unsupported) markUnsupported(node) else cls, ns.exported(name), true) + case t if (t.unsupported) => () // ignore types that have been marked as unsupported. case _ => throw new AssertionError(s"$name is not a class") } else if (node.isInterfaceDeclaration) ns.get(name) match { case TSInterfaceType(name, members, typeVars, parents) => val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet)) ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) + case t if (t.unsupported) => () // ignore types that have been marked as unsupported. case _ => throw new AssertionError(s"$name is not an interface") } else if (node.isNamespace) { From a750e7f8651f2a3ea5e34361abad0503fcf3c139 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 24 Jun 2023 17:53:31 +0800 Subject: [PATCH 128/202] WIP: Support UMD(not ready) --- driver/js/src/main/scala/driver/Driver.scala | 6 +- .../projects/.interfaces/mlscript/Lodash.mlsi | 5 + .../node_modules/@types/lodash/fp.mlsi | 3143 +++++++++++++++++ .../node_modules/@types/lodash/index.mlsi | 9 + .../node_modules/json5/lib/json5.mlsi | 4 +- .../src/test/projects/js/mlscript/Lodash.js | 18 + .../js/src/test/projects/mlscript/Lodash.mls | 4 + driver/js/src/test/projects/package-lock.json | 24 +- driver/js/src/test/projects/package.json | 4 +- .../test/scala/driver/DriverDiffTests.scala | 63 +- .../src/main/scala/ts2mls/TSNamespace.scala | 68 +- ts2mls/js/src/test/diff/ES5.mlsi | 2 +- 12 files changed, 3291 insertions(+), 59 deletions(-) create mode 100644 driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi create mode 100644 driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi create mode 100644 driver/js/src/test/projects/js/mlscript/Lodash.js create mode 100644 driver/js/src/test/projects/mlscript/Lodash.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 8a12ad002..78e70421e 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -34,12 +34,12 @@ class Driver(options: DriverOptions) { import TSPathResolver.{normalize, isLocal, dirname} - private def checkESModule(filename: String) = + private def checkESModule(filename: String, from: String) = if (filename.endsWith(".mls")) None else if (isLocal(filename)) Some(TypeScript.isESModule(config, false)) else { - val fullname = TypeScript.resolveModuleName(filename, "", config) + val fullname = TypeScript.resolveModuleName(filename, from, config) def find(path: String): Boolean = { val dir = dirname(path) val pack = s"$dir/package.json" @@ -241,7 +241,7 @@ class Driver(options: DriverOptions) { saveToFile(mlsiFile, interfaces) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( imp => new Import(resolveTarget(file, imp.path)) with ModuleType { - val isESModule = checkESModule(path) + val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } ), exported || importedModule(file.filename)) } diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi b/driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi new file mode 100644 index 000000000..24af2c5de --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi @@ -0,0 +1,5 @@ +import "lodash/fp.mlsi" +declare module Lodash() { + fun inc: (x: Int,) -> Int + unit +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi new file mode 100644 index 000000000..e929b7b69 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi @@ -0,0 +1,3143 @@ +import "./index.mlsi" +export declare module fp { + export val extendWith: LodashExtendWith + export val sortedIndexOf: LodashSortedIndexOf + export val toInteger: {} + export val mergeAll: LodashMergeAll + export val isDate: {} + export val defer: {} + export val unapply: {} + export val toPath: {} + export val takeLastWhile: LodashTakeRightWhile + export val constant: {} + export val countBy: LodashCountBy + export val flatMapDepth: LodashFlatMapDepth + export val isLength: {} + export val find: LodashFind + export val rearg: LodashRearg + export val dropRightWhile: LodashDropRightWhile + export val flatten: {} + export val method: {} + export val unary: {} + export val findLastKey: LodashFindLastKey + export val toFinite: {} + export val any: LodashSome + export val uniq: {} + export val extendAll: LodashExtendAll + export val assignIn: LodashAssignIn + export val padEnd: LodashPadEnd + export val once: {} + export val random: LodashRandom + export val nAry: LodashAry + export val spread: {} + export val propOr: LodashPropOr + export val symmetricDifference: LodashXor + export val chunk: LodashChunk + export val toPairsIn: LodashToPairsIn + export val isArray: {} + export val delay: LodashDelay + export val replace: LodashReplace + export val unionBy: LodashUnionBy + export val differenceWith: LodashDifferenceWith + export val isEqual: LodashIsEqual + export val runInContext: {} + export val takeWhile: LodashTakeWhile + export val isError: {} + export val pathEq: LodashMatchesProperty + export val partial: LodashPartial + export val union: LodashUnion + export val defaultsDeep: LodashDefaultsDeep + export val zip: LodashZip + export val sortedLastIndexBy: LodashSortedLastIndexBy + export val initial: {} + export val rangeStepRight: LodashRangeStepRight + export val findLastIndexFrom: LodashFindLastIndexFrom + export val gte: LodashGte + export val path: LodashPath + export val minBy: LodashMinBy + export val defaults: LodashDefaults + export val size: {} + export val rangeRight: LodashRangeRight + export val compose: LodashFlowRight + export val stubObject: {} + export val partialRight: LodashPartialRight + export val trimCharsEnd: LodashTrimCharsEnd + export val dropLastWhile: LodashDropRightWhile + export val defaultsDeepAll: {} + export val join: LodashJoin + export val stubFalse: {} + export val isSafeInteger: {} + export val dropWhile: LodashDropWhile + export val subtract: LodashSubtract + export val map: LodashMap + export val dissocPath: LodashUnset + export val takeRight: LodashTakeRight + export val assignAll: LodashAssignAll + export val indexBy: LodashKeyBy + export val updateWith: LodashUpdateWith + export val equals: LodashIsEqual + export val forInRight: LodashForInRight + export val isArrayLikeObject: LodashIsArrayLikeObject + export val startCase: {} + export val intersection: LodashIntersection + export val bindAll: LodashBindAll + export val isNull: {} + export val unset: LodashUnset + export val T: {} + export val sortedLastIndex: LodashSortedLastIndex + export val startsWith: LodashStartsWith + export val uniqWith: LodashUniqWith + export val lastIndexOf: LodashLastIndexOf + export val assignWith: LodashAssignWith + export val invertBy: LodashInvertBy + export val takeLast: LodashTakeRight + export val all: LodashEvery + export val rest: {} + export val cloneDeepWith: LodashCloneDeepWith + export val head: {} + export val allPass: {} + export val toNumber: {} + export val findLastFrom: LodashFindLastFrom + export val curry: LodashCurry + export val takeRightWhile: LodashTakeRightWhile + export val unzip: {} + export val symmetricDifferenceWith: LodashXorWith + export val result: LodashResult + export val every: LodashEvery + export val sumBy: LodashSumBy + export val set: LodashSet + export val sortBy: LodashSortBy + export val before: LodashBefore + export val truncate: LodashTruncate + export val noConflict: {} + export val F: {} + export val pickBy: LodashPickBy + export val capitalize: {} + export val pullAllBy: LodashPullAllBy + export val deburr: {} + export val indexOfFrom: LodashIndexOfFrom + export val flattenDeep: {} + export val concat: LodashConcat + export val partition: LodashPartition + export val padChars: LodashPadChars + export val bind: LodashBind + export val entriesIn: LodashToPairsIn + export val mean: {} + export val uniqBy: LodashUniqBy + export val unionWith: LodashUnionWith + export val tap: LodashTap + export val matchesProperty: LodashMatchesProperty + export val toPlainObject: {} + export val create: {} + export val trimEnd: {} + export val isTypedArray: {} + export val assign: LodashAssign + export val min: {} + export val has: LodashHas + export val zipWith: LodashZipWith + export val sortedIndex: LodashSortedIndex + export val propertyOf: LodashPropertyOf + export val forEach: LodashForEach + export val anyPass: {} + export val toLower: {} + export val snakeCase: {} + export val setWith: LodashSetWith + export val assignInAll: LodashAssignInAll + export val findIndex: LodashFindIndex + export val clamp: LodashClamp + export val defaultTo: LodashDefaultTo + export val divide: LodashDivide + export val hasIn: LodashHasIn + export val tail: {} + export val isWeakSet: {} + export val paths: LodashAt + export val sortedLastIndexOf: LodashSortedLastIndexOf + export val omitAll: LodashOmit + export val each: LodashForEach + export val last: {} + export val lowerCase: {} + export val juxt: {} + export val placeholder: LoDashStatic + export val dropRight: LodashDropRight + export val pullAt: LodashPullAt + export val extend: LodashExtend + export val isWeakMap: {} + export val mapKeys: LodashMapKeys + export val isMatchWith: LodashIsMatchWith + export val rangeStep: LodashRangeStep + export val isInteger: {} + export val findIndexFrom: LodashFindIndexFrom + export val isMap: {} + export val reject: LodashReject + export val toSafeInteger: {} + export val pad: LodashPad + export val pullAllWith: LodashPullAllWith + export val omitBy: LodashOmitBy + export val forEachRight: LodashForEachRight + export val drop: LodashDrop + export val reverse: {} + export val overEvery: {} + export val assignAllWith: LodashAssignAllWith + export val sortedIndexBy: LodashSortedIndexBy + export val ceil: {} + export val now: {} + export val invokeMap: LodashInvokeMap + export val filter: LodashFilter + export val assignInAllWith: LodashAssignInAllWith + export val escapeRegExp: {} + export val toLength: {} + export val noop: {} + export val unzipWith: LodashUnzipWith + export val upperCase: {} + export val findKey: LodashFindKey + export val useWith: LodashOverArgs + export val isFinite: {} + export val isFunction: {} + export val cloneWith: LodashCloneWith + export val mergeWith: LodashMergeWith + export val endsWith: LodashEndsWith + export val forIn: LodashForIn + export val at: LodashAt + export val merge: LodashMerge + export val kebabCase: {} + export val zipObj: LodashZipObject + export val isPlainObject: {} + export val pathOr: LodashPathOr + export val ___: LoDashStatic + export val over: {} + export val isMatch: LodashIsMatch + export val isEqualWith: LodashIsEqualWith + export val dropLast: LodashDropRight + export val isBoolean: {} + export val remove: LodashRemove + export val apply: {} + export val trimStart: {} + export val after: LodashAfter + export val wrap: LodashWrap + export val overArgs: LodashOverArgs + export val max: {} + export val upperFirst: {} + export val entries: LodashToPairs + export val conformsTo: LodashConformsTo + export val escape: {} + export val forOwn: LodashForOwn + export val flatMap: LodashFlatMap + export val eachRight: LodashForEachRight + export val take: LodashTake + export val findLast: LodashFindLast + export val invoke: LodashInvoke + export val omit: LodashOmit + export val unnest: {} + export val reduceRight: LodashReduceRight + export val stubString: {} + export val groupBy: LodashGroupBy + export val isString: {} + export val maxBy: LodashMaxBy + export val fill: LodashFill + export val negate: {} + export val range: LodashRange + export val curryN: LodashCurryN + export val split: LodashSplit + export val clone: {} + export val pick: LodashPick + export val flow: LodashFlow + export val includesFrom: LodashIncludesFrom + export val floor: {} + export val pullAll: LodashPullAll + export val xor: LodashXor + export val flip: {} + export val slice: LodashSlice + export val castArray: {} + export val ary: LodashAry + export val reduce: LodashReduce + export val times: LodashTimes + export val orderBy: LodashOrderBy + export val assocPath: LodashSet + export val dissoc: LodashUnset + export val toArray: LodashToArray + export val intersectionWith: LodashIntersectionWith + export val restFrom: LodashRestFrom + export val isSymbol: {} + export val isNumber: {} + export val cloneDeep: {} + export val first: {} + export val multiply: LodashMultiply + export val nth: LodashNth + export val thru: LodashThru + export val getOr: LodashGetOr + export val functionsIn: {} + export val mergeAllWith: LodashMergeAllWith + export val isNaN: {} + export val differenceBy: LodashDifferenceBy + export val shuffle: LodashShuffle + export val fromPairs: LodashFromPairs + export val sample: LodashSample + export val complement: {} + export val words: {} + export val assignInWith: LodashAssignInWith + export val findFrom: LodashFindFrom + export val template: {} + export val lowerFirst: {} + export val xorBy: LodashXorBy + export val values: LodashValues + export val toString: {} + export val sampleSize: LodashSampleSize + export val invokeArgsMap: LodashInvokeArgsMap + export val pull: LodashPull + export val round: {} + export val property: LodashProperty + export val overSome: {} + export val iteratee: LodashIteratee + export val isNil: {} + export val isBuffer: {} + export val lte: LodashLte + export val prop: LodashProp + export val zipObject: LodashZipObject + export val padCharsEnd: LodashPadCharsEnd + export val stubTrue: {} + export val whereEq: LodashIsMatch + export val defaultsAll: LodashDefaultsAll + export val findLastIndex: LodashFindLastIndex + export val flowRight: LodashFlowRight + export val sortedUniq: {} + export val functions: {} + export val id"where": LodashConformsTo + export val curryRightN: LodashCurryRightN + export val cond: LodashCond + export val assoc: LodashSet + export val bindKey: LodashBindKey + export val always: {} + export val get: LodashGet + export val trimChars: LodashTrimChars + export val isObject: {} + export val repeat: LodashRepeat + export val pipe: LodashFlow + export val update: LodashUpdate + export val zipObjectDeep: LodashZipObjectDeep + export val toPairs: LodashToPairs + export val props: LodashAt + export val invert: {} + export val isArrayLike: LodashIsArrayLike + export val identity: LodashIdentity + export val mapValues: LodashMapValues + export val isUndefined: {} + export val meanBy: LodashMeanBy + export val pickAll: LodashPick + export val attempt: {} + export val forOwnRight: LodashForOwnRight + export val trim: {} + export val extendAllWith: LodashExtendAllWith + export val isArrayBuffer: {} + export val throttle: LodashThrottle + export val matches: LodashIsMatch + export val parseInt: LodashParseInt + export val uniqueId: {} + export val valuesIn: LodashValuesIn + export val stubArray: {} + export val includes: LodashIncludes + export val lastIndexOfFrom: LodashLastIndexOfFrom + export val invokeArgs: LodashInvokeArgs + export val isNative: {} + export val flatMapDeep: LodashFlatMapDeep + export val contains: LodashContains + export val isEmpty: LodashIsEmpty + export val isArguments: {} + export val conforms: LodashConformsTo + export val xorWith: LodashXorWith + export val flattenDepth: LodashFlattenDepth + export val isSet: {} + export val add: LodashAdd + export val init: {} + export val lt: LodashLt + export val difference: LodashDifference + export val keyBy: LodashKeyBy + export val isRegExp: {} + export val padCharsStart: LodashPadCharsStart + export val transform: LodashTransform + export val some: LodashSome + export val indexOf: LodashIndexOf + export val padStart: LodashPadStart + export val intersectionBy: LodashIntersectionBy + export val curryRight: LodashCurryRight + export val isElement: {} + export val unescape: {} + export val gt: LodashGt + export val keysIn: {} + export val inRange: LodashInRange + export val pluck: LodashMap + export val methodOf: {} + export val symmetricDifferenceBy: LodashXorBy + export val sortedUniqBy: LodashSortedUniqBy + export val spreadFrom: LodashSpreadFrom + export val eq: LodashEq + export val sum: {} + export val without: LodashWithout + export val propEq: LodashMatchesProperty + export val nthArg: {} + export val keys: {} + export val zipAll: LodashZipAll + export val compact: {} + export val invertObj: {} + export val debounce: LodashDebounce + export val identical: LodashEq + export val camelCase: {} + export val isObjectLike: {} + export val trimCharsStart: LodashTrimCharsStart + export val toUpper: {} + export val memoize: {} + val lodash = index + export declare trait LodashAdd { + val __call: unsupported["(augend: number, addend: number): number;", "fp.d.ts", 13, 58] + } + export type LodashAdd1x1 = (addend: Num) => Num + export type LodashAdd1x2 = (augend: Num) => Num + export declare trait LodashAfter { + val __call: unsupported[" any>(func: TFunc, n: number): TFunc;", "fp.d.ts", 20, 53] + } + export type LodashAfter1x1[TFunc] = (n: Num) => TFunc + export type LodashAfter1x2 = unsupported["type LodashAfter1x2 = any>(func: TFunc) => TFunc;", "fp.d.ts", 23, 86] + export declare trait LodashEvery { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): boolean;", "fp.d.ts", 29, 102] + } + export type LodashEvery1x1[T] = (collection: (Object) | (ArrayLike[T])) => (false) | (true) + export type LodashEvery1x2 = unsupported["type LodashEvery1x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 32, 97] + export type LodashEvery2x2 = unsupported["type LodashEvery2x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 33, 92] + export type LodashOverEvery = unsupported["type LodashOverEvery = (predicates: lodash.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean;", "fp.d.ts", 34, 101] + export type LodashConstant = unsupported["type LodashConstant = (value: T) => () => T;", "fp.d.ts", 35, 112] + export declare trait LodashSome { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): boolean;", "fp.d.ts", 41, 101] + } + export type LodashSome1x1[T] = (collection: (Object) | (ArrayLike[T])) => (false) | (true) + export type LodashSome1x2 = unsupported["type LodashSome1x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 44, 96] + export type LodashSome2x2 = unsupported["type LodashSome2x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 45, 91] + export type LodashOverSome = unsupported["type LodashOverSome = (predicates: lodash.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean;", "fp.d.ts", 46, 100] + export type LodashApply = unsupported["type LodashApply = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 47, 111] + export declare trait LodashAry { + val __call: unsupported["(n: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 51, 68] + } + export type LodashAry1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export type LodashAry1x2 = (n: Num) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashAssign { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 58, 80] + } + export type LodashAssign1x1 = unsupported["type LodashAssign1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 60, 5] + export type LodashAssign1x2 = unsupported["type LodashAssign1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 61, 84] + export declare trait LodashAssignAll { + val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 68, 46] + } + export declare trait LodashAssignAllWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 73, 82] + } + export type LodashAssignAllWith1x1 = (args: ReadonlyArray[anything]) => anything + export type LodashAssignAllWith1x2 = (customizer: {}) => anything + export declare trait LodashAssignIn { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 80, 82] + } + export type LodashAssignIn1x1 = unsupported["type LodashAssignIn1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 82, 5] + export type LodashAssignIn1x2 = unsupported["type LodashAssignIn1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 83, 86] + export declare trait LodashAssignInAll { + val __call: unsupported["(object: ReadonlyArray): TResult;", "fp.d.ts", 90, 46] + } + export declare trait LodashAssignInAllWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 95, 84] + } + export type LodashAssignInAllWith1x1 = (args: ReadonlyArray[anything]) => anything + export type LodashAssignInAllWith1x2 = (customizer: {}) => anything + export declare trait LodashAssignInWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 106, 125] + } + export declare trait LodashAssignInWith1x1 { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 111, 86] + } + export declare trait LodashAssignInWith1x2[TObject] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 116, 99] + } + export type LodashAssignInWith1x3 = unsupported["type LodashAssignInWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 118, 5] + export declare trait LodashAssignInWith1x4[TSource] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 122, 99] + } + export type LodashAssignInWith1x5 = unsupported["type LodashAssignInWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 124, 5] + export type LodashAssignInWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) + export declare trait LodashAssignWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 133, 123] + } + export declare trait LodashAssignWith1x1 { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 138, 84] + } + export declare trait LodashAssignWith1x2[TObject] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 143, 97] + } + export type LodashAssignWith1x3 = unsupported["type LodashAssignWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 145, 5] + export declare trait LodashAssignWith1x4[TSource] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 149, 97] + } + export type LodashAssignWith1x5 = unsupported["type LodashAssignWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 151, 5] + export type LodashAssignWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) + export declare trait LodashSet { + val __call: unsupported["(path: lodash.PropertyPath, value: any, object: object): TResult;", "fp.d.ts", 164, 68] + } + export declare trait LodashSet1x1 { + val __call: unsupported["(value: any, object: object): TResult;", "fp.d.ts", 171, 57] + } + export declare trait LodashSet1x2 { + val __call: unsupported["(path: lodash.PropertyPath, object: object): TResult;", "fp.d.ts", 178, 56] + } + export declare trait LodashSet1x3 { + val __call: unsupported["(object: object): TResult;", "fp.d.ts", 182, 41] + } + export declare trait LodashSet1x4[T] { + val __call: unsupported["(path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 187, 55] + } + export type LodashSet1x5[T] = (value: anything) => T + export type LodashSet1x6[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T + export declare trait LodashSet2x4 { + val __call: unsupported["(path: lodash.PropertyPath, value: any): TResult;", "fp.d.ts", 194, 52] + } + export type LodashSet2x5 = unsupported["type LodashSet2x5 = (value: any) => TResult;", "fp.d.ts", 196, 5] + export type LodashSet2x6 = unsupported["type LodashSet2x6 = (path: lodash.PropertyPath) => TResult;", "fp.d.ts", 197, 57] + export declare trait LodashAt { + val __call: unsupported["(props: lodash.Many, object: T | null | undefined): Array;", "fp.d.ts", 204, 91] + } + export type LodashAt1x1 = unsupported["type LodashAt1x1 = (object: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => T[];", "fp.d.ts", 206, 5] + export type LodashAt1x2[T] = (props: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => MutArray[T] + export type LodashAt2x1 = unsupported["type LodashAt2x1 = (object: T | null | undefined) => Array;", "fp.d.ts", 208, 62] + export type LodashAt2x2 = unsupported["type LodashAt2x2 = (props: lodash.Many) => Array;", "fp.d.ts", 209, 78] + export type LodashAttempt = unsupported["type LodashAttempt = (func: (...args: any[]) => TResult) => TResult | Error;", "fp.d.ts", 210, 77] + export declare trait LodashBefore { + val __call: unsupported[" any>(func: TFunc, n: number): TFunc;", "fp.d.ts", 214, 54] + } + export type LodashBefore1x1[TFunc] = (n: Num) => TFunc + export type LodashBefore1x2 = unsupported["type LodashBefore1x2 = any>(func: TFunc) => TFunc;", "fp.d.ts", 217, 87] + export declare trait LodashBind { + val __call: unsupported["(func: (...args: any[]) => any, thisArg: any): (...args: any[]) => any;", "fp.d.ts", 221, 55] + val placeholder: LoDashStatic + } + export type LodashBind1x1 = (thisArg: anything) => (args: (anything) | (MutArray[anything])) => anything + export type LodashBind1x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashBindAll { + val __call: unsupported["(methodNames: lodash.Many, object: T): T;", "fp.d.ts", 229, 68] + } + export type LodashBindAll1x1 = unsupported["type LodashBindAll1x1 = (object: T) => T;", "fp.d.ts", 231, 5] + export type LodashBindAll1x2[T] = (methodNames: (Str) | (ReadonlyArray[Str])) => T + export declare trait LodashBindKey { + val __call: unsupported["(object: object, key: string): (...args: any[]) => any;", "fp.d.ts", 236, 59] + val placeholder: LoDashStatic + } + export type LodashBindKey1x1 = (key: Str) => (args: (anything) | (MutArray[anything])) => anything + export type LodashBindKey1x2 = (object: Object) => (args: (anything) | (MutArray[anything])) => anything + export type LodashCamelCase = (string: Str) => Str + export type LodashCapitalize = (string: Str) => Str + export type LodashCastArray = unsupported["type LodashCastArray = (value: lodash.Many) => T[];", "fp.d.ts", 243, 55] + export type LodashCeil = (n: Num) => Num + export declare trait LodashChunk { + val __call: unsupported["(size: number, array: lodash.List | null | undefined): T[][];", "fp.d.ts", 248, 90] + } + export type LodashChunk1x1 = unsupported["type LodashChunk1x1 = (array: lodash.List | null | undefined) => T[][];", "fp.d.ts", 250, 5] + export type LodashChunk1x2[T] = (size: Num) => MutArray[MutArray[T]] + export declare trait LodashClamp { + val __call: unsupported["(lower: number, upper: number, number: number): number;", "fp.d.ts", 259, 74] + } + export declare trait LodashClamp1x1 { + val __call: unsupported["(upper: number, number: number): number;", "fp.d.ts", 264, 59] + } + export declare trait LodashClamp1x2 { + val __call: unsupported["(lower: number, number: number): number;", "fp.d.ts", 269, 59] + } + export type LodashClamp1x3 = (number: Num) => Num + export declare trait LodashClamp1x4 { + val __call: unsupported["(lower: number, upper: number): number;", "fp.d.ts", 275, 58] + } + export type LodashClamp1x5 = (upper: Num) => Num + export type LodashClamp1x6 = (lower: Num) => Num + export type LodashClone = unsupported["type LodashClone = (value: T) => T;", "fp.d.ts", 279, 52] + export type LodashCloneDeep = unsupported["type LodashCloneDeep = (value: T) => T;", "fp.d.ts", 280, 42] + export declare trait LodashCloneDeepWith { + val __call: unsupported["(customizer: lodash.CloneDeepWithCustomizer, value: T): any;", "fp.d.ts", 284, 72] + } + export type LodashCloneDeepWith1x1[T] = (value: T) => anything + export type LodashCloneDeepWith1x2[T] = (customizer: {}) => anything + export declare trait LodashCloneWith { + val __call: unsupported["(customizer: lodash.CloneWithCustomizer, value: T): TResult | T;", "fp.d.ts", 293, 117] + } + export type LodashCloneWith1x1[T, TResult] = (value: T) => TResult + export declare trait LodashCloneWith1x2[T] { + val __call: unsupported["(customizer: lodash.CloneWithCustomizer): TResult | T;", "fp.d.ts", 298, 129] + } + export type LodashCloneWith2x1[T, TResult] = (value: T) => (T) | (TResult) + export type LodashCompact = unsupported["type LodashCompact = (array: lodash.List | null | undefined) => Array>;", "fp.d.ts", 301, 68] + export type LodashNegate = unsupported["type LodashNegate = (predicate: (...args: T) => any) => (...args: T) => boolean;", "fp.d.ts", 302, 107] + export declare trait LodashFlowRight { + val __call: unsupported["(...func: Array any>>): (...args: any[]) => any;", "fp.d.ts", 310, 97] + } + export declare trait LodashConcat { + val __call: unsupported["(array: lodash.Many, values: lodash.Many): T[];", "fp.d.ts", 315, 74] + } + export type LodashConcat1x1[T] = (values: (T) | (ReadonlyArray[T])) => MutArray[T] + export type LodashConcat1x2[T] = (array: (T) | (ReadonlyArray[T])) => MutArray[T] + export declare trait LodashCond { + val __call: unsupported["(pairs: Array>): (Target: T) => R;", "fp.d.ts", 321, 62] + } + export declare trait LodashConformsTo { + val __call: unsupported["(source: lodash.ConformsPredicateObject, object: T): boolean;", "fp.d.ts", 326, 66] + } + export type LodashConformsTo1x1[T] = (object: T) => (false) | (true) + export type LodashConformsTo1x2 = unsupported["type LodashConformsTo1x2 = (source: lodash.ConformsPredicateObject) => boolean;", "fp.d.ts", 329, 57] + export declare trait LodashContains { + val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 333, 136] + } + export type LodashContains1x1[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) + export type LodashContains1x2[T] = (target: T) => (false) | (true) + export declare trait LodashCountBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 342, 103] + } + export type LodashCountBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[Num] + export type LodashCountBy1x2 = unsupported["type LodashCountBy1x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 345, 117] + export type LodashCountBy2x2 = unsupported["type LodashCountBy2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 346, 96] + export type LodashCreate = unsupported["type LodashCreate = (prototype: T) => T & U;", "fp.d.ts", 347, 105] + export declare trait LodashCurry { + val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 354, 133] + val placeholder: LoDashStatic + } + export declare trait LodashCurryN { + val __call: unsupported["(arity: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 370, 75] + val placeholder: LoDashStatic + } + export declare trait LodashCurryN1x1 { + val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 379, 133] + } + export type LodashCurryN1x2[T1, R] = (arity: Num) => CurriedFunction1[T1, R] + export type LodashCurryN2x2[T1, T2, R] = (arity: Num) => CurriedFunction2[T1, T2, R] + export type LodashCurryN3x2[T1, T2, T3, R] = (arity: Num) => CurriedFunction3[T1, T2, T3, R] + export type LodashCurryN4x2[T1, T2, T3, T4, R] = (arity: Num) => CurriedFunction4[T1, T2, T3, T4, R] + export type LodashCurryN5x2[T1, T2, T3, T4, T5, R] = (arity: Num) => CurriedFunction5[T1, T2, T3, T4, T5, R] + export type LodashCurryN6x2 = (arity: Num) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashCurryRight { + val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 393, 138] + val placeholder: LoDashStatic + } + export declare trait LodashCurryRightN { + val __call: unsupported["(arity: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 409, 80] + val placeholder: LoDashStatic + } + export declare trait LodashCurryRightN1x1 { + val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 418, 138] + } + export type LodashCurryRightN1x2[T1, R] = (arity: Num) => RightCurriedFunction1[T1, R] + export type LodashCurryRightN2x2[T1, T2, R] = (arity: Num) => RightCurriedFunction2[T1, T2, R] + export type LodashCurryRightN3x2[T1, T2, T3, R] = (arity: Num) => RightCurriedFunction3[T1, T2, T3, R] + export type LodashCurryRightN4x2[T1, T2, T3, T4, R] = (arity: Num) => RightCurriedFunction4[T1, T2, T3, T4, R] + export type LodashCurryRightN5x2[T1, T2, T3, T4, T5, R] = (arity: Num) => RightCurriedFunction5[T1, T2, T3, T4, T5, R] + export type LodashCurryRightN6x2 = (arity: Num) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashDebounce { + val __call: unsupported[" any>(wait: number, func: T): lodash.DebouncedFunc;", "fp.d.ts", 429, 90] + } + export type LodashDebounce1x1 = unsupported["type LodashDebounce1x1 = any>(func: T) => lodash.DebouncedFunc;", "fp.d.ts", 431, 5] + export type LodashDebounce1x2[T] = (wait: Num) => DebouncedFunc[T] + export type LodashDeburr = (string: Str) => Str + export declare trait LodashDefaults { + val __call: unsupported["(source: TSource, object: TObject): TSource & TObject;", "fp.d.ts", 437, 82] + } + export type LodashDefaults1x1 = unsupported["type LodashDefaults1x1 = (object: TObject) => TSource & TObject;", "fp.d.ts", 439, 5] + export type LodashDefaults1x2 = unsupported["type LodashDefaults1x2 = (source: TSource) => TSource & TObject;", "fp.d.ts", 440, 86] + export declare trait LodashDefaultsAll { + val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 447, 46] + } + export declare trait LodashDefaultsDeep { + val __call: unsupported["(sources: any, object: any): any;", "fp.d.ts", 452, 65] + } + export type LodashDefaultsDeep1x1 = (object: anything) => anything + export type LodashDefaultsDeep1x2 = (sources: anything) => anything + export type LodashDefaultsDeepAll = (object: ReadonlyArray[anything]) => anything + export declare trait LodashDefaultTo { + val __call: unsupported["(defaultValue: TDefault, value: T | null | undefined): T | TDefault;", "fp.d.ts", 462, 73] + } + export type LodashDefaultTo1x1[T] = (value: T) => T + export declare trait LodashDefaultTo1x2[T] { + val __call: unsupported["(defaultValue: TDefault): T | TDefault;", "fp.d.ts", 467, 29] + } + export type LodashDefaultTo2x1 = unsupported["type LodashDefaultTo2x1 = (value: T | null | undefined) => T | TDefault;", "fp.d.ts", 469, 5] + export type LodashDefer = (func: (args: (anything) | (MutArray[anything])) => anything, args: (anything) | (MutArray[anything])) => Num + export declare trait LodashDelay { + val __call: unsupported["(wait: number, func: (...args: any[]) => any): number;", "fp.d.ts", 474, 73] + } + export type LodashDelay1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => Num + export type LodashDelay1x2 = (wait: Num) => Num + export declare trait LodashDifference { + val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T[];", "fp.d.ts", 481, 78] + } + export type LodashDifference1x1[T] = (values: ArrayLike[T]) => MutArray[T] + export type LodashDifference1x2[T] = (array: ArrayLike[T]) => MutArray[T] + export declare trait LodashDifferenceBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 492, 137] + } + export declare trait LodashDifferenceBy1x1[T1, T2] { + val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 497, 79] + } + export declare trait LodashDifferenceBy1x2[T1] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 502, 90] + } + export type LodashDifferenceBy1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export declare trait LodashDifferenceBy1x4[T2] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 508, 108] + } + export type LodashDifferenceBy1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] + export type LodashDifferenceBy1x6 = unsupported["type LodashDifferenceBy1x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 511, 89] + export declare trait LodashDifferenceWith { + val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 519, 141] + } + export declare trait LodashDifferenceWith1x1[T1, T2] { + val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 524, 81] + } + export declare trait LodashDifferenceWith1x2[T1] { + val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 529, 94] + } + export type LodashDifferenceWith1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export declare trait LodashDifferenceWith1x4[T2] { + val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 535, 112] + } + export type LodashDifferenceWith1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] + export type LodashDifferenceWith1x6[T1, T2] = (comparator: {}) => MutArray[T1] + export declare trait LodashUnset { + val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 542, 59] + } + export type LodashUnset1x1 = unsupported["type LodashUnset1x1 = (object: T) => T;", "fp.d.ts", 544, 5] + export type LodashUnset1x2[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T + export declare trait LodashDivide { + val __call: unsupported["(dividend: number, divisor: number): number;", "fp.d.ts", 549, 64] + } + export type LodashDivide1x1 = (divisor: Num) => Num + export type LodashDivide1x2 = (dividend: Num) => Num + export declare trait LodashDrop { + val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 556, 86] + } + export type LodashDrop1x1 = unsupported["type LodashDrop1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 558, 5] + export type LodashDrop1x2[T] = (n: Num) => MutArray[T] + export declare trait LodashDropRight { + val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 563, 91] + } + export type LodashDropRight1x1 = unsupported["type LodashDropRight1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 565, 5] + export type LodashDropRight1x2[T] = (n: Num) => MutArray[T] + export declare trait LodashDropRightWhile { + val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 570, 104] + } + export type LodashDropRightWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashDropRightWhile1x2 = unsupported["type LodashDropRightWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 573, 88] + export declare trait LodashDropWhile { + val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 577, 99] + } + export type LodashDropWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashDropWhile1x2 = unsupported["type LodashDropWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 580, 83] + export declare trait LodashForEach { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined;", "fp.d.ts", 594, 103] + } + export declare trait LodashForEach1x1[T] { + val __call: unsupported["(collection: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 602, 122] + } + export type LodashForEach1x2[T] = (iteratee: (value: T) => anything) => MutArray[T] + export type LodashForEach2x2[T] = (iteratee: (value: T) => anything) => ArrayLike[T] + export type LodashForEach3x2 = unsupported["type LodashForEach3x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 606, 79] + export type LodashForEach4x2[T, TArray] = (iteratee: (value: T) => anything) => TArray + export type LodashForEach5x2[T, TList] = (iteratee: (value: T) => anything) => TList + export type LodashForEach6x2 = unsupported["type LodashForEach6x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 609, 77] + export declare trait LodashForEachRight { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined;", "fp.d.ts", 623, 108] + } + export declare trait LodashForEachRight1x1[T] { + val __call: unsupported["(collection: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 631, 122] + } + export type LodashForEachRight1x2[T] = (iteratee: (value: T) => anything) => MutArray[T] + export type LodashForEachRight2x2[T] = (iteratee: (value: T) => anything) => ArrayLike[T] + export type LodashForEachRight3x2 = unsupported["type LodashForEachRight3x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 635, 84] + export type LodashForEachRight4x2[T, TArray] = (iteratee: (value: T) => anything) => TArray + export type LodashForEachRight5x2[T, TList] = (iteratee: (value: T) => anything) => TList + export type LodashForEachRight6x2 = unsupported["type LodashForEachRight6x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 638, 82] + export declare trait LodashEndsWith { + val __call: unsupported["(target: string, string: string): boolean;", "fp.d.ts", 642, 63] + } + export type LodashEndsWith1x1 = (string: Str) => (false) | (true) + export type LodashEndsWith1x2 = (target: Str) => (false) | (true) + export declare trait LodashToPairs { + val __call: unsupported["(object: object): Array<[string, any]>;", "fp.d.ts", 648, 92] + } + export declare trait LodashToPairsIn { + val __call: unsupported["(object: object): Array<[string, any]>;", "fp.d.ts", 652, 92] + } + export declare trait LodashEq { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 657, 52] + } + export type LodashEq1x1 = (other: anything) => (false) | (true) + export type LodashEq1x2 = (value: anything) => (false) | (true) + export declare trait LodashIsEqual { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 664, 57] + } + export type LodashIsEqual1x1 = (other: anything) => (false) | (true) + export type LodashIsEqual1x2 = (value: anything) => (false) | (true) + export type LodashEscape = (string: Str) => Str + export type LodashEscapeRegExp = (string: Str) => Str + export declare trait LodashExtend { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 673, 80] + } + export type LodashExtend1x1 = unsupported["type LodashExtend1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 675, 5] + export type LodashExtend1x2 = unsupported["type LodashExtend1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 676, 84] + export declare trait LodashExtendAll { + val __call: unsupported["(object: ReadonlyArray): TResult;", "fp.d.ts", 683, 46] + } + export declare trait LodashExtendAllWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 688, 82] + } + export type LodashExtendAllWith1x1 = (args: ReadonlyArray[anything]) => anything + export type LodashExtendAllWith1x2 = (customizer: {}) => anything + export declare trait LodashExtendWith { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 699, 123] + } + export declare trait LodashExtendWith1x1 { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 704, 84] + } + export declare trait LodashExtendWith1x2[TObject] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 709, 97] + } + export type LodashExtendWith1x3 = unsupported["type LodashExtendWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 711, 5] + export declare trait LodashExtendWith1x4[TSource] { + val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 715, 97] + } + export type LodashExtendWith1x5 = unsupported["type LodashExtendWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 717, 5] + export type LodashExtendWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) + export type LodashStubFalse = () => false + export declare trait LodashFill { + val __call: unsupported["(start: number, end: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 743, 120] + } + export declare trait LodashFill1x1 { + val __call: unsupported["(end: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 756, 105] + } + export declare trait LodashFill1x2 { + val __call: unsupported["(start: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 769, 107] + } + export declare trait LodashFill1x3 { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 776, 91] + } + export declare trait LodashFill1x4[T] { + val __call: unsupported["(start: number, end: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 789, 107] + } + export declare trait LodashFill1x5[T] { + val __call: unsupported["(end: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 796, 92] + } + export declare trait LodashFill1x6[T] { + val __call: unsupported["(start: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 803, 94] + } + export declare trait LodashFill1x7[T] { + val __call: unsupported["(array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 807, 57] + } + export declare trait LodashFill1x8[U] { + val __call: unsupported["(start: number, end: number, value: T): Array;", "fp.d.ts", 816, 75] + } + export declare trait LodashFill1x9[U] { + val __call: unsupported["(end: number, value: T): Array;", "fp.d.ts", 821, 60] + } + export declare trait LodashFill1x10[U] { + val __call: unsupported["(start: number, value: T): Array;", "fp.d.ts", 826, 62] + } + export type LodashFill1x11 = unsupported["type LodashFill1x11 = (value: T) => Array;", "fp.d.ts", 828, 5] + export declare trait LodashFill1x12[T, U] { + val __call: unsupported["(start: number, end: number): Array;", "fp.d.ts", 832, 62] + } + export type LodashFill1x13[T, U] = (end: Num) => MutArray[(T) | (U)] + export type LodashFill1x14[T, U] = (start: Num) => MutArray[(T) | (U)] + export declare trait LodashFill2x8[U] { + val __call: unsupported["(start: number, end: number, value: T): lodash.List;", "fp.d.ts", 843, 75] + } + export declare trait LodashFill2x9[U] { + val __call: unsupported["(end: number, value: T): lodash.List;", "fp.d.ts", 848, 60] + } + export declare trait LodashFill2x10[U] { + val __call: unsupported["(start: number, value: T): lodash.List;", "fp.d.ts", 853, 62] + } + export type LodashFill2x11 = unsupported["type LodashFill2x11 = (value: T) => lodash.List;", "fp.d.ts", 855, 5] + export declare trait LodashFill2x12[T, U] { + val __call: unsupported["(start: number, end: number): lodash.List;", "fp.d.ts", 859, 62] + } + export type LodashFill2x13[T, U] = (end: Num) => ArrayLike[(T) | (U)] + export type LodashFill2x14[T, U] = (start: Num) => ArrayLike[(T) | (U)] + export declare trait LodashFilter { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): Array;", "fp.d.ts", 872, 145] + } + export type LodashFilter1x1[T, S] = (collection: ArrayLike[T]) => MutArray[S] + export declare trait LodashFilter1x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[];", "fp.d.ts", 877, 75] + } + export type LodashFilter2x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] + export type LodashFilter3x1[T, S] = (collection: T) => MutArray[S] + export declare trait LodashFilter3x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): Array;", "fp.d.ts", 883, 93] + } + export declare trait LodashFind { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 894, 153] + } + export type LodashFind1x1[T, S] = (collection: ArrayLike[T]) => S + export declare trait LodashFind1x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 899, 83] + } + export type LodashFind2x1[T] = (collection: (Object) | (ArrayLike[T])) => T + export type LodashFind3x1[T, S] = (collection: T) => S + export declare trait LodashFind3x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 905, 101] + } + export declare trait LodashFindFrom { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 926, 165] + } + export declare trait LodashFindFrom1x1[T, S] { + val __call: unsupported["(fromIndex: number, collection: lodash.List | null | undefined): S|undefined;", "fp.d.ts", 931, 100] + } + export declare trait LodashFindFrom1x2 { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 942, 153] + } + export type LodashFindFrom1x3[T, S] = (collection: ArrayLike[T]) => S + export declare trait LodashFindFrom1x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T|undefined;", "fp.d.ts", 950, 82] + } + export type LodashFindFrom1x5[S] = (fromIndex: Num) => S + export declare trait LodashFindFrom1x6[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 955, 83] + } + export declare trait LodashFindFrom2x1[T] { + val __call: unsupported["(fromIndex: lodash.__, collection: T1 | null | undefined): LodashFindFrom4x5;", "fp.d.ts", 961, 97] + } + export declare trait LodashFindFrom2x3[T] { + val __call: unsupported["(collection: object | null | undefined): object|undefined;", "fp.d.ts", 965, 69] + } + export type LodashFindFrom2x5[T] = (fromIndex: Num) => T + export declare trait LodashFindFrom3x1[T, S] { + val __call: unsupported["(fromIndex: number, collection: T | null | undefined): S|undefined;", "fp.d.ts", 971, 87] + } + export type LodashFindFrom3x3[T, S] = (collection: T) => S + export declare trait LodashFindFrom3x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T[keyof T]|undefined;", "fp.d.ts", 979, 91] + } + export type LodashFindFrom3x5[S] = (fromIndex: Num) => S + export declare trait LodashFindFrom3x6[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 984, 101] + } + export type LodashFindFrom4x5 = unsupported["type LodashFindFrom4x5 = (fromIndex: number) => T[keyof T]|undefined;", "fp.d.ts", 986, 5] + export declare trait LodashFindIndex { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 990, 99] + } + export type LodashFindIndex1x1[T] = (array: ArrayLike[T]) => Num + export type LodashFindIndex1x2 = unsupported["type LodashFindIndex1x2 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 993, 86] + export declare trait LodashFindIndexFrom { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1001, 122] + } + export declare trait LodashFindIndexFrom1x1[T] { + val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1006, 97] + } + export declare trait LodashFindIndexFrom1x2 { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1011, 103] + } + export type LodashFindIndexFrom1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashFindIndexFrom1x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): number;", "fp.d.ts", 1017, 77] + } + export type LodashFindIndexFrom1x5 = (fromIndex: Num) => Num + export type LodashFindIndexFrom1x6 = unsupported["type LodashFindIndexFrom1x6 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1020, 64] + export declare trait LodashFindKey { + val __call: unsupported["(predicate: lodash.ValueIteratee, object: T | null | undefined): string | undefined;", "fp.d.ts", 1024, 85] + } + export type LodashFindKey1x1[T] = (object: Object) => Str + export type LodashFindKey1x2 = unsupported["type LodashFindKey1x2 = (predicate: lodash.ValueIteratee) => string | undefined;", "fp.d.ts", 1027, 89] + export declare trait LodashFindLast { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1037, 153] + } + export type LodashFindLast1x1[T, S] = (collection: ArrayLike[T]) => S + export declare trait LodashFindLast1x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 1042, 83] + } + export type LodashFindLast2x1[T] = (collection: (Object) | (ArrayLike[T])) => T + export type LodashFindLast3x1[T, S] = (collection: T) => S + export declare trait LodashFindLast3x2[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 1048, 101] + } + export declare trait LodashFindLastFrom { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1069, 169] + } + export declare trait LodashFindLastFrom1x1[T, S] { + val __call: unsupported["(fromIndex: number, collection: lodash.List | null | undefined): S|undefined;", "fp.d.ts", 1074, 104] + } + export declare trait LodashFindLastFrom1x2 { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1085, 153] + } + export type LodashFindLastFrom1x3[T, S] = (collection: ArrayLike[T]) => S + export declare trait LodashFindLastFrom1x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T|undefined;", "fp.d.ts", 1093, 86] + } + export type LodashFindLastFrom1x5[S] = (fromIndex: Num) => S + export declare trait LodashFindLastFrom1x6[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 1098, 83] + } + export declare trait LodashFindLastFrom2x1[T] { + val __call: unsupported["(fromIndex: lodash.__, collection: T1 | null | undefined): LodashFindLastFrom4x5;", "fp.d.ts", 1104, 97] + } + export declare trait LodashFindLastFrom2x3[T] { + val __call: unsupported["(collection: object | null | undefined): object|undefined;", "fp.d.ts", 1108, 69] + } + export type LodashFindLastFrom2x5[T] = (fromIndex: Num) => T + export declare trait LodashFindLastFrom3x1[T, S] { + val __call: unsupported["(fromIndex: number, collection: T | null | undefined): S|undefined;", "fp.d.ts", 1114, 91] + } + export type LodashFindLastFrom3x3[T, S] = (collection: T) => S + export declare trait LodashFindLastFrom3x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T[keyof T]|undefined;", "fp.d.ts", 1122, 95] + } + export type LodashFindLastFrom3x5[S] = (fromIndex: Num) => S + export declare trait LodashFindLastFrom3x6[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 1127, 101] + } + export type LodashFindLastFrom4x5 = unsupported["type LodashFindLastFrom4x5 = (fromIndex: number) => T[keyof T]|undefined;", "fp.d.ts", 1129, 5] + export declare trait LodashFindLastIndex { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1133, 103] + } + export type LodashFindLastIndex1x1[T] = (array: ArrayLike[T]) => Num + export type LodashFindLastIndex1x2 = unsupported["type LodashFindLastIndex1x2 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1136, 90] + export declare trait LodashFindLastIndexFrom { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1144, 126] + } + export declare trait LodashFindLastIndexFrom1x1[T] { + val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1149, 101] + } + export declare trait LodashFindLastIndexFrom1x2 { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1154, 107] + } + export type LodashFindLastIndexFrom1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashFindLastIndexFrom1x4[T] { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): number;", "fp.d.ts", 1160, 81] + } + export type LodashFindLastIndexFrom1x5 = (fromIndex: Num) => Num + export type LodashFindLastIndexFrom1x6 = unsupported["type LodashFindLastIndexFrom1x6 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1163, 68] + export declare trait LodashFindLastKey { + val __call: unsupported["(predicate: lodash.ValueIteratee, object: T | null | undefined): string | undefined;", "fp.d.ts", 1167, 89] + } + export type LodashFindLastKey1x1[T] = (object: Object) => Str + export type LodashFindLastKey1x2 = unsupported["type LodashFindLastKey1x2 = (predicate: lodash.ValueIteratee) => string | undefined;", "fp.d.ts", 1170, 93] + export type LodashHead = unsupported["type LodashHead = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 1171, 103] + export declare trait LodashFlatMap { + val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1183, 45] + } + export type LodashFlatMap1x1[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] + export type LodashFlatMap1x2 = unsupported["type LodashFlatMap1x2 = (iteratee: (value: T) => lodash.Many) => TResult[];", "fp.d.ts", 1186, 101] + export type LodashFlatMap2x1[T, TResult] = (collection: T) => MutArray[TResult] + export type LodashFlatMap2x2 = unsupported["type LodashFlatMap2x2 = (iteratee: (value: T[keyof T]) => lodash.Many) => TResult[];", "fp.d.ts", 1188, 88] + export type LodashFlatMap3x1 = (collection: Object) => MutArray[anything] + export declare trait LodashFlatMap3x2 { + val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1192, 34] + } + export type LodashFlatMap4x1 = (collection: Object) => MutArray[(false) | (true)] + export declare trait LodashFlatMapDeep { + val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1206, 49] + } + export type LodashFlatMapDeep1x1[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] + export type LodashFlatMapDeep1x2 = unsupported["type LodashFlatMapDeep1x2 = (iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1209, 105] + export type LodashFlatMapDeep2x1[T, TResult] = (collection: T) => MutArray[TResult] + export type LodashFlatMapDeep2x2 = unsupported["type LodashFlatMapDeep2x2 = (iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1211, 92] + export type LodashFlatMapDeep3x1 = (collection: Object) => MutArray[anything] + export declare trait LodashFlatMapDeep3x2 { + val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1215, 34] + } + export type LodashFlatMapDeep4x1 = (collection: Object) => MutArray[(false) | (true)] + export declare trait LodashFlatMapDepth { + val __call: unsupported["(iteratee: object, depth: number, collection: object | null | undefined): boolean[];", "fp.d.ts", 1241, 107] + } + export declare trait LodashFlatMapDepth1x1[T, TResult] { + val __call: unsupported["(depth: number, collection: lodash.List | null | undefined): TResult[];", "fp.d.ts", 1246, 106] + } + export declare trait LodashFlatMapDepth1x2 { + val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1259, 50] + } + export type LodashFlatMapDepth1x3[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] + export declare trait LodashFlatMapDepth1x4[T] { + val __call: unsupported["(iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult, depth: number): TResult[];", "fp.d.ts", 1265, 71] + } + export type LodashFlatMapDepth1x5[TResult] = (depth: Num) => MutArray[TResult] + export type LodashFlatMapDepth1x6 = unsupported["type LodashFlatMapDepth1x6 = (iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1268, 71] + export declare trait LodashFlatMapDepth2x1[T, TResult] { + val __call: unsupported["(depth: number, collection: T | null | undefined): TResult[];", "fp.d.ts", 1272, 93] + } + export type LodashFlatMapDepth2x3[T, TResult] = (collection: T) => MutArray[TResult] + export declare trait LodashFlatMapDepth2x4[T] { + val __call: unsupported["(iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult, depth: number): TResult[];", "fp.d.ts", 1278, 71] + } + export type LodashFlatMapDepth2x5[TResult] = (depth: Num) => MutArray[TResult] + export type LodashFlatMapDepth2x6 = unsupported["type LodashFlatMapDepth2x6 = (iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1281, 71] + export declare trait LodashFlatMapDepth3x1 { + val __call: unsupported["(depth: number, collection: object | null | undefined): any[];", "fp.d.ts", 1285, 89] + } + export type LodashFlatMapDepth3x3 = (collection: Object) => MutArray[anything] + export declare trait LodashFlatMapDepth3x4 { + val __call: unsupported["(iteratee: object, depth: number): boolean[];", "fp.d.ts", 1293, 50] + } + export type LodashFlatMapDepth3x5 = (depth: Num) => MutArray[anything] + export declare trait LodashFlatMapDepth3x6 { + val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1298, 34] + } + export declare trait LodashFlatMapDepth4x1 { + val __call: unsupported["(depth: number, collection: object | null | undefined): boolean[];", "fp.d.ts", 1303, 89] + } + export type LodashFlatMapDepth4x3 = (collection: Object) => MutArray[(false) | (true)] + export type LodashFlatMapDepth4x5 = (depth: Num) => MutArray[(false) | (true)] + export type LodashFlatten = unsupported["type LodashFlatten = (array: lodash.List> | null | undefined) => T[];", "fp.d.ts", 1307, 62] + export type LodashFlattenDeep = unsupported["type LodashFlattenDeep = (array: lodash.ListOfRecursiveArraysOrValues | null | undefined) => T[];", "fp.d.ts", 1308, 91] + export declare trait LodashFlattenDepth { + val __call: unsupported["(depth: number, array: lodash.ListOfRecursiveArraysOrValues | null | undefined): T[];", "fp.d.ts", 1312, 123] + } + export type LodashFlattenDepth1x1 = unsupported["type LodashFlattenDepth1x1 = (array: lodash.ListOfRecursiveArraysOrValues | null | undefined) => T[];", "fp.d.ts", 1314, 5] + export type LodashFlattenDepth1x2[T] = (depth: Num) => MutArray[T] + export type LodashFlip = unsupported["type LodashFlip = any>(func: T) => T;", "fp.d.ts", 1316, 59] + export type LodashFloor = (n: Num) => Num + export declare trait LodashFlow { + val __call: unsupported["(...func: Array any>>): (...args: any[]) => any;", "fp.d.ts", 1326, 97] + } + export declare trait LodashForIn { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1333, 82] + } + export declare trait LodashForIn1x1[T] { + val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1337, 44] + } + export type LodashForIn1x2 = unsupported["type LodashForIn1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1339, 5] + export type LodashForIn2x2 = unsupported["type LodashForIn2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1340, 73] + export declare trait LodashForInRight { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1346, 87] + } + export declare trait LodashForInRight1x1[T] { + val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1350, 44] + } + export type LodashForInRight1x2 = unsupported["type LodashForInRight1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1352, 5] + export type LodashForInRight2x2 = unsupported["type LodashForInRight2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1353, 78] + export declare trait LodashForOwn { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1359, 83] + } + export declare trait LodashForOwn1x1[T] { + val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1363, 44] + } + export type LodashForOwn1x2 = unsupported["type LodashForOwn1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1365, 5] + export type LodashForOwn2x2 = unsupported["type LodashForOwn2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1366, 74] + export declare trait LodashForOwnRight { + val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1372, 88] + } + export declare trait LodashForOwnRight1x1[T] { + val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1376, 44] + } + export type LodashForOwnRight1x2 = unsupported["type LodashForOwnRight1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1378, 5] + export type LodashForOwnRight2x2 = unsupported["type LodashForOwnRight2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1379, 79] + export declare trait LodashFromPairs { + val __call: unsupported["(pairs: lodash.List | null | undefined): lodash.Dictionary;", "fp.d.ts", 1382, 99] + } + export type LodashFunctions = (object: anything) => MutArray[Str] + export type LodashFunctionsIn = (object: anything) => MutArray[Str] + export declare trait LodashGet { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1410, 54] + } + export val LodashGet1x1: unsupported["interface LodashGet1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 1412, 5] + export declare trait LodashGet1x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 1420, 176] + } + export declare trait LodashGet2x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 1426, 188] + } + export val LodashGet3x1: unsupported["interface LodashGet3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 1428, 5] + export val LodashGet5x1: unsupported["interface LodashGet5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 1432, 5] + export val LodashGet7x1: unsupported["interface LodashGet7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 1436, 5] + export declare trait LodashGet9x1 { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 1442, 52] + } + export type LodashGet9x2[T] = (path: Num) => T + export type LodashGet10x2[T] = (path: Num) => T + export declare trait LodashGet11x1 { + val __call: unsupported["(object: any): any;", "fp.d.ts", 1448, 46] + } + export type LodashGet11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined + export type LodashGet12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashGetOr { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1489, 90] + } + export declare trait LodashGetOr1x1[TDefault] { + val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 1506, 78] + } + export val LodashGetOr1x2: unsupported["interface LodashGetOr1x2 { (defaultValue: TDefault): LodashGetOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1508, 5] + export type LodashGetOr1x3 = unsupported["type LodashGetOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1513, 5] + export declare trait LodashGetOr1x4[TObject] { + val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 1523, 281] + } + export declare trait LodashGetOr1x5[TObject, TDefault] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 1529, 207] + } + export type LodashGetOr1x6 = unsupported["type LodashGetOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1531, 5] + export val LodashGetOr2x2: unsupported["interface LodashGetOr2x2 { (defaultValue: TDefault): LodashGetOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1532, 146] + export type LodashGetOr2x3 = unsupported["type LodashGetOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1537, 5] + export type LodashGetOr2x6 = unsupported["type LodashGetOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1538, 203] + export val LodashGetOr3x2: unsupported["interface LodashGetOr3x2 { (defaultValue: TDefault): LodashGetOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1539, 191] + export type LodashGetOr3x3 = unsupported["type LodashGetOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1544, 5] + export type LodashGetOr3x6 = unsupported["type LodashGetOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1545, 253] + export val LodashGetOr4x2: unsupported["interface LodashGetOr4x2 { (defaultValue: TDefault): LodashGetOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1546, 241] + export type LodashGetOr4x3 = unsupported["type LodashGetOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1551, 5] + export type LodashGetOr4x6 = unsupported["type LodashGetOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1552, 310] + export declare trait LodashGetOr5x2 { + val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 1556, 112] + } + export type LodashGetOr5x3 = unsupported["type LodashGetOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 1558, 5] + export declare trait LodashGetOr5x4[T] { + val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 1562, 67] + } + export type LodashGetOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) + export type LodashGetOr5x6 = unsupported["type LodashGetOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 1565, 70] + export declare trait LodashGetOr6x2 { + val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 1572, 63] + } + export type LodashGetOr6x3[TDefault] = (object: null) => TDefault + export declare trait LodashGetOr6x4 { + val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 1578, 77] + } + export type LodashGetOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault + export type LodashGetOr6x6 = unsupported["type LodashGetOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 1581, 76] + export declare trait LodashGetOr7x1 { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1585, 55] + } + export type LodashGetOr7x3 = (object: anything) => anything + export declare trait LodashGetOr7x4 { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 1591, 77] + } + export type LodashGetOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export type LodashGetOr7x6 = (defaultValue: anything) => anything + export declare trait LodashGroupBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: T | null | undefined): lodash.Dictionary>;", "fp.d.ts", 1600, 103] + } + export type LodashGroupBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[MutArray[T]] + export type LodashGroupBy1x2 = unsupported["type LodashGroupBy1x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1603, 114] + export type LodashGroupBy2x2 = unsupported["type LodashGroupBy2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary>;", "fp.d.ts", 1604, 93] + export declare trait LodashGt { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1608, 52] + } + export type LodashGt1x1 = (other: anything) => (false) | (true) + export type LodashGt1x2 = (value: anything) => (false) | (true) + export declare trait LodashGte { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1615, 53] + } + export type LodashGte1x1 = (other: anything) => (false) | (true) + export type LodashGte1x2 = (value: anything) => (false) | (true) + export declare trait LodashHas { + val __call: unsupported["(path: lodash.PropertyPath, object: T): boolean;", "fp.d.ts", 1622, 54] + } + export type LodashHas1x1 = unsupported["type LodashHas1x1 = (object: T) => boolean;", "fp.d.ts", 1624, 5] + export type LodashHas1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (false) | (true) + export declare trait LodashHasIn { + val __call: unsupported["(path: lodash.PropertyPath, object: T): boolean;", "fp.d.ts", 1629, 56] + } + export type LodashHasIn1x1 = unsupported["type LodashHasIn1x1 = (object: T) => boolean;", "fp.d.ts", 1631, 5] + export type LodashHasIn1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (false) | (true) + export declare trait LodashIdentity { + val __call: unsupported["(): undefined;", "fp.d.ts", 1635, 25] + } + export declare trait LodashIncludes { + val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1640, 136] + } + export type LodashIncludes1x1[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) + export type LodashIncludes1x2[T] = (target: T) => (false) | (true) + export declare trait LodashIncludesFrom { + val __call: unsupported["(target: T, fromIndex: number, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1651, 159] + } + export declare trait LodashIncludesFrom1x1[T] { + val __call: unsupported["(fromIndex: number, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1656, 137] + } + export declare trait LodashIncludesFrom1x2 { + val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1661, 140] + } + export type LodashIncludesFrom1x3[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) + export declare trait LodashIncludesFrom1x4[T] { + val __call: unsupported["(target: T, fromIndex: number): boolean;", "fp.d.ts", 1667, 73] + } + export type LodashIncludesFrom1x5 = (fromIndex: Num) => (false) | (true) + export type LodashIncludesFrom1x6[T] = (target: T) => (false) | (true) + export declare trait LodashKeyBy { + val __call: unsupported["(iteratee: lodash.ValueIterateeCustom, collection: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 1676, 101] + } + export type LodashKeyBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[T] + export type LodashKeyBy1x2 = unsupported["type LodashKeyBy1x2 = (iteratee: lodash.ValueIterateeCustom) => lodash.Dictionary;", "fp.d.ts", 1679, 110] + export type LodashKeyBy2x2 = unsupported["type LodashKeyBy2x2 = (iteratee: lodash.ValueIterateeCustom) => lodash.Dictionary;", "fp.d.ts", 1680, 116] + export declare trait LodashIndexOf { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 1684, 93] + } + export type LodashIndexOf1x1[T] = (array: ArrayLike[T]) => Num + export type LodashIndexOf1x2[T] = (value: T) => Num + export declare trait LodashIndexOfFrom { + val __call: unsupported["(value: T, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1695, 116] + } + export declare trait LodashIndexOfFrom1x1[T] { + val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1700, 95] + } + export declare trait LodashIndexOfFrom1x2 { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 1705, 97] + } + export type LodashIndexOfFrom1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashIndexOfFrom1x4[T] { + val __call: unsupported["(value: T, fromIndex: number): number;", "fp.d.ts", 1711, 71] + } + export type LodashIndexOfFrom1x5 = (fromIndex: Num) => Num + export type LodashIndexOfFrom1x6[T] = (value: T) => Num + export type LodashInitial = unsupported["type LodashInitial = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 1715, 56] + export declare trait LodashInRange { + val __call: unsupported["(start: number, end: number, n: number): boolean;", "fp.d.ts", 1723, 69] + } + export declare trait LodashInRange1x1 { + val __call: unsupported["(end: number, n: number): boolean;", "fp.d.ts", 1728, 54] + } + export declare trait LodashInRange1x2 { + val __call: unsupported["(start: number, n: number): boolean;", "fp.d.ts", 1733, 56] + } + export type LodashInRange1x3 = (n: Num) => (false) | (true) + export declare trait LodashInRange1x4 { + val __call: unsupported["(start: number, end: number): boolean;", "fp.d.ts", 1739, 58] + } + export type LodashInRange1x5 = (end: Num) => (false) | (true) + export type LodashInRange1x6 = (start: Num) => (false) | (true) + export declare trait LodashIntersection { + val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 1746, 101] + } + export type LodashIntersection1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashIntersection1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashIntersectionBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null, values: lodash.List): T1[];", "fp.d.ts", 1757, 127] + } + export declare trait LodashIntersectionBy1x1[T1, T2] { + val __call: unsupported["(array: lodash.List | null, values: lodash.List): T1[];", "fp.d.ts", 1762, 81] + } + export declare trait LodashIntersectionBy1x2[T1] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 1767, 92] + } + export type LodashIntersectionBy1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export declare trait LodashIntersectionBy1x4[T2] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null): T1[];", "fp.d.ts", 1773, 98] + } + export type LodashIntersectionBy1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] + export type LodashIntersectionBy1x6 = unsupported["type LodashIntersectionBy1x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 1776, 79] + export declare trait LodashIntersectionWith { + val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 1784, 143] + } + export declare trait LodashIntersectionWith1x1[T1, T2] { + val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 1789, 83] + } + export declare trait LodashIntersectionWith1x2[T1] { + val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 1794, 96] + } + export type LodashIntersectionWith1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export declare trait LodashIntersectionWith1x4[T2] { + val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 1800, 114] + } + export type LodashIntersectionWith1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] + export type LodashIntersectionWith1x6[T1, T2] = (comparator: {}) => MutArray[T1] + export type LodashInvert = (object: Object) => Dictionary[Str] + export declare trait LodashInvertBy { + val __call: unsupported["(interatee: lodash.ValueIteratee, object: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 1810, 101] + } + export type LodashInvertBy1x1[T] = (object: ((Object) | (Dictionary[T])) | (NumericDictionary[T])) => Dictionary[MutArray[Str]] + export type LodashInvertBy1x2 = unsupported["type LodashInvertBy1x2 = (interatee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1813, 152] + export type LodashInvertBy2x2 = unsupported["type LodashInvertBy2x2 = (interatee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1814, 100] + export declare trait LodashInvoke { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1818, 56] + } + export type LodashInvoke1x1 = (object: anything) => anything + export type LodashInvoke1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashInvokeArgs { + val __call: unsupported["(path: lodash.PropertyPath, args: ReadonlyArray, object: any): any;", "fp.d.ts", 1829, 86] + } + export declare trait LodashInvokeArgs1x1 { + val __call: unsupported["(args: ReadonlyArray, object: any): any;", "fp.d.ts", 1834, 60] + } + export declare trait LodashInvokeArgs1x2 { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1839, 60] + } + export type LodashInvokeArgs1x3 = (object: anything) => anything + export declare trait LodashInvokeArgs1x4 { + val __call: unsupported["(path: lodash.PropertyPath, args: ReadonlyArray): any;", "fp.d.ts", 1845, 73] + } + export type LodashInvokeArgs1x5 = (args: ReadonlyArray[anything]) => anything + export type LodashInvokeArgs1x6 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashInvokeArgsMap { + val __call: unsupported["(method: (...args: any[]) => TResult, args: ReadonlyArray, collection: object | null | undefined): TResult[];", "fp.d.ts", 1860, 144] + } + export declare trait LodashInvokeArgsMap1x1 { + val __call: unsupported["(args: ReadonlyArray, collection: object | null | undefined): any[];", "fp.d.ts", 1865, 89] + } + export declare trait LodashInvokeArgsMap1x2 { + val __call: unsupported["(method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[];", "fp.d.ts", 1872, 88] + } + export type LodashInvokeArgsMap1x3 = (collection: Object) => MutArray[anything] + export declare trait LodashInvokeArgsMap1x4 { + val __call: unsupported["(method: (...args: any[]) => TResult, args: ReadonlyArray): TResult[];", "fp.d.ts", 1880, 88] + } + export type LodashInvokeArgsMap1x5 = (args: ReadonlyArray[anything]) => MutArray[anything] + export declare trait LodashInvokeArgsMap1x6 { + val __call: unsupported["(method: (...args: any[]) => TResult): TResult[];", "fp.d.ts", 1885, 36] + } + export declare trait LodashInvokeArgsMap2x1[TResult] { + val __call: unsupported["(args: ReadonlyArray, collection: object | null | undefined): TResult[];", "fp.d.ts", 1890, 98] + } + export type LodashInvokeArgsMap2x3[TResult] = (collection: Object) => MutArray[TResult] + export type LodashInvokeArgsMap2x5[TResult] = (args: ReadonlyArray[anything]) => MutArray[TResult] + export declare trait LodashInvokeMap { + val __call: unsupported["(method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[];", "fp.d.ts", 1899, 84] + } + export type LodashInvokeMap1x1 = (collection: Object) => MutArray[anything] + export declare trait LodashInvokeMap1x2 { + val __call: unsupported["(method: (...args: any[]) => TResult): TResult[];", "fp.d.ts", 1904, 36] + } + export type LodashInvokeMap2x1[TResult] = (collection: Object) => MutArray[TResult] + export type LodashIsArguments = (value: anything) => (false) | (true) + export type LodashIsArray = (value: anything) => (false) | (true) + export type LodashIsArrayBuffer = (value: anything) => (false) | (true) + export declare trait LodashIsArrayLike { + val __call: unsupported["(value: any): value is { length: number };", "fp.d.ts", 1913, 78] + } + export declare trait LodashIsArrayLikeObject { + val __call: unsupported["(value: any): value is object & { length: number };", "fp.d.ts", 1918, 128] + } + export type LodashIsBoolean = (value: anything) => (false) | (true) + export type LodashIsBuffer = (value: anything) => (false) | (true) + export type LodashIsDate = (value: anything) => (false) | (true) + export type LodashIsElement = (value: anything) => (false) | (true) + export declare trait LodashIsEmpty { + val __call: unsupported["(value?: any): boolean;", "fp.d.ts", 1931, 109] + } + export declare trait LodashIsEqualWith { + val __call: unsupported["(customizer: lodash.IsEqualCustomizer, value: any, other: any): boolean;", "fp.d.ts", 1940, 78] + } + export declare trait LodashIsEqualWith1x1 { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1945, 61] + } + export declare trait LodashIsEqualWith1x2 { + val __call: unsupported["(customizer: lodash.IsEqualCustomizer, other: any): boolean;", "fp.d.ts", 1950, 66] + } + export type LodashIsEqualWith1x3 = (other: anything) => (false) | (true) + export declare trait LodashIsEqualWith1x4 { + val __call: unsupported["(customizer: lodash.IsEqualCustomizer, value: any): boolean;", "fp.d.ts", 1956, 66] + } + export type LodashIsEqualWith1x5 = (value: anything) => (false) | (true) + export type LodashIsEqualWith1x6 = (customizer: {}) => (false) | (true) + export type LodashIsError = (value: anything) => (false) | (true) + export type LodashIsFinite = (value: anything) => (false) | (true) + export type LodashIsFunction = (value: anything) => (false) | (true) + export type LodashIsInteger = (value: anything) => (false) | (true) + export type LodashIsLength = (value: anything) => (false) | (true) + export type LodashIsMap = (value: anything) => (false) | (true) + export declare trait LodashIsMatch { + val __call: unsupported["(source: object, object: object): boolean;", "fp.d.ts", 1969, 62] + } + export type LodashIsMatch1x1 = (object: Object) => (false) | (true) + export type LodashIsMatch1x2 = (source: Object) => (false) | (true) + export declare trait LodashIsMatchWith { + val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, source: object, object: object): boolean;", "fp.d.ts", 1980, 86] + } + export declare trait LodashIsMatchWith1x1 { + val __call: unsupported["(source: object, object: object): boolean;", "fp.d.ts", 1985, 66] + } + export declare trait LodashIsMatchWith1x2 { + val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, object: object): boolean;", "fp.d.ts", 1990, 70] + } + export type LodashIsMatchWith1x3 = (object: Object) => (false) | (true) + export declare trait LodashIsMatchWith1x4 { + val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, source: object): boolean;", "fp.d.ts", 1996, 70] + } + export type LodashIsMatchWith1x5 = (source: Object) => (false) | (true) + export type LodashIsMatchWith1x6 = (customizer: {}) => (false) | (true) + export type LodashIsNaN = (value: anything) => (false) | (true) + export type LodashIsNative = (value: anything) => (false) | (true) + export type LodashIsNil = (value: anything) => (false) | (true) + export type LodashIsNull = (value: anything) => (false) | (true) + export type LodashIsNumber = (value: anything) => (false) | (true) + export type LodashIsObject = (value: anything) => (false) | (true) + export type LodashIsObjectLike = (value: anything) => (false) | (true) + export type LodashIsPlainObject = (value: anything) => (false) | (true) + export type LodashIsRegExp = (value: anything) => (false) | (true) + export type LodashIsSafeInteger = (value: anything) => (false) | (true) + export type LodashIsSet = (value: anything) => (false) | (true) + export type LodashIsString = (value: anything) => (false) | (true) + export type LodashIsSymbol = (value: anything) => (false) | (true) + export type LodashIsTypedArray = (value: anything) => (false) | (true) + export type LodashIsUndefined = (value: anything) => (false) | (true) + export type LodashIsWeakMap = (value: anything) => (false) | (true) + export type LodashIsWeakSet = (value: anything) => (false) | (true) + export declare trait LodashIteratee { + val __call: unsupported["(func: string | object): (...args: any[]) => any;", "fp.d.ts", 2019, 80] + } + export declare trait LodashJoin { + val __call: unsupported["(separator: string, array: lodash.List | null | undefined): string;", "fp.d.ts", 2024, 90] + } + export type LodashJoin1x1 = (array: ArrayLike[anything]) => Str + export type LodashJoin1x2 = (separator: Str) => Str + export type LodashOver = unsupported["type LodashOver = (iteratees: lodash.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[];", "fp.d.ts", 2028, 55] + export type LodashKebabCase = (string: Str) => Str + export type LodashKeys = (object: anything) => MutArray[Str] + export type LodashKeysIn = (object: anything) => MutArray[Str] + export type LodashLast = unsupported["type LodashLast = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2032, 50] + export declare trait LodashLastIndexOf { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 2036, 97] + } + export type LodashLastIndexOf1x1[T] = (array: ArrayLike[T]) => Num + export type LodashLastIndexOf1x2[T] = (value: T) => Num + export declare trait LodashLastIndexOfFrom { + val __call: unsupported["(value: T, fromIndex: true|number, array: lodash.List | null | undefined): number;", "fp.d.ts", 2047, 125] + } + export declare trait LodashLastIndexOfFrom1x1[T] { + val __call: unsupported["(fromIndex: true|number, array: lodash.List | null | undefined): number;", "fp.d.ts", 2052, 99] + } + export declare trait LodashLastIndexOfFrom1x2 { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 2057, 101] + } + export type LodashLastIndexOfFrom1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashLastIndexOfFrom1x4[T] { + val __call: unsupported["(value: T, fromIndex: true|number): number;", "fp.d.ts", 2063, 80] + } + export type LodashLastIndexOfFrom1x5 = (fromIndex: (Num) | (true)) => Num + export type LodashLastIndexOfFrom1x6[T] = (value: T) => Num + export type LodashLowerCase = (string: Str) => Str + export type LodashLowerFirst = (string: Str) => Str + export declare trait LodashLt { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 2072, 52] + } + export type LodashLt1x1 = (other: anything) => (false) | (true) + export type LodashLt1x2 = (value: anything) => (false) | (true) + export declare trait LodashLte { + val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 2079, 53] + } + export type LodashLte1x1 = (other: anything) => (false) | (true) + export type LodashLte1x2 = (value: anything) => (false) | (true) + export declare trait LodashMap { + val __call: unsupported["(iteratee: object, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean[];", "fp.d.ts", 2097, 41] + } + export type LodashMap1x1[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => MutArray[TResult] + export type LodashMap1x2 = unsupported["type LodashMap1x2 = (iteratee: (value: T) => TResult) => TResult[];", "fp.d.ts", 2100, 103] + export type LodashMap2x2 = unsupported["type LodashMap2x2 = (iteratee: (value: T) => TResult) => TResult[];", "fp.d.ts", 2101, 83] + export type LodashMap3x1[T, TResult] = (collection: T) => MutArray[TResult] + export type LodashMap3x2 = unsupported["type LodashMap3x2 = (iteratee: (value: T[keyof T]) => TResult) => TResult[];", "fp.d.ts", 2103, 84] + export type LodashMap4x1 = unsupported["type LodashMap4x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => Array;", "fp.d.ts", 2104, 92] + export declare trait LodashMap4x2[T] { + val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 2108, 34] + } + export type LodashMap5x1 = unsupported["type LodashMap5x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => any[];", "fp.d.ts", 2110, 5] + export type LodashMap6x1 = unsupported["type LodashMap6x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => boolean[];", "fp.d.ts", 2111, 120] + export declare trait LodashMapKeys { + val __call: unsupported["(iteratee: lodash.ValueIteratee, object: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 2118, 99] + } + export type LodashMapKeys1x1 = unsupported["type LodashMapKeys1x1 = (object: lodash.List | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2120, 5] + export type LodashMapKeys1x2[T] = (iteratee: ((((Str) | (Num)) | (Symbol)) | ((((Str) | (Num)) | (Symbol), anything, ))) | ((value: T) => anything)) => Dictionary[T] + export type LodashMapKeys2x1 = unsupported["type LodashMapKeys2x1 = (object: T | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2122, 96] + export type LodashMapKeys2x2 = unsupported["type LodashMapKeys2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 2123, 110] + export declare trait LodashMapValues { + val __call: unsupported["(iteratee: string, obj: T | null | undefined): { [P in keyof T]: any };", "fp.d.ts", 2138, 130] + } + export type LodashMapValues1x1[T, TResult] = (obj: (Dictionary[T]) | (NumericDictionary[T])) => Dictionary[TResult] + export declare trait LodashMapValues1x2[T] { + val __call: unsupported["(iteratee: string): lodash.Dictionary;", "fp.d.ts", 2145, 75] + } + export type LodashMapValues2x1 = unsupported["type LodashMapValues2x1 = (obj: T | null | undefined) => { [P in keyof T]: TResult };", "fp.d.ts", 2147, 5] + export declare trait LodashMapValues2x2[T] { + val __call: unsupported["(iteratee: string): { [P in keyof T]: any };", "fp.d.ts", 2151, 56] + } + export declare trait LodashMapValues3x1 { + val __call: unsupported["(obj: T | null | undefined): { [P in keyof T]: boolean };", "fp.d.ts", 2155, 116] + } + export type LodashMapValues5x1 = unsupported["type LodashMapValues5x1 = (obj: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2157, 5] + export declare trait LodashMapValues6x1 { + val __call: unsupported["(obj: T | null | undefined): { [P in keyof T]: any };", "fp.d.ts", 2160, 112] + } + export declare trait LodashMatchesProperty { + val __call: unsupported["(path: lodash.PropertyPath, srcValue: T): (value: any) => boolean;", "fp.d.ts", 2165, 68] + } + export type LodashMatchesProperty1x1 = unsupported["type LodashMatchesProperty1x1 = (srcValue: T) => (value: any) => boolean;", "fp.d.ts", 2167, 5] + export type LodashMatchesProperty1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (value: anything) => (false) | (true) + export type LodashMax = unsupported["type LodashMax = (collection: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2169, 91] + export declare trait LodashMaxBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2173, 99] + } + export type LodashMaxBy1x1[T] = (collection: ArrayLike[T]) => T + export type LodashMaxBy1x2 = unsupported["type LodashMaxBy1x2 = (iteratee: lodash.ValueIteratee) => T | undefined;", "fp.d.ts", 2176, 94] + export type LodashMean = (collection: ArrayLike[anything]) => Num + export declare trait LodashMeanBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): number;", "fp.d.ts", 2181, 100] + } + export type LodashMeanBy1x1[T] = (collection: ArrayLike[T]) => Num + export type LodashMeanBy1x2 = unsupported["type LodashMeanBy1x2 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 2184, 88] + export type LodashMemoize = unsupported["type LodashMemoize = any>(func: T) => T & lodash.MemoizedFunction;", "fp.d.ts", 2185, 76] + export declare trait LodashMerge { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2189, 79] + } + export type LodashMerge1x1 = unsupported["type LodashMerge1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 2191, 5] + export type LodashMerge1x2 = unsupported["type LodashMerge1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 2192, 83] + export declare trait LodashMergeAll { + val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 2198, 170] + } + export declare trait LodashMergeAllWith { + val __call: unsupported["(customizer: lodash.MergeWithCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 2203, 81] + } + export type LodashMergeAllWith1x1 = (args: ReadonlyArray[anything]) => anything + export type LodashMergeAllWith1x2 = (customizer: (value: anything, srcValue: anything, key: Str, object: anything, source: anything) => anything) => anything + export declare trait LodashMergeWith { + val __call: unsupported["(customizer: lodash.MergeWithCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2214, 122] + } + export declare trait LodashMergeWith1x1 { + val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2219, 83] + } + export declare trait LodashMergeWith1x2[TObject] { + val __call: unsupported["(customizer: lodash.MergeWithCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 2224, 96] + } + export type LodashMergeWith1x3 = unsupported["type LodashMergeWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 2226, 5] + export declare trait LodashMergeWith1x4[TSource] { + val __call: unsupported["(customizer: lodash.MergeWithCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 2230, 96] + } + export type LodashMergeWith1x5 = unsupported["type LodashMergeWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 2232, 5] + export type LodashMergeWith1x6[TObject, TSource] = (customizer: (value: anything, srcValue: anything, key: Str, object: anything, source: anything) => anything) => (TObject) & (TSource) + export type LodashMethod = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (object: anything) => anything + export type LodashMethodOf = (object: Object) => (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export type LodashMin = unsupported["type LodashMin = (collection: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2236, 81] + export declare trait LodashMinBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2240, 99] + } + export type LodashMinBy1x1[T] = (collection: ArrayLike[T]) => T + export type LodashMinBy1x2 = unsupported["type LodashMinBy1x2 = (iteratee: lodash.ValueIteratee) => T | undefined;", "fp.d.ts", 2243, 94] + export declare trait LodashMultiply { + val __call: unsupported["(multiplier: number, multiplicand: number): number;", "fp.d.ts", 2247, 73] + } + export type LodashMultiply1x1 = (multiplicand: Num) => Num + export type LodashMultiply1x2 = (multiplier: Num) => Num + export type LodashNoConflict = () => LoDashFp + export type LodashNoop = (args: (anything) | (MutArray[anything])) => unit + export type LodashNow = () => Num + export declare trait LodashNth { + val __call: unsupported["(n: number, array: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2257, 85] + } + export type LodashNth1x1 = unsupported["type LodashNth1x1 = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2259, 5] + export type LodashNth1x2[T] = (n: Num) => T + export type LodashNthArg = (n: Num) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashOmit { + val __call: unsupported["(paths: lodash.Many, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2267, 65] + } + export type LodashOmit1x1 = unsupported["type LodashOmit1x1 = (object: T | null | undefined) => lodash.Omit;", "fp.d.ts", 2269, 5] + export declare trait LodashOmit1x2[T] { + val __call: unsupported["(paths: lodash.Many): lodash.PartialObject;", "fp.d.ts", 2272, 70] + } + export type LodashOmit2x1 = unsupported["type LodashOmit2x1 = (object: T | null | undefined) => lodash.PartialObject;", "fp.d.ts", 2274, 5] + export declare trait LodashOmitBy { + val __call: unsupported["(predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2282, 99] + } + export declare trait LodashOmitBy1x1[T] { + val __call: unsupported["(object: T1 | null | undefined): lodash.PartialObject;", "fp.d.ts", 2287, 94] + } + export type LodashOmitBy1x2 = unsupported["type LodashOmitBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.Dictionary;", "fp.d.ts", 2289, 5] + export type LodashOmitBy2x2 = unsupported["type LodashOmitBy2x2 = (predicate: lodash.ValueKeyIteratee) => lodash.NumericDictionary;", "fp.d.ts", 2290, 94] + export type LodashOmitBy3x2 = unsupported["type LodashOmitBy3x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject;", "fp.d.ts", 2291, 101] + export type LodashOnce = unsupported["type LodashOnce = any>(func: T) => T;", "fp.d.ts", 2292, 106] + export declare trait LodashOrderBy { + val __call: unsupported["(iteratees: lodash.Many>, orders: lodash.__, collection: T | null | undefined): LodashOrderBy4x5;", "fp.d.ts", 2308, 238] + } + export declare trait LodashOrderBy1x1[T] { + val __call: unsupported["(orders: lodash.__, collection: T1 | null | undefined): LodashOrderBy3x5;", "fp.d.ts", 2314, 117] + } + export declare trait LodashOrderBy1x2 { + val __call: unsupported["(iteratees: lodash.Many<(value: T[keyof T]) => lodash.NotVoid> | lodash.Many>, collection: T | null | undefined): Array;", "fp.d.ts", 2322, 104] + } + export declare trait LodashOrderBy1x3[T] { + val __call: unsupported["(collection: object | null | undefined): object[];", "fp.d.ts", 2326, 61] + } + export declare trait LodashOrderBy1x4[T] { + val __call: unsupported["(iteratees: lodash.Many>): LodashOrderBy2x5;", "fp.d.ts", 2332, 154] + } + export type LodashOrderBy1x5[T] = (orders: ((((false) | (true)) | (Str)) | (Str)) | (ReadonlyArray[(((false) | (true)) | (Str)) | (Str)])) => MutArray[T] + export type LodashOrderBy1x6 = unsupported["type LodashOrderBy1x6 = (iteratees: lodash.Many<(value: T) => lodash.NotVoid> | lodash.Many>) => T[];", "fp.d.ts", 2335, 82] + export declare trait LodashOrderBy2x1[T] { + val __call: unsupported["(orders: lodash.__, collection: T1 | null | undefined): LodashOrderBy4x5;", "fp.d.ts", 2340, 117] + } + export declare trait LodashOrderBy2x3[T] { + val __call: unsupported["(collection: object | null | undefined): object[];", "fp.d.ts", 2344, 61] + } + export type LodashOrderBy2x5[T] = (orders: ((((false) | (true)) | (Str)) | (Str)) | (ReadonlyArray[(((false) | (true)) | (Str)) | (Str)])) => MutArray[T] + export declare trait LodashOrderBy3x4[T] { + val __call: unsupported["(iteratees: lodash.Many>): LodashOrderBy4x5;", "fp.d.ts", 2351, 186] + } + export type LodashOrderBy3x5 = unsupported["type LodashOrderBy3x5 = (orders: lodash.Many) => Array;", "fp.d.ts", 2353, 5] + export type LodashOrderBy3x6 = unsupported["type LodashOrderBy3x6 = (iteratees: lodash.Many<(value: T[keyof T]) => lodash.NotVoid> | lodash.Many>) => Array;", "fp.d.ts", 2354, 96] + export type LodashOrderBy4x5 = unsupported["type LodashOrderBy4x5 = (orders: lodash.Many) => Array;", "fp.d.ts", 2355, 164] + export declare trait LodashOverArgs { + val __call: unsupported["(func: (...args: any[]) => any, transforms: lodash.Many<(...args: any[]) => any>): (...args: any[]) => any;", "fp.d.ts", 2359, 95] + } + export type LodashOverArgs1x1 = (transforms: ((args: (anything) | (MutArray[anything])) => anything) | (ReadonlyArray[(args: (anything) | (MutArray[anything])) => anything])) => (args: (anything) | (MutArray[anything])) => anything + export type LodashOverArgs1x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashPad { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2366, 58] + } + export type LodashPad1x1 = (string: Str) => Str + export type LodashPad1x2 = (length: Num) => Str + export declare trait LodashPadChars { + val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2377, 78] + } + export declare trait LodashPadChars1x1 { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2382, 63] + } + export declare trait LodashPadChars1x2 { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2387, 62] + } + export type LodashPadChars1x3 = (string: Str) => Str + export declare trait LodashPadChars1x4 { + val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2393, 62] + } + export type LodashPadChars1x5 = (length: Num) => Str + export type LodashPadChars1x6 = (chars: Str) => Str + export declare trait LodashPadCharsEnd { + val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2404, 81] + } + export declare trait LodashPadCharsEnd1x1 { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2409, 66] + } + export declare trait LodashPadCharsEnd1x2 { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2414, 65] + } + export type LodashPadCharsEnd1x3 = (string: Str) => Str + export declare trait LodashPadCharsEnd1x4 { + val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2420, 65] + } + export type LodashPadCharsEnd1x5 = (length: Num) => Str + export type LodashPadCharsEnd1x6 = (chars: Str) => Str + export declare trait LodashPadCharsStart { + val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2431, 83] + } + export declare trait LodashPadCharsStart1x1 { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2436, 68] + } + export declare trait LodashPadCharsStart1x2 { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2441, 67] + } + export type LodashPadCharsStart1x3 = (string: Str) => Str + export declare trait LodashPadCharsStart1x4 { + val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2447, 67] + } + export type LodashPadCharsStart1x5 = (length: Num) => Str + export type LodashPadCharsStart1x6 = (chars: Str) => Str + export declare trait LodashPadEnd { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2454, 61] + } + export type LodashPadEnd1x1 = (string: Str) => Str + export type LodashPadEnd1x2 = (length: Num) => Str + export declare trait LodashPadStart { + val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2461, 63] + } + export type LodashPadStart1x1 = (string: Str) => Str + export type LodashPadStart1x2 = (length: Num) => Str + export declare trait LodashParseInt { + val __call: unsupported["(radix: number, string: string): number;", "fp.d.ts", 2468, 62] + } + export type LodashParseInt1x1 = (string: Str) => Num + export type LodashParseInt1x2 = (radix: Num) => Num + export declare trait LodashPartial { + val __call: unsupported["(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: [T1, T2, T3, T4]): (...ts: TS) => R;", "fp.d.ts", 2515, 99] + val placeholder: LoDashStatic + } + export type LodashPartial1x1[T1, T2, R] = (plc1: (LoDashStatic, T2, )) => {} + export declare trait LodashPartial1x2[T2] { + val __call: unsupported["(func: lodash.Function4): lodash.Function3;", "fp.d.ts", 2522, 88] + } + export declare trait LodashPartial2x1[T1, T2, T3, R] { + val __call: unsupported["(plc1: [lodash.__, T2, T3]): lodash.Function1;", "fp.d.ts", 2528, 61] + } + export declare trait LodashPartial3x2[T3] { + val __call: unsupported["(func: lodash.Function4): lodash.Function3;", "fp.d.ts", 2532, 88] + } + export declare trait LodashPartial4x2[T1, T3] { + val __call: unsupported["(func: lodash.Function4): lodash.Function2;", "fp.d.ts", 2536, 80] + } + export declare trait LodashPartial5x2[T2, T3] { + val __call: unsupported["(func: lodash.Function4): lodash.Function2;", "fp.d.ts", 2540, 80] + } + export declare trait LodashPartial6x1[T1, T2, T3, T4, R] { + val __call: unsupported["(plc1: [lodash.__, T2, T3, T4]): lodash.Function1;", "fp.d.ts", 2554, 65] + } + export declare trait LodashPartial10x2[T1, T2, T3] { + val __call: unsupported["(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R): (...ts: TS) => R;", "fp.d.ts", 2558, 84] + } + export type LodashPartial11x2 = unsupported["type LodashPartial11x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2560, 5] + export type LodashPartial12x2 = unsupported["type LodashPartial12x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2561, 127] + export type LodashPartial13x2 = unsupported["type LodashPartial13x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2562, 123] + export type LodashPartial14x2 = unsupported["type LodashPartial14x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2563, 123] + export type LodashPartial15x2 = unsupported["type LodashPartial15x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2564, 119] + export type LodashPartial16x2 = unsupported["type LodashPartial16x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2565, 123] + export type LodashPartial17x2 = unsupported["type LodashPartial17x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2566, 119] + export type LodashPartial18x1[TS, T1, R] = (arg1: (T1, )) => (ts: TS) => R + export type LodashPartial18x2 = unsupported["type LodashPartial18x2 = (func: (t1: T1, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2568, 87] + export type LodashPartial19x1[TS, T1, T2, R] = (t1: (T1, T2, )) => (ts: TS) => R + export type LodashPartial19x2 = unsupported["type LodashPartial19x2 = (func: (t1: T1, t2: T2, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2570, 93] + export type LodashPartial20x1[TS, T1, T2, T3, R] = (t1: (T1, T2, T3, )) => (ts: TS) => R + export type LodashPartial21x1[TS, T1, T2, T3, T4, R] = (t1: (T1, T2, T3, T4, )) => (ts: TS) => R + export type LodashPartial21x2 = unsupported["type LodashPartial21x2 = (func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2573, 109] + export declare trait LodashPartialRight { + val __call: unsupported["(func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any;", "fp.d.ts", 2633, 76] + val placeholder: LoDashStatic + } + export type LodashPartialRight1x1[T1, R] = (arg1: (T1, )) => {} + export type LodashPartialRight1x2 = unsupported["type LodashPartialRight1x2 = (func: lodash.Function1) => lodash.Function0;", "fp.d.ts", 2637, 76] + export declare trait LodashPartialRight2x1[T1, T2, R] { + val __call: unsupported["(arg1: [T1, T2]): lodash.Function0;", "fp.d.ts", 2641, 46] + } + export type LodashPartialRight2x2 = unsupported["type LodashPartialRight2x2 = (func: lodash.Function2) => lodash.Function1;", "fp.d.ts", 2643, 5] + export type LodashPartialRight3x2 = unsupported["type LodashPartialRight3x2 = (func: lodash.Function2) => lodash.Function1;", "fp.d.ts", 2644, 107] + export type LodashPartialRight4x2 = unsupported["type LodashPartialRight4x2 = (func: lodash.Function2) => lodash.Function0;", "fp.d.ts", 2645, 107] + export declare trait LodashPartialRight5x1[T1, T2, T3, R] { + val __call: unsupported["(arg1: [T1, T2, T3]): lodash.Function0;", "fp.d.ts", 2653, 50] + } + export type LodashPartialRight5x2 = unsupported["type LodashPartialRight5x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2655, 5] + export type LodashPartialRight6x2 = unsupported["type LodashPartialRight6x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2656, 119] + export type LodashPartialRight7x2 = unsupported["type LodashPartialRight7x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2657, 119] + export type LodashPartialRight8x2 = unsupported["type LodashPartialRight8x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2658, 115] + export type LodashPartialRight9x2 = unsupported["type LodashPartialRight9x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2659, 119] + export type LodashPartialRight10x2 = unsupported["type LodashPartialRight10x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2660, 115] + export type LodashPartialRight11x2 = unsupported["type LodashPartialRight11x2 = (func: lodash.Function3) => lodash.Function0;", "fp.d.ts", 2661, 116] + export declare trait LodashPartialRight12x1[T1, T2, T3, T4, R] { + val __call: unsupported["(arg1: [T1, T2, T3, T4]): lodash.Function0;", "fp.d.ts", 2677, 54] + } + export type LodashPartialRight12x2 = unsupported["type LodashPartialRight12x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2679, 5] + export type LodashPartialRight13x2 = unsupported["type LodashPartialRight13x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2680, 132] + export type LodashPartialRight14x2 = unsupported["type LodashPartialRight14x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2681, 132] + export type LodashPartialRight15x2 = unsupported["type LodashPartialRight15x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2682, 128] + export type LodashPartialRight16x2 = unsupported["type LodashPartialRight16x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2683, 132] + export type LodashPartialRight17x2 = unsupported["type LodashPartialRight17x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2684, 128] + export type LodashPartialRight18x2 = unsupported["type LodashPartialRight18x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2685, 128] + export type LodashPartialRight19x2 = unsupported["type LodashPartialRight19x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2686, 124] + export type LodashPartialRight20x2 = unsupported["type LodashPartialRight20x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2687, 132] + export type LodashPartialRight21x2 = unsupported["type LodashPartialRight21x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2688, 128] + export type LodashPartialRight22x2 = unsupported["type LodashPartialRight22x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2689, 128] + export type LodashPartialRight23x2 = unsupported["type LodashPartialRight23x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2690, 124] + export type LodashPartialRight24x2 = unsupported["type LodashPartialRight24x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2691, 128] + export type LodashPartialRight25x2 = unsupported["type LodashPartialRight25x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2692, 124] + export type LodashPartialRight26x2 = unsupported["type LodashPartialRight26x2 = (func: lodash.Function4) => lodash.Function0;", "fp.d.ts", 2693, 124] + export type LodashPartialRight27x1 = (args: ReadonlyArray[anything]) => (args: (anything) | (MutArray[anything])) => anything + export type LodashPartialRight27x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashPartition { + val __call: unsupported["(callback: lodash.ValueIteratee, collection: T | null | undefined): [Array, Array];", "fp.d.ts", 2703, 105] + } + export type LodashPartition1x1 = unsupported["type LodashPartition1x1 = (collection: lodash.List | null | undefined) => [U[], Array>];", "fp.d.ts", 2705, 5] + export declare trait LodashPartition1x2[T] { + val __call: unsupported["(callback: lodash.ValueIteratee): [T[], T[]];", "fp.d.ts", 2708, 98] + } + export type LodashPartition2x1[T] = (collection: (Object) | (ArrayLike[T])) => (MutArray[T], MutArray[T], ) + export type LodashPartition3x2 = unsupported["type LodashPartition3x2 = (callback: lodash.ValueIteratee) => [Array, Array];", "fp.d.ts", 2711, 104] + export declare trait LodashPath { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2736, 55] + } + export val LodashPath1x1: unsupported["interface LodashPath1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 2738, 5] + export declare trait LodashPath1x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 2746, 176] + } + export declare trait LodashPath2x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 2752, 188] + } + export val LodashPath3x1: unsupported["interface LodashPath3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 2754, 5] + export val LodashPath5x1: unsupported["interface LodashPath5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 2758, 5] + export val LodashPath7x1: unsupported["interface LodashPath7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 2762, 5] + export declare trait LodashPath9x1 { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 2768, 52] + } + export type LodashPath9x2[T] = (path: Num) => T + export type LodashPath10x2[T] = (path: Num) => T + export declare trait LodashPath11x1 { + val __call: unsupported["(object: any): any;", "fp.d.ts", 2774, 46] + } + export type LodashPath11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined + export type LodashPath12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashPathOr { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2815, 91] + } + export declare trait LodashPathOr1x1[TDefault] { + val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 2832, 79] + } + export val LodashPathOr1x2: unsupported["interface LodashPathOr1x2 { (defaultValue: TDefault): LodashPathOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2834, 5] + export type LodashPathOr1x3 = unsupported["type LodashPathOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2839, 5] + export declare trait LodashPathOr1x4[TObject] { + val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 2849, 282] + } + export declare trait LodashPathOr1x5[TObject, TDefault] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 2855, 207] + } + export type LodashPathOr1x6 = unsupported["type LodashPathOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2857, 5] + export val LodashPathOr2x2: unsupported["interface LodashPathOr2x2 { (defaultValue: TDefault): LodashPathOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2858, 147] + export type LodashPathOr2x3 = unsupported["type LodashPathOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2863, 5] + export type LodashPathOr2x6 = unsupported["type LodashPathOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2864, 204] + export val LodashPathOr3x2: unsupported["interface LodashPathOr3x2 { (defaultValue: TDefault): LodashPathOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2865, 192] + export type LodashPathOr3x3 = unsupported["type LodashPathOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2870, 5] + export type LodashPathOr3x6 = unsupported["type LodashPathOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2871, 254] + export val LodashPathOr4x2: unsupported["interface LodashPathOr4x2 { (defaultValue: TDefault): LodashPathOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2872, 242] + export type LodashPathOr4x3 = unsupported["type LodashPathOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2877, 5] + export type LodashPathOr4x6 = unsupported["type LodashPathOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2878, 311] + export declare trait LodashPathOr5x2 { + val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 2882, 113] + } + export type LodashPathOr5x3 = unsupported["type LodashPathOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 2884, 5] + export declare trait LodashPathOr5x4[T] { + val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 2888, 68] + } + export type LodashPathOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) + export type LodashPathOr5x6 = unsupported["type LodashPathOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 2891, 71] + export declare trait LodashPathOr6x2 { + val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 2898, 64] + } + export type LodashPathOr6x3[TDefault] = (object: null) => TDefault + export declare trait LodashPathOr6x4 { + val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 2904, 78] + } + export type LodashPathOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault + export type LodashPathOr6x6 = unsupported["type LodashPathOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 2907, 77] + export declare trait LodashPathOr7x1 { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2911, 56] + } + export type LodashPathOr7x3 = (object: anything) => anything + export declare trait LodashPathOr7x4 { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 2917, 78] + } + export type LodashPathOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export type LodashPathOr7x6 = (defaultValue: anything) => anything + export declare trait LodashPick { + val __call: unsupported["(props: lodash.PropertyPath, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2927, 78] + } + export type LodashPick1x1 = unsupported["type LodashPick1x1 = (object: T) => Pick;", "fp.d.ts", 2929, 5] + export type LodashPick1x2 = unsupported["type LodashPick1x2 = (props: lodash.Many) => Pick;", "fp.d.ts", 2930, 73] + export type LodashPick2x1 = unsupported["type LodashPick2x1 = (object: T | null | undefined) => lodash.PartialObject;", "fp.d.ts", 2931, 85] + export type LodashPick2x2 = unsupported["type LodashPick2x2 = (props: lodash.PropertyPath) => lodash.PartialObject;", "fp.d.ts", 2932, 86] + export declare trait LodashPickBy { + val __call: unsupported["(predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2943, 99] + } + export declare trait LodashPickBy1x1[T, S] { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary;", "fp.d.ts", 2947, 80] + } + export declare trait LodashPickBy1x2[T] { + val __call: unsupported["(predicate: lodash.ValueKeyIteratee): lodash.Dictionary;", "fp.d.ts", 2951, 95] + } + export declare trait LodashPickBy2x2[T] { + val __call: unsupported["(predicate: lodash.ValueKeyIteratee): lodash.NumericDictionary;", "fp.d.ts", 2955, 102] + } + export declare trait LodashPickBy3x1[T] { + val __call: unsupported["(object: T1 | null | undefined): lodash.PartialObject;", "fp.d.ts", 2960, 94] + } + export type LodashPickBy5x2 = unsupported["type LodashPickBy5x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject;", "fp.d.ts", 2962, 5] + export declare trait LodashProp { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2987, 55] + } + export val LodashProp1x1: unsupported["interface LodashProp1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 2989, 5] + export declare trait LodashProp1x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 2997, 176] + } + export declare trait LodashProp2x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3003, 188] + } + export val LodashProp3x1: unsupported["interface LodashProp3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3005, 5] + export val LodashProp5x1: unsupported["interface LodashProp5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3009, 5] + export val LodashProp7x1: unsupported["interface LodashProp7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3013, 5] + export declare trait LodashProp9x1 { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3019, 52] + } + export type LodashProp9x2[T] = (path: Num) => T + export type LodashProp10x2[T] = (path: Num) => T + export declare trait LodashProp11x1 { + val __call: unsupported["(object: any): any;", "fp.d.ts", 3025, 46] + } + export type LodashProp11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined + export type LodashProp12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashProperty { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3053, 59] + } + export val LodashProperty1x1: unsupported["interface LodashProperty1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 3055, 5] + export declare trait LodashProperty1x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 3063, 176] + } + export declare trait LodashProperty2x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3069, 188] + } + export val LodashProperty3x1: unsupported["interface LodashProperty3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3071, 5] + export val LodashProperty5x1: unsupported["interface LodashProperty5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3075, 5] + export val LodashProperty7x1: unsupported["interface LodashProperty7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3079, 5] + export declare trait LodashProperty9x1 { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3085, 52] + } + export type LodashProperty9x2[T] = (path: Num) => T + export type LodashProperty10x2[T] = (path: Num) => T + export declare trait LodashProperty11x1 { + val __call: unsupported["(object: any): any;", "fp.d.ts", 3091, 46] + } + export type LodashProperty11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined + export type LodashProperty12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashPropertyOf { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3119, 61] + } + export val LodashPropertyOf1x1: unsupported["interface LodashPropertyOf1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 3121, 5] + export declare trait LodashPropertyOf1x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 3129, 176] + } + export declare trait LodashPropertyOf2x2[TObject] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3135, 188] + } + export val LodashPropertyOf3x1: unsupported["interface LodashPropertyOf3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3137, 5] + export val LodashPropertyOf5x1: unsupported["interface LodashPropertyOf5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3141, 5] + export val LodashPropertyOf7x1: unsupported["interface LodashPropertyOf7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3145, 5] + export declare trait LodashPropertyOf9x1 { + val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3151, 52] + } + export type LodashPropertyOf9x2[T] = (path: Num) => T + export type LodashPropertyOf10x2[T] = (path: Num) => T + export declare trait LodashPropertyOf11x1 { + val __call: unsupported["(object: any): any;", "fp.d.ts", 3157, 46] + } + export type LodashPropertyOf11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined + export type LodashPropertyOf12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashPropOr { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3198, 91] + } + export declare trait LodashPropOr1x1[TDefault] { + val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 3215, 79] + } + export val LodashPropOr1x2: unsupported["interface LodashPropOr1x2 { (defaultValue: TDefault): LodashPropOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3217, 5] + export type LodashPropOr1x3 = unsupported["type LodashPropOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3222, 5] + export declare trait LodashPropOr1x4[TObject] { + val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 3232, 282] + } + export declare trait LodashPropOr1x5[TObject, TDefault] { + val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 3238, 207] + } + export type LodashPropOr1x6 = unsupported["type LodashPropOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3240, 5] + export val LodashPropOr2x2: unsupported["interface LodashPropOr2x2 { (defaultValue: TDefault): LodashPropOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3241, 147] + export type LodashPropOr2x3 = unsupported["type LodashPropOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3246, 5] + export type LodashPropOr2x6 = unsupported["type LodashPropOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3247, 204] + export val LodashPropOr3x2: unsupported["interface LodashPropOr3x2 { (defaultValue: TDefault): LodashPropOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3248, 192] + export type LodashPropOr3x3 = unsupported["type LodashPropOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3253, 5] + export type LodashPropOr3x6 = unsupported["type LodashPropOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3254, 254] + export val LodashPropOr4x2: unsupported["interface LodashPropOr4x2 { (defaultValue: TDefault): LodashPropOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3255, 242] + export type LodashPropOr4x3 = unsupported["type LodashPropOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3260, 5] + export type LodashPropOr4x6 = unsupported["type LodashPropOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3261, 311] + export declare trait LodashPropOr5x2 { + val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 3265, 113] + } + export type LodashPropOr5x3 = unsupported["type LodashPropOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 3267, 5] + export declare trait LodashPropOr5x4[T] { + val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 3271, 68] + } + export type LodashPropOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) + export type LodashPropOr5x6 = unsupported["type LodashPropOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 3274, 71] + export declare trait LodashPropOr6x2 { + val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 3281, 64] + } + export type LodashPropOr6x3[TDefault] = (object: null) => TDefault + export declare trait LodashPropOr6x4 { + val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 3287, 78] + } + export type LodashPropOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault + export type LodashPropOr6x6 = unsupported["type LodashPropOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 3290, 77] + export declare trait LodashPropOr7x1 { + val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3294, 56] + } + export type LodashPropOr7x3 = (object: anything) => anything + export declare trait LodashPropOr7x4 { + val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 3300, 78] + } + export type LodashPropOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export type LodashPropOr7x6 = (defaultValue: anything) => anything + export declare trait LodashPull { + val __call: unsupported["(values: T, array: lodash.List): lodash.List;", "fp.d.ts", 3309, 72] + } + export declare trait LodashPull1x1[T] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3313, 39] + } + export type LodashPull1x2[T] = (values: T) => MutArray[T] + export type LodashPull2x2[T] = (values: T) => ArrayLike[T] + export declare trait LodashPullAll { + val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3322, 75] + } + export declare trait LodashPullAll1x1[T] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3326, 39] + } + export type LodashPullAll1x2[T] = (values: ArrayLike[T]) => MutArray[T] + export type LodashPullAll2x2[T] = (values: ArrayLike[T]) => ArrayLike[T] + export declare trait LodashPullAllBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3352, 115] + } + export declare trait LodashPullAllBy1x1[T] { + val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3359, 74] + } + export declare trait LodashPullAllBy1x2[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List): lodash.List;", "fp.d.ts", 3366, 76] + } + export declare trait LodashPullAllBy1x3[T] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3370, 39] + } + export declare trait LodashPullAllBy1x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T[];", "fp.d.ts", 3375, 77] + } + export type LodashPullAllBy1x5[T] = (values: ArrayLike[T]) => MutArray[T] + export type LodashPullAllBy1x6 = unsupported["type LodashPullAllBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 3378, 65] + export declare trait LodashPullAllBy2x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): lodash.List;", "fp.d.ts", 3382, 77] + } + export type LodashPullAllBy2x5[T] = (values: ArrayLike[T]) => ArrayLike[T] + export type LodashPullAllBy2x6 = unsupported["type LodashPullAllBy2x6 = (iteratee: lodash.ValueIteratee) => lodash.List;", "fp.d.ts", 3385, 76] + export declare trait LodashPullAllBy3x1[T1, T2] { + val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3391, 80] + } + export declare trait LodashPullAllBy3x2[T2] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List): lodash.List;", "fp.d.ts", 3398, 86] + } + export declare trait LodashPullAllBy3x3[T1] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3402, 41] + } + export declare trait LodashPullAllBy3x4[T1] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 3407, 87] + } + export type LodashPullAllBy3x5[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export type LodashPullAllBy3x6 = unsupported["type LodashPullAllBy3x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 3410, 72] + export declare trait LodashPullAllBy4x4[T1] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): lodash.List;", "fp.d.ts", 3414, 87] + } + export type LodashPullAllBy4x5[T1, T2] = (values: ArrayLike[T2]) => ArrayLike[T1] + export type LodashPullAllBy4x6 = unsupported["type LodashPullAllBy4x6 = (iteratee: lodash.ValueIteratee) => lodash.List;", "fp.d.ts", 3417, 83] + export declare trait LodashPullAllWith { + val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3440, 119] + } + export declare trait LodashPullAllWith1x1[T] { + val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3447, 76] + } + export declare trait LodashPullAllWith1x2[T] { + val __call: unsupported["(comparator: lodash.Comparator, array: lodash.List): lodash.List;", "fp.d.ts", 3454, 80] + } + export declare trait LodashPullAllWith1x3[T] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3458, 39] + } + export declare trait LodashPullAllWith1x4[T] { + val __call: unsupported["(comparator: lodash.Comparator, values: lodash.List): T[];", "fp.d.ts", 3463, 81] + } + export type LodashPullAllWith1x5[T] = (values: ArrayLike[T]) => MutArray[T] + export type LodashPullAllWith1x6[T] = (comparator: {}) => MutArray[T] + export declare trait LodashPullAllWith2x4[T] { + val __call: unsupported["(comparator: lodash.Comparator, values: lodash.List): lodash.List;", "fp.d.ts", 3470, 81] + } + export type LodashPullAllWith2x5[T] = (values: ArrayLike[T]) => ArrayLike[T] + export type LodashPullAllWith2x6[T] = (comparator: {}) => ArrayLike[T] + export declare trait LodashPullAllWith3x1[T1, T2] { + val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3479, 82] + } + export declare trait LodashPullAllWith3x2[T2] { + val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List): lodash.List;", "fp.d.ts", 3486, 90] + } + export declare trait LodashPullAllWith3x3[T1] { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3490, 41] + } + export declare trait LodashPullAllWith3x4[T1] { + val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 3495, 91] + } + export type LodashPullAllWith3x5[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] + export type LodashPullAllWith3x6[T1, T2] = (comparator: {}) => MutArray[T1] + export declare trait LodashPullAllWith4x4[T1] { + val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): lodash.List;", "fp.d.ts", 3502, 91] + } + export type LodashPullAllWith4x5[T1, T2] = (values: ArrayLike[T2]) => ArrayLike[T1] + export type LodashPullAllWith4x6[T1, T2] = (comparator: {}) => ArrayLike[T1] + export declare trait LodashPullAt { + val __call: unsupported["(indexes: lodash.Many, array: lodash.List): lodash.List;", "fp.d.ts", 3511, 75] + } + export declare trait LodashPullAt1x1 { + val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3515, 42] + } + export type LodashPullAt1x2[T] = (indexes: (Num) | (ReadonlyArray[Num])) => MutArray[T] + export type LodashPullAt2x2[T] = (indexes: (Num) | (ReadonlyArray[Num])) => ArrayLike[T] + export declare trait LodashRandom { + val __call: unsupported["(min: lodash.__, max: number): LodashRandom2x2;", "fp.d.ts", 3523, 68] + } + export type LodashRandom1x1 = (floatingOrMax: ((Num) | (false)) | (true)) => Num + export type LodashRandom1x2 = (max: Num) => Num + export type LodashRandom2x2 = (min: Num) => Num + export declare trait LodashRange { + val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3531, 56] + } + export type LodashRange1x1 = (end: Num) => MutArray[Num] + export type LodashRange1x2 = (start: Num) => MutArray[Num] + export declare trait LodashRangeRight { + val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3538, 61] + } + export type LodashRangeRight1x1 = (end: Num) => MutArray[Num] + export type LodashRangeRight1x2 = (start: Num) => MutArray[Num] + export declare trait LodashRangeStep { + val __call: unsupported["(start: number, end: number, step: number): number[];", "fp.d.ts", 3549, 74] + } + export declare trait LodashRangeStep1x1 { + val __call: unsupported["(end: number, step: number): number[];", "fp.d.ts", 3554, 59] + } + export declare trait LodashRangeStep1x2 { + val __call: unsupported["(start: number, step: number): number[];", "fp.d.ts", 3559, 61] + } + export type LodashRangeStep1x3 = (step: Num) => MutArray[Num] + export declare trait LodashRangeStep1x4 { + val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3565, 60] + } + export type LodashRangeStep1x5 = (end: Num) => MutArray[Num] + export type LodashRangeStep1x6 = (start: Num) => MutArray[Num] + export declare trait LodashRangeStepRight { + val __call: unsupported["(start: number, end: number, step: number): number[];", "fp.d.ts", 3576, 79] + } + export declare trait LodashRangeStepRight1x1 { + val __call: unsupported["(end: number, step: number): number[];", "fp.d.ts", 3581, 64] + } + export declare trait LodashRangeStepRight1x2 { + val __call: unsupported["(start: number, step: number): number[];", "fp.d.ts", 3586, 66] + } + export type LodashRangeStepRight1x3 = (step: Num) => MutArray[Num] + export declare trait LodashRangeStepRight1x4 { + val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3592, 65] + } + export type LodashRangeStepRight1x5 = (end: Num) => MutArray[Num] + export type LodashRangeStepRight1x6 = (start: Num) => MutArray[Num] + export declare trait LodashRearg { + val __call: unsupported["(indexes: lodash.Many, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 3599, 76] + } + export type LodashRearg1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export type LodashRearg1x2 = (indexes: (Num) | (ReadonlyArray[Num])) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashReduce { + val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3619, 142] + } + export declare trait LodashReduce1x1[T, TResult] { + val __call: unsupported["(accumulator: lodash.__, collection: lodash.List | null | undefined): LodashReduce2x5;", "fp.d.ts", 3625, 93] + } + export declare trait LodashReduce1x2[TResult] { + val __call: unsupported["(callback: lodash.MemoIteratorCapped, collection: T | null | undefined): TResult;", "fp.d.ts", 3634, 111] + } + export type LodashReduce1x3[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => TResult + export declare trait LodashReduce1x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3640, 90] + } + export type LodashReduce1x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduce1x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReduce2x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3647, 90] + } + export type LodashReduce2x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduce2x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReduce3x1[T, TResult] { + val __call: unsupported["(accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3654, 93] + } + export type LodashReduce3x3[T, TResult] = (collection: T) => TResult + export declare trait LodashReduce3x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3660, 90] + } + export type LodashReduce3x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduce3x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReduceRight { + val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3680, 147] + } + export declare trait LodashReduceRight1x1[T, TResult] { + val __call: unsupported["(accumulator: lodash.__, collection: lodash.List | null | undefined): LodashReduceRight2x5;", "fp.d.ts", 3686, 93] + } + export declare trait LodashReduceRight1x2[TResult] { + val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, collection: T | null | undefined): TResult;", "fp.d.ts", 3695, 116] + } + export type LodashReduceRight1x3[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => TResult + export declare trait LodashReduceRight1x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3701, 95] + } + export type LodashReduceRight1x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduceRight1x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReduceRight2x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3708, 95] + } + export type LodashReduceRight2x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduceRight2x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReduceRight3x1[T, TResult] { + val __call: unsupported["(accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3715, 98] + } + export type LodashReduceRight3x3[T, TResult] = (collection: T) => TResult + export declare trait LodashReduceRight3x4[T] { + val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3721, 95] + } + export type LodashReduceRight3x5[TResult] = (accumulator: TResult) => TResult + export type LodashReduceRight3x6[T, TResult] = (callback: {}) => TResult + export declare trait LodashReject { + val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): Array;", "fp.d.ts", 3730, 103] + } + export type LodashReject1x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] + export type LodashReject1x2 = unsupported["type LodashReject1x2 = (predicate: lodash.ValueIterateeCustom) => T[];", "fp.d.ts", 3733, 94] + export type LodashReject2x2 = unsupported["type LodashReject2x2 = (predicate: lodash.ValueIterateeCustom) => Array;", "fp.d.ts", 3734, 89] + export declare trait LodashRemove { + val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List): T[];", "fp.d.ts", 3738, 77] + } + export type LodashRemove1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashRemove1x2 = unsupported["type LodashRemove1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 3741, 61] + export declare trait LodashRepeat { + val __call: unsupported["(n: number, string: string): string;", "fp.d.ts", 3745, 56] + } + export type LodashRepeat1x1 = (string: Str) => Str + export type LodashRepeat1x2 = (n: Num) => Str + export declare trait LodashReplace { + val __call: unsupported["(pattern: RegExp | string, replacement: lodash.ReplaceFunction | string, string: string): string;", "fp.d.ts", 3756, 109] + } + export declare trait LodashReplace1x1 { + val __call: unsupported["(replacement: lodash.ReplaceFunction | string, string: string): string;", "fp.d.ts", 3761, 67] + } + export declare trait LodashReplace1x2 { + val __call: unsupported["(pattern: RegExp | string, string: string): string;", "fp.d.ts", 3766, 63] + } + export type LodashReplace1x3 = (string: Str) => Str + export declare trait LodashReplace1x4 { + val __call: unsupported["(pattern: RegExp | string, replacement: lodash.ReplaceFunction | string): string;", "fp.d.ts", 3772, 93] + } + export type LodashReplace1x5 = (replacement: (Str) | ({})) => Str + export type LodashReplace1x6 = (pattern: (Str) | (RegExp)) => Str + export type LodashRest = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashRestFrom { + val __call: unsupported["(start: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 3780, 77] + } + export type LodashRestFrom1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export type LodashRestFrom1x2 = (start: Num) => (args: (anything) | (MutArray[anything])) => anything + export declare trait LodashResult { + val __call: unsupported["(path: lodash.PropertyPath, object: any): TResult;", "fp.d.ts", 3787, 56] + } + export type LodashResult1x1 = unsupported["type LodashResult1x1 = (object: any) => TResult;", "fp.d.ts", 3789, 5] + export type LodashResult1x2 = unsupported["type LodashResult1x2 = (path: lodash.PropertyPath) => TResult;", "fp.d.ts", 3790, 61] + export type LodashReverse = unsupported["type LodashReverse = >(array: TList) => TList;", "fp.d.ts", 3791, 75] + export type LodashRound = (n: Num) => Num + export type LodashRunInContext = (context: Object) => LoDashStatic + export declare trait LodashSample { + val __call: unsupported["(collection: T | null | undefined): T[keyof T] | undefined;", "fp.d.ts", 3796, 110] + } + export declare trait LodashSampleSize { + val __call: unsupported["(n: number, collection: T | null | undefined): Array;", "fp.d.ts", 3803, 99] + } + export declare trait LodashSampleSize1x1 { + val __call: unsupported["(collection: T | null | undefined): Array;", "fp.d.ts", 3807, 100] + } + export type LodashSampleSize1x2[T] = (n: Num) => MutArray[T] + export type LodashSampleSize2x2 = unsupported["type LodashSampleSize2x2 = (n: number) => Array;", "fp.d.ts", 3810, 53] + export declare trait LodashSetWith { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, value: any, object: T): T;", "fp.d.ts", 3826, 122] + } + export declare trait LodashSetWith1x1[T] { + val __call: unsupported["(path: lodash.PropertyPath, value: any, object: T): T;", "fp.d.ts", 3835, 71] + } + export declare trait LodashSetWith1x2 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, value: any, object: T): T;", "fp.d.ts", 3844, 95] + } + export declare trait LodashSetWith1x3[T] { + val __call: unsupported["(value: any, object: T): T;", "fp.d.ts", 3849, 60] + } + export declare trait LodashSetWith1x4 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 3858, 110] + } + export declare trait LodashSetWith1x5[T] { + val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 3863, 59] + } + export declare trait LodashSetWith1x6 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, object: T): T;", "fp.d.ts", 3868, 83] + } + export type LodashSetWith1x7[T] = (object: T) => T + export declare trait LodashSetWith1x8[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 3878, 93] + } + export declare trait LodashSetWith1x9[T] { + val __call: unsupported["(path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 3883, 60] + } + export declare trait LodashSetWith1x10[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, value: any): T;", "fp.d.ts", 3888, 66] + } + export type LodashSetWith1x11[T] = (value: anything) => T + export declare trait LodashSetWith1x12[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath): T;", "fp.d.ts", 3894, 81] + } + export type LodashSetWith1x13[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T + export type LodashSetWith1x14[T] = (customizer: {}) => T + export declare trait LodashShuffle { + val __call: unsupported["(collection: T | null | undefined): Array;", "fp.d.ts", 3900, 64] + } + export type LodashSize = (collection: (Str) | (Object)) => Num + export declare trait LodashSlice { + val __call: unsupported["(start: number, end: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3910, 104] + } + export declare trait LodashSlice1x1 { + val __call: unsupported["(end: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3915, 89] + } + export declare trait LodashSlice1x2 { + val __call: unsupported["(start: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3920, 91] + } + export type LodashSlice1x3 = unsupported["type LodashSlice1x3 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 3922, 5] + export declare trait LodashSlice1x4[T] { + val __call: unsupported["(start: number, end: number): T[];", "fp.d.ts", 3926, 59] + } + export type LodashSlice1x5[T] = (end: Num) => MutArray[T] + export type LodashSlice1x6[T] = (start: Num) => MutArray[T] + export type LodashSnakeCase = (string: Str) => Str + export declare trait LodashSortBy { + val __call: unsupported["(iteratees: lodash.Many>, collection: T | null | undefined): Array;", "fp.d.ts", 3936, 103] + } + export type LodashSortBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] + export type LodashSortBy1x2 = unsupported["type LodashSortBy1x2 = (iteratees: lodash.Many>) => T[];", "fp.d.ts", 3939, 94] + export type LodashSortBy2x2 = unsupported["type LodashSortBy2x2 = (iteratees: lodash.Many>) => Array;", "fp.d.ts", 3940, 87] + export declare trait LodashSortedIndex { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3944, 97] + } + export type LodashSortedIndex1x1[T] = (array: ArrayLike[T]) => Num + export type LodashSortedIndex1x2[T] = (value: T) => Num + export declare trait LodashSortedIndexBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3955, 112] + } + export declare trait LodashSortedIndexBy1x1[T] { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3960, 96] + } + export declare trait LodashSortedIndexBy1x2[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): number;", "fp.d.ts", 3965, 99] + } + export type LodashSortedIndexBy1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashSortedIndexBy1x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T): number;", "fp.d.ts", 3971, 67] + } + export type LodashSortedIndexBy1x5[T] = (value: T) => Num + export type LodashSortedIndexBy1x6 = unsupported["type LodashSortedIndexBy1x6 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 3974, 58] + export declare trait LodashSortedIndexOf { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3978, 99] + } + export type LodashSortedIndexOf1x1[T] = (array: ArrayLike[T]) => Num + export type LodashSortedIndexOf1x2[T] = (value: T) => Num + export declare trait LodashSortedLastIndex { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3985, 101] + } + export type LodashSortedLastIndex1x1[T] = (array: ArrayLike[T]) => Num + export type LodashSortedLastIndex1x2[T] = (value: T) => Num + export declare trait LodashSortedLastIndexBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3996, 116] + } + export declare trait LodashSortedLastIndexBy1x1[T] { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 4001, 100] + } + export declare trait LodashSortedLastIndexBy1x2[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): number;", "fp.d.ts", 4006, 103] + } + export type LodashSortedLastIndexBy1x3[T] = (array: ArrayLike[T]) => Num + export declare trait LodashSortedLastIndexBy1x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T): number;", "fp.d.ts", 4012, 71] + } + export type LodashSortedLastIndexBy1x5[T] = (value: T) => Num + export type LodashSortedLastIndexBy1x6 = unsupported["type LodashSortedLastIndexBy1x6 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 4015, 62] + export declare trait LodashSortedLastIndexOf { + val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 4019, 103] + } + export type LodashSortedLastIndexOf1x1[T] = (array: ArrayLike[T]) => Num + export type LodashSortedLastIndexOf1x2[T] = (value: T) => Num + export type LodashSortedUniq = unsupported["type LodashSortedUniq = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4023, 62] + export declare trait LodashSortedUniqBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4027, 101] + } + export type LodashSortedUniqBy1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashSortedUniqBy1x2 = unsupported["type LodashSortedUniqBy1x2 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4030, 86] + export declare trait LodashSplit { + val __call: unsupported["(separator: RegExp | string, string: string | null | undefined): string[];", "fp.d.ts", 4034, 82] + } + export type LodashSplit1x1 = (string: Str) => MutArray[Str] + export type LodashSplit1x2 = (separator: (Str) | (RegExp)) => MutArray[Str] + export type LodashSpread = unsupported["type LodashSpread = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 4038, 67] + export declare trait LodashSpreadFrom { + val __call: unsupported["(start: number, func: (...args: any[]) => TResult): (...args: any[]) => TResult;", "fp.d.ts", 4042, 101] + } + export type LodashSpreadFrom1x1 = unsupported["type LodashSpreadFrom1x1 = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 4044, 5] + export type LodashSpreadFrom1x2[TResult] = (start: Num) => (args: (anything) | (MutArray[anything])) => TResult + export type LodashStartCase = (string: Str) => Str + export declare trait LodashStartsWith { + val __call: unsupported["(target: string, string: string): boolean;", "fp.d.ts", 4050, 65] + } + export type LodashStartsWith1x1 = (string: Str) => (false) | (true) + export type LodashStartsWith1x2 = (target: Str) => (false) | (true) + export type LodashStubArray = () => MutArray[anything] + export type LodashStubObject = () => anything + export type LodashStubString = () => Str + export type LodashStubTrue = () => true + export declare trait LodashSubtract { + val __call: unsupported["(minuend: number, subtrahend: number): number;", "fp.d.ts", 4061, 68] + } + export type LodashSubtract1x1 = (subtrahend: Num) => Num + export type LodashSubtract1x2 = (minuend: Num) => Num + export type LodashSum = (collection: ArrayLike[anything]) => Num + export declare trait LodashSumBy { + val __call: unsupported["(iteratee: ((value: T) => number) | string, collection: lodash.List | null | undefined): number;", "fp.d.ts", 4069, 99] + } + export type LodashSumBy1x1[T] = (collection: ArrayLike[T]) => Num + export type LodashSumBy1x2[T] = (iteratee: (Str) | ((value: T) => Num)) => Num + export declare trait LodashXor { + val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4076, 92] + } + export type LodashXor1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashXor1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashXorBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4087, 139] + } + export declare trait LodashXorBy1x1[T] { + val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4092, 91] + } + export declare trait LodashXorBy1x2[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4097, 93] + } + export type LodashXorBy1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashXorBy1x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4103, 92] + } + export type LodashXorBy1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashXorBy1x6 = unsupported["type LodashXorBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4106, 80] + export declare trait LodashXorWith { + val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4114, 143] + } + export declare trait LodashXorWith1x1[T] { + val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4119, 93] + } + export declare trait LodashXorWith1x2[T] { + val __call: unsupported["(comparator: lodash.Comparator, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4124, 97] + } + export type LodashXorWith1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashXorWith1x4[T] { + val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4130, 96] + } + export type LodashXorWith1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashXorWith1x6[T] = (comparator: {}) => MutArray[T] + export type LodashTail = unsupported["type LodashTail = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4134, 73] + export declare trait LodashTake { + val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4138, 86] + } + export type LodashTake1x1 = unsupported["type LodashTake1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4140, 5] + export type LodashTake1x2[T] = (n: Num) => MutArray[T] + export declare trait LodashTakeRight { + val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4145, 91] + } + export type LodashTakeRight1x1 = unsupported["type LodashTakeRight1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4147, 5] + export type LodashTakeRight1x2[T] = (n: Num) => MutArray[T] + export declare trait LodashTakeRightWhile { + val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4152, 104] + } + export type LodashTakeRightWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashTakeRightWhile1x2 = unsupported["type LodashTakeRightWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 4155, 88] + export declare trait LodashTakeWhile { + val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4159, 99] + } + export type LodashTakeWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashTakeWhile1x2 = unsupported["type LodashTakeWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 4162, 83] + export declare trait LodashTap { + val __call: unsupported["(interceptor: (value: T) => void, value: T): T;", "fp.d.ts", 4166, 63] + } + export type LodashTap1x1[T] = (value: T) => T + export type LodashTap1x2[T] = (interceptor: (value: T) => unit) => T + export type LodashTemplate = (string: Str) => "../index".TemplateExecutor + export declare trait LodashThrottle { + val __call: unsupported[" any>(wait: number, func: T): lodash.DebouncedFunc;", "fp.d.ts", 4174, 90] + } + export type LodashThrottle1x1 = unsupported["type LodashThrottle1x1 = any>(func: T) => lodash.DebouncedFunc;", "fp.d.ts", 4176, 5] + export type LodashThrottle1x2[T] = (wait: Num) => DebouncedFunc[T] + export declare trait LodashThru { + val __call: unsupported["(interceptor: (value: T) => TResult, value: T): TResult;", "fp.d.ts", 4181, 64] + } + export type LodashThru1x1[T, TResult] = (value: T) => TResult + export type LodashThru1x2 = unsupported["type LodashThru1x2 = (interceptor: (value: T) => TResult) => TResult;", "fp.d.ts", 4184, 59] + export declare trait LodashTimes { + val __call: unsupported["(iteratee: (num: number) => TResult, n: number): TResult[];", "fp.d.ts", 4188, 57] + } + export type LodashTimes1x1[TResult] = (n: Num) => MutArray[TResult] + export type LodashTimes1x2 = unsupported["type LodashTimes1x2 = (iteratee: (num: number) => TResult) => TResult[];", "fp.d.ts", 4191, 60] + export declare trait LodashToArray { + val __call: unsupported["(): any[];", "fp.d.ts", 4195, 41] + } + export type LodashToFinite = (value: anything) => Num + export type LodashToInteger = (value: anything) => Num + export type LodashToLength = (value: anything) => Num + export type LodashToLower = (string: Str) => Str + export type LodashToNumber = (value: anything) => Num + export type LodashToPath = (value: anything) => MutArray[Str] + export type LodashToPlainObject = (value: anything) => anything + export type LodashToSafeInteger = (value: anything) => Num + export type LodashToString = (value: anything) => Str + export type LodashToUpper = (string: Str) => Str + export declare trait LodashTransform { + val __call: unsupported["(iteratee: lodash.__, accumulator: TResult, object: lodash.Dictionary): LodashTransform2x6;", "fp.d.ts", 4217, 157] + } + export declare trait LodashTransform1x1[T, TResult] { + val __call: unsupported["(accumulator: lodash.__, object: lodash.Dictionary): LodashTransform2x5;", "fp.d.ts", 4223, 89] + } + export declare trait LodashTransform1x2[TResult] { + val __call: unsupported["(iteratee: lodash.__, object: lodash.Dictionary): LodashTransform2x6;", "fp.d.ts", 4229, 123] + } + export type LodashTransform1x3[T, TResult] = (object: (ReadonlyArray[T]) | (Dictionary[T])) => TResult + export declare trait LodashTransform1x4[T] { + val __call: unsupported["(iteratee: lodash.MemoVoidIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 4235, 93] + } + export type LodashTransform1x5[TResult] = (accumulator: TResult) => TResult + export type LodashTransform1x6[T, TResult] = (iteratee: {}) => TResult + export declare trait LodashTransform2x4[T] { + val __call: unsupported["(iteratee: lodash.MemoVoidIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 4242, 93] + } + export type LodashTransform2x5[TResult] = (accumulator: TResult) => TResult + export type LodashTransform2x6[T, TResult] = (iteratee: {}) => TResult + export type LodashTrim = (string: Str) => Str + export declare trait LodashTrimChars { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4250, 63] + } + export type LodashTrimChars1x1 = (string: Str) => Str + export type LodashTrimChars1x2 = (chars: Str) => Str + export declare trait LodashTrimCharsEnd { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4257, 66] + } + export type LodashTrimCharsEnd1x1 = (string: Str) => Str + export type LodashTrimCharsEnd1x2 = (chars: Str) => Str + export declare trait LodashTrimCharsStart { + val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4264, 68] + } + export type LodashTrimCharsStart1x1 = (string: Str) => Str + export type LodashTrimCharsStart1x2 = (chars: Str) => Str + export type LodashTrimEnd = (string: Str) => Str + export type LodashTrimStart = (string: Str) => Str + export declare trait LodashTruncate { + val __call: unsupported["(options: lodash.TruncateOptions, string: string): string;", "fp.d.ts", 4273, 64] + } + export type LodashTruncate1x1 = (string: Str) => Str + export type LodashTruncate1x2 = (options: "../index".TruncateOptions) => Str + export type LodashUnapply = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything + export type LodashUnary = unsupported["type LodashUnary = (func: (arg1: T, ...args: any[]) => TResult) => (arg1: T) => TResult;", "fp.d.ts", 4278, 84] + export type LodashUnescape = (string: Str) => Str + export declare trait LodashUnion { + val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4283, 94] + } + export type LodashUnion1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashUnion1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashUnionBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays1: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4294, 142] + } + export declare trait LodashUnionBy1x1[T] { + val __call: unsupported["(arrays1: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4299, 94] + } + export declare trait LodashUnionBy1x2[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4304, 95] + } + export type LodashUnionBy1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashUnionBy1x4[T] { + val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays1: lodash.List | null | undefined): T[];", "fp.d.ts", 4310, 95] + } + export type LodashUnionBy1x5[T] = (arrays1: ArrayLike[T]) => MutArray[T] + export type LodashUnionBy1x6 = unsupported["type LodashUnionBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4313, 83] + export declare trait LodashUnionWith { + val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4321, 145] + } + export declare trait LodashUnionWith1x1[T] { + val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4326, 95] + } + export declare trait LodashUnionWith1x2[T] { + val __call: unsupported["(comparator: lodash.Comparator, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4331, 99] + } + export type LodashUnionWith1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] + export declare trait LodashUnionWith1x4[T] { + val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4337, 98] + } + export type LodashUnionWith1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] + export type LodashUnionWith1x6[T] = (comparator: {}) => MutArray[T] + export type LodashUniq = unsupported["type LodashUniq = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4341, 75] + export declare trait LodashUniqBy { + val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4345, 95] + } + export type LodashUniqBy1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashUniqBy1x2 = unsupported["type LodashUniqBy1x2 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4348, 80] + export type LodashUniqueId = (prefix: Str) => Str + export declare trait LodashUniqWith { + val __call: unsupported["(comparator: lodash.Comparator, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4353, 99] + } + export type LodashUniqWith1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashUniqWith1x2[T] = (comparator: {}) => MutArray[T] + export type LodashUnzip = unsupported["type LodashUnzip = (array: T[][] | lodash.List> | null | undefined) => T[][];", "fp.d.ts", 4357, 74] + export declare trait LodashUnzipWith { + val __call: unsupported["(iteratee: (...values: T[]) => TResult, array: lodash.List> | null | undefined): TResult[];", "fp.d.ts", 4361, 111] + } + export type LodashUnzipWith1x1[T, TResult] = (array: ArrayLike[ArrayLike[T]]) => MutArray[TResult] + export type LodashUnzipWith1x2 = unsupported["type LodashUnzipWith1x2 = (iteratee: (...values: T[]) => TResult) => TResult[];", "fp.d.ts", 4364, 111] + export declare trait LodashUpdate { + val __call: unsupported["(path: lodash.PropertyPath, updater: (value: any) => any, object: object): any;", "fp.d.ts", 4372, 89] + } + export declare trait LodashUpdate1x1 { + val __call: unsupported["(updater: (value: any) => any, object: object): any;", "fp.d.ts", 4377, 62] + } + export declare trait LodashUpdate1x2 { + val __call: unsupported["(path: lodash.PropertyPath, object: object): any;", "fp.d.ts", 4382, 59] + } + export type LodashUpdate1x3 = (object: Object) => anything + export declare trait LodashUpdate1x4 { + val __call: unsupported["(path: lodash.PropertyPath, updater: (value: any) => any): any;", "fp.d.ts", 4388, 73] + } + export type LodashUpdate1x5 = (updater: (value: anything) => anything) => anything + export type LodashUpdate1x6 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything + export declare trait LodashUpdateWith { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4407, 146] + } + export declare trait LodashUpdateWith1x1[T] { + val __call: unsupported["(path: lodash.PropertyPath, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4416, 95] + } + export declare trait LodashUpdateWith1x2 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4425, 119] + } + export declare trait LodashUpdateWith1x3[T] { + val __call: unsupported["(updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4430, 65] + } + export declare trait LodashUpdateWith1x4 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 4439, 113] + } + export declare trait LodashUpdateWith1x5[T] { + val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 4444, 62] + } + export declare trait LodashUpdateWith1x6 { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, object: T): T;", "fp.d.ts", 4449, 86] + } + export type LodashUpdateWith1x7[T] = (object: T) => T + export declare trait LodashUpdateWith1x8[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, updater: (oldValue: any) => any): T;", "fp.d.ts", 4459, 117] + } + export declare trait LodashUpdateWith1x9[T] { + val __call: unsupported["(path: lodash.PropertyPath, updater: (oldValue: any) => any): T;", "fp.d.ts", 4464, 84] + } + export declare trait LodashUpdateWith1x10[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, updater: (oldValue: any) => any): T;", "fp.d.ts", 4469, 90] + } + export type LodashUpdateWith1x11[T] = (updater: (oldValue: anything) => anything) => T + export declare trait LodashUpdateWith1x12[T] { + val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath): T;", "fp.d.ts", 4475, 84] + } + export type LodashUpdateWith1x13[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T + export type LodashUpdateWith1x14[T] = (customizer: {}) => T + export type LodashUpperCase = (string: Str) => Str + export type LodashUpperFirst = (string: Str) => Str + export declare trait LodashValues { + val __call: unsupported["(object: any): any[];", "fp.d.ts", 4484, 76] + } + export declare trait LodashValuesIn { + val __call: unsupported["(object: T | null | undefined): Array;", "fp.d.ts", 4488, 113] + } + export declare trait LodashWithout { + val __call: unsupported["(values: ReadonlyArray, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4493, 94] + } + export type LodashWithout1x1[T] = (array: ArrayLike[T]) => MutArray[T] + export type LodashWithout1x2[T] = (values: ReadonlyArray[T]) => MutArray[T] + export type LodashWords = (string: Str) => MutArray[Str] + export declare trait LodashWrap { + val __call: unsupported["(wrapper: (value: T, ...args: TArgs[]) => TResult, value: T): (...args: TArgs[]) => TResult;", "fp.d.ts", 4501, 60] + } + export type LodashWrap1x1[T, TArgs, TResult] = (value: T) => (args: (TArgs) | (MutArray[TArgs])) => TResult + export type LodashWrap1x2 = unsupported["type LodashWrap1x2 = (wrapper: (value: T, ...args: TArgs[]) => TResult) => (...args: TArgs[]) => TResult;", "fp.d.ts", 4504, 88] + export declare trait LodashZip { + val __call: unsupported["(arrays1: lodash.List, arrays2: lodash.List): Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4508, 77] + } + export type LodashZip1x1 = unsupported["type LodashZip1x1 = (arrays2: lodash.List) => Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4510, 5] + export type LodashZip1x2 = unsupported["type LodashZip1x2 = (arrays1: lodash.List) => Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4511, 102] + export declare trait LodashZipAll { + val __call: unsupported["(arrays: ReadonlyArray | null | undefined>): Array>;", "fp.d.ts", 4517, 214] + } + export declare trait LodashZipObject { + val __call: unsupported["(props: lodash.List, values: lodash.List): lodash.Dictionary;", "fp.d.ts", 4522, 77] + } + export type LodashZipObject1x1 = unsupported["type LodashZipObject1x1 = (values: lodash.List) => lodash.Dictionary;", "fp.d.ts", 4524, 5] + export type LodashZipObject1x2[T] = (props: ArrayLike[((Str) | (Num)) | (Symbol)]) => Dictionary[T] + export declare trait LodashZipObjectDeep { + val __call: unsupported["(paths: lodash.List, values: lodash.List): object;", "fp.d.ts", 4529, 77] + } + export type LodashZipObjectDeep1x1 = (values: ArrayLike[anything]) => Object + export type LodashZipObjectDeep1x2 = (paths: ArrayLike[(((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])]) => Object + export declare trait LodashZipWith { + val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays1: lodash.List, arrays2: lodash.List): TResult[];", "fp.d.ts", 4540, 116] + } + export declare trait LodashZipWith1x1[T1, T2, TResult] { + val __call: unsupported["(arrays1: lodash.List, arrays2: lodash.List): TResult[];", "fp.d.ts", 4545, 86] + } + export declare trait LodashZipWith1x2[T1] { + val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays2: lodash.List): TResult[];", "fp.d.ts", 4550, 86] + } + export type LodashZipWith1x3[T2, TResult] = (arrays2: ArrayLike[T2]) => MutArray[TResult] + export declare trait LodashZipWith1x4[T2] { + val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays1: lodash.List): TResult[];", "fp.d.ts", 4556, 86] + } + export type LodashZipWith1x5[T1, TResult] = (arrays1: ArrayLike[T1]) => MutArray[TResult] + export type LodashZipWith1x6 = unsupported["type LodashZipWith1x6 = (iteratee: (value1: T1, value2: T2) => TResult) => TResult[];", "fp.d.ts", 4559, 81] + export declare trait LoDashFp { + val extendWith: LodashExtendWith + val sortedIndexOf: LodashSortedIndexOf + val toInteger: {} + val mergeAll: LodashMergeAll + val isDate: {} + val defer: {} + val unapply: {} + val toPath: {} + val takeLastWhile: LodashTakeRightWhile + val constant: {} + val countBy: LodashCountBy + val flatMapDepth: LodashFlatMapDepth + val isLength: {} + val find: LodashFind + val rearg: LodashRearg + val dropRightWhile: LodashDropRightWhile + val flatten: {} + val method: {} + val unary: {} + val findLastKey: LodashFindLastKey + val toFinite: {} + val any: LodashSome + val uniq: {} + val extendAll: LodashExtendAll + val assignIn: LodashAssignIn + val padEnd: LodashPadEnd + val once: {} + val random: LodashRandom + val nAry: LodashAry + val spread: {} + val propOr: LodashPropOr + val symmetricDifference: LodashXor + val chunk: LodashChunk + val toPairsIn: LodashToPairsIn + val isArray: {} + val delay: LodashDelay + val replace: LodashReplace + val unionBy: LodashUnionBy + val differenceWith: LodashDifferenceWith + val isEqual: LodashIsEqual + val runInContext: {} + val takeWhile: LodashTakeWhile + val isError: {} + val pathEq: LodashMatchesProperty + val partial: LodashPartial + val union: LodashUnion + val defaultsDeep: LodashDefaultsDeep + val zip: LodashZip + val sortedLastIndexBy: LodashSortedLastIndexBy + val initial: {} + val rangeStepRight: LodashRangeStepRight + val findLastIndexFrom: LodashFindLastIndexFrom + val gte: LodashGte + val path: LodashPath + val minBy: LodashMinBy + val defaults: LodashDefaults + val size: {} + val rangeRight: LodashRangeRight + val compose: LodashFlowRight + val stubObject: {} + val partialRight: LodashPartialRight + val trimCharsEnd: LodashTrimCharsEnd + val dropLastWhile: LodashDropRightWhile + val defaultsDeepAll: {} + val join: LodashJoin + val stubFalse: {} + val isSafeInteger: {} + val dropWhile: LodashDropWhile + val subtract: LodashSubtract + val map: LodashMap + val dissocPath: LodashUnset + val takeRight: LodashTakeRight + val assignAll: LodashAssignAll + val indexBy: LodashKeyBy + val updateWith: LodashUpdateWith + val equals: LodashIsEqual + val forInRight: LodashForInRight + val isArrayLikeObject: LodashIsArrayLikeObject + val startCase: {} + val intersection: LodashIntersection + val bindAll: LodashBindAll + val isNull: {} + val unset: LodashUnset + val T: {} + val sortedLastIndex: LodashSortedLastIndex + val startsWith: LodashStartsWith + val uniqWith: LodashUniqWith + val lastIndexOf: LodashLastIndexOf + val assignWith: LodashAssignWith + val invertBy: LodashInvertBy + val takeLast: LodashTakeRight + val all: LodashEvery + val rest: {} + val cloneDeepWith: LodashCloneDeepWith + val head: {} + val allPass: {} + val toNumber: {} + val findLastFrom: LodashFindLastFrom + val curry: LodashCurry + val takeRightWhile: LodashTakeRightWhile + val unzip: {} + val symmetricDifferenceWith: LodashXorWith + val result: LodashResult + val every: LodashEvery + val sumBy: LodashSumBy + val set: LodashSet + val sortBy: LodashSortBy + val before: LodashBefore + val truncate: LodashTruncate + val noConflict: {} + val F: {} + val pickBy: LodashPickBy + val capitalize: {} + val pullAllBy: LodashPullAllBy + val deburr: {} + val indexOfFrom: LodashIndexOfFrom + val flattenDeep: {} + val concat: LodashConcat + val partition: LodashPartition + val padChars: LodashPadChars + val bind: LodashBind + val entriesIn: LodashToPairsIn + val mean: {} + val uniqBy: LodashUniqBy + val unionWith: LodashUnionWith + val tap: LodashTap + val matchesProperty: LodashMatchesProperty + val toPlainObject: {} + val create: {} + val trimEnd: {} + val isTypedArray: {} + val assign: LodashAssign + val min: {} + val has: LodashHas + val zipWith: LodashZipWith + val sortedIndex: LodashSortedIndex + val propertyOf: LodashPropertyOf + val forEach: LodashForEach + val anyPass: {} + val toLower: {} + val snakeCase: {} + val setWith: LodashSetWith + val assignInAll: LodashAssignInAll + val findIndex: LodashFindIndex + val clamp: LodashClamp + val defaultTo: LodashDefaultTo + val divide: LodashDivide + val hasIn: LodashHasIn + val tail: {} + val isWeakSet: {} + val paths: LodashAt + val sortedLastIndexOf: LodashSortedLastIndexOf + val omitAll: LodashOmit + val each: LodashForEach + val last: {} + val lowerCase: {} + val juxt: {} + val placeholder: LoDashStatic + val dropRight: LodashDropRight + val pullAt: LodashPullAt + val extend: LodashExtend + val isWeakMap: {} + val mapKeys: LodashMapKeys + val isMatchWith: LodashIsMatchWith + val rangeStep: LodashRangeStep + val isInteger: {} + val findIndexFrom: LodashFindIndexFrom + val isMap: {} + val reject: LodashReject + val toSafeInteger: {} + val pad: LodashPad + val pullAllWith: LodashPullAllWith + val omitBy: LodashOmitBy + val forEachRight: LodashForEachRight + val drop: LodashDrop + val reverse: {} + val overEvery: {} + val assignAllWith: LodashAssignAllWith + val sortedIndexBy: LodashSortedIndexBy + val ceil: {} + val now: {} + val invokeMap: LodashInvokeMap + val filter: LodashFilter + val assignInAllWith: LodashAssignInAllWith + val escapeRegExp: {} + val toLength: {} + val noop: {} + val unzipWith: LodashUnzipWith + val upperCase: {} + val findKey: LodashFindKey + val useWith: LodashOverArgs + val isFinite: {} + val isFunction: {} + val cloneWith: LodashCloneWith + val mergeWith: LodashMergeWith + val endsWith: LodashEndsWith + val forIn: LodashForIn + val at: LodashAt + val merge: LodashMerge + val kebabCase: {} + val zipObj: LodashZipObject + val isPlainObject: {} + val pathOr: LodashPathOr + val ___: LoDashStatic + val over: {} + val isMatch: LodashIsMatch + val isEqualWith: LodashIsEqualWith + val dropLast: LodashDropRight + val isBoolean: {} + val remove: LodashRemove + val apply: {} + val trimStart: {} + val after: LodashAfter + val wrap: LodashWrap + val overArgs: LodashOverArgs + val max: {} + val upperFirst: {} + val entries: LodashToPairs + val conformsTo: LodashConformsTo + val escape: {} + val forOwn: LodashForOwn + val flatMap: LodashFlatMap + val eachRight: LodashForEachRight + val take: LodashTake + val findLast: LodashFindLast + val invoke: LodashInvoke + val omit: LodashOmit + val unnest: {} + val reduceRight: LodashReduceRight + val stubString: {} + val groupBy: LodashGroupBy + val isString: {} + val maxBy: LodashMaxBy + val fill: LodashFill + val negate: {} + val range: LodashRange + val curryN: LodashCurryN + val split: LodashSplit + val clone: {} + val pick: LodashPick + val flow: LodashFlow + val includesFrom: LodashIncludesFrom + val floor: {} + val pullAll: LodashPullAll + val xor: LodashXor + val flip: {} + val slice: LodashSlice + val castArray: {} + val ary: LodashAry + val reduce: LodashReduce + val times: LodashTimes + val orderBy: LodashOrderBy + val assocPath: LodashSet + val dissoc: LodashUnset + val toArray: LodashToArray + val intersectionWith: LodashIntersectionWith + val restFrom: LodashRestFrom + val isSymbol: {} + val isNumber: {} + val cloneDeep: {} + val first: {} + val multiply: LodashMultiply + val nth: LodashNth + val thru: LodashThru + val getOr: LodashGetOr + val functionsIn: {} + val mergeAllWith: LodashMergeAllWith + val isNaN: {} + val differenceBy: LodashDifferenceBy + val shuffle: LodashShuffle + val fromPairs: LodashFromPairs + val sample: LodashSample + val complement: {} + val words: {} + val assignInWith: LodashAssignInWith + val findFrom: LodashFindFrom + val template: {} + val lowerFirst: {} + val xorBy: LodashXorBy + val values: LodashValues + val toString: {} + val sampleSize: LodashSampleSize + val invokeArgsMap: LodashInvokeArgsMap + val pull: LodashPull + val round: {} + val property: LodashProperty + val overSome: {} + val iteratee: LodashIteratee + val isNil: {} + val isBuffer: {} + val lte: LodashLte + val prop: LodashProp + val zipObject: LodashZipObject + val padCharsEnd: LodashPadCharsEnd + val stubTrue: {} + val whereEq: LodashIsMatch + val defaultsAll: LodashDefaultsAll + val findLastIndex: LodashFindLastIndex + val flowRight: LodashFlowRight + val sortedUniq: {} + val functions: {} + val id"where": LodashConformsTo + val curryRightN: LodashCurryRightN + val cond: LodashCond + val assoc: LodashSet + val bindKey: LodashBindKey + val always: {} + val get: LodashGet + val trimChars: LodashTrimChars + val isObject: {} + val repeat: LodashRepeat + val pipe: LodashFlow + val update: LodashUpdate + val zipObjectDeep: LodashZipObjectDeep + val toPairs: LodashToPairs + val props: LodashAt + val invert: {} + val isArrayLike: LodashIsArrayLike + val identity: LodashIdentity + val mapValues: LodashMapValues + val isUndefined: {} + val meanBy: LodashMeanBy + val pickAll: LodashPick + val attempt: {} + val forOwnRight: LodashForOwnRight + val trim: {} + val extendAllWith: LodashExtendAllWith + val isArrayBuffer: {} + val throttle: LodashThrottle + val matches: LodashIsMatch + val parseInt: LodashParseInt + val uniqueId: {} + val valuesIn: LodashValuesIn + val stubArray: {} + val includes: LodashIncludes + val lastIndexOfFrom: LodashLastIndexOfFrom + val invokeArgs: LodashInvokeArgs + val isNative: {} + val flatMapDeep: LodashFlatMapDeep + val contains: LodashContains + val isEmpty: LodashIsEmpty + val isArguments: {} + val conforms: LodashConformsTo + val xorWith: LodashXorWith + val flattenDepth: LodashFlattenDepth + val isSet: {} + val add: LodashAdd + val init: {} + val lt: LodashLt + val difference: LodashDifference + val keyBy: LodashKeyBy + val isRegExp: {} + val padCharsStart: LodashPadCharsStart + val transform: LodashTransform + val some: LodashSome + val indexOf: LodashIndexOf + val padStart: LodashPadStart + val intersectionBy: LodashIntersectionBy + val curryRight: LodashCurryRight + val isElement: {} + val unescape: {} + val gt: LodashGt + val keysIn: {} + val inRange: LodashInRange + val pluck: LodashMap + val methodOf: {} + val symmetricDifferenceBy: LodashXorBy + val sortedUniqBy: LodashSortedUniqBy + val spreadFrom: LodashSpreadFrom + val eq: LodashEq + val sum: {} + val without: LodashWithout + val propEq: LodashMatchesProperty + val nthArg: {} + val keys: {} + val zipAll: LodashZipAll + val compact: {} + val invertObj: {} + val debounce: LodashDebounce + val identical: LodashEq + val camelCase: {} + val isObjectLike: {} + val trimCharsStart: LodashTrimCharsStart + val toUpper: {} + val memoize: {} + } +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi new file mode 100644 index 000000000..9a6d39bd8 --- /dev/null +++ b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi @@ -0,0 +1,9 @@ +export declare module index { + declare module __global { + export declare trait Set[T] {} + export declare trait Map[K, V] {} + export declare trait WeakSet[T] {} + export declare trait WeakMap[K, V] {} + } + export declare trait LoDashStatic {} +} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi index 51a100e1d..f5eebb252 100644 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi +++ b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi @@ -1,6 +1,6 @@ import "./stringify.mlsi" import "./parse.mlsi" export declare module json5 { - export val parse = parse.parse - export val stringify = stringify.stringify + export val parse = parse + export val stringify = stringify } diff --git a/driver/js/src/test/projects/js/mlscript/Lodash.js b/driver/js/src/test/projects/js/mlscript/Lodash.js new file mode 100644 index 000000000..150990fab --- /dev/null +++ b/driver/js/src/test/projects/js/mlscript/Lodash.js @@ -0,0 +1,18 @@ +import fp from "lodash/fp" + +const Lodash = new class Lodash { + constructor() { + } + inc(x) { + return x + 1; + } + $init() { + const self = this; + console.log(fp.map(self.inc)([ + 1, + 2, + 3 + ])); + } +}; +Lodash.$init(); diff --git a/driver/js/src/test/projects/mlscript/Lodash.mls b/driver/js/src/test/projects/mlscript/Lodash.mls new file mode 100644 index 000000000..cac91136b --- /dev/null +++ b/driver/js/src/test/projects/mlscript/Lodash.mls @@ -0,0 +1,4 @@ +import "lodash/fp" + +fun inc(x: Int) = x + 1 +console.log(fp.map(inc)([1, 2, 3])) diff --git a/driver/js/src/test/projects/package-lock.json b/driver/js/src/test/projects/package-lock.json index d091f9638..a066f3c89 100644 --- a/driver/js/src/test/projects/package-lock.json +++ b/driver/js/src/test/projects/package-lock.json @@ -5,10 +5,17 @@ "packages": { "": { "dependencies": { + "@types/lodash": "^4.14.195", "fp-ts": "^2.16.0", - "json5": "^2.2.3" + "json5": "^2.2.3", + "lodash": "^4.17.21" } }, + "node_modules/@types/lodash": { + "version": "4.14.195", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", + "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" + }, "node_modules/fp-ts": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", @@ -24,9 +31,19 @@ "engines": { "node": ">=6" } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } }, "dependencies": { + "@types/lodash": { + "version": "4.14.195", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", + "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" + }, "fp-ts": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", @@ -36,6 +53,11 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } } } diff --git a/driver/js/src/test/projects/package.json b/driver/js/src/test/projects/package.json index 80cb02650..0c0be0186 100644 --- a/driver/js/src/test/projects/package.json +++ b/driver/js/src/test/projects/package.json @@ -1,7 +1,9 @@ { "dependencies": { + "@types/lodash": "^4.14.195", "fp-ts": "^2.16.0", - "json5": "^2.2.3" + "json5": "^2.2.3", + "lodash": "^4.17.21" }, "module": "es2015" } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 183f6e5e8..21f0618bb 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -70,38 +70,39 @@ object DriverDiffTests { TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, ignoreTypeError, expectError) private val testCases = List[TestOption]( - // entry("Simple"), - // entry("Cycle2"), - // entry("Self", expectError = true), - // entry("C", ignoreTypeError = true, expectError = true), - // entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members - // entry("Output", Some("./tsconfig.json")), - // entry("Output2", Some("./tsconfig.json")), - // entry("MLS2TheMax", Some("./tsconfig.json")), - // entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + entry("Simple"), + entry("Cycle2"), + entry("Self", expectError = true), + entry("C", ignoreTypeError = true, expectError = true), + entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members + entry("Output", Some("./tsconfig.json")), + entry("Output2", Some("./tsconfig.json")), + entry("MLS2TheMax", Some("./tsconfig.json")), + entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + entry("Lodash", Some("./tsconfig.json"), expectError = true), // TODO: generate correct import and check typing entry("Builtin"), - // ts2mlsEntry("BasicFunctions", ignoreTypeError = true), - // ts2mlsEntry("ClassMember"), - // ts2mlsEntry("Cycle1", ignoreTypeError = true), - // ts2mlsEntry("Dec", ignoreTypeError = true), - // ts2mlsEntry("Enum"), - // ts2mlsEntry("Escape"), - // ts2mlsEntry("Export", ignoreTypeError = true), - // ts2mlsEntry("Heritage", ignoreTypeError = true), - // ts2mlsEntry("HighOrderFunc"), - // ts2mlsEntry("Import"), - // ts2mlsEntry("InterfaceMember", ignoreTypeError = true), - // ts2mlsEntry("Intersection", ignoreTypeError = true), - // ts2mlsEntry("Literal"), - // ts2mlsEntry("Namespace", expectError = true), - // ts2mlsEntry("Optional", ignoreTypeError = true), - // ts2mlsEntry("Overload", ignoreTypeError = true), - // ts2mlsEntry("TSArray", ignoreTypeError = true), - // ts2mlsEntry("Tuple", ignoreTypeError = true), - // ts2mlsEntry("Type", ignoreTypeError = true), - // ts2mlsEntry("TypeParameter", ignoreTypeError = true), - // ts2mlsEntry("Union"), - // ts2mlsEntry("Variables", expectError = true), + ts2mlsEntry("BasicFunctions", ignoreTypeError = true), + ts2mlsEntry("ClassMember"), + ts2mlsEntry("Cycle1", ignoreTypeError = true), + ts2mlsEntry("Dec", ignoreTypeError = true), + ts2mlsEntry("Enum"), + ts2mlsEntry("Escape"), + ts2mlsEntry("Export", ignoreTypeError = true), + ts2mlsEntry("Heritage", ignoreTypeError = true), + ts2mlsEntry("HighOrderFunc"), + ts2mlsEntry("Import"), + ts2mlsEntry("InterfaceMember", ignoreTypeError = true), + ts2mlsEntry("Intersection", ignoreTypeError = true), + ts2mlsEntry("Literal"), + ts2mlsEntry("Namespace", expectError = true), + ts2mlsEntry("Optional", ignoreTypeError = true), + ts2mlsEntry("Overload", ignoreTypeError = true), + ts2mlsEntry("TSArray", ignoreTypeError = true), + ts2mlsEntry("Tuple", ignoreTypeError = true), + ts2mlsEntry("Type", ignoreTypeError = true), + ts2mlsEntry("TypeParameter", ignoreTypeError = true), + ts2mlsEntry("Union"), + ts2mlsEntry("Variables", expectError = true), ) private val cp = g.require("child_process") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index a4cff0985..287695944 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -8,6 +8,10 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { // name -> (namespace/type, export) private val subSpace = HashMap[String, (TSNamespace, Boolean)]() private val members = HashMap[String, (TSType, Boolean)]() + private lazy val umd = + members.keys.find(name => subSpace.contains(name)).fold[Option[String]](None)( + name => Option.when(members(name)._2)(name) + ) // write down the order of members // easier to check the output one by one @@ -81,33 +85,57 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { private def expStr(exp: Boolean) = if (exp) "export " else "" - def generate(writer: JSWriter, indent: String): Unit = + private def generateInOrder(order: List[Either[String, String]], writer: JSWriter, indent: String) = order.toList.foreach((p) => p match { - case Left(subName) => { + case Left(subName) => val ss = subSpace(subName) writer.writeln(s"${indent}${expStr(ss._2)}declare module ${Converter.escapeIdent(subName)} {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") - } - case Right(name) => { - val (mem, exp) = members(name) - mem match { - case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) - case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) - case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) - case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) - case TSInterfaceType(name, _, _, _) if (name =/= "") => - writer.writeln(Converter.convert(mem, exp)(indent)) - case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) - case TSRenamedType(name, original) => - writer.writeln(s"${indent}${if (exp) "export " else ""}val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") - case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)}: ${Converter.convert(mem)("")}") + case Right(name) => + if (subSpace.contains(name)) writer.writeln(s"$indent// WARNING: namespace $name has been declared") + else { + val (mem, exp) = members(name) + mem match { + case inter: TSIntersectionType => // overloaded functions + writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) + case f: TSFunctionType => + writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) + case overload: TSIgnoredOverload => + writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) + case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) + case TSInterfaceType(name, _, _, _) if (name =/= "") => + writer.writeln(Converter.convert(mem, exp)(indent)) + case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) + case TSRenamedType(name, original) => + writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") + case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)}: ${Converter.convert(mem)("")}") + } } - } }) + + private def generateUMD(name: String, writer: JSWriter, indent: String)(implicit ns: TSNamespace) = members(name)._1 match { + case TSReferenceType(realType) => ns.get(realType) match { + case TSInterfaceType(itf, members, _, _) => + members.foreach{ + case (name, TSMemberType(tp, _)) => + writer.writeln(s"${indent}export val ${Converter.escapeIdent(name)}: ${Converter.convert(tp, false)("")}") + } + generateInOrder(order.toList.filter{ + case Left(value) => value =/= name + case Right(value) => value =/= name + }, writer, indent) + ns.generate(writer, indent) + case _ => generateInOrder(order.toList, writer, indent) + } + case _ => generateInOrder(order.toList, writer, indent) + } + + def generate(writer: JSWriter, indent: String): Unit = + umd match { + case Some(name) => generateUMD(name, writer, indent)(subSpace(name)._1) + case _ => generateInOrder(order.toList, writer, indent) + } } object TSNamespace { diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index e764f17c7..12fe3aeb5 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -365,7 +365,7 @@ declare trait TypedPropertyDescriptor[T] { val writable: ((false) | (true)) | (undefined) val value: (T) | (undefined) } -type PromiseConstructorLike = (executor: (resolve: (value: (T) | (PromiseLike[T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike[T] +type PromiseConstructorLike = unsupported["declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;", "ES5.d.ts", 1488, 1] declare trait PromiseLike[T] { fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): PromiseLike[(TResult1) | (TResult2)] } From 9d30fee6787b58f24503de63b80605e24b8fea8c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sun, 25 Jun 2023 11:01:46 +0800 Subject: [PATCH 129/202] WIP: Add module setting --- .gitignore | 1 - driver/js/src/main/scala/driver/Driver.scala | 13 +- .../src/main/scala/driver/DriverBackend.scala | 8 +- .../src/main/scala/driver/DriverOptions.scala | 1 + .../.interfaces/mlscript/Lodash.mlsi | 0 .../js/mlscript/Lodash.js | 2 +- .../js/src/test/cjsprojects/js/package.json | 1 + .../mlscript/Lodash.mls | 0 .../js/src/test/cjsprojects/package-lock.json | 35 + .../{projects => cjsprojects}/package.json | 4 +- driver/js/src/test/cjsprojects/tsconfig.json | 11 + .../.interfaces/mlscript/A.mlsi | 0 .../.interfaces/mlscript/B.mlsi | 0 .../.interfaces/mlscript/Builtin.mlsi | 0 .../.interfaces/mlscript/C.mlsi | 0 .../.interfaces/mlscript/Cycle1.mlsi | 0 .../.interfaces/mlscript/Cycle2.mlsi | 0 .../.interfaces/mlscript/MLS2TheMax.mlsi | 0 .../.interfaces/mlscript/Opened.mlsi | 0 .../.interfaces/mlscript/Output.mlsi | 0 .../.interfaces/mlscript/Output2.mlsi | 0 .../.interfaces/mlscript/Simple.mlsi | 0 .../.interfaces/mlscript/TS.mlsi | 0 .../.interfaces/mlscript/tools/Concat.mlsi | 0 .../.interfaces/mlscript/tools/Inc.mlsi | 0 .../.interfaces/ts/ConfigGen.mlsi | 0 .../.interfaces/ts/MyPrint.mlsi | 0 .../.interfaces/ts/ReadLine.mlsi | 0 .../{projects => esprojects}/js/mlscript/A.js | 0 .../{projects => esprojects}/js/mlscript/B.js | 0 .../js/mlscript/Builtin.js | 0 .../js/mlscript/Cycle1.js | 0 .../js/mlscript/Cycle2.js | 0 .../js/mlscript/MLS2TheMax.js | 0 .../js/mlscript/Opened.js | 0 .../js/mlscript/Output.js | 0 .../js/mlscript/Output2.js | 0 .../js/mlscript/Simple.js | 0 .../js/mlscript/TS.js | 0 .../js/mlscript/tools/Concat.js | 0 .../js/mlscript/tools/Inc.js | 0 .../js/my_ts_path/ConfigGen.js | 0 .../js/my_ts_path/MyPrint.js | 0 .../js/my_ts_path/ReadLine.js | 0 driver/js/src/test/esprojects/js/package.json | 1 + .../{projects => esprojects}/mlscript/A.mls | 0 .../{projects => esprojects}/mlscript/B.mls | 0 .../mlscript/Builtin.mls | 0 .../{projects => esprojects}/mlscript/C.mls | 0 .../mlscript/Cycle1.mls | 0 .../mlscript/Cycle2.mls | 0 .../mlscript/MLS2TheMax.mls | 0 .../mlscript/MyPartialOrder.mls | 0 .../mlscript/Opened.mls | 0 .../mlscript/Output.mls | 0 .../mlscript/Output2.mls | 0 .../mlscript/Self.mls | 0 .../mlscript/Simple.mls | 0 .../{projects => esprojects}/mlscript/TS.mls | 0 .../mlscript/tools/Concat.mls | 0 .../mlscript/tools/Inc.mls | 0 .../package-lock.json | 0 driver/js/src/test/esprojects/package.json | 7 + .../{projects => esprojects}/ts/ConfigGen.ts | 0 .../{projects => esprojects}/ts/MyPrint.ts | 0 .../{projects => esprojects}/ts/ReadLine.ts | 0 .../{projects => esprojects}/tsconfig.json | 0 .../node_modules/@types/lodash/fp.mlsi | 3143 ----------------- .../node_modules/@types/lodash/index.mlsi | 9 - .../fp-ts/lib/BoundedMeetSemilattice.mlsi | 6 - .../fp-ts/lib/MeetSemilattice.mlsi | 5 - .../node_modules/json5/lib/json5.mlsi | 6 - .../node_modules/json5/lib/parse.mlsi | 3 - .../node_modules/json5/lib/stringify.mlsi | 4 - driver/js/src/test/projects/js/package.json | 1 - .../test/scala/driver/DriverDiffTests.scala | 67 +- .../main/scala/mlscript/codegen/Codegen.scala | 6 +- 77 files changed, 119 insertions(+), 3215 deletions(-) rename driver/js/src/test/{projects => cjsprojects}/.interfaces/mlscript/Lodash.mlsi (100%) rename driver/js/src/test/{projects => cjsprojects}/js/mlscript/Lodash.js (87%) create mode 100644 driver/js/src/test/cjsprojects/js/package.json rename driver/js/src/test/{projects => cjsprojects}/mlscript/Lodash.mls (100%) create mode 100644 driver/js/src/test/cjsprojects/package-lock.json rename driver/js/src/test/{projects => cjsprojects}/package.json (56%) create mode 100644 driver/js/src/test/cjsprojects/tsconfig.json rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/A.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/B.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Builtin.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/C.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Cycle1.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Cycle2.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/MLS2TheMax.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Opened.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Output.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Output2.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/Simple.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/TS.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/tools/Concat.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/mlscript/tools/Inc.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/ts/ConfigGen.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/ts/MyPrint.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/.interfaces/ts/ReadLine.mlsi (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/A.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/B.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Builtin.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Cycle1.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Cycle2.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/MLS2TheMax.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Opened.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Output.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Output2.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/Simple.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/TS.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/tools/Concat.js (100%) rename driver/js/src/test/{projects => esprojects}/js/mlscript/tools/Inc.js (100%) rename driver/js/src/test/{projects => esprojects}/js/my_ts_path/ConfigGen.js (100%) rename driver/js/src/test/{projects => esprojects}/js/my_ts_path/MyPrint.js (100%) rename driver/js/src/test/{projects => esprojects}/js/my_ts_path/ReadLine.js (100%) create mode 100644 driver/js/src/test/esprojects/js/package.json rename driver/js/src/test/{projects => esprojects}/mlscript/A.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/B.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Builtin.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/C.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Cycle1.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Cycle2.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/MLS2TheMax.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/MyPartialOrder.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Opened.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Output.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Output2.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Self.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/Simple.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/TS.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/tools/Concat.mls (100%) rename driver/js/src/test/{projects => esprojects}/mlscript/tools/Inc.mls (100%) rename driver/js/src/test/{projects => esprojects}/package-lock.json (100%) create mode 100644 driver/js/src/test/esprojects/package.json rename driver/js/src/test/{projects => esprojects}/ts/ConfigGen.ts (100%) rename driver/js/src/test/{projects => esprojects}/ts/MyPrint.ts (100%) rename driver/js/src/test/{projects => esprojects}/ts/ReadLine.ts (100%) rename driver/js/src/test/{projects => esprojects}/tsconfig.json (100%) delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi delete mode 100644 driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi delete mode 100644 driver/js/src/test/projects/js/package.json diff --git a/.gitignore b/.gitignore index dbfae3e07..4a989b4c7 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ project/Dependencies.scala project/metals.sbt **.worksheet.sc .DS_Store -!driver/js/src/test/projects/.interfaces/node_modules diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 78e70421e..40c3c3a56 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -76,11 +76,12 @@ class Driver(options: DriverOptions) { false } - def genPackageJson(): Unit = - if (!exists(s"${options.outputDir}/package.json")) { - val content = "{ 'type': 'module' }\n" // TODO: more settings? - saveToFile(s"${options.outputDir}/package.json", content) - } + def genPackageJson(): Unit = { + val content = // TODO: more settings? + if (!options.commonJS) "{ \"type\": \"module\" }\n" + else "{ \"type\": \"commonjs\" }\n" + saveToFile(s"${options.outputDir}/package.json", content) + } type ParseResult = (List[Statement], List[NuDecl], List[Import], Origin) private def parse(filename: String, content: String): ParseResult = { @@ -262,7 +263,7 @@ class Driver(options: DriverOptions) { ): Unit = try { val backend = new JSDriverBackend() jsBuiltinDecs.foreach(lst => backend.declareJSBuiltin(Pgrm(lst))) - val lines = backend(program, moduleName, imports, exported) + val lines = backend(program, moduleName, imports, exported, options.commonJS) val code = lines.mkString("", "\n", "\n") saveToFile(filename, code) } catch { diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala index 191bf03b2..10813043b 100644 --- a/driver/js/src/main/scala/driver/DriverBackend.scala +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -48,23 +48,23 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { import JSDriverBackend.ModuleType - private def translateImport(imp: Import with ModuleType) = { + private def translateImport(imp: Import with ModuleType, commonJS: Bool) = { val path = imp.path val last = path.lastIndexOf(".") JSImport( path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), - imp.isESModule + imp.isESModule, commonJS ) } - def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool): Ls[Str] = { + def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool, commonJS: Bool): Ls[Str] = { imports.flatMap (imp => { val path = imp.path val last = path.lastIndexOf(".") val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) topLevelScope.declareValue(moduleName, Some(false), false) - translateImport(imp).toSourceCode.toLines + translateImport(imp, commonJS).toSourceCode.toLines }) ::: generateNewDef(pgrm, topModuleName, exported) } } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index af3f347ea..d6b06909f 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -11,6 +11,7 @@ final case class DriverOptions( outputDir: String, tsconfig: Option[String], interfaceDir: String, + commonJS: Boolean, // generate common js or es5 ignoreTypeError: Boolean, force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Lodash.mlsi rename to driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi diff --git a/driver/js/src/test/projects/js/mlscript/Lodash.js b/driver/js/src/test/cjsprojects/js/mlscript/Lodash.js similarity index 87% rename from driver/js/src/test/projects/js/mlscript/Lodash.js rename to driver/js/src/test/cjsprojects/js/mlscript/Lodash.js index 150990fab..983858c7b 100644 --- a/driver/js/src/test/projects/js/mlscript/Lodash.js +++ b/driver/js/src/test/cjsprojects/js/mlscript/Lodash.js @@ -1,4 +1,4 @@ -import fp from "lodash/fp" +const fp = require("lodash/fp") const Lodash = new class Lodash { constructor() { diff --git a/driver/js/src/test/cjsprojects/js/package.json b/driver/js/src/test/cjsprojects/js/package.json new file mode 100644 index 000000000..a3c15a7a6 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/package.json @@ -0,0 +1 @@ +{ "type": "commonjs" } diff --git a/driver/js/src/test/projects/mlscript/Lodash.mls b/driver/js/src/test/cjsprojects/mlscript/Lodash.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Lodash.mls rename to driver/js/src/test/cjsprojects/mlscript/Lodash.mls diff --git a/driver/js/src/test/cjsprojects/package-lock.json b/driver/js/src/test/cjsprojects/package-lock.json new file mode 100644 index 000000000..85f6be4c8 --- /dev/null +++ b/driver/js/src/test/cjsprojects/package-lock.json @@ -0,0 +1,35 @@ +{ + "name": "cjsprojects", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "dependencies": { + "@types/lodash": "^4.14.195", + "lodash": "^4.17.21" + } + }, + "node_modules/@types/lodash": { + "version": "4.14.195", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", + "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + } + }, + "dependencies": { + "@types/lodash": { + "version": "4.14.195", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", + "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" + }, + "lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" + } + } +} diff --git a/driver/js/src/test/projects/package.json b/driver/js/src/test/cjsprojects/package.json similarity index 56% rename from driver/js/src/test/projects/package.json rename to driver/js/src/test/cjsprojects/package.json index 0c0be0186..19f9fec2d 100644 --- a/driver/js/src/test/projects/package.json +++ b/driver/js/src/test/cjsprojects/package.json @@ -1,9 +1,7 @@ { "dependencies": { "@types/lodash": "^4.14.195", - "fp-ts": "^2.16.0", - "json5": "^2.2.3", "lodash": "^4.17.21" }, - "module": "es2015" + "module": "commonJS" } diff --git a/driver/js/src/test/cjsprojects/tsconfig.json b/driver/js/src/test/cjsprojects/tsconfig.json new file mode 100644 index 000000000..086094bd7 --- /dev/null +++ b/driver/js/src/test/cjsprojects/tsconfig.json @@ -0,0 +1,11 @@ +{ + "compilerOptions": { + "outDir": "js/ts", + "module": "CommonJS", + "target": "ES2015", + "moduleResolution": "node", + "allowJs": true, + "esModuleInterop": true + }, + "include": ["ts/*"], +} diff --git a/driver/js/src/test/projects/.interfaces/mlscript/A.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/A.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/B.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/B.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Builtin.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/C.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/C.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Cycle1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Cycle1.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Cycle2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Cycle2.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/MLS2TheMax.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Opened.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Opened.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Output.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Output2.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/Simple.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/Simple.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/TS.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/tools/Concat.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi diff --git a/driver/js/src/test/projects/.interfaces/mlscript/tools/Inc.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/mlscript/tools/Inc.mlsi rename to driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi diff --git a/driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/ts/ConfigGen.mlsi rename to driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi diff --git a/driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/ts/MyPrint.mlsi rename to driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi diff --git a/driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi similarity index 100% rename from driver/js/src/test/projects/.interfaces/ts/ReadLine.mlsi rename to driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi diff --git a/driver/js/src/test/projects/js/mlscript/A.js b/driver/js/src/test/esprojects/js/mlscript/A.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/A.js rename to driver/js/src/test/esprojects/js/mlscript/A.js diff --git a/driver/js/src/test/projects/js/mlscript/B.js b/driver/js/src/test/esprojects/js/mlscript/B.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/B.js rename to driver/js/src/test/esprojects/js/mlscript/B.js diff --git a/driver/js/src/test/projects/js/mlscript/Builtin.js b/driver/js/src/test/esprojects/js/mlscript/Builtin.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Builtin.js rename to driver/js/src/test/esprojects/js/mlscript/Builtin.js diff --git a/driver/js/src/test/projects/js/mlscript/Cycle1.js b/driver/js/src/test/esprojects/js/mlscript/Cycle1.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Cycle1.js rename to driver/js/src/test/esprojects/js/mlscript/Cycle1.js diff --git a/driver/js/src/test/projects/js/mlscript/Cycle2.js b/driver/js/src/test/esprojects/js/mlscript/Cycle2.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Cycle2.js rename to driver/js/src/test/esprojects/js/mlscript/Cycle2.js diff --git a/driver/js/src/test/projects/js/mlscript/MLS2TheMax.js b/driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/MLS2TheMax.js rename to driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js diff --git a/driver/js/src/test/projects/js/mlscript/Opened.js b/driver/js/src/test/esprojects/js/mlscript/Opened.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Opened.js rename to driver/js/src/test/esprojects/js/mlscript/Opened.js diff --git a/driver/js/src/test/projects/js/mlscript/Output.js b/driver/js/src/test/esprojects/js/mlscript/Output.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Output.js rename to driver/js/src/test/esprojects/js/mlscript/Output.js diff --git a/driver/js/src/test/projects/js/mlscript/Output2.js b/driver/js/src/test/esprojects/js/mlscript/Output2.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Output2.js rename to driver/js/src/test/esprojects/js/mlscript/Output2.js diff --git a/driver/js/src/test/projects/js/mlscript/Simple.js b/driver/js/src/test/esprojects/js/mlscript/Simple.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/Simple.js rename to driver/js/src/test/esprojects/js/mlscript/Simple.js diff --git a/driver/js/src/test/projects/js/mlscript/TS.js b/driver/js/src/test/esprojects/js/mlscript/TS.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/TS.js rename to driver/js/src/test/esprojects/js/mlscript/TS.js diff --git a/driver/js/src/test/projects/js/mlscript/tools/Concat.js b/driver/js/src/test/esprojects/js/mlscript/tools/Concat.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/tools/Concat.js rename to driver/js/src/test/esprojects/js/mlscript/tools/Concat.js diff --git a/driver/js/src/test/projects/js/mlscript/tools/Inc.js b/driver/js/src/test/esprojects/js/mlscript/tools/Inc.js similarity index 100% rename from driver/js/src/test/projects/js/mlscript/tools/Inc.js rename to driver/js/src/test/esprojects/js/mlscript/tools/Inc.js diff --git a/driver/js/src/test/projects/js/my_ts_path/ConfigGen.js b/driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js similarity index 100% rename from driver/js/src/test/projects/js/my_ts_path/ConfigGen.js rename to driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js diff --git a/driver/js/src/test/projects/js/my_ts_path/MyPrint.js b/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js similarity index 100% rename from driver/js/src/test/projects/js/my_ts_path/MyPrint.js rename to driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js diff --git a/driver/js/src/test/projects/js/my_ts_path/ReadLine.js b/driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js similarity index 100% rename from driver/js/src/test/projects/js/my_ts_path/ReadLine.js rename to driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js diff --git a/driver/js/src/test/esprojects/js/package.json b/driver/js/src/test/esprojects/js/package.json new file mode 100644 index 000000000..5ffd9800b --- /dev/null +++ b/driver/js/src/test/esprojects/js/package.json @@ -0,0 +1 @@ +{ "type": "module" } diff --git a/driver/js/src/test/projects/mlscript/A.mls b/driver/js/src/test/esprojects/mlscript/A.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/A.mls rename to driver/js/src/test/esprojects/mlscript/A.mls diff --git a/driver/js/src/test/projects/mlscript/B.mls b/driver/js/src/test/esprojects/mlscript/B.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/B.mls rename to driver/js/src/test/esprojects/mlscript/B.mls diff --git a/driver/js/src/test/projects/mlscript/Builtin.mls b/driver/js/src/test/esprojects/mlscript/Builtin.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Builtin.mls rename to driver/js/src/test/esprojects/mlscript/Builtin.mls diff --git a/driver/js/src/test/projects/mlscript/C.mls b/driver/js/src/test/esprojects/mlscript/C.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/C.mls rename to driver/js/src/test/esprojects/mlscript/C.mls diff --git a/driver/js/src/test/projects/mlscript/Cycle1.mls b/driver/js/src/test/esprojects/mlscript/Cycle1.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Cycle1.mls rename to driver/js/src/test/esprojects/mlscript/Cycle1.mls diff --git a/driver/js/src/test/projects/mlscript/Cycle2.mls b/driver/js/src/test/esprojects/mlscript/Cycle2.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Cycle2.mls rename to driver/js/src/test/esprojects/mlscript/Cycle2.mls diff --git a/driver/js/src/test/projects/mlscript/MLS2TheMax.mls b/driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/MLS2TheMax.mls rename to driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls diff --git a/driver/js/src/test/projects/mlscript/MyPartialOrder.mls b/driver/js/src/test/esprojects/mlscript/MyPartialOrder.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/MyPartialOrder.mls rename to driver/js/src/test/esprojects/mlscript/MyPartialOrder.mls diff --git a/driver/js/src/test/projects/mlscript/Opened.mls b/driver/js/src/test/esprojects/mlscript/Opened.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Opened.mls rename to driver/js/src/test/esprojects/mlscript/Opened.mls diff --git a/driver/js/src/test/projects/mlscript/Output.mls b/driver/js/src/test/esprojects/mlscript/Output.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Output.mls rename to driver/js/src/test/esprojects/mlscript/Output.mls diff --git a/driver/js/src/test/projects/mlscript/Output2.mls b/driver/js/src/test/esprojects/mlscript/Output2.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Output2.mls rename to driver/js/src/test/esprojects/mlscript/Output2.mls diff --git a/driver/js/src/test/projects/mlscript/Self.mls b/driver/js/src/test/esprojects/mlscript/Self.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Self.mls rename to driver/js/src/test/esprojects/mlscript/Self.mls diff --git a/driver/js/src/test/projects/mlscript/Simple.mls b/driver/js/src/test/esprojects/mlscript/Simple.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/Simple.mls rename to driver/js/src/test/esprojects/mlscript/Simple.mls diff --git a/driver/js/src/test/projects/mlscript/TS.mls b/driver/js/src/test/esprojects/mlscript/TS.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/TS.mls rename to driver/js/src/test/esprojects/mlscript/TS.mls diff --git a/driver/js/src/test/projects/mlscript/tools/Concat.mls b/driver/js/src/test/esprojects/mlscript/tools/Concat.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/tools/Concat.mls rename to driver/js/src/test/esprojects/mlscript/tools/Concat.mls diff --git a/driver/js/src/test/projects/mlscript/tools/Inc.mls b/driver/js/src/test/esprojects/mlscript/tools/Inc.mls similarity index 100% rename from driver/js/src/test/projects/mlscript/tools/Inc.mls rename to driver/js/src/test/esprojects/mlscript/tools/Inc.mls diff --git a/driver/js/src/test/projects/package-lock.json b/driver/js/src/test/esprojects/package-lock.json similarity index 100% rename from driver/js/src/test/projects/package-lock.json rename to driver/js/src/test/esprojects/package-lock.json diff --git a/driver/js/src/test/esprojects/package.json b/driver/js/src/test/esprojects/package.json new file mode 100644 index 000000000..80cb02650 --- /dev/null +++ b/driver/js/src/test/esprojects/package.json @@ -0,0 +1,7 @@ +{ + "dependencies": { + "fp-ts": "^2.16.0", + "json5": "^2.2.3" + }, + "module": "es2015" +} diff --git a/driver/js/src/test/projects/ts/ConfigGen.ts b/driver/js/src/test/esprojects/ts/ConfigGen.ts similarity index 100% rename from driver/js/src/test/projects/ts/ConfigGen.ts rename to driver/js/src/test/esprojects/ts/ConfigGen.ts diff --git a/driver/js/src/test/projects/ts/MyPrint.ts b/driver/js/src/test/esprojects/ts/MyPrint.ts similarity index 100% rename from driver/js/src/test/projects/ts/MyPrint.ts rename to driver/js/src/test/esprojects/ts/MyPrint.ts diff --git a/driver/js/src/test/projects/ts/ReadLine.ts b/driver/js/src/test/esprojects/ts/ReadLine.ts similarity index 100% rename from driver/js/src/test/projects/ts/ReadLine.ts rename to driver/js/src/test/esprojects/ts/ReadLine.ts diff --git a/driver/js/src/test/projects/tsconfig.json b/driver/js/src/test/esprojects/tsconfig.json similarity index 100% rename from driver/js/src/test/projects/tsconfig.json rename to driver/js/src/test/esprojects/tsconfig.json diff --git a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi deleted file mode 100644 index e929b7b69..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/fp.mlsi +++ /dev/null @@ -1,3143 +0,0 @@ -import "./index.mlsi" -export declare module fp { - export val extendWith: LodashExtendWith - export val sortedIndexOf: LodashSortedIndexOf - export val toInteger: {} - export val mergeAll: LodashMergeAll - export val isDate: {} - export val defer: {} - export val unapply: {} - export val toPath: {} - export val takeLastWhile: LodashTakeRightWhile - export val constant: {} - export val countBy: LodashCountBy - export val flatMapDepth: LodashFlatMapDepth - export val isLength: {} - export val find: LodashFind - export val rearg: LodashRearg - export val dropRightWhile: LodashDropRightWhile - export val flatten: {} - export val method: {} - export val unary: {} - export val findLastKey: LodashFindLastKey - export val toFinite: {} - export val any: LodashSome - export val uniq: {} - export val extendAll: LodashExtendAll - export val assignIn: LodashAssignIn - export val padEnd: LodashPadEnd - export val once: {} - export val random: LodashRandom - export val nAry: LodashAry - export val spread: {} - export val propOr: LodashPropOr - export val symmetricDifference: LodashXor - export val chunk: LodashChunk - export val toPairsIn: LodashToPairsIn - export val isArray: {} - export val delay: LodashDelay - export val replace: LodashReplace - export val unionBy: LodashUnionBy - export val differenceWith: LodashDifferenceWith - export val isEqual: LodashIsEqual - export val runInContext: {} - export val takeWhile: LodashTakeWhile - export val isError: {} - export val pathEq: LodashMatchesProperty - export val partial: LodashPartial - export val union: LodashUnion - export val defaultsDeep: LodashDefaultsDeep - export val zip: LodashZip - export val sortedLastIndexBy: LodashSortedLastIndexBy - export val initial: {} - export val rangeStepRight: LodashRangeStepRight - export val findLastIndexFrom: LodashFindLastIndexFrom - export val gte: LodashGte - export val path: LodashPath - export val minBy: LodashMinBy - export val defaults: LodashDefaults - export val size: {} - export val rangeRight: LodashRangeRight - export val compose: LodashFlowRight - export val stubObject: {} - export val partialRight: LodashPartialRight - export val trimCharsEnd: LodashTrimCharsEnd - export val dropLastWhile: LodashDropRightWhile - export val defaultsDeepAll: {} - export val join: LodashJoin - export val stubFalse: {} - export val isSafeInteger: {} - export val dropWhile: LodashDropWhile - export val subtract: LodashSubtract - export val map: LodashMap - export val dissocPath: LodashUnset - export val takeRight: LodashTakeRight - export val assignAll: LodashAssignAll - export val indexBy: LodashKeyBy - export val updateWith: LodashUpdateWith - export val equals: LodashIsEqual - export val forInRight: LodashForInRight - export val isArrayLikeObject: LodashIsArrayLikeObject - export val startCase: {} - export val intersection: LodashIntersection - export val bindAll: LodashBindAll - export val isNull: {} - export val unset: LodashUnset - export val T: {} - export val sortedLastIndex: LodashSortedLastIndex - export val startsWith: LodashStartsWith - export val uniqWith: LodashUniqWith - export val lastIndexOf: LodashLastIndexOf - export val assignWith: LodashAssignWith - export val invertBy: LodashInvertBy - export val takeLast: LodashTakeRight - export val all: LodashEvery - export val rest: {} - export val cloneDeepWith: LodashCloneDeepWith - export val head: {} - export val allPass: {} - export val toNumber: {} - export val findLastFrom: LodashFindLastFrom - export val curry: LodashCurry - export val takeRightWhile: LodashTakeRightWhile - export val unzip: {} - export val symmetricDifferenceWith: LodashXorWith - export val result: LodashResult - export val every: LodashEvery - export val sumBy: LodashSumBy - export val set: LodashSet - export val sortBy: LodashSortBy - export val before: LodashBefore - export val truncate: LodashTruncate - export val noConflict: {} - export val F: {} - export val pickBy: LodashPickBy - export val capitalize: {} - export val pullAllBy: LodashPullAllBy - export val deburr: {} - export val indexOfFrom: LodashIndexOfFrom - export val flattenDeep: {} - export val concat: LodashConcat - export val partition: LodashPartition - export val padChars: LodashPadChars - export val bind: LodashBind - export val entriesIn: LodashToPairsIn - export val mean: {} - export val uniqBy: LodashUniqBy - export val unionWith: LodashUnionWith - export val tap: LodashTap - export val matchesProperty: LodashMatchesProperty - export val toPlainObject: {} - export val create: {} - export val trimEnd: {} - export val isTypedArray: {} - export val assign: LodashAssign - export val min: {} - export val has: LodashHas - export val zipWith: LodashZipWith - export val sortedIndex: LodashSortedIndex - export val propertyOf: LodashPropertyOf - export val forEach: LodashForEach - export val anyPass: {} - export val toLower: {} - export val snakeCase: {} - export val setWith: LodashSetWith - export val assignInAll: LodashAssignInAll - export val findIndex: LodashFindIndex - export val clamp: LodashClamp - export val defaultTo: LodashDefaultTo - export val divide: LodashDivide - export val hasIn: LodashHasIn - export val tail: {} - export val isWeakSet: {} - export val paths: LodashAt - export val sortedLastIndexOf: LodashSortedLastIndexOf - export val omitAll: LodashOmit - export val each: LodashForEach - export val last: {} - export val lowerCase: {} - export val juxt: {} - export val placeholder: LoDashStatic - export val dropRight: LodashDropRight - export val pullAt: LodashPullAt - export val extend: LodashExtend - export val isWeakMap: {} - export val mapKeys: LodashMapKeys - export val isMatchWith: LodashIsMatchWith - export val rangeStep: LodashRangeStep - export val isInteger: {} - export val findIndexFrom: LodashFindIndexFrom - export val isMap: {} - export val reject: LodashReject - export val toSafeInteger: {} - export val pad: LodashPad - export val pullAllWith: LodashPullAllWith - export val omitBy: LodashOmitBy - export val forEachRight: LodashForEachRight - export val drop: LodashDrop - export val reverse: {} - export val overEvery: {} - export val assignAllWith: LodashAssignAllWith - export val sortedIndexBy: LodashSortedIndexBy - export val ceil: {} - export val now: {} - export val invokeMap: LodashInvokeMap - export val filter: LodashFilter - export val assignInAllWith: LodashAssignInAllWith - export val escapeRegExp: {} - export val toLength: {} - export val noop: {} - export val unzipWith: LodashUnzipWith - export val upperCase: {} - export val findKey: LodashFindKey - export val useWith: LodashOverArgs - export val isFinite: {} - export val isFunction: {} - export val cloneWith: LodashCloneWith - export val mergeWith: LodashMergeWith - export val endsWith: LodashEndsWith - export val forIn: LodashForIn - export val at: LodashAt - export val merge: LodashMerge - export val kebabCase: {} - export val zipObj: LodashZipObject - export val isPlainObject: {} - export val pathOr: LodashPathOr - export val ___: LoDashStatic - export val over: {} - export val isMatch: LodashIsMatch - export val isEqualWith: LodashIsEqualWith - export val dropLast: LodashDropRight - export val isBoolean: {} - export val remove: LodashRemove - export val apply: {} - export val trimStart: {} - export val after: LodashAfter - export val wrap: LodashWrap - export val overArgs: LodashOverArgs - export val max: {} - export val upperFirst: {} - export val entries: LodashToPairs - export val conformsTo: LodashConformsTo - export val escape: {} - export val forOwn: LodashForOwn - export val flatMap: LodashFlatMap - export val eachRight: LodashForEachRight - export val take: LodashTake - export val findLast: LodashFindLast - export val invoke: LodashInvoke - export val omit: LodashOmit - export val unnest: {} - export val reduceRight: LodashReduceRight - export val stubString: {} - export val groupBy: LodashGroupBy - export val isString: {} - export val maxBy: LodashMaxBy - export val fill: LodashFill - export val negate: {} - export val range: LodashRange - export val curryN: LodashCurryN - export val split: LodashSplit - export val clone: {} - export val pick: LodashPick - export val flow: LodashFlow - export val includesFrom: LodashIncludesFrom - export val floor: {} - export val pullAll: LodashPullAll - export val xor: LodashXor - export val flip: {} - export val slice: LodashSlice - export val castArray: {} - export val ary: LodashAry - export val reduce: LodashReduce - export val times: LodashTimes - export val orderBy: LodashOrderBy - export val assocPath: LodashSet - export val dissoc: LodashUnset - export val toArray: LodashToArray - export val intersectionWith: LodashIntersectionWith - export val restFrom: LodashRestFrom - export val isSymbol: {} - export val isNumber: {} - export val cloneDeep: {} - export val first: {} - export val multiply: LodashMultiply - export val nth: LodashNth - export val thru: LodashThru - export val getOr: LodashGetOr - export val functionsIn: {} - export val mergeAllWith: LodashMergeAllWith - export val isNaN: {} - export val differenceBy: LodashDifferenceBy - export val shuffle: LodashShuffle - export val fromPairs: LodashFromPairs - export val sample: LodashSample - export val complement: {} - export val words: {} - export val assignInWith: LodashAssignInWith - export val findFrom: LodashFindFrom - export val template: {} - export val lowerFirst: {} - export val xorBy: LodashXorBy - export val values: LodashValues - export val toString: {} - export val sampleSize: LodashSampleSize - export val invokeArgsMap: LodashInvokeArgsMap - export val pull: LodashPull - export val round: {} - export val property: LodashProperty - export val overSome: {} - export val iteratee: LodashIteratee - export val isNil: {} - export val isBuffer: {} - export val lte: LodashLte - export val prop: LodashProp - export val zipObject: LodashZipObject - export val padCharsEnd: LodashPadCharsEnd - export val stubTrue: {} - export val whereEq: LodashIsMatch - export val defaultsAll: LodashDefaultsAll - export val findLastIndex: LodashFindLastIndex - export val flowRight: LodashFlowRight - export val sortedUniq: {} - export val functions: {} - export val id"where": LodashConformsTo - export val curryRightN: LodashCurryRightN - export val cond: LodashCond - export val assoc: LodashSet - export val bindKey: LodashBindKey - export val always: {} - export val get: LodashGet - export val trimChars: LodashTrimChars - export val isObject: {} - export val repeat: LodashRepeat - export val pipe: LodashFlow - export val update: LodashUpdate - export val zipObjectDeep: LodashZipObjectDeep - export val toPairs: LodashToPairs - export val props: LodashAt - export val invert: {} - export val isArrayLike: LodashIsArrayLike - export val identity: LodashIdentity - export val mapValues: LodashMapValues - export val isUndefined: {} - export val meanBy: LodashMeanBy - export val pickAll: LodashPick - export val attempt: {} - export val forOwnRight: LodashForOwnRight - export val trim: {} - export val extendAllWith: LodashExtendAllWith - export val isArrayBuffer: {} - export val throttle: LodashThrottle - export val matches: LodashIsMatch - export val parseInt: LodashParseInt - export val uniqueId: {} - export val valuesIn: LodashValuesIn - export val stubArray: {} - export val includes: LodashIncludes - export val lastIndexOfFrom: LodashLastIndexOfFrom - export val invokeArgs: LodashInvokeArgs - export val isNative: {} - export val flatMapDeep: LodashFlatMapDeep - export val contains: LodashContains - export val isEmpty: LodashIsEmpty - export val isArguments: {} - export val conforms: LodashConformsTo - export val xorWith: LodashXorWith - export val flattenDepth: LodashFlattenDepth - export val isSet: {} - export val add: LodashAdd - export val init: {} - export val lt: LodashLt - export val difference: LodashDifference - export val keyBy: LodashKeyBy - export val isRegExp: {} - export val padCharsStart: LodashPadCharsStart - export val transform: LodashTransform - export val some: LodashSome - export val indexOf: LodashIndexOf - export val padStart: LodashPadStart - export val intersectionBy: LodashIntersectionBy - export val curryRight: LodashCurryRight - export val isElement: {} - export val unescape: {} - export val gt: LodashGt - export val keysIn: {} - export val inRange: LodashInRange - export val pluck: LodashMap - export val methodOf: {} - export val symmetricDifferenceBy: LodashXorBy - export val sortedUniqBy: LodashSortedUniqBy - export val spreadFrom: LodashSpreadFrom - export val eq: LodashEq - export val sum: {} - export val without: LodashWithout - export val propEq: LodashMatchesProperty - export val nthArg: {} - export val keys: {} - export val zipAll: LodashZipAll - export val compact: {} - export val invertObj: {} - export val debounce: LodashDebounce - export val identical: LodashEq - export val camelCase: {} - export val isObjectLike: {} - export val trimCharsStart: LodashTrimCharsStart - export val toUpper: {} - export val memoize: {} - val lodash = index - export declare trait LodashAdd { - val __call: unsupported["(augend: number, addend: number): number;", "fp.d.ts", 13, 58] - } - export type LodashAdd1x1 = (addend: Num) => Num - export type LodashAdd1x2 = (augend: Num) => Num - export declare trait LodashAfter { - val __call: unsupported[" any>(func: TFunc, n: number): TFunc;", "fp.d.ts", 20, 53] - } - export type LodashAfter1x1[TFunc] = (n: Num) => TFunc - export type LodashAfter1x2 = unsupported["type LodashAfter1x2 = any>(func: TFunc) => TFunc;", "fp.d.ts", 23, 86] - export declare trait LodashEvery { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): boolean;", "fp.d.ts", 29, 102] - } - export type LodashEvery1x1[T] = (collection: (Object) | (ArrayLike[T])) => (false) | (true) - export type LodashEvery1x2 = unsupported["type LodashEvery1x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 32, 97] - export type LodashEvery2x2 = unsupported["type LodashEvery2x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 33, 92] - export type LodashOverEvery = unsupported["type LodashOverEvery = (predicates: lodash.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean;", "fp.d.ts", 34, 101] - export type LodashConstant = unsupported["type LodashConstant = (value: T) => () => T;", "fp.d.ts", 35, 112] - export declare trait LodashSome { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): boolean;", "fp.d.ts", 41, 101] - } - export type LodashSome1x1[T] = (collection: (Object) | (ArrayLike[T])) => (false) | (true) - export type LodashSome1x2 = unsupported["type LodashSome1x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 44, 96] - export type LodashSome2x2 = unsupported["type LodashSome2x2 = (predicate: lodash.ValueIterateeCustom) => boolean;", "fp.d.ts", 45, 91] - export type LodashOverSome = unsupported["type LodashOverSome = (predicates: lodash.Many<(...args: T[]) => boolean>) => (...args: T[]) => boolean;", "fp.d.ts", 46, 100] - export type LodashApply = unsupported["type LodashApply = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 47, 111] - export declare trait LodashAry { - val __call: unsupported["(n: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 51, 68] - } - export type LodashAry1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export type LodashAry1x2 = (n: Num) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashAssign { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 58, 80] - } - export type LodashAssign1x1 = unsupported["type LodashAssign1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 60, 5] - export type LodashAssign1x2 = unsupported["type LodashAssign1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 61, 84] - export declare trait LodashAssignAll { - val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 68, 46] - } - export declare trait LodashAssignAllWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 73, 82] - } - export type LodashAssignAllWith1x1 = (args: ReadonlyArray[anything]) => anything - export type LodashAssignAllWith1x2 = (customizer: {}) => anything - export declare trait LodashAssignIn { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 80, 82] - } - export type LodashAssignIn1x1 = unsupported["type LodashAssignIn1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 82, 5] - export type LodashAssignIn1x2 = unsupported["type LodashAssignIn1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 83, 86] - export declare trait LodashAssignInAll { - val __call: unsupported["(object: ReadonlyArray): TResult;", "fp.d.ts", 90, 46] - } - export declare trait LodashAssignInAllWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 95, 84] - } - export type LodashAssignInAllWith1x1 = (args: ReadonlyArray[anything]) => anything - export type LodashAssignInAllWith1x2 = (customizer: {}) => anything - export declare trait LodashAssignInWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 106, 125] - } - export declare trait LodashAssignInWith1x1 { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 111, 86] - } - export declare trait LodashAssignInWith1x2[TObject] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 116, 99] - } - export type LodashAssignInWith1x3 = unsupported["type LodashAssignInWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 118, 5] - export declare trait LodashAssignInWith1x4[TSource] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 122, 99] - } - export type LodashAssignInWith1x5 = unsupported["type LodashAssignInWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 124, 5] - export type LodashAssignInWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) - export declare trait LodashAssignWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 133, 123] - } - export declare trait LodashAssignWith1x1 { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 138, 84] - } - export declare trait LodashAssignWith1x2[TObject] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 143, 97] - } - export type LodashAssignWith1x3 = unsupported["type LodashAssignWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 145, 5] - export declare trait LodashAssignWith1x4[TSource] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 149, 97] - } - export type LodashAssignWith1x5 = unsupported["type LodashAssignWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 151, 5] - export type LodashAssignWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) - export declare trait LodashSet { - val __call: unsupported["(path: lodash.PropertyPath, value: any, object: object): TResult;", "fp.d.ts", 164, 68] - } - export declare trait LodashSet1x1 { - val __call: unsupported["(value: any, object: object): TResult;", "fp.d.ts", 171, 57] - } - export declare trait LodashSet1x2 { - val __call: unsupported["(path: lodash.PropertyPath, object: object): TResult;", "fp.d.ts", 178, 56] - } - export declare trait LodashSet1x3 { - val __call: unsupported["(object: object): TResult;", "fp.d.ts", 182, 41] - } - export declare trait LodashSet1x4[T] { - val __call: unsupported["(path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 187, 55] - } - export type LodashSet1x5[T] = (value: anything) => T - export type LodashSet1x6[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T - export declare trait LodashSet2x4 { - val __call: unsupported["(path: lodash.PropertyPath, value: any): TResult;", "fp.d.ts", 194, 52] - } - export type LodashSet2x5 = unsupported["type LodashSet2x5 = (value: any) => TResult;", "fp.d.ts", 196, 5] - export type LodashSet2x6 = unsupported["type LodashSet2x6 = (path: lodash.PropertyPath) => TResult;", "fp.d.ts", 197, 57] - export declare trait LodashAt { - val __call: unsupported["(props: lodash.Many, object: T | null | undefined): Array;", "fp.d.ts", 204, 91] - } - export type LodashAt1x1 = unsupported["type LodashAt1x1 = (object: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => T[];", "fp.d.ts", 206, 5] - export type LodashAt1x2[T] = (props: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => MutArray[T] - export type LodashAt2x1 = unsupported["type LodashAt2x1 = (object: T | null | undefined) => Array;", "fp.d.ts", 208, 62] - export type LodashAt2x2 = unsupported["type LodashAt2x2 = (props: lodash.Many) => Array;", "fp.d.ts", 209, 78] - export type LodashAttempt = unsupported["type LodashAttempt = (func: (...args: any[]) => TResult) => TResult | Error;", "fp.d.ts", 210, 77] - export declare trait LodashBefore { - val __call: unsupported[" any>(func: TFunc, n: number): TFunc;", "fp.d.ts", 214, 54] - } - export type LodashBefore1x1[TFunc] = (n: Num) => TFunc - export type LodashBefore1x2 = unsupported["type LodashBefore1x2 = any>(func: TFunc) => TFunc;", "fp.d.ts", 217, 87] - export declare trait LodashBind { - val __call: unsupported["(func: (...args: any[]) => any, thisArg: any): (...args: any[]) => any;", "fp.d.ts", 221, 55] - val placeholder: LoDashStatic - } - export type LodashBind1x1 = (thisArg: anything) => (args: (anything) | (MutArray[anything])) => anything - export type LodashBind1x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashBindAll { - val __call: unsupported["(methodNames: lodash.Many, object: T): T;", "fp.d.ts", 229, 68] - } - export type LodashBindAll1x1 = unsupported["type LodashBindAll1x1 = (object: T) => T;", "fp.d.ts", 231, 5] - export type LodashBindAll1x2[T] = (methodNames: (Str) | (ReadonlyArray[Str])) => T - export declare trait LodashBindKey { - val __call: unsupported["(object: object, key: string): (...args: any[]) => any;", "fp.d.ts", 236, 59] - val placeholder: LoDashStatic - } - export type LodashBindKey1x1 = (key: Str) => (args: (anything) | (MutArray[anything])) => anything - export type LodashBindKey1x2 = (object: Object) => (args: (anything) | (MutArray[anything])) => anything - export type LodashCamelCase = (string: Str) => Str - export type LodashCapitalize = (string: Str) => Str - export type LodashCastArray = unsupported["type LodashCastArray = (value: lodash.Many) => T[];", "fp.d.ts", 243, 55] - export type LodashCeil = (n: Num) => Num - export declare trait LodashChunk { - val __call: unsupported["(size: number, array: lodash.List | null | undefined): T[][];", "fp.d.ts", 248, 90] - } - export type LodashChunk1x1 = unsupported["type LodashChunk1x1 = (array: lodash.List | null | undefined) => T[][];", "fp.d.ts", 250, 5] - export type LodashChunk1x2[T] = (size: Num) => MutArray[MutArray[T]] - export declare trait LodashClamp { - val __call: unsupported["(lower: number, upper: number, number: number): number;", "fp.d.ts", 259, 74] - } - export declare trait LodashClamp1x1 { - val __call: unsupported["(upper: number, number: number): number;", "fp.d.ts", 264, 59] - } - export declare trait LodashClamp1x2 { - val __call: unsupported["(lower: number, number: number): number;", "fp.d.ts", 269, 59] - } - export type LodashClamp1x3 = (number: Num) => Num - export declare trait LodashClamp1x4 { - val __call: unsupported["(lower: number, upper: number): number;", "fp.d.ts", 275, 58] - } - export type LodashClamp1x5 = (upper: Num) => Num - export type LodashClamp1x6 = (lower: Num) => Num - export type LodashClone = unsupported["type LodashClone = (value: T) => T;", "fp.d.ts", 279, 52] - export type LodashCloneDeep = unsupported["type LodashCloneDeep = (value: T) => T;", "fp.d.ts", 280, 42] - export declare trait LodashCloneDeepWith { - val __call: unsupported["(customizer: lodash.CloneDeepWithCustomizer, value: T): any;", "fp.d.ts", 284, 72] - } - export type LodashCloneDeepWith1x1[T] = (value: T) => anything - export type LodashCloneDeepWith1x2[T] = (customizer: {}) => anything - export declare trait LodashCloneWith { - val __call: unsupported["(customizer: lodash.CloneWithCustomizer, value: T): TResult | T;", "fp.d.ts", 293, 117] - } - export type LodashCloneWith1x1[T, TResult] = (value: T) => TResult - export declare trait LodashCloneWith1x2[T] { - val __call: unsupported["(customizer: lodash.CloneWithCustomizer): TResult | T;", "fp.d.ts", 298, 129] - } - export type LodashCloneWith2x1[T, TResult] = (value: T) => (T) | (TResult) - export type LodashCompact = unsupported["type LodashCompact = (array: lodash.List | null | undefined) => Array>;", "fp.d.ts", 301, 68] - export type LodashNegate = unsupported["type LodashNegate = (predicate: (...args: T) => any) => (...args: T) => boolean;", "fp.d.ts", 302, 107] - export declare trait LodashFlowRight { - val __call: unsupported["(...func: Array any>>): (...args: any[]) => any;", "fp.d.ts", 310, 97] - } - export declare trait LodashConcat { - val __call: unsupported["(array: lodash.Many, values: lodash.Many): T[];", "fp.d.ts", 315, 74] - } - export type LodashConcat1x1[T] = (values: (T) | (ReadonlyArray[T])) => MutArray[T] - export type LodashConcat1x2[T] = (array: (T) | (ReadonlyArray[T])) => MutArray[T] - export declare trait LodashCond { - val __call: unsupported["(pairs: Array>): (Target: T) => R;", "fp.d.ts", 321, 62] - } - export declare trait LodashConformsTo { - val __call: unsupported["(source: lodash.ConformsPredicateObject, object: T): boolean;", "fp.d.ts", 326, 66] - } - export type LodashConformsTo1x1[T] = (object: T) => (false) | (true) - export type LodashConformsTo1x2 = unsupported["type LodashConformsTo1x2 = (source: lodash.ConformsPredicateObject) => boolean;", "fp.d.ts", 329, 57] - export declare trait LodashContains { - val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 333, 136] - } - export type LodashContains1x1[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) - export type LodashContains1x2[T] = (target: T) => (false) | (true) - export declare trait LodashCountBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 342, 103] - } - export type LodashCountBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[Num] - export type LodashCountBy1x2 = unsupported["type LodashCountBy1x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 345, 117] - export type LodashCountBy2x2 = unsupported["type LodashCountBy2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 346, 96] - export type LodashCreate = unsupported["type LodashCreate = (prototype: T) => T & U;", "fp.d.ts", 347, 105] - export declare trait LodashCurry { - val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 354, 133] - val placeholder: LoDashStatic - } - export declare trait LodashCurryN { - val __call: unsupported["(arity: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 370, 75] - val placeholder: LoDashStatic - } - export declare trait LodashCurryN1x1 { - val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 379, 133] - } - export type LodashCurryN1x2[T1, R] = (arity: Num) => CurriedFunction1[T1, R] - export type LodashCurryN2x2[T1, T2, R] = (arity: Num) => CurriedFunction2[T1, T2, R] - export type LodashCurryN3x2[T1, T2, T3, R] = (arity: Num) => CurriedFunction3[T1, T2, T3, R] - export type LodashCurryN4x2[T1, T2, T3, T4, R] = (arity: Num) => CurriedFunction4[T1, T2, T3, T4, R] - export type LodashCurryN5x2[T1, T2, T3, T4, T5, R] = (arity: Num) => CurriedFunction5[T1, T2, T3, T4, T5, R] - export type LodashCurryN6x2 = (arity: Num) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashCurryRight { - val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 393, 138] - val placeholder: LoDashStatic - } - export declare trait LodashCurryRightN { - val __call: unsupported["(arity: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 409, 80] - val placeholder: LoDashStatic - } - export declare trait LodashCurryRightN1x1 { - val __call: unsupported["(func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 418, 138] - } - export type LodashCurryRightN1x2[T1, R] = (arity: Num) => RightCurriedFunction1[T1, R] - export type LodashCurryRightN2x2[T1, T2, R] = (arity: Num) => RightCurriedFunction2[T1, T2, R] - export type LodashCurryRightN3x2[T1, T2, T3, R] = (arity: Num) => RightCurriedFunction3[T1, T2, T3, R] - export type LodashCurryRightN4x2[T1, T2, T3, T4, R] = (arity: Num) => RightCurriedFunction4[T1, T2, T3, T4, R] - export type LodashCurryRightN5x2[T1, T2, T3, T4, T5, R] = (arity: Num) => RightCurriedFunction5[T1, T2, T3, T4, T5, R] - export type LodashCurryRightN6x2 = (arity: Num) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashDebounce { - val __call: unsupported[" any>(wait: number, func: T): lodash.DebouncedFunc;", "fp.d.ts", 429, 90] - } - export type LodashDebounce1x1 = unsupported["type LodashDebounce1x1 = any>(func: T) => lodash.DebouncedFunc;", "fp.d.ts", 431, 5] - export type LodashDebounce1x2[T] = (wait: Num) => DebouncedFunc[T] - export type LodashDeburr = (string: Str) => Str - export declare trait LodashDefaults { - val __call: unsupported["(source: TSource, object: TObject): TSource & TObject;", "fp.d.ts", 437, 82] - } - export type LodashDefaults1x1 = unsupported["type LodashDefaults1x1 = (object: TObject) => TSource & TObject;", "fp.d.ts", 439, 5] - export type LodashDefaults1x2 = unsupported["type LodashDefaults1x2 = (source: TSource) => TSource & TObject;", "fp.d.ts", 440, 86] - export declare trait LodashDefaultsAll { - val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 447, 46] - } - export declare trait LodashDefaultsDeep { - val __call: unsupported["(sources: any, object: any): any;", "fp.d.ts", 452, 65] - } - export type LodashDefaultsDeep1x1 = (object: anything) => anything - export type LodashDefaultsDeep1x2 = (sources: anything) => anything - export type LodashDefaultsDeepAll = (object: ReadonlyArray[anything]) => anything - export declare trait LodashDefaultTo { - val __call: unsupported["(defaultValue: TDefault, value: T | null | undefined): T | TDefault;", "fp.d.ts", 462, 73] - } - export type LodashDefaultTo1x1[T] = (value: T) => T - export declare trait LodashDefaultTo1x2[T] { - val __call: unsupported["(defaultValue: TDefault): T | TDefault;", "fp.d.ts", 467, 29] - } - export type LodashDefaultTo2x1 = unsupported["type LodashDefaultTo2x1 = (value: T | null | undefined) => T | TDefault;", "fp.d.ts", 469, 5] - export type LodashDefer = (func: (args: (anything) | (MutArray[anything])) => anything, args: (anything) | (MutArray[anything])) => Num - export declare trait LodashDelay { - val __call: unsupported["(wait: number, func: (...args: any[]) => any): number;", "fp.d.ts", 474, 73] - } - export type LodashDelay1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => Num - export type LodashDelay1x2 = (wait: Num) => Num - export declare trait LodashDifference { - val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T[];", "fp.d.ts", 481, 78] - } - export type LodashDifference1x1[T] = (values: ArrayLike[T]) => MutArray[T] - export type LodashDifference1x2[T] = (array: ArrayLike[T]) => MutArray[T] - export declare trait LodashDifferenceBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 492, 137] - } - export declare trait LodashDifferenceBy1x1[T1, T2] { - val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 497, 79] - } - export declare trait LodashDifferenceBy1x2[T1] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 502, 90] - } - export type LodashDifferenceBy1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export declare trait LodashDifferenceBy1x4[T2] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 508, 108] - } - export type LodashDifferenceBy1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] - export type LodashDifferenceBy1x6 = unsupported["type LodashDifferenceBy1x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 511, 89] - export declare trait LodashDifferenceWith { - val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 519, 141] - } - export declare trait LodashDifferenceWith1x1[T1, T2] { - val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 524, 81] - } - export declare trait LodashDifferenceWith1x2[T1] { - val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 529, 94] - } - export type LodashDifferenceWith1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export declare trait LodashDifferenceWith1x4[T2] { - val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 535, 112] - } - export type LodashDifferenceWith1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] - export type LodashDifferenceWith1x6[T1, T2] = (comparator: {}) => MutArray[T1] - export declare trait LodashUnset { - val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 542, 59] - } - export type LodashUnset1x1 = unsupported["type LodashUnset1x1 = (object: T) => T;", "fp.d.ts", 544, 5] - export type LodashUnset1x2[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T - export declare trait LodashDivide { - val __call: unsupported["(dividend: number, divisor: number): number;", "fp.d.ts", 549, 64] - } - export type LodashDivide1x1 = (divisor: Num) => Num - export type LodashDivide1x2 = (dividend: Num) => Num - export declare trait LodashDrop { - val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 556, 86] - } - export type LodashDrop1x1 = unsupported["type LodashDrop1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 558, 5] - export type LodashDrop1x2[T] = (n: Num) => MutArray[T] - export declare trait LodashDropRight { - val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 563, 91] - } - export type LodashDropRight1x1 = unsupported["type LodashDropRight1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 565, 5] - export type LodashDropRight1x2[T] = (n: Num) => MutArray[T] - export declare trait LodashDropRightWhile { - val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 570, 104] - } - export type LodashDropRightWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashDropRightWhile1x2 = unsupported["type LodashDropRightWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 573, 88] - export declare trait LodashDropWhile { - val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 577, 99] - } - export type LodashDropWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashDropWhile1x2 = unsupported["type LodashDropWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 580, 83] - export declare trait LodashForEach { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined;", "fp.d.ts", 594, 103] - } - export declare trait LodashForEach1x1[T] { - val __call: unsupported["(collection: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 602, 122] - } - export type LodashForEach1x2[T] = (iteratee: (value: T) => anything) => MutArray[T] - export type LodashForEach2x2[T] = (iteratee: (value: T) => anything) => ArrayLike[T] - export type LodashForEach3x2 = unsupported["type LodashForEach3x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 606, 79] - export type LodashForEach4x2[T, TArray] = (iteratee: (value: T) => anything) => TArray - export type LodashForEach5x2[T, TList] = (iteratee: (value: T) => anything) => TList - export type LodashForEach6x2 = unsupported["type LodashForEach6x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 609, 77] - export declare trait LodashForEachRight { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, collection: T | null | undefined): T | null | undefined;", "fp.d.ts", 623, 108] - } - export declare trait LodashForEachRight1x1[T] { - val __call: unsupported["(collection: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 631, 122] - } - export type LodashForEachRight1x2[T] = (iteratee: (value: T) => anything) => MutArray[T] - export type LodashForEachRight2x2[T] = (iteratee: (value: T) => anything) => ArrayLike[T] - export type LodashForEachRight3x2 = unsupported["type LodashForEachRight3x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 635, 84] - export type LodashForEachRight4x2[T, TArray] = (iteratee: (value: T) => anything) => TArray - export type LodashForEachRight5x2[T, TList] = (iteratee: (value: T) => anything) => TList - export type LodashForEachRight6x2 = unsupported["type LodashForEachRight6x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 638, 82] - export declare trait LodashEndsWith { - val __call: unsupported["(target: string, string: string): boolean;", "fp.d.ts", 642, 63] - } - export type LodashEndsWith1x1 = (string: Str) => (false) | (true) - export type LodashEndsWith1x2 = (target: Str) => (false) | (true) - export declare trait LodashToPairs { - val __call: unsupported["(object: object): Array<[string, any]>;", "fp.d.ts", 648, 92] - } - export declare trait LodashToPairsIn { - val __call: unsupported["(object: object): Array<[string, any]>;", "fp.d.ts", 652, 92] - } - export declare trait LodashEq { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 657, 52] - } - export type LodashEq1x1 = (other: anything) => (false) | (true) - export type LodashEq1x2 = (value: anything) => (false) | (true) - export declare trait LodashIsEqual { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 664, 57] - } - export type LodashIsEqual1x1 = (other: anything) => (false) | (true) - export type LodashIsEqual1x2 = (value: anything) => (false) | (true) - export type LodashEscape = (string: Str) => Str - export type LodashEscapeRegExp = (string: Str) => Str - export declare trait LodashExtend { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 673, 80] - } - export type LodashExtend1x1 = unsupported["type LodashExtend1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 675, 5] - export type LodashExtend1x2 = unsupported["type LodashExtend1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 676, 84] - export declare trait LodashExtendAll { - val __call: unsupported["(object: ReadonlyArray): TResult;", "fp.d.ts", 683, 46] - } - export declare trait LodashExtendAllWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 688, 82] - } - export type LodashExtendAllWith1x1 = (args: ReadonlyArray[anything]) => anything - export type LodashExtendAllWith1x2 = (customizer: {}) => anything - export declare trait LodashExtendWith { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 699, 123] - } - export declare trait LodashExtendWith1x1 { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 704, 84] - } - export declare trait LodashExtendWith1x2[TObject] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 709, 97] - } - export type LodashExtendWith1x3 = unsupported["type LodashExtendWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 711, 5] - export declare trait LodashExtendWith1x4[TSource] { - val __call: unsupported["(customizer: lodash.AssignCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 715, 97] - } - export type LodashExtendWith1x5 = unsupported["type LodashExtendWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 717, 5] - export type LodashExtendWith1x6[TObject, TSource] = (customizer: {}) => (TObject) & (TSource) - export type LodashStubFalse = () => false - export declare trait LodashFill { - val __call: unsupported["(start: number, end: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 743, 120] - } - export declare trait LodashFill1x1 { - val __call: unsupported["(end: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 756, 105] - } - export declare trait LodashFill1x2 { - val __call: unsupported["(start: number, value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 769, 107] - } - export declare trait LodashFill1x3 { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 776, 91] - } - export declare trait LodashFill1x4[T] { - val __call: unsupported["(start: number, end: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 789, 107] - } - export declare trait LodashFill1x5[T] { - val __call: unsupported["(end: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 796, 92] - } - export declare trait LodashFill1x6[T] { - val __call: unsupported["(start: number, array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 803, 94] - } - export declare trait LodashFill1x7[T] { - val __call: unsupported["(array: lodash.List | null | undefined): lodash.List;", "fp.d.ts", 807, 57] - } - export declare trait LodashFill1x8[U] { - val __call: unsupported["(start: number, end: number, value: T): Array;", "fp.d.ts", 816, 75] - } - export declare trait LodashFill1x9[U] { - val __call: unsupported["(end: number, value: T): Array;", "fp.d.ts", 821, 60] - } - export declare trait LodashFill1x10[U] { - val __call: unsupported["(start: number, value: T): Array;", "fp.d.ts", 826, 62] - } - export type LodashFill1x11 = unsupported["type LodashFill1x11 = (value: T) => Array;", "fp.d.ts", 828, 5] - export declare trait LodashFill1x12[T, U] { - val __call: unsupported["(start: number, end: number): Array;", "fp.d.ts", 832, 62] - } - export type LodashFill1x13[T, U] = (end: Num) => MutArray[(T) | (U)] - export type LodashFill1x14[T, U] = (start: Num) => MutArray[(T) | (U)] - export declare trait LodashFill2x8[U] { - val __call: unsupported["(start: number, end: number, value: T): lodash.List;", "fp.d.ts", 843, 75] - } - export declare trait LodashFill2x9[U] { - val __call: unsupported["(end: number, value: T): lodash.List;", "fp.d.ts", 848, 60] - } - export declare trait LodashFill2x10[U] { - val __call: unsupported["(start: number, value: T): lodash.List;", "fp.d.ts", 853, 62] - } - export type LodashFill2x11 = unsupported["type LodashFill2x11 = (value: T) => lodash.List;", "fp.d.ts", 855, 5] - export declare trait LodashFill2x12[T, U] { - val __call: unsupported["(start: number, end: number): lodash.List;", "fp.d.ts", 859, 62] - } - export type LodashFill2x13[T, U] = (end: Num) => ArrayLike[(T) | (U)] - export type LodashFill2x14[T, U] = (start: Num) => ArrayLike[(T) | (U)] - export declare trait LodashFilter { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): Array;", "fp.d.ts", 872, 145] - } - export type LodashFilter1x1[T, S] = (collection: ArrayLike[T]) => MutArray[S] - export declare trait LodashFilter1x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[];", "fp.d.ts", 877, 75] - } - export type LodashFilter2x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] - export type LodashFilter3x1[T, S] = (collection: T) => MutArray[S] - export declare trait LodashFilter3x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): Array;", "fp.d.ts", 883, 93] - } - export declare trait LodashFind { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 894, 153] - } - export type LodashFind1x1[T, S] = (collection: ArrayLike[T]) => S - export declare trait LodashFind1x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 899, 83] - } - export type LodashFind2x1[T] = (collection: (Object) | (ArrayLike[T])) => T - export type LodashFind3x1[T, S] = (collection: T) => S - export declare trait LodashFind3x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 905, 101] - } - export declare trait LodashFindFrom { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 926, 165] - } - export declare trait LodashFindFrom1x1[T, S] { - val __call: unsupported["(fromIndex: number, collection: lodash.List | null | undefined): S|undefined;", "fp.d.ts", 931, 100] - } - export declare trait LodashFindFrom1x2 { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 942, 153] - } - export type LodashFindFrom1x3[T, S] = (collection: ArrayLike[T]) => S - export declare trait LodashFindFrom1x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T|undefined;", "fp.d.ts", 950, 82] - } - export type LodashFindFrom1x5[S] = (fromIndex: Num) => S - export declare trait LodashFindFrom1x6[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 955, 83] - } - export declare trait LodashFindFrom2x1[T] { - val __call: unsupported["(fromIndex: lodash.__, collection: T1 | null | undefined): LodashFindFrom4x5;", "fp.d.ts", 961, 97] - } - export declare trait LodashFindFrom2x3[T] { - val __call: unsupported["(collection: object | null | undefined): object|undefined;", "fp.d.ts", 965, 69] - } - export type LodashFindFrom2x5[T] = (fromIndex: Num) => T - export declare trait LodashFindFrom3x1[T, S] { - val __call: unsupported["(fromIndex: number, collection: T | null | undefined): S|undefined;", "fp.d.ts", 971, 87] - } - export type LodashFindFrom3x3[T, S] = (collection: T) => S - export declare trait LodashFindFrom3x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T[keyof T]|undefined;", "fp.d.ts", 979, 91] - } - export type LodashFindFrom3x5[S] = (fromIndex: Num) => S - export declare trait LodashFindFrom3x6[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 984, 101] - } - export type LodashFindFrom4x5 = unsupported["type LodashFindFrom4x5 = (fromIndex: number) => T[keyof T]|undefined;", "fp.d.ts", 986, 5] - export declare trait LodashFindIndex { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 990, 99] - } - export type LodashFindIndex1x1[T] = (array: ArrayLike[T]) => Num - export type LodashFindIndex1x2 = unsupported["type LodashFindIndex1x2 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 993, 86] - export declare trait LodashFindIndexFrom { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1001, 122] - } - export declare trait LodashFindIndexFrom1x1[T] { - val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1006, 97] - } - export declare trait LodashFindIndexFrom1x2 { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1011, 103] - } - export type LodashFindIndexFrom1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashFindIndexFrom1x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): number;", "fp.d.ts", 1017, 77] - } - export type LodashFindIndexFrom1x5 = (fromIndex: Num) => Num - export type LodashFindIndexFrom1x6 = unsupported["type LodashFindIndexFrom1x6 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1020, 64] - export declare trait LodashFindKey { - val __call: unsupported["(predicate: lodash.ValueIteratee, object: T | null | undefined): string | undefined;", "fp.d.ts", 1024, 85] - } - export type LodashFindKey1x1[T] = (object: Object) => Str - export type LodashFindKey1x2 = unsupported["type LodashFindKey1x2 = (predicate: lodash.ValueIteratee) => string | undefined;", "fp.d.ts", 1027, 89] - export declare trait LodashFindLast { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1037, 153] - } - export type LodashFindLast1x1[T, S] = (collection: ArrayLike[T]) => S - export declare trait LodashFindLast1x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 1042, 83] - } - export type LodashFindLast2x1[T] = (collection: (Object) | (ArrayLike[T])) => T - export type LodashFindLast3x1[T, S] = (collection: T) => S - export declare trait LodashFindLast3x2[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 1048, 101] - } - export declare trait LodashFindLastFrom { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1069, 169] - } - export declare trait LodashFindLastFrom1x1[T, S] { - val __call: unsupported["(fromIndex: number, collection: lodash.List | null | undefined): S|undefined;", "fp.d.ts", 1074, 104] - } - export declare trait LodashFindLastFrom1x2 { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): T[keyof T]|undefined;", "fp.d.ts", 1085, 153] - } - export type LodashFindLastFrom1x3[T, S] = (collection: ArrayLike[T]) => S - export declare trait LodashFindLastFrom1x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T|undefined;", "fp.d.ts", 1093, 86] - } - export type LodashFindLastFrom1x5[S] = (fromIndex: Num) => S - export declare trait LodashFindLastFrom1x6[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T|undefined;", "fp.d.ts", 1098, 83] - } - export declare trait LodashFindLastFrom2x1[T] { - val __call: unsupported["(fromIndex: lodash.__, collection: T1 | null | undefined): LodashFindLastFrom4x5;", "fp.d.ts", 1104, 97] - } - export declare trait LodashFindLastFrom2x3[T] { - val __call: unsupported["(collection: object | null | undefined): object|undefined;", "fp.d.ts", 1108, 69] - } - export type LodashFindLastFrom2x5[T] = (fromIndex: Num) => T - export declare trait LodashFindLastFrom3x1[T, S] { - val __call: unsupported["(fromIndex: number, collection: T | null | undefined): S|undefined;", "fp.d.ts", 1114, 91] - } - export type LodashFindLastFrom3x3[T, S] = (collection: T) => S - export declare trait LodashFindLastFrom3x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): T[keyof T]|undefined;", "fp.d.ts", 1122, 95] - } - export type LodashFindLastFrom3x5[S] = (fromIndex: Num) => S - export declare trait LodashFindLastFrom3x6[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom): T[keyof T]|undefined;", "fp.d.ts", 1127, 101] - } - export type LodashFindLastFrom4x5 = unsupported["type LodashFindLastFrom4x5 = (fromIndex: number) => T[keyof T]|undefined;", "fp.d.ts", 1129, 5] - export declare trait LodashFindLastIndex { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1133, 103] - } - export type LodashFindLastIndex1x1[T] = (array: ArrayLike[T]) => Num - export type LodashFindLastIndex1x2 = unsupported["type LodashFindLastIndex1x2 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1136, 90] - export declare trait LodashFindLastIndexFrom { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1144, 126] - } - export declare trait LodashFindLastIndexFrom1x1[T] { - val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1149, 101] - } - export declare trait LodashFindLastIndexFrom1x2 { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, array: lodash.List | null | undefined): number;", "fp.d.ts", 1154, 107] - } - export type LodashFindLastIndexFrom1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashFindLastIndexFrom1x4[T] { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, fromIndex: number): number;", "fp.d.ts", 1160, 81] - } - export type LodashFindLastIndexFrom1x5 = (fromIndex: Num) => Num - export type LodashFindLastIndexFrom1x6 = unsupported["type LodashFindLastIndexFrom1x6 = (predicate: lodash.ValueIterateeCustom) => number;", "fp.d.ts", 1163, 68] - export declare trait LodashFindLastKey { - val __call: unsupported["(predicate: lodash.ValueIteratee, object: T | null | undefined): string | undefined;", "fp.d.ts", 1167, 89] - } - export type LodashFindLastKey1x1[T] = (object: Object) => Str - export type LodashFindLastKey1x2 = unsupported["type LodashFindLastKey1x2 = (predicate: lodash.ValueIteratee) => string | undefined;", "fp.d.ts", 1170, 93] - export type LodashHead = unsupported["type LodashHead = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 1171, 103] - export declare trait LodashFlatMap { - val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1183, 45] - } - export type LodashFlatMap1x1[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] - export type LodashFlatMap1x2 = unsupported["type LodashFlatMap1x2 = (iteratee: (value: T) => lodash.Many) => TResult[];", "fp.d.ts", 1186, 101] - export type LodashFlatMap2x1[T, TResult] = (collection: T) => MutArray[TResult] - export type LodashFlatMap2x2 = unsupported["type LodashFlatMap2x2 = (iteratee: (value: T[keyof T]) => lodash.Many) => TResult[];", "fp.d.ts", 1188, 88] - export type LodashFlatMap3x1 = (collection: Object) => MutArray[anything] - export declare trait LodashFlatMap3x2 { - val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1192, 34] - } - export type LodashFlatMap4x1 = (collection: Object) => MutArray[(false) | (true)] - export declare trait LodashFlatMapDeep { - val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1206, 49] - } - export type LodashFlatMapDeep1x1[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] - export type LodashFlatMapDeep1x2 = unsupported["type LodashFlatMapDeep1x2 = (iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1209, 105] - export type LodashFlatMapDeep2x1[T, TResult] = (collection: T) => MutArray[TResult] - export type LodashFlatMapDeep2x2 = unsupported["type LodashFlatMapDeep2x2 = (iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1211, 92] - export type LodashFlatMapDeep3x1 = (collection: Object) => MutArray[anything] - export declare trait LodashFlatMapDeep3x2 { - val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1215, 34] - } - export type LodashFlatMapDeep4x1 = (collection: Object) => MutArray[(false) | (true)] - export declare trait LodashFlatMapDepth { - val __call: unsupported["(iteratee: object, depth: number, collection: object | null | undefined): boolean[];", "fp.d.ts", 1241, 107] - } - export declare trait LodashFlatMapDepth1x1[T, TResult] { - val __call: unsupported["(depth: number, collection: lodash.List | null | undefined): TResult[];", "fp.d.ts", 1246, 106] - } - export declare trait LodashFlatMapDepth1x2 { - val __call: unsupported["(iteratee: object, collection: object | null | undefined): boolean[];", "fp.d.ts", 1259, 50] - } - export type LodashFlatMapDepth1x3[T, TResult] = (collection: ArrayLike[T]) => MutArray[TResult] - export declare trait LodashFlatMapDepth1x4[T] { - val __call: unsupported["(iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult, depth: number): TResult[];", "fp.d.ts", 1265, 71] - } - export type LodashFlatMapDepth1x5[TResult] = (depth: Num) => MutArray[TResult] - export type LodashFlatMapDepth1x6 = unsupported["type LodashFlatMapDepth1x6 = (iteratee: (value: T) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1268, 71] - export declare trait LodashFlatMapDepth2x1[T, TResult] { - val __call: unsupported["(depth: number, collection: T | null | undefined): TResult[];", "fp.d.ts", 1272, 93] - } - export type LodashFlatMapDepth2x3[T, TResult] = (collection: T) => MutArray[TResult] - export declare trait LodashFlatMapDepth2x4[T] { - val __call: unsupported["(iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult, depth: number): TResult[];", "fp.d.ts", 1278, 71] - } - export type LodashFlatMapDepth2x5[TResult] = (depth: Num) => MutArray[TResult] - export type LodashFlatMapDepth2x6 = unsupported["type LodashFlatMapDepth2x6 = (iteratee: (value: T[keyof T]) => lodash.ListOfRecursiveArraysOrValues | TResult) => TResult[];", "fp.d.ts", 1281, 71] - export declare trait LodashFlatMapDepth3x1 { - val __call: unsupported["(depth: number, collection: object | null | undefined): any[];", "fp.d.ts", 1285, 89] - } - export type LodashFlatMapDepth3x3 = (collection: Object) => MutArray[anything] - export declare trait LodashFlatMapDepth3x4 { - val __call: unsupported["(iteratee: object, depth: number): boolean[];", "fp.d.ts", 1293, 50] - } - export type LodashFlatMapDepth3x5 = (depth: Num) => MutArray[anything] - export declare trait LodashFlatMapDepth3x6 { - val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 1298, 34] - } - export declare trait LodashFlatMapDepth4x1 { - val __call: unsupported["(depth: number, collection: object | null | undefined): boolean[];", "fp.d.ts", 1303, 89] - } - export type LodashFlatMapDepth4x3 = (collection: Object) => MutArray[(false) | (true)] - export type LodashFlatMapDepth4x5 = (depth: Num) => MutArray[(false) | (true)] - export type LodashFlatten = unsupported["type LodashFlatten = (array: lodash.List> | null | undefined) => T[];", "fp.d.ts", 1307, 62] - export type LodashFlattenDeep = unsupported["type LodashFlattenDeep = (array: lodash.ListOfRecursiveArraysOrValues | null | undefined) => T[];", "fp.d.ts", 1308, 91] - export declare trait LodashFlattenDepth { - val __call: unsupported["(depth: number, array: lodash.ListOfRecursiveArraysOrValues | null | undefined): T[];", "fp.d.ts", 1312, 123] - } - export type LodashFlattenDepth1x1 = unsupported["type LodashFlattenDepth1x1 = (array: lodash.ListOfRecursiveArraysOrValues | null | undefined) => T[];", "fp.d.ts", 1314, 5] - export type LodashFlattenDepth1x2[T] = (depth: Num) => MutArray[T] - export type LodashFlip = unsupported["type LodashFlip = any>(func: T) => T;", "fp.d.ts", 1316, 59] - export type LodashFloor = (n: Num) => Num - export declare trait LodashFlow { - val __call: unsupported["(...func: Array any>>): (...args: any[]) => any;", "fp.d.ts", 1326, 97] - } - export declare trait LodashForIn { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1333, 82] - } - export declare trait LodashForIn1x1[T] { - val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1337, 44] - } - export type LodashForIn1x2 = unsupported["type LodashForIn1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1339, 5] - export type LodashForIn2x2 = unsupported["type LodashForIn2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1340, 73] - export declare trait LodashForInRight { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1346, 87] - } - export declare trait LodashForInRight1x1[T] { - val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1350, 44] - } - export type LodashForInRight1x2 = unsupported["type LodashForInRight1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1352, 5] - export type LodashForInRight2x2 = unsupported["type LodashForInRight2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1353, 78] - export declare trait LodashForOwn { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1359, 83] - } - export declare trait LodashForOwn1x1[T] { - val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1363, 44] - } - export type LodashForOwn1x2 = unsupported["type LodashForOwn1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1365, 5] - export type LodashForOwn2x2 = unsupported["type LodashForOwn2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1366, 74] - export declare trait LodashForOwnRight { - val __call: unsupported["(iteratee: (value: T[keyof T]) => any, object: T | null | undefined): T | null | undefined;", "fp.d.ts", 1372, 88] - } - export declare trait LodashForOwnRight1x1[T] { - val __call: unsupported["(object: T1 | null | undefined): T1 | null | undefined;", "fp.d.ts", 1376, 44] - } - export type LodashForOwnRight1x2 = unsupported["type LodashForOwnRight1x2 = (iteratee: (value: T[keyof T]) => any) => T;", "fp.d.ts", 1378, 5] - export type LodashForOwnRight2x2 = unsupported["type LodashForOwnRight2x2 = (iteratee: (value: T[keyof T]) => any) => T | null | undefined;", "fp.d.ts", 1379, 79] - export declare trait LodashFromPairs { - val __call: unsupported["(pairs: lodash.List | null | undefined): lodash.Dictionary;", "fp.d.ts", 1382, 99] - } - export type LodashFunctions = (object: anything) => MutArray[Str] - export type LodashFunctionsIn = (object: anything) => MutArray[Str] - export declare trait LodashGet { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1410, 54] - } - export val LodashGet1x1: unsupported["interface LodashGet1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 1412, 5] - export declare trait LodashGet1x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 1420, 176] - } - export declare trait LodashGet2x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 1426, 188] - } - export val LodashGet3x1: unsupported["interface LodashGet3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 1428, 5] - export val LodashGet5x1: unsupported["interface LodashGet5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 1432, 5] - export val LodashGet7x1: unsupported["interface LodashGet7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 1436, 5] - export declare trait LodashGet9x1 { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 1442, 52] - } - export type LodashGet9x2[T] = (path: Num) => T - export type LodashGet10x2[T] = (path: Num) => T - export declare trait LodashGet11x1 { - val __call: unsupported["(object: any): any;", "fp.d.ts", 1448, 46] - } - export type LodashGet11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined - export type LodashGet12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashGetOr { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1489, 90] - } - export declare trait LodashGetOr1x1[TDefault] { - val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 1506, 78] - } - export val LodashGetOr1x2: unsupported["interface LodashGetOr1x2 { (defaultValue: TDefault): LodashGetOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1508, 5] - export type LodashGetOr1x3 = unsupported["type LodashGetOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1513, 5] - export declare trait LodashGetOr1x4[TObject] { - val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 1523, 281] - } - export declare trait LodashGetOr1x5[TObject, TDefault] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 1529, 207] - } - export type LodashGetOr1x6 = unsupported["type LodashGetOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1531, 5] - export val LodashGetOr2x2: unsupported["interface LodashGetOr2x2 { (defaultValue: TDefault): LodashGetOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1532, 146] - export type LodashGetOr2x3 = unsupported["type LodashGetOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1537, 5] - export type LodashGetOr2x6 = unsupported["type LodashGetOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1538, 203] - export val LodashGetOr3x2: unsupported["interface LodashGetOr3x2 { (defaultValue: TDefault): LodashGetOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1539, 191] - export type LodashGetOr3x3 = unsupported["type LodashGetOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1544, 5] - export type LodashGetOr3x6 = unsupported["type LodashGetOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1545, 253] - export val LodashGetOr4x2: unsupported["interface LodashGetOr4x2 { (defaultValue: TDefault): LodashGetOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashGetOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 1546, 241] - export type LodashGetOr4x3 = unsupported["type LodashGetOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 1551, 5] - export type LodashGetOr4x6 = unsupported["type LodashGetOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 1552, 310] - export declare trait LodashGetOr5x2 { - val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 1556, 112] - } - export type LodashGetOr5x3 = unsupported["type LodashGetOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 1558, 5] - export declare trait LodashGetOr5x4[T] { - val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 1562, 67] - } - export type LodashGetOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) - export type LodashGetOr5x6 = unsupported["type LodashGetOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 1565, 70] - export declare trait LodashGetOr6x2 { - val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 1572, 63] - } - export type LodashGetOr6x3[TDefault] = (object: null) => TDefault - export declare trait LodashGetOr6x4 { - val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 1578, 77] - } - export type LodashGetOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault - export type LodashGetOr6x6 = unsupported["type LodashGetOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 1581, 76] - export declare trait LodashGetOr7x1 { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1585, 55] - } - export type LodashGetOr7x3 = (object: anything) => anything - export declare trait LodashGetOr7x4 { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 1591, 77] - } - export type LodashGetOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export type LodashGetOr7x6 = (defaultValue: anything) => anything - export declare trait LodashGroupBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: T | null | undefined): lodash.Dictionary>;", "fp.d.ts", 1600, 103] - } - export type LodashGroupBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[MutArray[T]] - export type LodashGroupBy1x2 = unsupported["type LodashGroupBy1x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1603, 114] - export type LodashGroupBy2x2 = unsupported["type LodashGroupBy2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary>;", "fp.d.ts", 1604, 93] - export declare trait LodashGt { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1608, 52] - } - export type LodashGt1x1 = (other: anything) => (false) | (true) - export type LodashGt1x2 = (value: anything) => (false) | (true) - export declare trait LodashGte { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1615, 53] - } - export type LodashGte1x1 = (other: anything) => (false) | (true) - export type LodashGte1x2 = (value: anything) => (false) | (true) - export declare trait LodashHas { - val __call: unsupported["(path: lodash.PropertyPath, object: T): boolean;", "fp.d.ts", 1622, 54] - } - export type LodashHas1x1 = unsupported["type LodashHas1x1 = (object: T) => boolean;", "fp.d.ts", 1624, 5] - export type LodashHas1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (false) | (true) - export declare trait LodashHasIn { - val __call: unsupported["(path: lodash.PropertyPath, object: T): boolean;", "fp.d.ts", 1629, 56] - } - export type LodashHasIn1x1 = unsupported["type LodashHasIn1x1 = (object: T) => boolean;", "fp.d.ts", 1631, 5] - export type LodashHasIn1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (false) | (true) - export declare trait LodashIdentity { - val __call: unsupported["(): undefined;", "fp.d.ts", 1635, 25] - } - export declare trait LodashIncludes { - val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1640, 136] - } - export type LodashIncludes1x1[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) - export type LodashIncludes1x2[T] = (target: T) => (false) | (true) - export declare trait LodashIncludesFrom { - val __call: unsupported["(target: T, fromIndex: number, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1651, 159] - } - export declare trait LodashIncludesFrom1x1[T] { - val __call: unsupported["(fromIndex: number, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1656, 137] - } - export declare trait LodashIncludesFrom1x2 { - val __call: unsupported["(target: T, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean;", "fp.d.ts", 1661, 140] - } - export type LodashIncludesFrom1x3[T] = (collection: (Dictionary[T]) | (NumericDictionary[T])) => (false) | (true) - export declare trait LodashIncludesFrom1x4[T] { - val __call: unsupported["(target: T, fromIndex: number): boolean;", "fp.d.ts", 1667, 73] - } - export type LodashIncludesFrom1x5 = (fromIndex: Num) => (false) | (true) - export type LodashIncludesFrom1x6[T] = (target: T) => (false) | (true) - export declare trait LodashKeyBy { - val __call: unsupported["(iteratee: lodash.ValueIterateeCustom, collection: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 1676, 101] - } - export type LodashKeyBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => Dictionary[T] - export type LodashKeyBy1x2 = unsupported["type LodashKeyBy1x2 = (iteratee: lodash.ValueIterateeCustom) => lodash.Dictionary;", "fp.d.ts", 1679, 110] - export type LodashKeyBy2x2 = unsupported["type LodashKeyBy2x2 = (iteratee: lodash.ValueIterateeCustom) => lodash.Dictionary;", "fp.d.ts", 1680, 116] - export declare trait LodashIndexOf { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 1684, 93] - } - export type LodashIndexOf1x1[T] = (array: ArrayLike[T]) => Num - export type LodashIndexOf1x2[T] = (value: T) => Num - export declare trait LodashIndexOfFrom { - val __call: unsupported["(value: T, fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1695, 116] - } - export declare trait LodashIndexOfFrom1x1[T] { - val __call: unsupported["(fromIndex: number, array: lodash.List | null | undefined): number;", "fp.d.ts", 1700, 95] - } - export declare trait LodashIndexOfFrom1x2 { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 1705, 97] - } - export type LodashIndexOfFrom1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashIndexOfFrom1x4[T] { - val __call: unsupported["(value: T, fromIndex: number): number;", "fp.d.ts", 1711, 71] - } - export type LodashIndexOfFrom1x5 = (fromIndex: Num) => Num - export type LodashIndexOfFrom1x6[T] = (value: T) => Num - export type LodashInitial = unsupported["type LodashInitial = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 1715, 56] - export declare trait LodashInRange { - val __call: unsupported["(start: number, end: number, n: number): boolean;", "fp.d.ts", 1723, 69] - } - export declare trait LodashInRange1x1 { - val __call: unsupported["(end: number, n: number): boolean;", "fp.d.ts", 1728, 54] - } - export declare trait LodashInRange1x2 { - val __call: unsupported["(start: number, n: number): boolean;", "fp.d.ts", 1733, 56] - } - export type LodashInRange1x3 = (n: Num) => (false) | (true) - export declare trait LodashInRange1x4 { - val __call: unsupported["(start: number, end: number): boolean;", "fp.d.ts", 1739, 58] - } - export type LodashInRange1x5 = (end: Num) => (false) | (true) - export type LodashInRange1x6 = (start: Num) => (false) | (true) - export declare trait LodashIntersection { - val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 1746, 101] - } - export type LodashIntersection1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashIntersection1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashIntersectionBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null, values: lodash.List): T1[];", "fp.d.ts", 1757, 127] - } - export declare trait LodashIntersectionBy1x1[T1, T2] { - val __call: unsupported["(array: lodash.List | null, values: lodash.List): T1[];", "fp.d.ts", 1762, 81] - } - export declare trait LodashIntersectionBy1x2[T1] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 1767, 92] - } - export type LodashIntersectionBy1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export declare trait LodashIntersectionBy1x4[T2] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null): T1[];", "fp.d.ts", 1773, 98] - } - export type LodashIntersectionBy1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] - export type LodashIntersectionBy1x6 = unsupported["type LodashIntersectionBy1x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 1776, 79] - export declare trait LodashIntersectionWith { - val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 1784, 143] - } - export declare trait LodashIntersectionWith1x1[T1, T2] { - val __call: unsupported["(array: lodash.List | null | undefined, values: lodash.List): T1[];", "fp.d.ts", 1789, 83] - } - export declare trait LodashIntersectionWith1x2[T1] { - val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 1794, 96] - } - export type LodashIntersectionWith1x3[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export declare trait LodashIntersectionWith1x4[T2] { - val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List | null | undefined): T1[];", "fp.d.ts", 1800, 114] - } - export type LodashIntersectionWith1x5[T1] = (array: ArrayLike[T1]) => MutArray[T1] - export type LodashIntersectionWith1x6[T1, T2] = (comparator: {}) => MutArray[T1] - export type LodashInvert = (object: Object) => Dictionary[Str] - export declare trait LodashInvertBy { - val __call: unsupported["(interatee: lodash.ValueIteratee, object: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 1810, 101] - } - export type LodashInvertBy1x1[T] = (object: ((Object) | (Dictionary[T])) | (NumericDictionary[T])) => Dictionary[MutArray[Str]] - export type LodashInvertBy1x2 = unsupported["type LodashInvertBy1x2 = (interatee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1813, 152] - export type LodashInvertBy2x2 = unsupported["type LodashInvertBy2x2 = (interatee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 1814, 100] - export declare trait LodashInvoke { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1818, 56] - } - export type LodashInvoke1x1 = (object: anything) => anything - export type LodashInvoke1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashInvokeArgs { - val __call: unsupported["(path: lodash.PropertyPath, args: ReadonlyArray, object: any): any;", "fp.d.ts", 1829, 86] - } - export declare trait LodashInvokeArgs1x1 { - val __call: unsupported["(args: ReadonlyArray, object: any): any;", "fp.d.ts", 1834, 60] - } - export declare trait LodashInvokeArgs1x2 { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 1839, 60] - } - export type LodashInvokeArgs1x3 = (object: anything) => anything - export declare trait LodashInvokeArgs1x4 { - val __call: unsupported["(path: lodash.PropertyPath, args: ReadonlyArray): any;", "fp.d.ts", 1845, 73] - } - export type LodashInvokeArgs1x5 = (args: ReadonlyArray[anything]) => anything - export type LodashInvokeArgs1x6 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashInvokeArgsMap { - val __call: unsupported["(method: (...args: any[]) => TResult, args: ReadonlyArray, collection: object | null | undefined): TResult[];", "fp.d.ts", 1860, 144] - } - export declare trait LodashInvokeArgsMap1x1 { - val __call: unsupported["(args: ReadonlyArray, collection: object | null | undefined): any[];", "fp.d.ts", 1865, 89] - } - export declare trait LodashInvokeArgsMap1x2 { - val __call: unsupported["(method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[];", "fp.d.ts", 1872, 88] - } - export type LodashInvokeArgsMap1x3 = (collection: Object) => MutArray[anything] - export declare trait LodashInvokeArgsMap1x4 { - val __call: unsupported["(method: (...args: any[]) => TResult, args: ReadonlyArray): TResult[];", "fp.d.ts", 1880, 88] - } - export type LodashInvokeArgsMap1x5 = (args: ReadonlyArray[anything]) => MutArray[anything] - export declare trait LodashInvokeArgsMap1x6 { - val __call: unsupported["(method: (...args: any[]) => TResult): TResult[];", "fp.d.ts", 1885, 36] - } - export declare trait LodashInvokeArgsMap2x1[TResult] { - val __call: unsupported["(args: ReadonlyArray, collection: object | null | undefined): TResult[];", "fp.d.ts", 1890, 98] - } - export type LodashInvokeArgsMap2x3[TResult] = (collection: Object) => MutArray[TResult] - export type LodashInvokeArgsMap2x5[TResult] = (args: ReadonlyArray[anything]) => MutArray[TResult] - export declare trait LodashInvokeMap { - val __call: unsupported["(method: (...args: any[]) => TResult, collection: object | null | undefined): TResult[];", "fp.d.ts", 1899, 84] - } - export type LodashInvokeMap1x1 = (collection: Object) => MutArray[anything] - export declare trait LodashInvokeMap1x2 { - val __call: unsupported["(method: (...args: any[]) => TResult): TResult[];", "fp.d.ts", 1904, 36] - } - export type LodashInvokeMap2x1[TResult] = (collection: Object) => MutArray[TResult] - export type LodashIsArguments = (value: anything) => (false) | (true) - export type LodashIsArray = (value: anything) => (false) | (true) - export type LodashIsArrayBuffer = (value: anything) => (false) | (true) - export declare trait LodashIsArrayLike { - val __call: unsupported["(value: any): value is { length: number };", "fp.d.ts", 1913, 78] - } - export declare trait LodashIsArrayLikeObject { - val __call: unsupported["(value: any): value is object & { length: number };", "fp.d.ts", 1918, 128] - } - export type LodashIsBoolean = (value: anything) => (false) | (true) - export type LodashIsBuffer = (value: anything) => (false) | (true) - export type LodashIsDate = (value: anything) => (false) | (true) - export type LodashIsElement = (value: anything) => (false) | (true) - export declare trait LodashIsEmpty { - val __call: unsupported["(value?: any): boolean;", "fp.d.ts", 1931, 109] - } - export declare trait LodashIsEqualWith { - val __call: unsupported["(customizer: lodash.IsEqualCustomizer, value: any, other: any): boolean;", "fp.d.ts", 1940, 78] - } - export declare trait LodashIsEqualWith1x1 { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 1945, 61] - } - export declare trait LodashIsEqualWith1x2 { - val __call: unsupported["(customizer: lodash.IsEqualCustomizer, other: any): boolean;", "fp.d.ts", 1950, 66] - } - export type LodashIsEqualWith1x3 = (other: anything) => (false) | (true) - export declare trait LodashIsEqualWith1x4 { - val __call: unsupported["(customizer: lodash.IsEqualCustomizer, value: any): boolean;", "fp.d.ts", 1956, 66] - } - export type LodashIsEqualWith1x5 = (value: anything) => (false) | (true) - export type LodashIsEqualWith1x6 = (customizer: {}) => (false) | (true) - export type LodashIsError = (value: anything) => (false) | (true) - export type LodashIsFinite = (value: anything) => (false) | (true) - export type LodashIsFunction = (value: anything) => (false) | (true) - export type LodashIsInteger = (value: anything) => (false) | (true) - export type LodashIsLength = (value: anything) => (false) | (true) - export type LodashIsMap = (value: anything) => (false) | (true) - export declare trait LodashIsMatch { - val __call: unsupported["(source: object, object: object): boolean;", "fp.d.ts", 1969, 62] - } - export type LodashIsMatch1x1 = (object: Object) => (false) | (true) - export type LodashIsMatch1x2 = (source: Object) => (false) | (true) - export declare trait LodashIsMatchWith { - val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, source: object, object: object): boolean;", "fp.d.ts", 1980, 86] - } - export declare trait LodashIsMatchWith1x1 { - val __call: unsupported["(source: object, object: object): boolean;", "fp.d.ts", 1985, 66] - } - export declare trait LodashIsMatchWith1x2 { - val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, object: object): boolean;", "fp.d.ts", 1990, 70] - } - export type LodashIsMatchWith1x3 = (object: Object) => (false) | (true) - export declare trait LodashIsMatchWith1x4 { - val __call: unsupported["(customizer: lodash.isMatchWithCustomizer, source: object): boolean;", "fp.d.ts", 1996, 70] - } - export type LodashIsMatchWith1x5 = (source: Object) => (false) | (true) - export type LodashIsMatchWith1x6 = (customizer: {}) => (false) | (true) - export type LodashIsNaN = (value: anything) => (false) | (true) - export type LodashIsNative = (value: anything) => (false) | (true) - export type LodashIsNil = (value: anything) => (false) | (true) - export type LodashIsNull = (value: anything) => (false) | (true) - export type LodashIsNumber = (value: anything) => (false) | (true) - export type LodashIsObject = (value: anything) => (false) | (true) - export type LodashIsObjectLike = (value: anything) => (false) | (true) - export type LodashIsPlainObject = (value: anything) => (false) | (true) - export type LodashIsRegExp = (value: anything) => (false) | (true) - export type LodashIsSafeInteger = (value: anything) => (false) | (true) - export type LodashIsSet = (value: anything) => (false) | (true) - export type LodashIsString = (value: anything) => (false) | (true) - export type LodashIsSymbol = (value: anything) => (false) | (true) - export type LodashIsTypedArray = (value: anything) => (false) | (true) - export type LodashIsUndefined = (value: anything) => (false) | (true) - export type LodashIsWeakMap = (value: anything) => (false) | (true) - export type LodashIsWeakSet = (value: anything) => (false) | (true) - export declare trait LodashIteratee { - val __call: unsupported["(func: string | object): (...args: any[]) => any;", "fp.d.ts", 2019, 80] - } - export declare trait LodashJoin { - val __call: unsupported["(separator: string, array: lodash.List | null | undefined): string;", "fp.d.ts", 2024, 90] - } - export type LodashJoin1x1 = (array: ArrayLike[anything]) => Str - export type LodashJoin1x2 = (separator: Str) => Str - export type LodashOver = unsupported["type LodashOver = (iteratees: lodash.Many<(...args: any[]) => TResult>) => (...args: any[]) => TResult[];", "fp.d.ts", 2028, 55] - export type LodashKebabCase = (string: Str) => Str - export type LodashKeys = (object: anything) => MutArray[Str] - export type LodashKeysIn = (object: anything) => MutArray[Str] - export type LodashLast = unsupported["type LodashLast = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2032, 50] - export declare trait LodashLastIndexOf { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 2036, 97] - } - export type LodashLastIndexOf1x1[T] = (array: ArrayLike[T]) => Num - export type LodashLastIndexOf1x2[T] = (value: T) => Num - export declare trait LodashLastIndexOfFrom { - val __call: unsupported["(value: T, fromIndex: true|number, array: lodash.List | null | undefined): number;", "fp.d.ts", 2047, 125] - } - export declare trait LodashLastIndexOfFrom1x1[T] { - val __call: unsupported["(fromIndex: true|number, array: lodash.List | null | undefined): number;", "fp.d.ts", 2052, 99] - } - export declare trait LodashLastIndexOfFrom1x2 { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 2057, 101] - } - export type LodashLastIndexOfFrom1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashLastIndexOfFrom1x4[T] { - val __call: unsupported["(value: T, fromIndex: true|number): number;", "fp.d.ts", 2063, 80] - } - export type LodashLastIndexOfFrom1x5 = (fromIndex: (Num) | (true)) => Num - export type LodashLastIndexOfFrom1x6[T] = (value: T) => Num - export type LodashLowerCase = (string: Str) => Str - export type LodashLowerFirst = (string: Str) => Str - export declare trait LodashLt { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 2072, 52] - } - export type LodashLt1x1 = (other: anything) => (false) | (true) - export type LodashLt1x2 = (value: anything) => (false) | (true) - export declare trait LodashLte { - val __call: unsupported["(value: any, other: any): boolean;", "fp.d.ts", 2079, 53] - } - export type LodashLte1x1 = (other: anything) => (false) | (true) - export type LodashLte1x2 = (value: anything) => (false) | (true) - export declare trait LodashMap { - val __call: unsupported["(iteratee: object, collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined): boolean[];", "fp.d.ts", 2097, 41] - } - export type LodashMap1x1[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => MutArray[TResult] - export type LodashMap1x2 = unsupported["type LodashMap1x2 = (iteratee: (value: T) => TResult) => TResult[];", "fp.d.ts", 2100, 103] - export type LodashMap2x2 = unsupported["type LodashMap2x2 = (iteratee: (value: T) => TResult) => TResult[];", "fp.d.ts", 2101, 83] - export type LodashMap3x1[T, TResult] = (collection: T) => MutArray[TResult] - export type LodashMap3x2 = unsupported["type LodashMap3x2 = (iteratee: (value: T[keyof T]) => TResult) => TResult[];", "fp.d.ts", 2103, 84] - export type LodashMap4x1 = unsupported["type LodashMap4x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => Array;", "fp.d.ts", 2104, 92] - export declare trait LodashMap4x2[T] { - val __call: unsupported["(iteratee: object): boolean[];", "fp.d.ts", 2108, 34] - } - export type LodashMap5x1 = unsupported["type LodashMap5x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => any[];", "fp.d.ts", 2110, 5] - export type LodashMap6x1 = unsupported["type LodashMap6x1 = (collection: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => boolean[];", "fp.d.ts", 2111, 120] - export declare trait LodashMapKeys { - val __call: unsupported["(iteratee: lodash.ValueIteratee, object: T | null | undefined): lodash.Dictionary;", "fp.d.ts", 2118, 99] - } - export type LodashMapKeys1x1 = unsupported["type LodashMapKeys1x1 = (object: lodash.List | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2120, 5] - export type LodashMapKeys1x2[T] = (iteratee: ((((Str) | (Num)) | (Symbol)) | ((((Str) | (Num)) | (Symbol), anything, ))) | ((value: T) => anything)) => Dictionary[T] - export type LodashMapKeys2x1 = unsupported["type LodashMapKeys2x1 = (object: T | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2122, 96] - export type LodashMapKeys2x2 = unsupported["type LodashMapKeys2x2 = (iteratee: lodash.ValueIteratee) => lodash.Dictionary;", "fp.d.ts", 2123, 110] - export declare trait LodashMapValues { - val __call: unsupported["(iteratee: string, obj: T | null | undefined): { [P in keyof T]: any };", "fp.d.ts", 2138, 130] - } - export type LodashMapValues1x1[T, TResult] = (obj: (Dictionary[T]) | (NumericDictionary[T])) => Dictionary[TResult] - export declare trait LodashMapValues1x2[T] { - val __call: unsupported["(iteratee: string): lodash.Dictionary;", "fp.d.ts", 2145, 75] - } - export type LodashMapValues2x1 = unsupported["type LodashMapValues2x1 = (obj: T | null | undefined) => { [P in keyof T]: TResult };", "fp.d.ts", 2147, 5] - export declare trait LodashMapValues2x2[T] { - val __call: unsupported["(iteratee: string): { [P in keyof T]: any };", "fp.d.ts", 2151, 56] - } - export declare trait LodashMapValues3x1 { - val __call: unsupported["(obj: T | null | undefined): { [P in keyof T]: boolean };", "fp.d.ts", 2155, 116] - } - export type LodashMapValues5x1 = unsupported["type LodashMapValues5x1 = (obj: lodash.Dictionary | lodash.NumericDictionary | null | undefined) => lodash.Dictionary;", "fp.d.ts", 2157, 5] - export declare trait LodashMapValues6x1 { - val __call: unsupported["(obj: T | null | undefined): { [P in keyof T]: any };", "fp.d.ts", 2160, 112] - } - export declare trait LodashMatchesProperty { - val __call: unsupported["(path: lodash.PropertyPath, srcValue: T): (value: any) => boolean;", "fp.d.ts", 2165, 68] - } - export type LodashMatchesProperty1x1 = unsupported["type LodashMatchesProperty1x1 = (srcValue: T) => (value: any) => boolean;", "fp.d.ts", 2167, 5] - export type LodashMatchesProperty1x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (value: anything) => (false) | (true) - export type LodashMax = unsupported["type LodashMax = (collection: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2169, 91] - export declare trait LodashMaxBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2173, 99] - } - export type LodashMaxBy1x1[T] = (collection: ArrayLike[T]) => T - export type LodashMaxBy1x2 = unsupported["type LodashMaxBy1x2 = (iteratee: lodash.ValueIteratee) => T | undefined;", "fp.d.ts", 2176, 94] - export type LodashMean = (collection: ArrayLike[anything]) => Num - export declare trait LodashMeanBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): number;", "fp.d.ts", 2181, 100] - } - export type LodashMeanBy1x1[T] = (collection: ArrayLike[T]) => Num - export type LodashMeanBy1x2 = unsupported["type LodashMeanBy1x2 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 2184, 88] - export type LodashMemoize = unsupported["type LodashMemoize = any>(func: T) => T & lodash.MemoizedFunction;", "fp.d.ts", 2185, 76] - export declare trait LodashMerge { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2189, 79] - } - export type LodashMerge1x1 = unsupported["type LodashMerge1x1 = (source: TSource) => TObject & TSource;", "fp.d.ts", 2191, 5] - export type LodashMerge1x2 = unsupported["type LodashMerge1x2 = (object: TObject) => TObject & TSource;", "fp.d.ts", 2192, 83] - export declare trait LodashMergeAll { - val __call: unsupported["(object: ReadonlyArray): any;", "fp.d.ts", 2198, 170] - } - export declare trait LodashMergeAllWith { - val __call: unsupported["(customizer: lodash.MergeWithCustomizer, args: ReadonlyArray): any;", "fp.d.ts", 2203, 81] - } - export type LodashMergeAllWith1x1 = (args: ReadonlyArray[anything]) => anything - export type LodashMergeAllWith1x2 = (customizer: (value: anything, srcValue: anything, key: Str, object: anything, source: anything) => anything) => anything - export declare trait LodashMergeWith { - val __call: unsupported["(customizer: lodash.MergeWithCustomizer, object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2214, 122] - } - export declare trait LodashMergeWith1x1 { - val __call: unsupported["(object: TObject, source: TSource): TObject & TSource;", "fp.d.ts", 2219, 83] - } - export declare trait LodashMergeWith1x2[TObject] { - val __call: unsupported["(customizer: lodash.MergeWithCustomizer, source: TSource): TObject & TSource;", "fp.d.ts", 2224, 96] - } - export type LodashMergeWith1x3 = unsupported["type LodashMergeWith1x3 = (source: TSource) => TObject & TSource;", "fp.d.ts", 2226, 5] - export declare trait LodashMergeWith1x4[TSource] { - val __call: unsupported["(customizer: lodash.MergeWithCustomizer, object: TObject): TObject & TSource;", "fp.d.ts", 2230, 96] - } - export type LodashMergeWith1x5 = unsupported["type LodashMergeWith1x5 = (object: TObject) => TObject & TSource;", "fp.d.ts", 2232, 5] - export type LodashMergeWith1x6[TObject, TSource] = (customizer: (value: anything, srcValue: anything, key: Str, object: anything, source: anything) => anything) => (TObject) & (TSource) - export type LodashMethod = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => (object: anything) => anything - export type LodashMethodOf = (object: Object) => (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export type LodashMin = unsupported["type LodashMin = (collection: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2236, 81] - export declare trait LodashMinBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, collection: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2240, 99] - } - export type LodashMinBy1x1[T] = (collection: ArrayLike[T]) => T - export type LodashMinBy1x2 = unsupported["type LodashMinBy1x2 = (iteratee: lodash.ValueIteratee) => T | undefined;", "fp.d.ts", 2243, 94] - export declare trait LodashMultiply { - val __call: unsupported["(multiplier: number, multiplicand: number): number;", "fp.d.ts", 2247, 73] - } - export type LodashMultiply1x1 = (multiplicand: Num) => Num - export type LodashMultiply1x2 = (multiplier: Num) => Num - export type LodashNoConflict = () => LoDashFp - export type LodashNoop = (args: (anything) | (MutArray[anything])) => unit - export type LodashNow = () => Num - export declare trait LodashNth { - val __call: unsupported["(n: number, array: lodash.List | null | undefined): T | undefined;", "fp.d.ts", 2257, 85] - } - export type LodashNth1x1 = unsupported["type LodashNth1x1 = (array: lodash.List | null | undefined) => T | undefined;", "fp.d.ts", 2259, 5] - export type LodashNth1x2[T] = (n: Num) => T - export type LodashNthArg = (n: Num) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashOmit { - val __call: unsupported["(paths: lodash.Many, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2267, 65] - } - export type LodashOmit1x1 = unsupported["type LodashOmit1x1 = (object: T | null | undefined) => lodash.Omit;", "fp.d.ts", 2269, 5] - export declare trait LodashOmit1x2[T] { - val __call: unsupported["(paths: lodash.Many): lodash.PartialObject;", "fp.d.ts", 2272, 70] - } - export type LodashOmit2x1 = unsupported["type LodashOmit2x1 = (object: T | null | undefined) => lodash.PartialObject;", "fp.d.ts", 2274, 5] - export declare trait LodashOmitBy { - val __call: unsupported["(predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2282, 99] - } - export declare trait LodashOmitBy1x1[T] { - val __call: unsupported["(object: T1 | null | undefined): lodash.PartialObject;", "fp.d.ts", 2287, 94] - } - export type LodashOmitBy1x2 = unsupported["type LodashOmitBy1x2 = (predicate: lodash.ValueKeyIteratee) => lodash.Dictionary;", "fp.d.ts", 2289, 5] - export type LodashOmitBy2x2 = unsupported["type LodashOmitBy2x2 = (predicate: lodash.ValueKeyIteratee) => lodash.NumericDictionary;", "fp.d.ts", 2290, 94] - export type LodashOmitBy3x2 = unsupported["type LodashOmitBy3x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject;", "fp.d.ts", 2291, 101] - export type LodashOnce = unsupported["type LodashOnce = any>(func: T) => T;", "fp.d.ts", 2292, 106] - export declare trait LodashOrderBy { - val __call: unsupported["(iteratees: lodash.Many>, orders: lodash.__, collection: T | null | undefined): LodashOrderBy4x5;", "fp.d.ts", 2308, 238] - } - export declare trait LodashOrderBy1x1[T] { - val __call: unsupported["(orders: lodash.__, collection: T1 | null | undefined): LodashOrderBy3x5;", "fp.d.ts", 2314, 117] - } - export declare trait LodashOrderBy1x2 { - val __call: unsupported["(iteratees: lodash.Many<(value: T[keyof T]) => lodash.NotVoid> | lodash.Many>, collection: T | null | undefined): Array;", "fp.d.ts", 2322, 104] - } - export declare trait LodashOrderBy1x3[T] { - val __call: unsupported["(collection: object | null | undefined): object[];", "fp.d.ts", 2326, 61] - } - export declare trait LodashOrderBy1x4[T] { - val __call: unsupported["(iteratees: lodash.Many>): LodashOrderBy2x5;", "fp.d.ts", 2332, 154] - } - export type LodashOrderBy1x5[T] = (orders: ((((false) | (true)) | (Str)) | (Str)) | (ReadonlyArray[(((false) | (true)) | (Str)) | (Str)])) => MutArray[T] - export type LodashOrderBy1x6 = unsupported["type LodashOrderBy1x6 = (iteratees: lodash.Many<(value: T) => lodash.NotVoid> | lodash.Many>) => T[];", "fp.d.ts", 2335, 82] - export declare trait LodashOrderBy2x1[T] { - val __call: unsupported["(orders: lodash.__, collection: T1 | null | undefined): LodashOrderBy4x5;", "fp.d.ts", 2340, 117] - } - export declare trait LodashOrderBy2x3[T] { - val __call: unsupported["(collection: object | null | undefined): object[];", "fp.d.ts", 2344, 61] - } - export type LodashOrderBy2x5[T] = (orders: ((((false) | (true)) | (Str)) | (Str)) | (ReadonlyArray[(((false) | (true)) | (Str)) | (Str)])) => MutArray[T] - export declare trait LodashOrderBy3x4[T] { - val __call: unsupported["(iteratees: lodash.Many>): LodashOrderBy4x5;", "fp.d.ts", 2351, 186] - } - export type LodashOrderBy3x5 = unsupported["type LodashOrderBy3x5 = (orders: lodash.Many) => Array;", "fp.d.ts", 2353, 5] - export type LodashOrderBy3x6 = unsupported["type LodashOrderBy3x6 = (iteratees: lodash.Many<(value: T[keyof T]) => lodash.NotVoid> | lodash.Many>) => Array;", "fp.d.ts", 2354, 96] - export type LodashOrderBy4x5 = unsupported["type LodashOrderBy4x5 = (orders: lodash.Many) => Array;", "fp.d.ts", 2355, 164] - export declare trait LodashOverArgs { - val __call: unsupported["(func: (...args: any[]) => any, transforms: lodash.Many<(...args: any[]) => any>): (...args: any[]) => any;", "fp.d.ts", 2359, 95] - } - export type LodashOverArgs1x1 = (transforms: ((args: (anything) | (MutArray[anything])) => anything) | (ReadonlyArray[(args: (anything) | (MutArray[anything])) => anything])) => (args: (anything) | (MutArray[anything])) => anything - export type LodashOverArgs1x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashPad { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2366, 58] - } - export type LodashPad1x1 = (string: Str) => Str - export type LodashPad1x2 = (length: Num) => Str - export declare trait LodashPadChars { - val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2377, 78] - } - export declare trait LodashPadChars1x1 { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2382, 63] - } - export declare trait LodashPadChars1x2 { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2387, 62] - } - export type LodashPadChars1x3 = (string: Str) => Str - export declare trait LodashPadChars1x4 { - val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2393, 62] - } - export type LodashPadChars1x5 = (length: Num) => Str - export type LodashPadChars1x6 = (chars: Str) => Str - export declare trait LodashPadCharsEnd { - val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2404, 81] - } - export declare trait LodashPadCharsEnd1x1 { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2409, 66] - } - export declare trait LodashPadCharsEnd1x2 { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2414, 65] - } - export type LodashPadCharsEnd1x3 = (string: Str) => Str - export declare trait LodashPadCharsEnd1x4 { - val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2420, 65] - } - export type LodashPadCharsEnd1x5 = (length: Num) => Str - export type LodashPadCharsEnd1x6 = (chars: Str) => Str - export declare trait LodashPadCharsStart { - val __call: unsupported["(chars: string, length: number, string: string): string;", "fp.d.ts", 2431, 83] - } - export declare trait LodashPadCharsStart1x1 { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2436, 68] - } - export declare trait LodashPadCharsStart1x2 { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 2441, 67] - } - export type LodashPadCharsStart1x3 = (string: Str) => Str - export declare trait LodashPadCharsStart1x4 { - val __call: unsupported["(chars: string, length: number): string;", "fp.d.ts", 2447, 67] - } - export type LodashPadCharsStart1x5 = (length: Num) => Str - export type LodashPadCharsStart1x6 = (chars: Str) => Str - export declare trait LodashPadEnd { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2454, 61] - } - export type LodashPadEnd1x1 = (string: Str) => Str - export type LodashPadEnd1x2 = (length: Num) => Str - export declare trait LodashPadStart { - val __call: unsupported["(length: number, string: string): string;", "fp.d.ts", 2461, 63] - } - export type LodashPadStart1x1 = (string: Str) => Str - export type LodashPadStart1x2 = (length: Num) => Str - export declare trait LodashParseInt { - val __call: unsupported["(radix: number, string: string): number;", "fp.d.ts", 2468, 62] - } - export type LodashParseInt1x1 = (string: Str) => Num - export type LodashParseInt1x2 = (radix: Num) => Num - export declare trait LodashPartial { - val __call: unsupported["(func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R, t1: [T1, T2, T3, T4]): (...ts: TS) => R;", "fp.d.ts", 2515, 99] - val placeholder: LoDashStatic - } - export type LodashPartial1x1[T1, T2, R] = (plc1: (LoDashStatic, T2, )) => {} - export declare trait LodashPartial1x2[T2] { - val __call: unsupported["(func: lodash.Function4): lodash.Function3;", "fp.d.ts", 2522, 88] - } - export declare trait LodashPartial2x1[T1, T2, T3, R] { - val __call: unsupported["(plc1: [lodash.__, T2, T3]): lodash.Function1;", "fp.d.ts", 2528, 61] - } - export declare trait LodashPartial3x2[T3] { - val __call: unsupported["(func: lodash.Function4): lodash.Function3;", "fp.d.ts", 2532, 88] - } - export declare trait LodashPartial4x2[T1, T3] { - val __call: unsupported["(func: lodash.Function4): lodash.Function2;", "fp.d.ts", 2536, 80] - } - export declare trait LodashPartial5x2[T2, T3] { - val __call: unsupported["(func: lodash.Function4): lodash.Function2;", "fp.d.ts", 2540, 80] - } - export declare trait LodashPartial6x1[T1, T2, T3, T4, R] { - val __call: unsupported["(plc1: [lodash.__, T2, T3, T4]): lodash.Function1;", "fp.d.ts", 2554, 65] - } - export declare trait LodashPartial10x2[T1, T2, T3] { - val __call: unsupported["(func: (t1: T1, t2: T2, t3: T3, ...ts: TS) => R): (...ts: TS) => R;", "fp.d.ts", 2558, 84] - } - export type LodashPartial11x2 = unsupported["type LodashPartial11x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2560, 5] - export type LodashPartial12x2 = unsupported["type LodashPartial12x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2561, 127] - export type LodashPartial13x2 = unsupported["type LodashPartial13x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2562, 123] - export type LodashPartial14x2 = unsupported["type LodashPartial14x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2563, 123] - export type LodashPartial15x2 = unsupported["type LodashPartial15x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2564, 119] - export type LodashPartial16x2 = unsupported["type LodashPartial16x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2565, 123] - export type LodashPartial17x2 = unsupported["type LodashPartial17x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2566, 119] - export type LodashPartial18x1[TS, T1, R] = (arg1: (T1, )) => (ts: TS) => R - export type LodashPartial18x2 = unsupported["type LodashPartial18x2 = (func: (t1: T1, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2568, 87] - export type LodashPartial19x1[TS, T1, T2, R] = (t1: (T1, T2, )) => (ts: TS) => R - export type LodashPartial19x2 = unsupported["type LodashPartial19x2 = (func: (t1: T1, t2: T2, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2570, 93] - export type LodashPartial20x1[TS, T1, T2, T3, R] = (t1: (T1, T2, T3, )) => (ts: TS) => R - export type LodashPartial21x1[TS, T1, T2, T3, T4, R] = (t1: (T1, T2, T3, T4, )) => (ts: TS) => R - export type LodashPartial21x2 = unsupported["type LodashPartial21x2 = (func: (t1: T1, t2: T2, t3: T3, t4: T4, ...ts: TS) => R) => (...ts: TS) => R;", "fp.d.ts", 2573, 109] - export declare trait LodashPartialRight { - val __call: unsupported["(func: (...args: any[]) => any, args: ReadonlyArray): (...args: any[]) => any;", "fp.d.ts", 2633, 76] - val placeholder: LoDashStatic - } - export type LodashPartialRight1x1[T1, R] = (arg1: (T1, )) => {} - export type LodashPartialRight1x2 = unsupported["type LodashPartialRight1x2 = (func: lodash.Function1) => lodash.Function0;", "fp.d.ts", 2637, 76] - export declare trait LodashPartialRight2x1[T1, T2, R] { - val __call: unsupported["(arg1: [T1, T2]): lodash.Function0;", "fp.d.ts", 2641, 46] - } - export type LodashPartialRight2x2 = unsupported["type LodashPartialRight2x2 = (func: lodash.Function2) => lodash.Function1;", "fp.d.ts", 2643, 5] - export type LodashPartialRight3x2 = unsupported["type LodashPartialRight3x2 = (func: lodash.Function2) => lodash.Function1;", "fp.d.ts", 2644, 107] - export type LodashPartialRight4x2 = unsupported["type LodashPartialRight4x2 = (func: lodash.Function2) => lodash.Function0;", "fp.d.ts", 2645, 107] - export declare trait LodashPartialRight5x1[T1, T2, T3, R] { - val __call: unsupported["(arg1: [T1, T2, T3]): lodash.Function0;", "fp.d.ts", 2653, 50] - } - export type LodashPartialRight5x2 = unsupported["type LodashPartialRight5x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2655, 5] - export type LodashPartialRight6x2 = unsupported["type LodashPartialRight6x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2656, 119] - export type LodashPartialRight7x2 = unsupported["type LodashPartialRight7x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2657, 119] - export type LodashPartialRight8x2 = unsupported["type LodashPartialRight8x2 = (func: lodash.Function3) => lodash.Function2;", "fp.d.ts", 2658, 115] - export type LodashPartialRight9x2 = unsupported["type LodashPartialRight9x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2659, 119] - export type LodashPartialRight10x2 = unsupported["type LodashPartialRight10x2 = (func: lodash.Function3) => lodash.Function1;", "fp.d.ts", 2660, 115] - export type LodashPartialRight11x2 = unsupported["type LodashPartialRight11x2 = (func: lodash.Function3) => lodash.Function0;", "fp.d.ts", 2661, 116] - export declare trait LodashPartialRight12x1[T1, T2, T3, T4, R] { - val __call: unsupported["(arg1: [T1, T2, T3, T4]): lodash.Function0;", "fp.d.ts", 2677, 54] - } - export type LodashPartialRight12x2 = unsupported["type LodashPartialRight12x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2679, 5] - export type LodashPartialRight13x2 = unsupported["type LodashPartialRight13x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2680, 132] - export type LodashPartialRight14x2 = unsupported["type LodashPartialRight14x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2681, 132] - export type LodashPartialRight15x2 = unsupported["type LodashPartialRight15x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2682, 128] - export type LodashPartialRight16x2 = unsupported["type LodashPartialRight16x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2683, 132] - export type LodashPartialRight17x2 = unsupported["type LodashPartialRight17x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2684, 128] - export type LodashPartialRight18x2 = unsupported["type LodashPartialRight18x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2685, 128] - export type LodashPartialRight19x2 = unsupported["type LodashPartialRight19x2 = (func: lodash.Function4) => lodash.Function3;", "fp.d.ts", 2686, 124] - export type LodashPartialRight20x2 = unsupported["type LodashPartialRight20x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2687, 132] - export type LodashPartialRight21x2 = unsupported["type LodashPartialRight21x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2688, 128] - export type LodashPartialRight22x2 = unsupported["type LodashPartialRight22x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2689, 128] - export type LodashPartialRight23x2 = unsupported["type LodashPartialRight23x2 = (func: lodash.Function4) => lodash.Function2;", "fp.d.ts", 2690, 124] - export type LodashPartialRight24x2 = unsupported["type LodashPartialRight24x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2691, 128] - export type LodashPartialRight25x2 = unsupported["type LodashPartialRight25x2 = (func: lodash.Function4) => lodash.Function1;", "fp.d.ts", 2692, 124] - export type LodashPartialRight26x2 = unsupported["type LodashPartialRight26x2 = (func: lodash.Function4) => lodash.Function0;", "fp.d.ts", 2693, 124] - export type LodashPartialRight27x1 = (args: ReadonlyArray[anything]) => (args: (anything) | (MutArray[anything])) => anything - export type LodashPartialRight27x2 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashPartition { - val __call: unsupported["(callback: lodash.ValueIteratee, collection: T | null | undefined): [Array, Array];", "fp.d.ts", 2703, 105] - } - export type LodashPartition1x1 = unsupported["type LodashPartition1x1 = (collection: lodash.List | null | undefined) => [U[], Array>];", "fp.d.ts", 2705, 5] - export declare trait LodashPartition1x2[T] { - val __call: unsupported["(callback: lodash.ValueIteratee): [T[], T[]];", "fp.d.ts", 2708, 98] - } - export type LodashPartition2x1[T] = (collection: (Object) | (ArrayLike[T])) => (MutArray[T], MutArray[T], ) - export type LodashPartition3x2 = unsupported["type LodashPartition3x2 = (callback: lodash.ValueIteratee) => [Array, Array];", "fp.d.ts", 2711, 104] - export declare trait LodashPath { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2736, 55] - } - export val LodashPath1x1: unsupported["interface LodashPath1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 2738, 5] - export declare trait LodashPath1x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 2746, 176] - } - export declare trait LodashPath2x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 2752, 188] - } - export val LodashPath3x1: unsupported["interface LodashPath3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 2754, 5] - export val LodashPath5x1: unsupported["interface LodashPath5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 2758, 5] - export val LodashPath7x1: unsupported["interface LodashPath7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 2762, 5] - export declare trait LodashPath9x1 { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 2768, 52] - } - export type LodashPath9x2[T] = (path: Num) => T - export type LodashPath10x2[T] = (path: Num) => T - export declare trait LodashPath11x1 { - val __call: unsupported["(object: any): any;", "fp.d.ts", 2774, 46] - } - export type LodashPath11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined - export type LodashPath12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashPathOr { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2815, 91] - } - export declare trait LodashPathOr1x1[TDefault] { - val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 2832, 79] - } - export val LodashPathOr1x2: unsupported["interface LodashPathOr1x2 { (defaultValue: TDefault): LodashPathOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2834, 5] - export type LodashPathOr1x3 = unsupported["type LodashPathOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2839, 5] - export declare trait LodashPathOr1x4[TObject] { - val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 2849, 282] - } - export declare trait LodashPathOr1x5[TObject, TDefault] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 2855, 207] - } - export type LodashPathOr1x6 = unsupported["type LodashPathOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2857, 5] - export val LodashPathOr2x2: unsupported["interface LodashPathOr2x2 { (defaultValue: TDefault): LodashPathOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2858, 147] - export type LodashPathOr2x3 = unsupported["type LodashPathOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2863, 5] - export type LodashPathOr2x6 = unsupported["type LodashPathOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2864, 204] - export val LodashPathOr3x2: unsupported["interface LodashPathOr3x2 { (defaultValue: TDefault): LodashPathOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2865, 192] - export type LodashPathOr3x3 = unsupported["type LodashPathOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2870, 5] - export type LodashPathOr3x6 = unsupported["type LodashPathOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2871, 254] - export val LodashPathOr4x2: unsupported["interface LodashPathOr4x2 { (defaultValue: TDefault): LodashPathOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPathOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 2872, 242] - export type LodashPathOr4x3 = unsupported["type LodashPathOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 2877, 5] - export type LodashPathOr4x6 = unsupported["type LodashPathOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 2878, 311] - export declare trait LodashPathOr5x2 { - val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 2882, 113] - } - export type LodashPathOr5x3 = unsupported["type LodashPathOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 2884, 5] - export declare trait LodashPathOr5x4[T] { - val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 2888, 68] - } - export type LodashPathOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) - export type LodashPathOr5x6 = unsupported["type LodashPathOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 2891, 71] - export declare trait LodashPathOr6x2 { - val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 2898, 64] - } - export type LodashPathOr6x3[TDefault] = (object: null) => TDefault - export declare trait LodashPathOr6x4 { - val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 2904, 78] - } - export type LodashPathOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault - export type LodashPathOr6x6 = unsupported["type LodashPathOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 2907, 77] - export declare trait LodashPathOr7x1 { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2911, 56] - } - export type LodashPathOr7x3 = (object: anything) => anything - export declare trait LodashPathOr7x4 { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 2917, 78] - } - export type LodashPathOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export type LodashPathOr7x6 = (defaultValue: anything) => anything - export declare trait LodashPick { - val __call: unsupported["(props: lodash.PropertyPath, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2927, 78] - } - export type LodashPick1x1 = unsupported["type LodashPick1x1 = (object: T) => Pick;", "fp.d.ts", 2929, 5] - export type LodashPick1x2 = unsupported["type LodashPick1x2 = (props: lodash.Many) => Pick;", "fp.d.ts", 2930, 73] - export type LodashPick2x1 = unsupported["type LodashPick2x1 = (object: T | null | undefined) => lodash.PartialObject;", "fp.d.ts", 2931, 85] - export type LodashPick2x2 = unsupported["type LodashPick2x2 = (props: lodash.PropertyPath) => lodash.PartialObject;", "fp.d.ts", 2932, 86] - export declare trait LodashPickBy { - val __call: unsupported["(predicate: lodash.ValueKeyIteratee, object: T | null | undefined): lodash.PartialObject;", "fp.d.ts", 2943, 99] - } - export declare trait LodashPickBy1x1[T, S] { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): lodash.NumericDictionary;", "fp.d.ts", 2947, 80] - } - export declare trait LodashPickBy1x2[T] { - val __call: unsupported["(predicate: lodash.ValueKeyIteratee): lodash.Dictionary;", "fp.d.ts", 2951, 95] - } - export declare trait LodashPickBy2x2[T] { - val __call: unsupported["(predicate: lodash.ValueKeyIteratee): lodash.NumericDictionary;", "fp.d.ts", 2955, 102] - } - export declare trait LodashPickBy3x1[T] { - val __call: unsupported["(object: T1 | null | undefined): lodash.PartialObject;", "fp.d.ts", 2960, 94] - } - export type LodashPickBy5x2 = unsupported["type LodashPickBy5x2 = (predicate: lodash.ValueKeyIteratee) => lodash.PartialObject;", "fp.d.ts", 2962, 5] - export declare trait LodashProp { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 2987, 55] - } - export val LodashProp1x1: unsupported["interface LodashProp1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 2989, 5] - export declare trait LodashProp1x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 2997, 176] - } - export declare trait LodashProp2x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3003, 188] - } - export val LodashProp3x1: unsupported["interface LodashProp3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3005, 5] - export val LodashProp5x1: unsupported["interface LodashProp5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3009, 5] - export val LodashProp7x1: unsupported["interface LodashProp7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3013, 5] - export declare trait LodashProp9x1 { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3019, 52] - } - export type LodashProp9x2[T] = (path: Num) => T - export type LodashProp10x2[T] = (path: Num) => T - export declare trait LodashProp11x1 { - val __call: unsupported["(object: any): any;", "fp.d.ts", 3025, 46] - } - export type LodashProp11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined - export type LodashProp12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashProperty { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3053, 59] - } - export val LodashProperty1x1: unsupported["interface LodashProperty1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 3055, 5] - export declare trait LodashProperty1x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 3063, 176] - } - export declare trait LodashProperty2x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3069, 188] - } - export val LodashProperty3x1: unsupported["interface LodashProperty3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3071, 5] - export val LodashProperty5x1: unsupported["interface LodashProperty5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3075, 5] - export val LodashProperty7x1: unsupported["interface LodashProperty7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3079, 5] - export declare trait LodashProperty9x1 { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3085, 52] - } - export type LodashProperty9x2[T] = (path: Num) => T - export type LodashProperty10x2[T] = (path: Num) => T - export declare trait LodashProperty11x1 { - val __call: unsupported["(object: any): any;", "fp.d.ts", 3091, 46] - } - export type LodashProperty11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined - export type LodashProperty12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashPropertyOf { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3119, 61] - } - export val LodashPropertyOf1x1: unsupported["interface LodashPropertyOf1x1 { (object: TObject): TObject[TKey]; (object: TObject | null | undefined): TObject[TKey] | undefined; }", "fp.d.ts", 3121, 5] - export declare trait LodashPropertyOf1x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4];", "fp.d.ts", 3129, 176] - } - export declare trait LodashPropertyOf2x2[TObject] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): TObject[TKey1][TKey2][TKey3][TKey4] | undefined;", "fp.d.ts", 3135, 188] - } - export val LodashPropertyOf3x1: unsupported["interface LodashPropertyOf3x1 { (object: TObject): TObject[TKey1][TKey2]; (object: TObject | null | undefined): TObject[TKey1][TKey2] | undefined; }", "fp.d.ts", 3137, 5] - export val LodashPropertyOf5x1: unsupported["interface LodashPropertyOf5x1 { (object: TObject): TObject[TKey1][TKey2][TKey3]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3] | undefined; }", "fp.d.ts", 3141, 5] - export val LodashPropertyOf7x1: unsupported["interface LodashPropertyOf7x1 { (object: TObject): TObject[TKey1][TKey2][TKey3][TKey4]; (object: TObject | null | undefined): TObject[TKey1][TKey2][TKey3][TKey4] | undefined; }", "fp.d.ts", 3145, 5] - export declare trait LodashPropertyOf9x1 { - val __call: unsupported["(object: lodash.NumericDictionary | null | undefined): T | undefined;", "fp.d.ts", 3151, 52] - } - export type LodashPropertyOf9x2[T] = (path: Num) => T - export type LodashPropertyOf10x2[T] = (path: Num) => T - export declare trait LodashPropertyOf11x1 { - val __call: unsupported["(object: any): any;", "fp.d.ts", 3157, 46] - } - export type LodashPropertyOf11x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => undefined - export type LodashPropertyOf12x2 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashPropOr { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3198, 91] - } - export declare trait LodashPropOr1x1[TDefault] { - val __call: unsupported["(path: lodash.PropertyPath, object: null | undefined): TDefault;", "fp.d.ts", 3215, 79] - } - export val LodashPropOr1x2: unsupported["interface LodashPropOr1x2 { (defaultValue: TDefault): LodashPropOr1x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr1x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3217, 5] - export type LodashPropOr1x3 = unsupported["type LodashPropOr1x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3222, 5] - export declare trait LodashPropOr1x4[TObject] { - val __call: unsupported["(defaultValue: TDefault, path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 3232, 282] - } - export declare trait LodashPropOr1x5[TObject, TDefault] { - val __call: unsupported["(path: [TKey1, TKey2, TKey3, TKey4]): Exclude | TDefault;", "fp.d.ts", 3238, 207] - } - export type LodashPropOr1x6 = unsupported["type LodashPropOr1x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3240, 5] - export val LodashPropOr2x2: unsupported["interface LodashPropOr2x2 { (defaultValue: TDefault): LodashPropOr2x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr2x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3241, 147] - export type LodashPropOr2x3 = unsupported["type LodashPropOr2x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3246, 5] - export type LodashPropOr2x6 = unsupported["type LodashPropOr2x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3247, 204] - export val LodashPropOr3x2: unsupported["interface LodashPropOr3x2 { (defaultValue: TDefault): LodashPropOr3x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr3x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3248, 192] - export type LodashPropOr3x3 = unsupported["type LodashPropOr3x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3253, 5] - export type LodashPropOr3x6 = unsupported["type LodashPropOr3x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3254, 254] - export val LodashPropOr4x2: unsupported["interface LodashPropOr4x2 { (defaultValue: TDefault): LodashPropOr4x3; (defaultValue: lodash.__, object: TObject | null | undefined): LodashPropOr4x6; (defaultValue: TDefault, object: TObject | null | undefined): Exclude | TDefault; }", "fp.d.ts", 3255, 242] - export type LodashPropOr4x3 = unsupported["type LodashPropOr4x3 = (object: TObject | null | undefined) => Exclude | TDefault;", "fp.d.ts", 3260, 5] - export type LodashPropOr4x6 = unsupported["type LodashPropOr4x6 = (defaultValue: TDefault) => Exclude | TDefault;", "fp.d.ts", 3261, 311] - export declare trait LodashPropOr5x2 { - val __call: unsupported["(defaultValue: TDefault, object: lodash.NumericDictionary | null | undefined): T | TDefault;", "fp.d.ts", 3265, 113] - } - export type LodashPropOr5x3 = unsupported["type LodashPropOr5x3 = (object: lodash.NumericDictionary | null | undefined) => T | TDefault;", "fp.d.ts", 3267, 5] - export declare trait LodashPropOr5x4[T] { - val __call: unsupported["(defaultValue: TDefault, path: number): T | TDefault;", "fp.d.ts", 3271, 68] - } - export type LodashPropOr5x5[T, TDefault] = (path: Num) => (T) | (TDefault) - export type LodashPropOr5x6 = unsupported["type LodashPropOr5x6 = (defaultValue: TDefault) => T | TDefault;", "fp.d.ts", 3274, 71] - export declare trait LodashPropOr6x2 { - val __call: unsupported["(defaultValue: any, object: any): any;", "fp.d.ts", 3281, 64] - } - export type LodashPropOr6x3[TDefault] = (object: null) => TDefault - export declare trait LodashPropOr6x4 { - val __call: unsupported["(defaultValue: TDefault, path: lodash.PropertyPath): TDefault;", "fp.d.ts", 3287, 78] - } - export type LodashPropOr6x5[TDefault] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => TDefault - export type LodashPropOr6x6 = unsupported["type LodashPropOr6x6 = (defaultValue: TDefault) => TDefault;", "fp.d.ts", 3290, 77] - export declare trait LodashPropOr7x1 { - val __call: unsupported["(path: lodash.PropertyPath, object: any): any;", "fp.d.ts", 3294, 56] - } - export type LodashPropOr7x3 = (object: anything) => anything - export declare trait LodashPropOr7x4 { - val __call: unsupported["(defaultValue: any, path: lodash.PropertyPath): any;", "fp.d.ts", 3300, 78] - } - export type LodashPropOr7x5 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export type LodashPropOr7x6 = (defaultValue: anything) => anything - export declare trait LodashPull { - val __call: unsupported["(values: T, array: lodash.List): lodash.List;", "fp.d.ts", 3309, 72] - } - export declare trait LodashPull1x1[T] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3313, 39] - } - export type LodashPull1x2[T] = (values: T) => MutArray[T] - export type LodashPull2x2[T] = (values: T) => ArrayLike[T] - export declare trait LodashPullAll { - val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3322, 75] - } - export declare trait LodashPullAll1x1[T] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3326, 39] - } - export type LodashPullAll1x2[T] = (values: ArrayLike[T]) => MutArray[T] - export type LodashPullAll2x2[T] = (values: ArrayLike[T]) => ArrayLike[T] - export declare trait LodashPullAllBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3352, 115] - } - export declare trait LodashPullAllBy1x1[T] { - val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3359, 74] - } - export declare trait LodashPullAllBy1x2[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List): lodash.List;", "fp.d.ts", 3366, 76] - } - export declare trait LodashPullAllBy1x3[T] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3370, 39] - } - export declare trait LodashPullAllBy1x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T[];", "fp.d.ts", 3375, 77] - } - export type LodashPullAllBy1x5[T] = (values: ArrayLike[T]) => MutArray[T] - export type LodashPullAllBy1x6 = unsupported["type LodashPullAllBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 3378, 65] - export declare trait LodashPullAllBy2x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): lodash.List;", "fp.d.ts", 3382, 77] - } - export type LodashPullAllBy2x5[T] = (values: ArrayLike[T]) => ArrayLike[T] - export type LodashPullAllBy2x6 = unsupported["type LodashPullAllBy2x6 = (iteratee: lodash.ValueIteratee) => lodash.List;", "fp.d.ts", 3385, 76] - export declare trait LodashPullAllBy3x1[T1, T2] { - val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3391, 80] - } - export declare trait LodashPullAllBy3x2[T2] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List): lodash.List;", "fp.d.ts", 3398, 86] - } - export declare trait LodashPullAllBy3x3[T1] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3402, 41] - } - export declare trait LodashPullAllBy3x4[T1] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): T1[];", "fp.d.ts", 3407, 87] - } - export type LodashPullAllBy3x5[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export type LodashPullAllBy3x6 = unsupported["type LodashPullAllBy3x6 = (iteratee: lodash.ValueIteratee) => T1[];", "fp.d.ts", 3410, 72] - export declare trait LodashPullAllBy4x4[T1] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, values: lodash.List): lodash.List;", "fp.d.ts", 3414, 87] - } - export type LodashPullAllBy4x5[T1, T2] = (values: ArrayLike[T2]) => ArrayLike[T1] - export type LodashPullAllBy4x6 = unsupported["type LodashPullAllBy4x6 = (iteratee: lodash.ValueIteratee) => lodash.List;", "fp.d.ts", 3417, 83] - export declare trait LodashPullAllWith { - val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3440, 119] - } - export declare trait LodashPullAllWith1x1[T] { - val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3447, 76] - } - export declare trait LodashPullAllWith1x2[T] { - val __call: unsupported["(comparator: lodash.Comparator, array: lodash.List): lodash.List;", "fp.d.ts", 3454, 80] - } - export declare trait LodashPullAllWith1x3[T] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3458, 39] - } - export declare trait LodashPullAllWith1x4[T] { - val __call: unsupported["(comparator: lodash.Comparator, values: lodash.List): T[];", "fp.d.ts", 3463, 81] - } - export type LodashPullAllWith1x5[T] = (values: ArrayLike[T]) => MutArray[T] - export type LodashPullAllWith1x6[T] = (comparator: {}) => MutArray[T] - export declare trait LodashPullAllWith2x4[T] { - val __call: unsupported["(comparator: lodash.Comparator, values: lodash.List): lodash.List;", "fp.d.ts", 3470, 81] - } - export type LodashPullAllWith2x5[T] = (values: ArrayLike[T]) => ArrayLike[T] - export type LodashPullAllWith2x6[T] = (comparator: {}) => ArrayLike[T] - export declare trait LodashPullAllWith3x1[T1, T2] { - val __call: unsupported["(values: lodash.List, array: lodash.List): lodash.List;", "fp.d.ts", 3479, 82] - } - export declare trait LodashPullAllWith3x2[T2] { - val __call: unsupported["(comparator: lodash.Comparator2, array: lodash.List): lodash.List;", "fp.d.ts", 3486, 90] - } - export declare trait LodashPullAllWith3x3[T1] { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3490, 41] - } - export declare trait LodashPullAllWith3x4[T1] { - val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): T1[];", "fp.d.ts", 3495, 91] - } - export type LodashPullAllWith3x5[T1, T2] = (values: ArrayLike[T2]) => MutArray[T1] - export type LodashPullAllWith3x6[T1, T2] = (comparator: {}) => MutArray[T1] - export declare trait LodashPullAllWith4x4[T1] { - val __call: unsupported["(comparator: lodash.Comparator2, values: lodash.List): lodash.List;", "fp.d.ts", 3502, 91] - } - export type LodashPullAllWith4x5[T1, T2] = (values: ArrayLike[T2]) => ArrayLike[T1] - export type LodashPullAllWith4x6[T1, T2] = (comparator: {}) => ArrayLike[T1] - export declare trait LodashPullAt { - val __call: unsupported["(indexes: lodash.Many, array: lodash.List): lodash.List;", "fp.d.ts", 3511, 75] - } - export declare trait LodashPullAt1x1 { - val __call: unsupported["(array: lodash.List): lodash.List;", "fp.d.ts", 3515, 42] - } - export type LodashPullAt1x2[T] = (indexes: (Num) | (ReadonlyArray[Num])) => MutArray[T] - export type LodashPullAt2x2[T] = (indexes: (Num) | (ReadonlyArray[Num])) => ArrayLike[T] - export declare trait LodashRandom { - val __call: unsupported["(min: lodash.__, max: number): LodashRandom2x2;", "fp.d.ts", 3523, 68] - } - export type LodashRandom1x1 = (floatingOrMax: ((Num) | (false)) | (true)) => Num - export type LodashRandom1x2 = (max: Num) => Num - export type LodashRandom2x2 = (min: Num) => Num - export declare trait LodashRange { - val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3531, 56] - } - export type LodashRange1x1 = (end: Num) => MutArray[Num] - export type LodashRange1x2 = (start: Num) => MutArray[Num] - export declare trait LodashRangeRight { - val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3538, 61] - } - export type LodashRangeRight1x1 = (end: Num) => MutArray[Num] - export type LodashRangeRight1x2 = (start: Num) => MutArray[Num] - export declare trait LodashRangeStep { - val __call: unsupported["(start: number, end: number, step: number): number[];", "fp.d.ts", 3549, 74] - } - export declare trait LodashRangeStep1x1 { - val __call: unsupported["(end: number, step: number): number[];", "fp.d.ts", 3554, 59] - } - export declare trait LodashRangeStep1x2 { - val __call: unsupported["(start: number, step: number): number[];", "fp.d.ts", 3559, 61] - } - export type LodashRangeStep1x3 = (step: Num) => MutArray[Num] - export declare trait LodashRangeStep1x4 { - val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3565, 60] - } - export type LodashRangeStep1x5 = (end: Num) => MutArray[Num] - export type LodashRangeStep1x6 = (start: Num) => MutArray[Num] - export declare trait LodashRangeStepRight { - val __call: unsupported["(start: number, end: number, step: number): number[];", "fp.d.ts", 3576, 79] - } - export declare trait LodashRangeStepRight1x1 { - val __call: unsupported["(end: number, step: number): number[];", "fp.d.ts", 3581, 64] - } - export declare trait LodashRangeStepRight1x2 { - val __call: unsupported["(start: number, step: number): number[];", "fp.d.ts", 3586, 66] - } - export type LodashRangeStepRight1x3 = (step: Num) => MutArray[Num] - export declare trait LodashRangeStepRight1x4 { - val __call: unsupported["(start: number, end: number): number[];", "fp.d.ts", 3592, 65] - } - export type LodashRangeStepRight1x5 = (end: Num) => MutArray[Num] - export type LodashRangeStepRight1x6 = (start: Num) => MutArray[Num] - export declare trait LodashRearg { - val __call: unsupported["(indexes: lodash.Many, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 3599, 76] - } - export type LodashRearg1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export type LodashRearg1x2 = (indexes: (Num) | (ReadonlyArray[Num])) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashReduce { - val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3619, 142] - } - export declare trait LodashReduce1x1[T, TResult] { - val __call: unsupported["(accumulator: lodash.__, collection: lodash.List | null | undefined): LodashReduce2x5;", "fp.d.ts", 3625, 93] - } - export declare trait LodashReduce1x2[TResult] { - val __call: unsupported["(callback: lodash.MemoIteratorCapped, collection: T | null | undefined): TResult;", "fp.d.ts", 3634, 111] - } - export type LodashReduce1x3[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => TResult - export declare trait LodashReduce1x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3640, 90] - } - export type LodashReduce1x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduce1x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReduce2x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3647, 90] - } - export type LodashReduce2x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduce2x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReduce3x1[T, TResult] { - val __call: unsupported["(accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3654, 93] - } - export type LodashReduce3x3[T, TResult] = (collection: T) => TResult - export declare trait LodashReduce3x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 3660, 90] - } - export type LodashReduce3x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduce3x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReduceRight { - val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3680, 147] - } - export declare trait LodashReduceRight1x1[T, TResult] { - val __call: unsupported["(accumulator: lodash.__, collection: lodash.List | null | undefined): LodashReduceRight2x5;", "fp.d.ts", 3686, 93] - } - export declare trait LodashReduceRight1x2[TResult] { - val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, collection: T | null | undefined): TResult;", "fp.d.ts", 3695, 116] - } - export type LodashReduceRight1x3[T, TResult] = (collection: (MutArray[T]) | (ArrayLike[T])) => TResult - export declare trait LodashReduceRight1x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3701, 95] - } - export type LodashReduceRight1x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduceRight1x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReduceRight2x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3708, 95] - } - export type LodashReduceRight2x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduceRight2x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReduceRight3x1[T, TResult] { - val __call: unsupported["(accumulator: TResult, collection: T | null | undefined): TResult;", "fp.d.ts", 3715, 98] - } - export type LodashReduceRight3x3[T, TResult] = (collection: T) => TResult - export declare trait LodashReduceRight3x4[T] { - val __call: unsupported["(callback: lodash.MemoIteratorCappedRight, accumulator: TResult): TResult;", "fp.d.ts", 3721, 95] - } - export type LodashReduceRight3x5[TResult] = (accumulator: TResult) => TResult - export type LodashReduceRight3x6[T, TResult] = (callback: {}) => TResult - export declare trait LodashReject { - val __call: unsupported["(predicate: lodash.ValueIterateeCustom, collection: T | null | undefined): Array;", "fp.d.ts", 3730, 103] - } - export type LodashReject1x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] - export type LodashReject1x2 = unsupported["type LodashReject1x2 = (predicate: lodash.ValueIterateeCustom) => T[];", "fp.d.ts", 3733, 94] - export type LodashReject2x2 = unsupported["type LodashReject2x2 = (predicate: lodash.ValueIterateeCustom) => Array;", "fp.d.ts", 3734, 89] - export declare trait LodashRemove { - val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List): T[];", "fp.d.ts", 3738, 77] - } - export type LodashRemove1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashRemove1x2 = unsupported["type LodashRemove1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 3741, 61] - export declare trait LodashRepeat { - val __call: unsupported["(n: number, string: string): string;", "fp.d.ts", 3745, 56] - } - export type LodashRepeat1x1 = (string: Str) => Str - export type LodashRepeat1x2 = (n: Num) => Str - export declare trait LodashReplace { - val __call: unsupported["(pattern: RegExp | string, replacement: lodash.ReplaceFunction | string, string: string): string;", "fp.d.ts", 3756, 109] - } - export declare trait LodashReplace1x1 { - val __call: unsupported["(replacement: lodash.ReplaceFunction | string, string: string): string;", "fp.d.ts", 3761, 67] - } - export declare trait LodashReplace1x2 { - val __call: unsupported["(pattern: RegExp | string, string: string): string;", "fp.d.ts", 3766, 63] - } - export type LodashReplace1x3 = (string: Str) => Str - export declare trait LodashReplace1x4 { - val __call: unsupported["(pattern: RegExp | string, replacement: lodash.ReplaceFunction | string): string;", "fp.d.ts", 3772, 93] - } - export type LodashReplace1x5 = (replacement: (Str) | ({})) => Str - export type LodashReplace1x6 = (pattern: (Str) | (RegExp)) => Str - export type LodashRest = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashRestFrom { - val __call: unsupported["(start: number, func: (...args: any[]) => any): (...args: any[]) => any;", "fp.d.ts", 3780, 77] - } - export type LodashRestFrom1x1 = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export type LodashRestFrom1x2 = (start: Num) => (args: (anything) | (MutArray[anything])) => anything - export declare trait LodashResult { - val __call: unsupported["(path: lodash.PropertyPath, object: any): TResult;", "fp.d.ts", 3787, 56] - } - export type LodashResult1x1 = unsupported["type LodashResult1x1 = (object: any) => TResult;", "fp.d.ts", 3789, 5] - export type LodashResult1x2 = unsupported["type LodashResult1x2 = (path: lodash.PropertyPath) => TResult;", "fp.d.ts", 3790, 61] - export type LodashReverse = unsupported["type LodashReverse = >(array: TList) => TList;", "fp.d.ts", 3791, 75] - export type LodashRound = (n: Num) => Num - export type LodashRunInContext = (context: Object) => LoDashStatic - export declare trait LodashSample { - val __call: unsupported["(collection: T | null | undefined): T[keyof T] | undefined;", "fp.d.ts", 3796, 110] - } - export declare trait LodashSampleSize { - val __call: unsupported["(n: number, collection: T | null | undefined): Array;", "fp.d.ts", 3803, 99] - } - export declare trait LodashSampleSize1x1 { - val __call: unsupported["(collection: T | null | undefined): Array;", "fp.d.ts", 3807, 100] - } - export type LodashSampleSize1x2[T] = (n: Num) => MutArray[T] - export type LodashSampleSize2x2 = unsupported["type LodashSampleSize2x2 = (n: number) => Array;", "fp.d.ts", 3810, 53] - export declare trait LodashSetWith { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, value: any, object: T): T;", "fp.d.ts", 3826, 122] - } - export declare trait LodashSetWith1x1[T] { - val __call: unsupported["(path: lodash.PropertyPath, value: any, object: T): T;", "fp.d.ts", 3835, 71] - } - export declare trait LodashSetWith1x2 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, value: any, object: T): T;", "fp.d.ts", 3844, 95] - } - export declare trait LodashSetWith1x3[T] { - val __call: unsupported["(value: any, object: T): T;", "fp.d.ts", 3849, 60] - } - export declare trait LodashSetWith1x4 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 3858, 110] - } - export declare trait LodashSetWith1x5[T] { - val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 3863, 59] - } - export declare trait LodashSetWith1x6 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, object: T): T;", "fp.d.ts", 3868, 83] - } - export type LodashSetWith1x7[T] = (object: T) => T - export declare trait LodashSetWith1x8[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 3878, 93] - } - export declare trait LodashSetWith1x9[T] { - val __call: unsupported["(path: lodash.PropertyPath, value: any): T;", "fp.d.ts", 3883, 60] - } - export declare trait LodashSetWith1x10[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, value: any): T;", "fp.d.ts", 3888, 66] - } - export type LodashSetWith1x11[T] = (value: anything) => T - export declare trait LodashSetWith1x12[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath): T;", "fp.d.ts", 3894, 81] - } - export type LodashSetWith1x13[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T - export type LodashSetWith1x14[T] = (customizer: {}) => T - export declare trait LodashShuffle { - val __call: unsupported["(collection: T | null | undefined): Array;", "fp.d.ts", 3900, 64] - } - export type LodashSize = (collection: (Str) | (Object)) => Num - export declare trait LodashSlice { - val __call: unsupported["(start: number, end: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3910, 104] - } - export declare trait LodashSlice1x1 { - val __call: unsupported["(end: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3915, 89] - } - export declare trait LodashSlice1x2 { - val __call: unsupported["(start: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 3920, 91] - } - export type LodashSlice1x3 = unsupported["type LodashSlice1x3 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 3922, 5] - export declare trait LodashSlice1x4[T] { - val __call: unsupported["(start: number, end: number): T[];", "fp.d.ts", 3926, 59] - } - export type LodashSlice1x5[T] = (end: Num) => MutArray[T] - export type LodashSlice1x6[T] = (start: Num) => MutArray[T] - export type LodashSnakeCase = (string: Str) => Str - export declare trait LodashSortBy { - val __call: unsupported["(iteratees: lodash.Many>, collection: T | null | undefined): Array;", "fp.d.ts", 3936, 103] - } - export type LodashSortBy1x1[T] = (collection: (Object) | (ArrayLike[T])) => MutArray[T] - export type LodashSortBy1x2 = unsupported["type LodashSortBy1x2 = (iteratees: lodash.Many>) => T[];", "fp.d.ts", 3939, 94] - export type LodashSortBy2x2 = unsupported["type LodashSortBy2x2 = (iteratees: lodash.Many>) => Array;", "fp.d.ts", 3940, 87] - export declare trait LodashSortedIndex { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3944, 97] - } - export type LodashSortedIndex1x1[T] = (array: ArrayLike[T]) => Num - export type LodashSortedIndex1x2[T] = (value: T) => Num - export declare trait LodashSortedIndexBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3955, 112] - } - export declare trait LodashSortedIndexBy1x1[T] { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3960, 96] - } - export declare trait LodashSortedIndexBy1x2[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): number;", "fp.d.ts", 3965, 99] - } - export type LodashSortedIndexBy1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashSortedIndexBy1x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T): number;", "fp.d.ts", 3971, 67] - } - export type LodashSortedIndexBy1x5[T] = (value: T) => Num - export type LodashSortedIndexBy1x6 = unsupported["type LodashSortedIndexBy1x6 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 3974, 58] - export declare trait LodashSortedIndexOf { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3978, 99] - } - export type LodashSortedIndexOf1x1[T] = (array: ArrayLike[T]) => Num - export type LodashSortedIndexOf1x2[T] = (value: T) => Num - export declare trait LodashSortedLastIndex { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3985, 101] - } - export type LodashSortedLastIndex1x1[T] = (array: ArrayLike[T]) => Num - export type LodashSortedLastIndex1x2[T] = (value: T) => Num - export declare trait LodashSortedLastIndexBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 3996, 116] - } - export declare trait LodashSortedLastIndexBy1x1[T] { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 4001, 100] - } - export declare trait LodashSortedLastIndexBy1x2[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): number;", "fp.d.ts", 4006, 103] - } - export type LodashSortedLastIndexBy1x3[T] = (array: ArrayLike[T]) => Num - export declare trait LodashSortedLastIndexBy1x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, value: T): number;", "fp.d.ts", 4012, 71] - } - export type LodashSortedLastIndexBy1x5[T] = (value: T) => Num - export type LodashSortedLastIndexBy1x6 = unsupported["type LodashSortedLastIndexBy1x6 = (iteratee: lodash.ValueIteratee) => number;", "fp.d.ts", 4015, 62] - export declare trait LodashSortedLastIndexOf { - val __call: unsupported["(value: T, array: lodash.List | null | undefined): number;", "fp.d.ts", 4019, 103] - } - export type LodashSortedLastIndexOf1x1[T] = (array: ArrayLike[T]) => Num - export type LodashSortedLastIndexOf1x2[T] = (value: T) => Num - export type LodashSortedUniq = unsupported["type LodashSortedUniq = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4023, 62] - export declare trait LodashSortedUniqBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4027, 101] - } - export type LodashSortedUniqBy1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashSortedUniqBy1x2 = unsupported["type LodashSortedUniqBy1x2 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4030, 86] - export declare trait LodashSplit { - val __call: unsupported["(separator: RegExp | string, string: string | null | undefined): string[];", "fp.d.ts", 4034, 82] - } - export type LodashSplit1x1 = (string: Str) => MutArray[Str] - export type LodashSplit1x2 = (separator: (Str) | (RegExp)) => MutArray[Str] - export type LodashSpread = unsupported["type LodashSpread = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 4038, 67] - export declare trait LodashSpreadFrom { - val __call: unsupported["(start: number, func: (...args: any[]) => TResult): (...args: any[]) => TResult;", "fp.d.ts", 4042, 101] - } - export type LodashSpreadFrom1x1 = unsupported["type LodashSpreadFrom1x1 = (func: (...args: any[]) => TResult) => (...args: any[]) => TResult;", "fp.d.ts", 4044, 5] - export type LodashSpreadFrom1x2[TResult] = (start: Num) => (args: (anything) | (MutArray[anything])) => TResult - export type LodashStartCase = (string: Str) => Str - export declare trait LodashStartsWith { - val __call: unsupported["(target: string, string: string): boolean;", "fp.d.ts", 4050, 65] - } - export type LodashStartsWith1x1 = (string: Str) => (false) | (true) - export type LodashStartsWith1x2 = (target: Str) => (false) | (true) - export type LodashStubArray = () => MutArray[anything] - export type LodashStubObject = () => anything - export type LodashStubString = () => Str - export type LodashStubTrue = () => true - export declare trait LodashSubtract { - val __call: unsupported["(minuend: number, subtrahend: number): number;", "fp.d.ts", 4061, 68] - } - export type LodashSubtract1x1 = (subtrahend: Num) => Num - export type LodashSubtract1x2 = (minuend: Num) => Num - export type LodashSum = (collection: ArrayLike[anything]) => Num - export declare trait LodashSumBy { - val __call: unsupported["(iteratee: ((value: T) => number) | string, collection: lodash.List | null | undefined): number;", "fp.d.ts", 4069, 99] - } - export type LodashSumBy1x1[T] = (collection: ArrayLike[T]) => Num - export type LodashSumBy1x2[T] = (iteratee: (Str) | ((value: T) => Num)) => Num - export declare trait LodashXor { - val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4076, 92] - } - export type LodashXor1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashXor1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashXorBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4087, 139] - } - export declare trait LodashXorBy1x1[T] { - val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4092, 91] - } - export declare trait LodashXorBy1x2[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4097, 93] - } - export type LodashXorBy1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashXorBy1x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4103, 92] - } - export type LodashXorBy1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashXorBy1x6 = unsupported["type LodashXorBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4106, 80] - export declare trait LodashXorWith { - val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4114, 143] - } - export declare trait LodashXorWith1x1[T] { - val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4119, 93] - } - export declare trait LodashXorWith1x2[T] { - val __call: unsupported["(comparator: lodash.Comparator, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4124, 97] - } - export type LodashXorWith1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashXorWith1x4[T] { - val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4130, 96] - } - export type LodashXorWith1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashXorWith1x6[T] = (comparator: {}) => MutArray[T] - export type LodashTail = unsupported["type LodashTail = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4134, 73] - export declare trait LodashTake { - val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4138, 86] - } - export type LodashTake1x1 = unsupported["type LodashTake1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4140, 5] - export type LodashTake1x2[T] = (n: Num) => MutArray[T] - export declare trait LodashTakeRight { - val __call: unsupported["(n: number, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4145, 91] - } - export type LodashTakeRight1x1 = unsupported["type LodashTakeRight1x1 = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4147, 5] - export type LodashTakeRight1x2[T] = (n: Num) => MutArray[T] - export declare trait LodashTakeRightWhile { - val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4152, 104] - } - export type LodashTakeRightWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashTakeRightWhile1x2 = unsupported["type LodashTakeRightWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 4155, 88] - export declare trait LodashTakeWhile { - val __call: unsupported["(predicate: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4159, 99] - } - export type LodashTakeWhile1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashTakeWhile1x2 = unsupported["type LodashTakeWhile1x2 = (predicate: lodash.ValueIteratee) => T[];", "fp.d.ts", 4162, 83] - export declare trait LodashTap { - val __call: unsupported["(interceptor: (value: T) => void, value: T): T;", "fp.d.ts", 4166, 63] - } - export type LodashTap1x1[T] = (value: T) => T - export type LodashTap1x2[T] = (interceptor: (value: T) => unit) => T - export type LodashTemplate = (string: Str) => "../index".TemplateExecutor - export declare trait LodashThrottle { - val __call: unsupported[" any>(wait: number, func: T): lodash.DebouncedFunc;", "fp.d.ts", 4174, 90] - } - export type LodashThrottle1x1 = unsupported["type LodashThrottle1x1 = any>(func: T) => lodash.DebouncedFunc;", "fp.d.ts", 4176, 5] - export type LodashThrottle1x2[T] = (wait: Num) => DebouncedFunc[T] - export declare trait LodashThru { - val __call: unsupported["(interceptor: (value: T) => TResult, value: T): TResult;", "fp.d.ts", 4181, 64] - } - export type LodashThru1x1[T, TResult] = (value: T) => TResult - export type LodashThru1x2 = unsupported["type LodashThru1x2 = (interceptor: (value: T) => TResult) => TResult;", "fp.d.ts", 4184, 59] - export declare trait LodashTimes { - val __call: unsupported["(iteratee: (num: number) => TResult, n: number): TResult[];", "fp.d.ts", 4188, 57] - } - export type LodashTimes1x1[TResult] = (n: Num) => MutArray[TResult] - export type LodashTimes1x2 = unsupported["type LodashTimes1x2 = (iteratee: (num: number) => TResult) => TResult[];", "fp.d.ts", 4191, 60] - export declare trait LodashToArray { - val __call: unsupported["(): any[];", "fp.d.ts", 4195, 41] - } - export type LodashToFinite = (value: anything) => Num - export type LodashToInteger = (value: anything) => Num - export type LodashToLength = (value: anything) => Num - export type LodashToLower = (string: Str) => Str - export type LodashToNumber = (value: anything) => Num - export type LodashToPath = (value: anything) => MutArray[Str] - export type LodashToPlainObject = (value: anything) => anything - export type LodashToSafeInteger = (value: anything) => Num - export type LodashToString = (value: anything) => Str - export type LodashToUpper = (string: Str) => Str - export declare trait LodashTransform { - val __call: unsupported["(iteratee: lodash.__, accumulator: TResult, object: lodash.Dictionary): LodashTransform2x6;", "fp.d.ts", 4217, 157] - } - export declare trait LodashTransform1x1[T, TResult] { - val __call: unsupported["(accumulator: lodash.__, object: lodash.Dictionary): LodashTransform2x5;", "fp.d.ts", 4223, 89] - } - export declare trait LodashTransform1x2[TResult] { - val __call: unsupported["(iteratee: lodash.__, object: lodash.Dictionary): LodashTransform2x6;", "fp.d.ts", 4229, 123] - } - export type LodashTransform1x3[T, TResult] = (object: (ReadonlyArray[T]) | (Dictionary[T])) => TResult - export declare trait LodashTransform1x4[T] { - val __call: unsupported["(iteratee: lodash.MemoVoidIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 4235, 93] - } - export type LodashTransform1x5[TResult] = (accumulator: TResult) => TResult - export type LodashTransform1x6[T, TResult] = (iteratee: {}) => TResult - export declare trait LodashTransform2x4[T] { - val __call: unsupported["(iteratee: lodash.MemoVoidIteratorCapped, accumulator: TResult): TResult;", "fp.d.ts", 4242, 93] - } - export type LodashTransform2x5[TResult] = (accumulator: TResult) => TResult - export type LodashTransform2x6[T, TResult] = (iteratee: {}) => TResult - export type LodashTrim = (string: Str) => Str - export declare trait LodashTrimChars { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4250, 63] - } - export type LodashTrimChars1x1 = (string: Str) => Str - export type LodashTrimChars1x2 = (chars: Str) => Str - export declare trait LodashTrimCharsEnd { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4257, 66] - } - export type LodashTrimCharsEnd1x1 = (string: Str) => Str - export type LodashTrimCharsEnd1x2 = (chars: Str) => Str - export declare trait LodashTrimCharsStart { - val __call: unsupported["(chars: string, string: string): string;", "fp.d.ts", 4264, 68] - } - export type LodashTrimCharsStart1x1 = (string: Str) => Str - export type LodashTrimCharsStart1x2 = (chars: Str) => Str - export type LodashTrimEnd = (string: Str) => Str - export type LodashTrimStart = (string: Str) => Str - export declare trait LodashTruncate { - val __call: unsupported["(options: lodash.TruncateOptions, string: string): string;", "fp.d.ts", 4273, 64] - } - export type LodashTruncate1x1 = (string: Str) => Str - export type LodashTruncate1x2 = (options: "../index".TruncateOptions) => Str - export type LodashUnapply = (func: (args: (anything) | (MutArray[anything])) => anything) => (args: (anything) | (MutArray[anything])) => anything - export type LodashUnary = unsupported["type LodashUnary = (func: (arg1: T, ...args: any[]) => TResult) => (arg1: T) => TResult;", "fp.d.ts", 4278, 84] - export type LodashUnescape = (string: Str) => Str - export declare trait LodashUnion { - val __call: unsupported["(arrays2: lodash.List | null | undefined, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4283, 94] - } - export type LodashUnion1x1[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashUnion1x2[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashUnionBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays1: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4294, 142] - } - export declare trait LodashUnionBy1x1[T] { - val __call: unsupported["(arrays1: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4299, 94] - } - export declare trait LodashUnionBy1x2[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4304, 95] - } - export type LodashUnionBy1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashUnionBy1x4[T] { - val __call: unsupported["(iteratee: lodash.ValueIteratee, arrays1: lodash.List | null | undefined): T[];", "fp.d.ts", 4310, 95] - } - export type LodashUnionBy1x5[T] = (arrays1: ArrayLike[T]) => MutArray[T] - export type LodashUnionBy1x6 = unsupported["type LodashUnionBy1x6 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4313, 83] - export declare trait LodashUnionWith { - val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4321, 145] - } - export declare trait LodashUnionWith1x1[T] { - val __call: unsupported["(arrays: lodash.List | null | undefined, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4326, 95] - } - export declare trait LodashUnionWith1x2[T] { - val __call: unsupported["(comparator: lodash.Comparator, arrays2: lodash.List | null | undefined): T[];", "fp.d.ts", 4331, 99] - } - export type LodashUnionWith1x3[T] = (arrays2: ArrayLike[T]) => MutArray[T] - export declare trait LodashUnionWith1x4[T] { - val __call: unsupported["(comparator: lodash.Comparator, arrays: lodash.List | null | undefined): T[];", "fp.d.ts", 4337, 98] - } - export type LodashUnionWith1x5[T] = (arrays: ArrayLike[T]) => MutArray[T] - export type LodashUnionWith1x6[T] = (comparator: {}) => MutArray[T] - export type LodashUniq = unsupported["type LodashUniq = (array: lodash.List | null | undefined) => T[];", "fp.d.ts", 4341, 75] - export declare trait LodashUniqBy { - val __call: unsupported["(iteratee: lodash.ValueIteratee, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4345, 95] - } - export type LodashUniqBy1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashUniqBy1x2 = unsupported["type LodashUniqBy1x2 = (iteratee: lodash.ValueIteratee) => T[];", "fp.d.ts", 4348, 80] - export type LodashUniqueId = (prefix: Str) => Str - export declare trait LodashUniqWith { - val __call: unsupported["(comparator: lodash.Comparator, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4353, 99] - } - export type LodashUniqWith1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashUniqWith1x2[T] = (comparator: {}) => MutArray[T] - export type LodashUnzip = unsupported["type LodashUnzip = (array: T[][] | lodash.List> | null | undefined) => T[][];", "fp.d.ts", 4357, 74] - export declare trait LodashUnzipWith { - val __call: unsupported["(iteratee: (...values: T[]) => TResult, array: lodash.List> | null | undefined): TResult[];", "fp.d.ts", 4361, 111] - } - export type LodashUnzipWith1x1[T, TResult] = (array: ArrayLike[ArrayLike[T]]) => MutArray[TResult] - export type LodashUnzipWith1x2 = unsupported["type LodashUnzipWith1x2 = (iteratee: (...values: T[]) => TResult) => TResult[];", "fp.d.ts", 4364, 111] - export declare trait LodashUpdate { - val __call: unsupported["(path: lodash.PropertyPath, updater: (value: any) => any, object: object): any;", "fp.d.ts", 4372, 89] - } - export declare trait LodashUpdate1x1 { - val __call: unsupported["(updater: (value: any) => any, object: object): any;", "fp.d.ts", 4377, 62] - } - export declare trait LodashUpdate1x2 { - val __call: unsupported["(path: lodash.PropertyPath, object: object): any;", "fp.d.ts", 4382, 59] - } - export type LodashUpdate1x3 = (object: Object) => anything - export declare trait LodashUpdate1x4 { - val __call: unsupported["(path: lodash.PropertyPath, updater: (value: any) => any): any;", "fp.d.ts", 4388, 73] - } - export type LodashUpdate1x5 = (updater: (value: anything) => anything) => anything - export type LodashUpdate1x6 = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => anything - export declare trait LodashUpdateWith { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4407, 146] - } - export declare trait LodashUpdateWith1x1[T] { - val __call: unsupported["(path: lodash.PropertyPath, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4416, 95] - } - export declare trait LodashUpdateWith1x2 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4425, 119] - } - export declare trait LodashUpdateWith1x3[T] { - val __call: unsupported["(updater: (oldValue: any) => any, object: T): T;", "fp.d.ts", 4430, 65] - } - export declare trait LodashUpdateWith1x4 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 4439, 113] - } - export declare trait LodashUpdateWith1x5[T] { - val __call: unsupported["(path: lodash.PropertyPath, object: T): T;", "fp.d.ts", 4444, 62] - } - export declare trait LodashUpdateWith1x6 { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, object: T): T;", "fp.d.ts", 4449, 86] - } - export type LodashUpdateWith1x7[T] = (object: T) => T - export declare trait LodashUpdateWith1x8[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath, updater: (oldValue: any) => any): T;", "fp.d.ts", 4459, 117] - } - export declare trait LodashUpdateWith1x9[T] { - val __call: unsupported["(path: lodash.PropertyPath, updater: (oldValue: any) => any): T;", "fp.d.ts", 4464, 84] - } - export declare trait LodashUpdateWith1x10[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, updater: (oldValue: any) => any): T;", "fp.d.ts", 4469, 90] - } - export type LodashUpdateWith1x11[T] = (updater: (oldValue: anything) => anything) => T - export declare trait LodashUpdateWith1x12[T] { - val __call: unsupported["(customizer: lodash.SetWithCustomizer, path: lodash.PropertyPath): T;", "fp.d.ts", 4475, 84] - } - export type LodashUpdateWith1x13[T] = (path: (((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])) => T - export type LodashUpdateWith1x14[T] = (customizer: {}) => T - export type LodashUpperCase = (string: Str) => Str - export type LodashUpperFirst = (string: Str) => Str - export declare trait LodashValues { - val __call: unsupported["(object: any): any[];", "fp.d.ts", 4484, 76] - } - export declare trait LodashValuesIn { - val __call: unsupported["(object: T | null | undefined): Array;", "fp.d.ts", 4488, 113] - } - export declare trait LodashWithout { - val __call: unsupported["(values: ReadonlyArray, array: lodash.List | null | undefined): T[];", "fp.d.ts", 4493, 94] - } - export type LodashWithout1x1[T] = (array: ArrayLike[T]) => MutArray[T] - export type LodashWithout1x2[T] = (values: ReadonlyArray[T]) => MutArray[T] - export type LodashWords = (string: Str) => MutArray[Str] - export declare trait LodashWrap { - val __call: unsupported["(wrapper: (value: T, ...args: TArgs[]) => TResult, value: T): (...args: TArgs[]) => TResult;", "fp.d.ts", 4501, 60] - } - export type LodashWrap1x1[T, TArgs, TResult] = (value: T) => (args: (TArgs) | (MutArray[TArgs])) => TResult - export type LodashWrap1x2 = unsupported["type LodashWrap1x2 = (wrapper: (value: T, ...args: TArgs[]) => TResult) => (...args: TArgs[]) => TResult;", "fp.d.ts", 4504, 88] - export declare trait LodashZip { - val __call: unsupported["(arrays1: lodash.List, arrays2: lodash.List): Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4508, 77] - } - export type LodashZip1x1 = unsupported["type LodashZip1x1 = (arrays2: lodash.List) => Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4510, 5] - export type LodashZip1x2 = unsupported["type LodashZip1x2 = (arrays1: lodash.List) => Array<[T1 | undefined, T2 | undefined]>;", "fp.d.ts", 4511, 102] - export declare trait LodashZipAll { - val __call: unsupported["(arrays: ReadonlyArray | null | undefined>): Array>;", "fp.d.ts", 4517, 214] - } - export declare trait LodashZipObject { - val __call: unsupported["(props: lodash.List, values: lodash.List): lodash.Dictionary;", "fp.d.ts", 4522, 77] - } - export type LodashZipObject1x1 = unsupported["type LodashZipObject1x1 = (values: lodash.List) => lodash.Dictionary;", "fp.d.ts", 4524, 5] - export type LodashZipObject1x2[T] = (props: ArrayLike[((Str) | (Num)) | (Symbol)]) => Dictionary[T] - export declare trait LodashZipObjectDeep { - val __call: unsupported["(paths: lodash.List, values: lodash.List): object;", "fp.d.ts", 4529, 77] - } - export type LodashZipObjectDeep1x1 = (values: ArrayLike[anything]) => Object - export type LodashZipObjectDeep1x2 = (paths: ArrayLike[(((Str) | (Num)) | (Symbol)) | (ReadonlyArray[((Str) | (Num)) | (Symbol)])]) => Object - export declare trait LodashZipWith { - val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays1: lodash.List, arrays2: lodash.List): TResult[];", "fp.d.ts", 4540, 116] - } - export declare trait LodashZipWith1x1[T1, T2, TResult] { - val __call: unsupported["(arrays1: lodash.List, arrays2: lodash.List): TResult[];", "fp.d.ts", 4545, 86] - } - export declare trait LodashZipWith1x2[T1] { - val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays2: lodash.List): TResult[];", "fp.d.ts", 4550, 86] - } - export type LodashZipWith1x3[T2, TResult] = (arrays2: ArrayLike[T2]) => MutArray[TResult] - export declare trait LodashZipWith1x4[T2] { - val __call: unsupported["(iteratee: (value1: T1, value2: T2) => TResult, arrays1: lodash.List): TResult[];", "fp.d.ts", 4556, 86] - } - export type LodashZipWith1x5[T1, TResult] = (arrays1: ArrayLike[T1]) => MutArray[TResult] - export type LodashZipWith1x6 = unsupported["type LodashZipWith1x6 = (iteratee: (value1: T1, value2: T2) => TResult) => TResult[];", "fp.d.ts", 4559, 81] - export declare trait LoDashFp { - val extendWith: LodashExtendWith - val sortedIndexOf: LodashSortedIndexOf - val toInteger: {} - val mergeAll: LodashMergeAll - val isDate: {} - val defer: {} - val unapply: {} - val toPath: {} - val takeLastWhile: LodashTakeRightWhile - val constant: {} - val countBy: LodashCountBy - val flatMapDepth: LodashFlatMapDepth - val isLength: {} - val find: LodashFind - val rearg: LodashRearg - val dropRightWhile: LodashDropRightWhile - val flatten: {} - val method: {} - val unary: {} - val findLastKey: LodashFindLastKey - val toFinite: {} - val any: LodashSome - val uniq: {} - val extendAll: LodashExtendAll - val assignIn: LodashAssignIn - val padEnd: LodashPadEnd - val once: {} - val random: LodashRandom - val nAry: LodashAry - val spread: {} - val propOr: LodashPropOr - val symmetricDifference: LodashXor - val chunk: LodashChunk - val toPairsIn: LodashToPairsIn - val isArray: {} - val delay: LodashDelay - val replace: LodashReplace - val unionBy: LodashUnionBy - val differenceWith: LodashDifferenceWith - val isEqual: LodashIsEqual - val runInContext: {} - val takeWhile: LodashTakeWhile - val isError: {} - val pathEq: LodashMatchesProperty - val partial: LodashPartial - val union: LodashUnion - val defaultsDeep: LodashDefaultsDeep - val zip: LodashZip - val sortedLastIndexBy: LodashSortedLastIndexBy - val initial: {} - val rangeStepRight: LodashRangeStepRight - val findLastIndexFrom: LodashFindLastIndexFrom - val gte: LodashGte - val path: LodashPath - val minBy: LodashMinBy - val defaults: LodashDefaults - val size: {} - val rangeRight: LodashRangeRight - val compose: LodashFlowRight - val stubObject: {} - val partialRight: LodashPartialRight - val trimCharsEnd: LodashTrimCharsEnd - val dropLastWhile: LodashDropRightWhile - val defaultsDeepAll: {} - val join: LodashJoin - val stubFalse: {} - val isSafeInteger: {} - val dropWhile: LodashDropWhile - val subtract: LodashSubtract - val map: LodashMap - val dissocPath: LodashUnset - val takeRight: LodashTakeRight - val assignAll: LodashAssignAll - val indexBy: LodashKeyBy - val updateWith: LodashUpdateWith - val equals: LodashIsEqual - val forInRight: LodashForInRight - val isArrayLikeObject: LodashIsArrayLikeObject - val startCase: {} - val intersection: LodashIntersection - val bindAll: LodashBindAll - val isNull: {} - val unset: LodashUnset - val T: {} - val sortedLastIndex: LodashSortedLastIndex - val startsWith: LodashStartsWith - val uniqWith: LodashUniqWith - val lastIndexOf: LodashLastIndexOf - val assignWith: LodashAssignWith - val invertBy: LodashInvertBy - val takeLast: LodashTakeRight - val all: LodashEvery - val rest: {} - val cloneDeepWith: LodashCloneDeepWith - val head: {} - val allPass: {} - val toNumber: {} - val findLastFrom: LodashFindLastFrom - val curry: LodashCurry - val takeRightWhile: LodashTakeRightWhile - val unzip: {} - val symmetricDifferenceWith: LodashXorWith - val result: LodashResult - val every: LodashEvery - val sumBy: LodashSumBy - val set: LodashSet - val sortBy: LodashSortBy - val before: LodashBefore - val truncate: LodashTruncate - val noConflict: {} - val F: {} - val pickBy: LodashPickBy - val capitalize: {} - val pullAllBy: LodashPullAllBy - val deburr: {} - val indexOfFrom: LodashIndexOfFrom - val flattenDeep: {} - val concat: LodashConcat - val partition: LodashPartition - val padChars: LodashPadChars - val bind: LodashBind - val entriesIn: LodashToPairsIn - val mean: {} - val uniqBy: LodashUniqBy - val unionWith: LodashUnionWith - val tap: LodashTap - val matchesProperty: LodashMatchesProperty - val toPlainObject: {} - val create: {} - val trimEnd: {} - val isTypedArray: {} - val assign: LodashAssign - val min: {} - val has: LodashHas - val zipWith: LodashZipWith - val sortedIndex: LodashSortedIndex - val propertyOf: LodashPropertyOf - val forEach: LodashForEach - val anyPass: {} - val toLower: {} - val snakeCase: {} - val setWith: LodashSetWith - val assignInAll: LodashAssignInAll - val findIndex: LodashFindIndex - val clamp: LodashClamp - val defaultTo: LodashDefaultTo - val divide: LodashDivide - val hasIn: LodashHasIn - val tail: {} - val isWeakSet: {} - val paths: LodashAt - val sortedLastIndexOf: LodashSortedLastIndexOf - val omitAll: LodashOmit - val each: LodashForEach - val last: {} - val lowerCase: {} - val juxt: {} - val placeholder: LoDashStatic - val dropRight: LodashDropRight - val pullAt: LodashPullAt - val extend: LodashExtend - val isWeakMap: {} - val mapKeys: LodashMapKeys - val isMatchWith: LodashIsMatchWith - val rangeStep: LodashRangeStep - val isInteger: {} - val findIndexFrom: LodashFindIndexFrom - val isMap: {} - val reject: LodashReject - val toSafeInteger: {} - val pad: LodashPad - val pullAllWith: LodashPullAllWith - val omitBy: LodashOmitBy - val forEachRight: LodashForEachRight - val drop: LodashDrop - val reverse: {} - val overEvery: {} - val assignAllWith: LodashAssignAllWith - val sortedIndexBy: LodashSortedIndexBy - val ceil: {} - val now: {} - val invokeMap: LodashInvokeMap - val filter: LodashFilter - val assignInAllWith: LodashAssignInAllWith - val escapeRegExp: {} - val toLength: {} - val noop: {} - val unzipWith: LodashUnzipWith - val upperCase: {} - val findKey: LodashFindKey - val useWith: LodashOverArgs - val isFinite: {} - val isFunction: {} - val cloneWith: LodashCloneWith - val mergeWith: LodashMergeWith - val endsWith: LodashEndsWith - val forIn: LodashForIn - val at: LodashAt - val merge: LodashMerge - val kebabCase: {} - val zipObj: LodashZipObject - val isPlainObject: {} - val pathOr: LodashPathOr - val ___: LoDashStatic - val over: {} - val isMatch: LodashIsMatch - val isEqualWith: LodashIsEqualWith - val dropLast: LodashDropRight - val isBoolean: {} - val remove: LodashRemove - val apply: {} - val trimStart: {} - val after: LodashAfter - val wrap: LodashWrap - val overArgs: LodashOverArgs - val max: {} - val upperFirst: {} - val entries: LodashToPairs - val conformsTo: LodashConformsTo - val escape: {} - val forOwn: LodashForOwn - val flatMap: LodashFlatMap - val eachRight: LodashForEachRight - val take: LodashTake - val findLast: LodashFindLast - val invoke: LodashInvoke - val omit: LodashOmit - val unnest: {} - val reduceRight: LodashReduceRight - val stubString: {} - val groupBy: LodashGroupBy - val isString: {} - val maxBy: LodashMaxBy - val fill: LodashFill - val negate: {} - val range: LodashRange - val curryN: LodashCurryN - val split: LodashSplit - val clone: {} - val pick: LodashPick - val flow: LodashFlow - val includesFrom: LodashIncludesFrom - val floor: {} - val pullAll: LodashPullAll - val xor: LodashXor - val flip: {} - val slice: LodashSlice - val castArray: {} - val ary: LodashAry - val reduce: LodashReduce - val times: LodashTimes - val orderBy: LodashOrderBy - val assocPath: LodashSet - val dissoc: LodashUnset - val toArray: LodashToArray - val intersectionWith: LodashIntersectionWith - val restFrom: LodashRestFrom - val isSymbol: {} - val isNumber: {} - val cloneDeep: {} - val first: {} - val multiply: LodashMultiply - val nth: LodashNth - val thru: LodashThru - val getOr: LodashGetOr - val functionsIn: {} - val mergeAllWith: LodashMergeAllWith - val isNaN: {} - val differenceBy: LodashDifferenceBy - val shuffle: LodashShuffle - val fromPairs: LodashFromPairs - val sample: LodashSample - val complement: {} - val words: {} - val assignInWith: LodashAssignInWith - val findFrom: LodashFindFrom - val template: {} - val lowerFirst: {} - val xorBy: LodashXorBy - val values: LodashValues - val toString: {} - val sampleSize: LodashSampleSize - val invokeArgsMap: LodashInvokeArgsMap - val pull: LodashPull - val round: {} - val property: LodashProperty - val overSome: {} - val iteratee: LodashIteratee - val isNil: {} - val isBuffer: {} - val lte: LodashLte - val prop: LodashProp - val zipObject: LodashZipObject - val padCharsEnd: LodashPadCharsEnd - val stubTrue: {} - val whereEq: LodashIsMatch - val defaultsAll: LodashDefaultsAll - val findLastIndex: LodashFindLastIndex - val flowRight: LodashFlowRight - val sortedUniq: {} - val functions: {} - val id"where": LodashConformsTo - val curryRightN: LodashCurryRightN - val cond: LodashCond - val assoc: LodashSet - val bindKey: LodashBindKey - val always: {} - val get: LodashGet - val trimChars: LodashTrimChars - val isObject: {} - val repeat: LodashRepeat - val pipe: LodashFlow - val update: LodashUpdate - val zipObjectDeep: LodashZipObjectDeep - val toPairs: LodashToPairs - val props: LodashAt - val invert: {} - val isArrayLike: LodashIsArrayLike - val identity: LodashIdentity - val mapValues: LodashMapValues - val isUndefined: {} - val meanBy: LodashMeanBy - val pickAll: LodashPick - val attempt: {} - val forOwnRight: LodashForOwnRight - val trim: {} - val extendAllWith: LodashExtendAllWith - val isArrayBuffer: {} - val throttle: LodashThrottle - val matches: LodashIsMatch - val parseInt: LodashParseInt - val uniqueId: {} - val valuesIn: LodashValuesIn - val stubArray: {} - val includes: LodashIncludes - val lastIndexOfFrom: LodashLastIndexOfFrom - val invokeArgs: LodashInvokeArgs - val isNative: {} - val flatMapDeep: LodashFlatMapDeep - val contains: LodashContains - val isEmpty: LodashIsEmpty - val isArguments: {} - val conforms: LodashConformsTo - val xorWith: LodashXorWith - val flattenDepth: LodashFlattenDepth - val isSet: {} - val add: LodashAdd - val init: {} - val lt: LodashLt - val difference: LodashDifference - val keyBy: LodashKeyBy - val isRegExp: {} - val padCharsStart: LodashPadCharsStart - val transform: LodashTransform - val some: LodashSome - val indexOf: LodashIndexOf - val padStart: LodashPadStart - val intersectionBy: LodashIntersectionBy - val curryRight: LodashCurryRight - val isElement: {} - val unescape: {} - val gt: LodashGt - val keysIn: {} - val inRange: LodashInRange - val pluck: LodashMap - val methodOf: {} - val symmetricDifferenceBy: LodashXorBy - val sortedUniqBy: LodashSortedUniqBy - val spreadFrom: LodashSpreadFrom - val eq: LodashEq - val sum: {} - val without: LodashWithout - val propEq: LodashMatchesProperty - val nthArg: {} - val keys: {} - val zipAll: LodashZipAll - val compact: {} - val invertObj: {} - val debounce: LodashDebounce - val identical: LodashEq - val camelCase: {} - val isObjectLike: {} - val trimCharsStart: LodashTrimCharsStart - val toUpper: {} - val memoize: {} - } -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi deleted file mode 100644 index 9a6d39bd8..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/@types/lodash/index.mlsi +++ /dev/null @@ -1,9 +0,0 @@ -export declare module index { - declare module __global { - export declare trait Set[T] {} - export declare trait Map[K, V] {} - export declare trait WeakSet[T] {} - export declare trait WeakMap[K, V] {} - } - export declare trait LoDashStatic {} -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi deleted file mode 100644 index d5f1a32f8..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/BoundedMeetSemilattice.mlsi +++ /dev/null @@ -1,6 +0,0 @@ -import "./MeetSemilattice.mlsi" -export declare module BoundedMeetSemilattice { - export declare trait BoundedMeetSemilattice[A] extends MeetSemilattice[A] { - val one: A - } -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi deleted file mode 100644 index 96c2e453a..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/fp-ts/lib/MeetSemilattice.mlsi +++ /dev/null @@ -1,5 +0,0 @@ -export declare module MeetSemilattice { - export declare trait MeetSemilattice[A] { - fun meet(x: A, y: A): A - } -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi deleted file mode 100644 index f5eebb252..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/json5.mlsi +++ /dev/null @@ -1,6 +0,0 @@ -import "./stringify.mlsi" -import "./parse.mlsi" -export declare module json5 { - export val parse = parse - export val stringify = stringify -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi deleted file mode 100644 index 27698637a..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/parse.mlsi +++ /dev/null @@ -1,3 +0,0 @@ -export declare module parse { - export fun parse[T](text: Str, reviver: ((key: Str, value: anything) => anything) | (undefined)): T -} diff --git a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi b/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi deleted file mode 100644 index 6eafe4666..000000000 --- a/driver/js/src/test/projects/.interfaces/node_modules/json5/lib/stringify.mlsi +++ /dev/null @@ -1,4 +0,0 @@ -export declare module stringify { - type StringifyOptions = {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),} - export fun stringify(value: anything, options: {replacer: (((key: Str, value: anything) => anything) | (MutArray[(Str) | (Num)])) | (undefined),space: ((Str) | (Num)) | (undefined),quote: (Str) | (undefined),}): Str /* warning: the overload of function stringify is not supported yet. */ -} diff --git a/driver/js/src/test/projects/js/package.json b/driver/js/src/test/projects/js/package.json deleted file mode 100644 index bb34440a3..000000000 --- a/driver/js/src/test/projects/js/package.json +++ /dev/null @@ -1 +0,0 @@ -{ "type": "module" } \ No newline at end of file diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 21f0618bb..7057e6300 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -11,10 +11,11 @@ class DriverDiffTests extends AnyFunSuite { import ts2mls.JSFileSystem._ testCases.foreach { - case TestOption(filename, workDir, interfaceDir, execution, tsconfig, ignoreTypeError, expectError) => test(filename) { - val options = DriverOptions(filename, workDir, jsPath, tsconfig, interfaceDir, ignoreTypeError, forceCompiling) + case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, ignoreTypeError, expectError) => test(filename) { + val options = + DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, ignoreTypeError, forceCompiling) val driver = Driver(options) - driver.genPackageJson() + if (!outputDir.isEmpty()) driver.genPackageJson() val success = driver.execute assert(success != expectError, s"failed when compiling $filename.") @@ -35,22 +36,26 @@ object DriverDiffTests { // but we can ban it during CI private val forceCompiling = sys.env.get("CI").isEmpty - private val diffPath = "driver/js/src/test/projects/" - private val jsPath = s"${diffPath}js/" - private val outputPath = s"${diffPath}../output/" + private val esDiffPath = "driver/js/src/test/esprojects/" + private val cjsDiffPath = "driver/js/src/test/cjsprojects/" + private val esJsPath = s"${esDiffPath}js/" + private val cjsJsPath = s"${cjsDiffPath}js/" + private val outputPath = s"${esDiffPath}../output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" private case class TestOption( filename: String, workDir: String, + outputDir: String, interfaceDir: String, + commonJS: Boolean, execution: Option[(String, String)], tsconfig: Option[String], ignoreTypeError: Boolean, expectError: Boolean ) - private def entry( + private def cjsEntry( entryModule: String, tsconfig: Option[String] = None, ignoreTypeError: Boolean = false, @@ -58,29 +63,49 @@ object DriverDiffTests { ) = TestOption( s"./mlscript/${entryModule}.mls", - diffPath, + cjsDiffPath, + cjsJsPath, ".interfaces", - Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), + true, + Some((s"${cjsJsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), + tsconfig, + ignoreTypeError, + expectError + ) + + private def esEntry( + entryModule: String, + tsconfig: Option[String] = None, + ignoreTypeError: Boolean = false, + expectError: Boolean = false + ) = + TestOption( + s"./mlscript/${entryModule}.mls", + esDiffPath, + esJsPath, + ".interfaces", + false, + Some((s"${esJsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), tsconfig, ignoreTypeError, expectError ) private def ts2mlsEntry(entryModule: String, ignoreTypeError: Boolean = false, expectError: Boolean = false) = - TestOption(s"./${entryModule}.mlsi", ts2mlsPath, ".", None, None, ignoreTypeError, expectError) + TestOption(s"./${entryModule}.mlsi", ts2mlsPath, "", ".", false, None, None, ignoreTypeError, expectError) private val testCases = List[TestOption]( - entry("Simple"), - entry("Cycle2"), - entry("Self", expectError = true), - entry("C", ignoreTypeError = true, expectError = true), - entry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members - entry("Output", Some("./tsconfig.json")), - entry("Output2", Some("./tsconfig.json")), - entry("MLS2TheMax", Some("./tsconfig.json")), - entry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - entry("Lodash", Some("./tsconfig.json"), expectError = true), // TODO: generate correct import and check typing - entry("Builtin"), + esEntry("Simple"), + esEntry("Cycle2"), + esEntry("Self", expectError = true), + esEntry("C", ignoreTypeError = true, expectError = true), + esEntry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members + esEntry("Output", Some("./tsconfig.json")), + esEntry("Output2", Some("./tsconfig.json")), + esEntry("MLS2TheMax", Some("./tsconfig.json")), + esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + cjsEntry("Lodash", Some("./tsconfig.json"), expectError = true), // TODO: generate correct import and check typing + esEntry("Builtin"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), ts2mlsEntry("Cycle1", ignoreTypeError = true), diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index 0250fca48..f3b392b7f 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -917,12 +917,14 @@ final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { } // None: mls module, Some(true): ES module, Some(false): common JS module -final case class JSImport(name: Str, path: Str, isESModule: Opt[Bool]) extends JSStmt { +final case class JSImport(name: Str, path: Str, isESModule: Opt[Bool], genRequire: Bool) extends JSStmt { def toSourceCode: SourceCode = isESModule match { case N => SourceCode(s"import { $name } from \"$path\"\n") case S(true) => SourceCode(s"import * as $name from \"$path\"\n") - case S(false) => SourceCode(s"import $name from \"$path\"\n") + case S(false) => + if (genRequire) SourceCode(s"const $name = require(\"$path\")\n") + else SourceCode(s"import $name from \"$path\"\n") } } From 6036e0b7e8ffdbffe3451c01fe60566a88443cc2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sun, 25 Jun 2023 11:49:48 +0800 Subject: [PATCH 130/202] WIP: Fix substitution name parsing --- ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 0d0cd4435..3289a70f5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -156,7 +156,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) - else if (obj.isTypeParameterSubstitution) TSSubstitutionType(TSReferenceType(obj.symbol.escapedName), getSubstitutionArguments(obj.typeArguments)) + else if (obj.isTypeParameterSubstitution) + TSSubstitutionType(TSReferenceType(getSymbolFullname(obj.symbol)), getSubstitutionArguments(obj.typeArguments)) else if (obj.isObject) if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) From 9efb8bbd5689d4fe415cea49579d0bb23610ab30 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sun, 25 Jun 2023 12:22:50 +0800 Subject: [PATCH 131/202] WIP: Fix several problems --- driver/js/src/main/scala/driver/Driver.scala | 1 + driver/js/src/test/output/Lodash.check | 1 + .../js/src/test/scala/driver/DriverDiffTests.scala | 2 +- ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala | 14 ++++++++++---- 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 driver/js/src/test/output/Lodash.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 40c3c3a56..05188dadc 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -271,6 +271,7 @@ class Driver(options: DriverOptions) { totalErrors += 1 report(s"codegen error: $err") case t : Throwable => + totalErrors += 1 report(s"unexpected error: ${t.toString()}") t.printStackTrace() } diff --git a/driver/js/src/test/output/Lodash.check b/driver/js/src/test/output/Lodash.check new file mode 100644 index 000000000..f194bd1cf --- /dev/null +++ b/driver/js/src/test/output/Lodash.check @@ -0,0 +1 @@ +[ 2, 3, 4 ] diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 7057e6300..035acca27 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -104,7 +104,7 @@ object DriverDiffTests { esEntry("Output2", Some("./tsconfig.json")), esEntry("MLS2TheMax", Some("./tsconfig.json")), esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - cjsEntry("Lodash", Some("./tsconfig.json"), expectError = true), // TODO: generate correct import and check typing + cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: typing esEntry("Builtin"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 3289a70f5..12d7b412f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -132,8 +132,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) - else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) - sym.escapedName + else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) { + val name = sym.escapedName + if (name.contains("\"")) TSPathResolver.basename(name.substring(1, name.length() - 1)) + else name + } else { def simplify(symName: String, nsName: String): String = if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) @@ -156,8 +159,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (obj.isUnionType) getStructuralType(obj.types, true) else if (obj.isIntersectionType) getStructuralType(obj.types, false) else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) - else if (obj.isTypeParameterSubstitution) - TSSubstitutionType(TSReferenceType(getSymbolFullname(obj.symbol)), getSubstitutionArguments(obj.typeArguments)) + else if (obj.isTypeParameterSubstitution) { + val baseName = getSymbolFullname(obj.symbol) + if (baseName.contains(".")) TSPartialUnsupportedType // A.B is not supported in mlscript + else TSSubstitutionType(TSReferenceType(baseName), getSubstitutionArguments(obj.typeArguments)) + } else if (obj.isObject) if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) From 082c74adb7c9ace9e518a3c3dfcbdb00e7a6c43f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sun, 25 Jun 2023 16:52:23 +0800 Subject: [PATCH 132/202] WIP: Support interfaces merging and referenced files --- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 +- .../src/main/scala/ts2mls/TSNamespace.scala | 33 +++++++-- .../js/src/main/scala/ts2mls/TSProgram.scala | 28 ++++--- .../src/main/scala/ts2mls/TSSourceFile.scala | 74 ++++++++++++------- .../main/scala/ts2mls/types/Converter.scala | 3 +- ts2mls/js/src/test/typescript/ES5.d.ts | 41 ---------- 7 files changed, 98 insertions(+), 86 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 035acca27..94aa60ee3 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -104,7 +104,7 @@ object DriverDiffTests { esEntry("Output2", Some("./tsconfig.json")), esEntry("MLS2TheMax", Some("./tsconfig.json")), esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: typing + cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection esEntry("Builtin"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 0e50b0d96..157049c13 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -148,6 +148,7 @@ class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends T lazy val isOptionalMember = (flags & TypeScript.symbolFlagsOptional) > 0 lazy val valueDeclaration = TSNodeObject(sym.valueDeclaration) + lazy val isMerged = !IsUndefined(sym.mergeId) } object TSSymbolObject { @@ -156,7 +157,7 @@ object TSSymbolObject { class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAny(node) { private lazy val modifiers = TSTokenArray(node.modifiers) - private lazy val parent = TSNodeObject(node.parent) + lazy val parent = TSNodeObject(node.parent) lazy val isToken = TypeScript.isToken(node) lazy val isClassDeclaration = TypeScript.isClassDeclaration(node) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 287695944..268248a67 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -4,7 +4,7 @@ import scala.collection.mutable.{HashMap, ListBuffer} import types._ import mlscript.utils._ -class TSNamespace(name: String, parent: Option[TSNamespace]) { +class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: Boolean) { // name -> (namespace/type, export) private val subSpace = HashMap[String, (TSNamespace, Boolean)]() private val members = HashMap[String, (TSType, Boolean)]() @@ -25,7 +25,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def derive(name: String, exported: Boolean): TSNamespace = if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it else { - val sub = new TSNamespace(name, Some(this)) // not a top level module! + val sub = new TSNamespace(name, Some(this), allowReservedTypes) // not a top level module! subSpace.put(name, (sub, exported)) order += Left(name) sub @@ -37,6 +37,18 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { members.put(name, (tp, exported)) } else if (overrided) members.update(name, (tp, exported)) + else (members(name), tp) match { + case ((cls: TSClassType, exp), itf: TSInterfaceType) => + members.update(name, (TSClassType( + name, cls.members ++ itf.members, cls.statics, cls.typeVars, + cls.parents, cls.constructor + ), exported || exp)) + case ((itf1: TSInterfaceType, exp), itf2: TSInterfaceType) => + members.update(name, (TSInterfaceType( + name, itf1.members ++ itf2.members, itf1.typeVars, itf1.parents + ), exported || exp)) + case _ => () + } def `export`(name: String): Unit = if (members.contains(name)) @@ -54,7 +66,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { def get(name: String): TSType = if (members.contains(name)) members(name)._1 - else parent.fold(throw new Exception(s"member $name not found."))(p => p.get(name)) + else parent.fold[TSType](TSReferenceType(name))(p => p.get(name)) // default in es5 def get(names: List[String]): TSType = names match { case head :: Nil => get(head) @@ -84,6 +96,13 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { private def expStr(exp: Boolean) = if (exp) "export " else "" + private val typer = + new mlscript.Typer( + dbg = false, + verbose = false, + explainErrors = false, + newDefs = true + ) private def generateInOrder(order: List[Either[String, String]], writer: JSWriter, indent: String) = order.toList.foreach((p) => p match { @@ -93,7 +112,9 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") case Right(name) => - if (subSpace.contains(name)) writer.writeln(s"$indent// WARNING: namespace $name has been declared") + if (typer.reservedTypeNames.contains(name) && !allowReservedTypes) + writer.writeln(s"$indent// WARNING: type $name is reserved") + else if (subSpace.contains(name)) writer.writeln(s"$indent// WARNING: namespace $name has been declared") else { val (mem, exp) = members(name) mem match { @@ -123,7 +144,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { } generateInOrder(order.toList.filter{ case Left(value) => value =/= name - case Right(value) => value =/= name + case Right(value) => value =/= name && value =/= itf }, writer, indent) ns.generate(writer, indent) case _ => generateInOrder(order.toList, writer, indent) @@ -139,5 +160,5 @@ class TSNamespace(name: String, parent: Option[TSNamespace]) { } object TSNamespace { - def apply() = new TSNamespace("", None) // global namespace + def apply(allowReservedTypes: Boolean) = new TSNamespace("", None, allowReservedTypes) // global namespace } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index ddb8f524a..e890f21f3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -22,11 +22,11 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate: Boolean = generate(file)(Nil) + def generate: Boolean = generate(file, None)(Nil) - private def generate(file: FileInfo)(implicit stack: List[String]): Boolean = { + private def generate(file: FileInfo, ns: Option[TSNamespace])(implicit stack: List[String]): Boolean = { val filename = file.resolve - val globalNamespace = TSNamespace() + val globalNamespace = ns.getOrElse(TSNamespace(!uesTopLevelModule)) val sfObj = program.getSourceFileByPath(filename) val sourceFile = if (IsUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") @@ -46,7 +46,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str }) otherList.foreach(imp => { - generate(imp)(filename :: stack) + generate(imp, None)(filename :: stack) }) var writer = JSWriter(s"${file.workDir}/${file.interfaceFilename}") @@ -60,9 +60,11 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } }) cycleList.foreach(imp => { - writer.writeln(s"declare module ${Converter.escapeIdent(imp.moduleName)} {") - cache(imp.resolve).generate(writer, " ") - writer.writeln("}") + if (ns.isEmpty || stack.indexOf(filename) > 0) { + writer.writeln(s"declare module ${Converter.escapeIdent(imp.moduleName)} {") + cache(imp.resolve).generate(writer, " ") + writer.writeln("}") + } }) reExportList.foreach { @@ -79,8 +81,16 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } } - generate(writer, globalNamespace, moduleName) - writer.close() + sourceFile.referencedFiles.forEach((s: js.Dynamic) => { + generate(file.`import`(s.toString()), Some(globalNamespace))(filename :: stack) + }) + + sourceFile.postProcess + if (ns.isEmpty) { + generate(writer, globalNamespace, moduleName) + writer.close() + } + else false } private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String): Unit = diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 12d7b412f..67c594e25 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -13,6 +13,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() + val referencedFiles = sf.referencedFiles.map((x: js.Dynamic) => x.fileName.toString()) + // parse import TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) @@ -35,18 +37,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) - // handle parents - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces + def postProcess: Unit = // handle parents + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) handleParents(nodeObject, nodeObject.symbol.escapedName)(global) - else if (!nodeObject.declarationList.isUndefined) { // for variables - val decNode = nodeObject.declarationList.declaration - handleParents(decNode, decNode.symbol.escapedName)(global) - } - } - }) + }) // check export TypeScript.forEachChild(sf, (node: js.Dynamic) => { @@ -132,9 +128,19 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) - else if (sym.parent.isUndefined || !sym.parent.declaration.isNamespace) { + else if (!sym.parent.isUndefined && sym.parent.isMerged && sym.parent.escapedName === "_") { + def findDecFile(node: TSNodeObject): String = + if (node.parent.isUndefined) "" + else if (node.parent.isSourceFile) node.parent.resolvedPath + else findDecFile(node.parent) + val filename = findDecFile(sym.declaration) + if (filename === resolvedPath) sym.escapedName + else importList.resolveTypeAlias(filename, sym.escapedName) + } + else if (sym.parent.isUndefined) { val name = sym.escapedName if (name.contains("\"")) TSPathResolver.basename(name.substring(1, name.length() - 1)) + else if (name === "_") "" // for UMD else name } else { @@ -142,7 +148,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) else symName - simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) + val p = getSymbolFullname(sym.parent) + simplify(s"${if (p.isEmpty()) "" else s"$p."}${sym.escapedName}", ns.toString()) } private def markUnsupported(node: TSNodeObject): TSUnsupportedType = @@ -366,30 +373,43 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def handleParents(node: TSNodeObject, name: String)(implicit ns: TSNamespace): Unit = if (node.isClassDeclaration) ns.get(name) match { - case TSClassType(name, members, statics, typeVars, _, constructor) => - val cls = TSClassType(name, members, statics, typeVars, getHeritageList(node, members.keySet), constructor) - ns.put(name, if (cls.unsupported) markUnsupported(node) else cls, ns.exported(name), true) + case TSClassType(_, members, statics, typeVars, _, constructor) => + val list = getHeritageList(node, members.keySet) + if (!list.isEmpty) { + val cls = TSClassType(name, members, statics, typeVars, list, constructor) + ns.put(name, if (cls.unsupported) markUnsupported(node) else cls, ns.exported(name), true) + } case t if (t.unsupported) => () // ignore types that have been marked as unsupported. case _ => throw new AssertionError(s"$name is not a class") } else if (node.isInterfaceDeclaration) ns.get(name) match { - case TSInterfaceType(name, members, typeVars, parents) => - val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet)) - ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) + case TSInterfaceType(_, members, typeVars, parents) => + val list = getHeritageList(node, members.keySet) + if (!list.isEmpty) { + val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet)) + ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) + } case t if (t.unsupported) => () // ignore types that have been marked as unsupported. case _ => throw new AssertionError(s"$name is not an interface") } else if (node.isNamespace) { - val sub = ns.derive(node.symbol.escapedName, false) - node.locals.foreach((sym) => { - val node = sym.declaration - val name = sym.escapedName - if (!node.isToken) handleParents(node, name)(sub) - }) + val name = node.symbol.escapedName + + if (!name.contains("\"")) { + val sub = ns.derive(name, false) + node.locals.foreach((sym) => { + val node = sym.declaration + val name = sym.escapedName + if (!node.isToken) handleParents(node, name)(sub) + }) + } } - private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = - parseNamespaceLocals(node.locals, node.exports)(ns.derive(node.symbol.escapedName, node.isExported)) + private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = { + val name = node.symbol.escapedName + parseNamespaceLocals(node.locals, node.exports)(if (name.contains("\"")) ns else ns.derive(name, node.isExported)) + } + } object TSSourceFile { diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 22479179f..dcd0bbcd6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -17,7 +17,8 @@ object Converter { "true" -> "true", "false" -> "false", "symbol" -> "Symbol", - "error" -> "error" + "error" -> "error", + "bigint" -> "Num" ) def escapeIdent(name: String) = { diff --git a/ts2mls/js/src/test/typescript/ES5.d.ts b/ts2mls/js/src/test/typescript/ES5.d.ts index 44e51c6c2..dabff3f6a 100644 --- a/ts2mls/js/src/test/typescript/ES5.d.ts +++ b/ts2mls/js/src/test/typescript/ES5.d.ts @@ -4463,44 +4463,3 @@ declare namespace Intl { readonly prototype: DateTimeFormat; }; } - -interface String { - /** - * Determines whether two strings are equivalent in the current or specified locale. - * @param that String to compare to target string - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details. - * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details. - */ - localeCompare(that: string, locales?: string | string[], options?: Intl.CollatorOptions): number; -} - -interface Number { - /** - * Converts a number to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.NumberFormatOptions): string; -} - -interface Date { - /** - * Converts a date and time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - /** - * Converts a date to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleDateString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; - - /** - * Converts a time to a string by using the current or specified locale. - * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. - * @param options An object that contains one or more properties that specify comparison options. - */ - toLocaleTimeString(locales?: string | string[], options?: Intl.DateTimeFormatOptions): string; -} From 45ab56bde3a40ee5bfd1b60eb708524a27fff338 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 26 Jun 2023 10:57:39 +0800 Subject: [PATCH 133/202] WIP: Refactor code --- build.sbt | 3 +- driver/js/src/main/scala/driver/Driver.scala | 68 ++++++++----------- .../src/main/scala/driver/DriverBackend.scala | 13 ++-- .../src/main/scala/driver/DriverOptions.scala | 2 +- .../src/main/scala/mlscript/NuTypeDefs.scala | 4 +- .../main/scala/mlscript/codegen/Codegen.scala | 9 ++- .../main/scala/ts2mls/TSPathResolver.scala | 2 + 7 files changed, 45 insertions(+), 56 deletions(-) diff --git a/build.sbt b/build.sbt index 8cecc9663..23ab61d1b 100644 --- a/build.sbt +++ b/build.sbt @@ -98,8 +98,7 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) .jvmSettings() .jsSettings( libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", - libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", - Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "bin" / "mlsc.js", + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test" ) .dependsOn(mlscript % "compile->compile;test->test") .dependsOn(ts2mls % "compile->compile;test->test") diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 05188dadc..798f406e1 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -11,7 +11,7 @@ import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, Fi class Driver(options: DriverOptions) { import Driver._ - import ts2mls.JSFileSystem._ + import JSFileSystem._ import JSDriverBackend.ModuleType private val typer = @@ -32,13 +32,13 @@ class Driver(options: DriverOptions) { private val importedModule = MutSet[String]() private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) - import TSPathResolver.{normalize, isLocal, dirname} + import TSPathResolver.{normalize, isLocal, isMLScirpt, dirname} private def checkESModule(filename: String, from: String) = - if (filename.endsWith(".mls")) None - else if (isLocal(filename)) + if (isMLScirpt(filename)) None + else if (isLocal(filename)) // local files: check tsconfig.json Some(TypeScript.isESModule(config, false)) - else { + else { // node_modules: find package.json to get the module type val fullname = TypeScript.resolveModuleName(filename, from, config) def find(path: String): Boolean = { val dir = dirname(path) @@ -47,7 +47,7 @@ class Driver(options: DriverOptions) { val config = TypeScript.parsePackage(pack) TypeScript.isESModule(config, true) } - else if (dir === "." || dir === "/") false + else if (dir.isEmpty || dir === "." || dir === "/") false // not found: default is commonjs else find(dir) } Some(find(fullname)) @@ -115,13 +115,11 @@ class Driver(options: DriverOptions) { } private def packTopModule(moduleName: Option[String], content: String) = - moduleName match { - case Some(moduleName) => - s"declare module $moduleName() {\n" + + moduleName.fold(content)(moduleName => + s"declare module $moduleName() {\n" + content.splitSane('\n').toIndexedSeq.filter(!_.isEmpty()).map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}\n" - case _ => content - } + ) private def parseAndRun[Res](filename: String, f: (ParseResult) => Res): Res = readFile(filename) match { case Some(content) => f(parse(filename, content)) @@ -136,13 +134,14 @@ class Driver(options: DriverOptions) { NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N, N) :: Nil, Nil) }) - private def `type`(tu: TypingUnit, usingES5: Boolean)( + // if the current file is es5.mlsi, we allow overriding builtin type(like String and Object) + private def `type`(tu: TypingUnit, isES5: Boolean)( implicit ctx: Ctx, raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] ) = { - val tpd = typer.typeTypingUnit(tu, N, usingES5) + val tpd = typer.typeTypingUnit(tu, N, isES5) val sim = SimplifyPipeline(tpd, all = false) typer.expandType(sim) } @@ -158,14 +157,16 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType] ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst, Nil), true)) - private def resolveTarget(file: FileInfo, imp: String) = - if ((imp.startsWith("./") || imp.startsWith("../")) && !imp.endsWith(".mls") && !imp.endsWith(".mlsi")) { + // translate mlscirpt import paths into js import paths + private def resolveImportPath(file: FileInfo, imp: String) = + if (isLocal(imp) && !isMLScirpt(imp)) { // local ts files: locate by checking tsconfig.json val tsPath = TypeScript.getOutputFileNames(s"${TSPathResolver.dirname(file.filename)}/$imp", config) val outputBase = TSPathResolver.dirname(TSPathResolver.normalize(s"${options.outputDir}${file.jsFilename}")) TSPathResolver.relative(outputBase, tsPath) } - else imp + else imp // mlscript & node_module: use the original name + // return true if this file is recompiled. private def compile( file: FileInfo, exported: Boolean @@ -177,7 +178,7 @@ class Driver(options: DriverOptions) { stack: List[String] ): Boolean = { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") - if (!file.filename.endsWith(".mls") && !file.filename.endsWith(".mlsi") ) { // TypeScript + if (!isMLScirpt(file.filename)) { // TypeScript val tsprog = TSProgram(file, true, options.tsconfig) return tsprog.generate @@ -198,7 +199,7 @@ class Driver(options: DriverOptions) { case (sigs, recomp) => { importedModule += file.filename (sigs :+ extractSig(file.filename, file.moduleName), - isInterfaceOutdate(file.filename, s"${options.path}/${file.interfaceFilename}")) + recomp || isInterfaceOutdate(file.filename, s"${options.path}/${file.interfaceFilename}")) } }) val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => { @@ -217,39 +218,30 @@ class Driver(options: DriverOptions) { if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { System.out.println(s"compiling ${file.filename}...") - def importModule(file: FileInfo): Unit = { - val filename = s"${options.path}/${file.interfaceFilename}" - parseAndRun(filename, { - case (_, declarations, imports, _) => { - val depList = imports.map(_.path) - depList.foreach(d => importModule(file.`import`(d))) + def importModule(file: FileInfo): Unit = + parseAndRun(s"${options.path}/${file.interfaceFilename}", { + case (_, declarations, imports, _) => + imports.foreach(d => importModule(file.`import`(d.path))) `type`(TypingUnit(declarations, Nil), false) - } }) - } otherList.foreach(d => importModule(file.`import`(d))) - if (file.filename.endsWith(".mls")) { - def generateInterface(moduleName: Option[String], tu: TypingUnit) = { - val exp = `type`(tu, false) - packTopModule(moduleName, exp.show) - } - - val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${generateInterface(None, tu)}") + - generateInterface(Some(file.moduleName), TypingUnit(definitions, Nil)) + if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files + val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + + packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions, Nil), false).show) val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") saveToFile(mlsiFile, interfaces) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( - imp => new Import(resolveTarget(file, imp.path)) with ModuleType { + imp => new Import(resolveImportPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } ), exported || importedModule(file.filename)) } - else `type`(TypingUnit(declarations, Nil), false) + else `type`(TypingUnit(declarations, Nil), false) // for ts/mlsi files, we only check interface files true } - else false + else false // no need to recompile } }) } @@ -296,7 +288,7 @@ object Driver { writer.write(content) writer.close() } - + // TODO factor with duplicated logic in DiffTests private def report(diag: Diagnostic, ignoreTypeError: Boolean): Unit = { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala index 10813043b..e74fa6f3d 100644 --- a/driver/js/src/main/scala/driver/DriverBackend.scala +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -4,6 +4,7 @@ import mlscript._ import mlscript.codegen._ import mlscript.utils._, shorthands._, algorithms._ import mlscript.codegen.Helpers._ +import ts2mls.TSPathResolver class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { def declareJSBuiltin(pgrm: Pgrm): Unit = { @@ -50,21 +51,17 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { private def translateImport(imp: Import with ModuleType, commonJS: Bool) = { val path = imp.path - val last = path.lastIndexOf(".") + val ext = TSPathResolver.extname(path) JSImport( - path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last), - path.substring(0, if (last < 0) path.length() else last) + (if (last < 0) "" else ".js"), + TSPathResolver.basename(path), if (ext.isEmpty()) path else path.replace(ext, ".js"), imp.isESModule, commonJS ) } def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool, commonJS: Bool): Ls[Str] = { imports.flatMap (imp => { - val path = imp.path - val last = path.lastIndexOf(".") - val moduleName = path.substring(path.lastIndexOf("/") + 1, if (last < 0) path.length() else last) - topLevelScope.declareValue(moduleName, Some(false), false) - translateImport(imp, commonJS).toSourceCode.toLines + topLevelScope.declareValue(TSPathResolver.basename(imp.path), Some(false), false) + translateImport(imp, commonJS).toSourceCode.toLines }) ::: generateNewDef(pgrm, topModuleName, exported) } } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index d6b06909f..87951ffc9 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -12,6 +12,6 @@ final case class DriverOptions( tsconfig: Option[String], interfaceDir: String, commonJS: Boolean, // generate common js or es5 - ignoreTypeError: Boolean, + ignoreTypeError: Boolean, // ignore type errors for test force: Boolean // force to recompile if it is true ) diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index d187b6f4a..05d26b263 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -463,7 +463,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => /** Type checks a typing unit, which is a sequence of possibly-mutually-recursive type and function definitions * interleaved with plain statements. */ - def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer], usingES5: Bool = false) + def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer], isES5: Bool = false) (implicit ctx: Ctx, raise: Raise, vars: Map[Str, SimpleType]): TypedTypingUnit = trace(s"${ctx.lvl}. Typing $tu") { @@ -506,7 +506,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => fd.copy()(fd.declareLoc, fd.exportLoc, fd.signature, outer) } case td: NuTypeDef => - if ((td.nme.name in reservedTypeNames) && !usingES5) + if ((td.nme.name in reservedTypeNames) && !isES5) err(msg"Type name '${td.nme.name}' is reserved", td.toLoc) td } diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index f3b392b7f..f0faf7ecb 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -919,13 +919,12 @@ final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { // None: mls module, Some(true): ES module, Some(false): common JS module final case class JSImport(name: Str, path: Str, isESModule: Opt[Bool], genRequire: Bool) extends JSStmt { def toSourceCode: SourceCode = - isESModule match { + if (genRequire) SourceCode(s"const $name = require(\"$path\")\n") + else isESModule match { case N => SourceCode(s"import { $name } from \"$path\"\n") case S(true) => SourceCode(s"import * as $name from \"$path\"\n") - case S(false) => - if (genRequire) SourceCode(s"const $name = require(\"$path\")\n") - else SourceCode(s"import $name from \"$path\"\n") - } + case S(false) => SourceCode(s"import $name from \"$path\"\n") + } } final case class JSComment(text: Str) extends JSStmt { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala index f4f0c97e9..4735b6885 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala @@ -12,6 +12,8 @@ object TSPathResolver { def dirname(filename: String): String = np.dirname(filename).toString() def isLocal(path: String): Boolean = path.startsWith("./") || path.startsWith("/") || path.startsWith("../") + def isMLScirpt(path: String): Boolean = + path.endsWith(".mls") || path.endsWith(".mlsi") def normalize(path: String): String = np.normalize(path).toString() def relative(from: String, to: String) = np.relative(from, to).toString() From c927c0a71ad957801b9e455513466172d8e24af7 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 26 Jun 2023 11:13:01 +0800 Subject: [PATCH 134/202] WIP: Fix commonjs export --- driver/js/src/main/scala/driver/DriverBackend.scala | 9 ++++++--- .../test/cjsprojects/.interfaces/mlscript/CJS1.mlsi | 4 ++++ .../test/cjsprojects/.interfaces/mlscript/CJS2.mlsi | 3 +++ driver/js/src/test/cjsprojects/js/mlscript/CJS1.js | 10 ++++++++++ driver/js/src/test/cjsprojects/js/mlscript/CJS2.js | 10 ++++++++++ driver/js/src/test/cjsprojects/mlscript/CJS1.mls | 2 ++ driver/js/src/test/cjsprojects/mlscript/CJS2.mls | 1 + driver/js/src/test/output/CJS1.check | 1 + driver/js/src/test/scala/driver/DriverDiffTests.scala | 1 + shared/src/main/scala/mlscript/codegen/Codegen.scala | 8 +++++--- 10 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi create mode 100644 driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi create mode 100644 driver/js/src/test/cjsprojects/js/mlscript/CJS1.js create mode 100644 driver/js/src/test/cjsprojects/js/mlscript/CJS2.js create mode 100644 driver/js/src/test/cjsprojects/mlscript/CJS1.mls create mode 100644 driver/js/src/test/cjsprojects/mlscript/CJS2.mls create mode 100644 driver/js/src/test/output/CJS1.check diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala index e74fa6f3d..54097148d 100644 --- a/driver/js/src/main/scala/driver/DriverBackend.scala +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -23,7 +23,7 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { } } - private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool): Ls[Str] = { + private def generateNewDef(pgrm: Pgrm, topModuleName: Str, exported: Bool, commonJS: Bool): Ls[Str] = { val (typeDefs, otherStmts) = pgrm.tops.partitionMap { case ot: Terms => R(ot) case fd: NuFunDef => R(fd) @@ -41,7 +41,10 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { val insDecl = JSConstDecl(topModuleName, JSNew(JSClassExpr(moduleDecl))) val ins = - if (exported) JSExport(insDecl) :: invoke :: Nil + if (exported) { + if (commonJS) insDecl :: invoke :: JSExport(R(JSIdent(topModuleName))) :: Nil + else JSExport(L(insDecl)) :: invoke :: Nil + } else insDecl :: invoke :: Nil SourceCode.fromStmts(polyfill.emit() ++ ins).toLines @@ -62,7 +65,7 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { imports.flatMap (imp => { topLevelScope.declareValue(TSPathResolver.basename(imp.path), Some(false), false) translateImport(imp, commonJS).toSourceCode.toLines - }) ::: generateNewDef(pgrm, topModuleName, exported) + }) ::: generateNewDef(pgrm, topModuleName, exported, commonJS) } } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi new file mode 100644 index 000000000..cc6c3e148 --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi @@ -0,0 +1,4 @@ +import "./CJS2.mlsi" +declare module CJS1() { + unit +} diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi new file mode 100644 index 000000000..6ee76e9d2 --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi @@ -0,0 +1,3 @@ +declare module CJS2() { + fun add: (x: Int, y: Int,) -> Int +} diff --git a/driver/js/src/test/cjsprojects/js/mlscript/CJS1.js b/driver/js/src/test/cjsprojects/js/mlscript/CJS1.js new file mode 100644 index 000000000..8da9c92f0 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/mlscript/CJS1.js @@ -0,0 +1,10 @@ +const CJS2 = require("./CJS2.js") + +const CJS1 = new class CJS1 { + constructor() { + } + $init() { + console.log(CJS2.add(42, 24)); + } +}; +CJS1.$init(); diff --git a/driver/js/src/test/cjsprojects/js/mlscript/CJS2.js b/driver/js/src/test/cjsprojects/js/mlscript/CJS2.js new file mode 100644 index 000000000..6cbf1b1ee --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/mlscript/CJS2.js @@ -0,0 +1,10 @@ +const CJS2 = new class CJS2 { + constructor() { + } + add(x, y) { + return x + y; + } + $init() {} +}; +CJS2.$init(); +module.exports = CJS2; diff --git a/driver/js/src/test/cjsprojects/mlscript/CJS1.mls b/driver/js/src/test/cjsprojects/mlscript/CJS1.mls new file mode 100644 index 000000000..78c509802 --- /dev/null +++ b/driver/js/src/test/cjsprojects/mlscript/CJS1.mls @@ -0,0 +1,2 @@ +import "./CJS2.mls" +console.log(CJS2.add(42, 24)) diff --git a/driver/js/src/test/cjsprojects/mlscript/CJS2.mls b/driver/js/src/test/cjsprojects/mlscript/CJS2.mls new file mode 100644 index 000000000..53e75068d --- /dev/null +++ b/driver/js/src/test/cjsprojects/mlscript/CJS2.mls @@ -0,0 +1 @@ +export fun add(x: Int, y: Int) = x + y diff --git a/driver/js/src/test/output/CJS1.check b/driver/js/src/test/output/CJS1.check new file mode 100644 index 000000000..69a893aa3 --- /dev/null +++ b/driver/js/src/test/output/CJS1.check @@ -0,0 +1 @@ +66 diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 94aa60ee3..83fe83c12 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -106,6 +106,7 @@ object DriverDiffTests { esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection esEntry("Builtin"), + cjsEntry("CJS1"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), ts2mlsEntry("Cycle1", ignoreTypeError = true), diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index f0faf7ecb..dd90f1b0a 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -911,9 +911,11 @@ final case class JSClassNewDecl( private val fieldsSet = collection.immutable.HashSet.from(fields) } -final case class JSExport(moduleDecl: JSConstDecl) extends JSStmt { - def toSourceCode: SourceCode = - SourceCode(s"export ${moduleDecl.toSourceCode}") +final case class JSExport(module: JSConstDecl \/ JSIdent) extends JSStmt { + def toSourceCode: SourceCode = module match { + case L(dec) => SourceCode(s"export ${dec.toSourceCode}") + case R(name) => SourceCode(s"module.exports = ${name.toSourceCode};") + } } // None: mls module, Some(true): ES module, Some(false): common JS module From 6a59966a8d1c293cff405dc58bb66c79499e24c3 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 26 Jun 2023 12:34:47 +0800 Subject: [PATCH 135/202] WIP: Refactor code --- .../test/scala/driver/DriverDiffTests.scala | 51 +++++++++---------- .../scala/mlscript/ConstraintSolver.scala | 1 + shared/src/test/diff/nu/AbstractClasses.mls | 2 + .../js/src/main/scala/ts2mls/FileInfo.scala | 12 +++-- .../js/src/main/scala/ts2mls/JSWriter.scala | 7 +-- .../main/scala/ts2mls/TSCompilerInfo.scala | 1 - 6 files changed, 36 insertions(+), 38 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 83fe83c12..841f9a515 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -36,11 +36,8 @@ object DriverDiffTests { // but we can ban it during CI private val forceCompiling = sys.env.get("CI").isEmpty - private val esDiffPath = "driver/js/src/test/esprojects/" - private val cjsDiffPath = "driver/js/src/test/cjsprojects/" - private val esJsPath = s"${esDiffPath}js/" - private val cjsJsPath = s"${cjsDiffPath}js/" - private val outputPath = s"${esDiffPath}../output/" + private val diffPath = "driver/js/src/test/" + private val outputPath = s"${diffPath}output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" private case class TestOption( @@ -55,41 +52,41 @@ object DriverDiffTests { expectError: Boolean ) - private def cjsEntry( + private def driverEntry( entryModule: String, - tsconfig: Option[String] = None, - ignoreTypeError: Boolean = false, - expectError: Boolean = false - ) = - TestOption( + tsconfig: Option[String], + workDir: String, + jsPath: String, + ignoreTypeError: Boolean, + expectError: Boolean, + commonJS: Boolean + ) = TestOption( s"./mlscript/${entryModule}.mls", - cjsDiffPath, - cjsJsPath, + workDir, + jsPath, ".interfaces", - true, - Some((s"${cjsJsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), + commonJS, + Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), tsconfig, ignoreTypeError, expectError ) + private def cjsEntry( + entryModule: String, + tsconfig: Option[String] = None, + ignoreTypeError: Boolean = false, + expectError: Boolean = false + ) = driverEntry(entryModule, tsconfig, s"${diffPath}cjsprojects/", + s"${diffPath}cjsprojects/js/", ignoreTypeError, expectError, true) + private def esEntry( entryModule: String, tsconfig: Option[String] = None, ignoreTypeError: Boolean = false, expectError: Boolean = false - ) = - TestOption( - s"./mlscript/${entryModule}.mls", - esDiffPath, - esJsPath, - ".interfaces", - false, - Some((s"${esJsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), - tsconfig, - ignoreTypeError, - expectError - ) + ) = driverEntry(entryModule, tsconfig, s"${diffPath}esprojects/", + s"${diffPath}esprojects/js/", ignoreTypeError, expectError, false) private def ts2mlsEntry(entryModule: String, ignoreTypeError: Boolean = false, expectError: Boolean = false) = TestOption(s"./${entryModule}.mlsi", ts2mlsPath, "", ".", false, None, None, ignoreTypeError, expectError) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index fda3ce609..ac3ad8b60 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -34,6 +34,7 @@ class ConstraintSolver extends NormalForms { self: Typer => val info = ctx.tyDefs2.getOrElse(clsNme, die/*TODO*/) if (info.isComputing) { + L(ErrorReport( msg"${info.decl.kind.str.capitalize} `${info.decl.name}` is not supported yet." -> fld.toLoc :: Nil)) diff --git a/shared/src/test/diff/nu/AbstractClasses.mls b/shared/src/test/diff/nu/AbstractClasses.mls index b8749319e..c693dfdf2 100644 --- a/shared/src/test/diff/nu/AbstractClasses.mls +++ b/shared/src/test/diff/nu/AbstractClasses.mls @@ -167,3 +167,5 @@ class C { //│ } //│ Code generation encountered an error: //│ unresolved symbol x + + diff --git a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala index e0bcf58e2..684996944 100644 --- a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala @@ -13,7 +13,7 @@ final case class FileInfo( ) { import TSPathResolver.{normalize, isLocal, dirname, basename, extname} - val relatedPath: Option[String] = // related path (related to work dir, or none if it is in node_modules) + val relatedPath: Option[String] = if (isLocal(localFilename)) Some(normalize(dirname(localFilename))) else None @@ -55,7 +55,7 @@ final case class FileInfo( if (isLocal(path)) relatedPath match { case Some(value) => - if (path.endsWith(".mls") || path.endsWith(".mlsi")) + if (TSPathResolver.isMLScirpt(path)) FileInfo(workDir, s"./${normalize(s"$value/$path")}", interfaceDir, Some(resolve)) else { val res = TypeScript.resolveModuleName(s"./${dirname(path)}/${basename(path)}", resolve, config) @@ -70,8 +70,10 @@ final case class FileInfo( } object FileInfo { - def importPath(filename: String): String = - if (filename.endsWith(".mls") || filename.endsWith(".ts")) - filename.replace(TSPathResolver.extname(filename), ".mlsi") + def importPath(filename: String): String = { + val ext = TSPathResolver.extname(filename) + if (!ext.isEmpty()) + filename.replace(ext, ".mlsi") else filename + ".mlsi" + } } diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 5f7354cc9..c9266a32b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -11,13 +11,10 @@ class JSWriter(filename: String) { private val buffer = new StringBuilder() - def writeln(str: String): Unit = { - val strln = str + "\n" - buffer ++= strln - } - + def writeln(str: String): Unit = write(str + "\n") def write(str: String): Unit = buffer ++= str + // return true if the file has been updated def close(): Boolean = { val str = buffer.toString() val origin = readFile(filename).getOrElse("") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 157049c13..b76ee85dd 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -6,7 +6,6 @@ import js.DynamicImplicits._ import js.JSConverters._ import ts2mls.types._ import mlscript.utils._ -import ts2mls.TSPathResolver object TypeScript { private def load(moduleName: String) = try g.require(moduleName) catch { From 7b57badf27a1e1d16ef20b29754e9efdeb9352a2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 26 Jun 2023 13:28:41 +0800 Subject: [PATCH 136/202] WIP: Support call signature --- .../main/scala/ts2mls/TSCompilerInfo.scala | 1 + .../src/main/scala/ts2mls/TSNamespace.scala | 10 ++--- .../src/main/scala/ts2mls/TSSourceFile.scala | 24 ++++++---- .../main/scala/ts2mls/types/Converter.scala | 12 +++-- .../src/main/scala/ts2mls/types/TSType.scala | 12 ++--- ts2mls/js/src/test/diff/Dec.mlsi | 4 +- ts2mls/js/src/test/diff/ES5.mlsi | 45 ++++++++----------- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 9 ++-- 8 files changed, 60 insertions(+), 57 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index b76ee85dd..971ae5248 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -275,6 +275,7 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) lazy val symbol = TSSymbolObject(obj.symbol) + lazy val aliasSymbol = TSSymbolObject(obj.aliasSymbol) lazy val typeArguments = TSTypeArray(checker.getTypeArguments(obj)) lazy val intrinsicName: String = if (!IsUndefined(obj.intrinsicName)) obj.intrinsicName.toString diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 268248a67..724b5314c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -36,7 +36,6 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: order += Right(name) members.put(name, (tp, exported)) } - else if (overrided) members.update(name, (tp, exported)) else (members(name), tp) match { case ((cls: TSClassType, exp), itf: TSInterfaceType) => members.update(name, (TSClassType( @@ -45,9 +44,10 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: ), exported || exp)) case ((itf1: TSInterfaceType, exp), itf2: TSInterfaceType) => members.update(name, (TSInterfaceType( - name, itf1.members ++ itf2.members, itf1.typeVars, itf1.parents + name, itf1.members ++ itf2.members, itf1.typeVars, itf1.parents, + itf1.callSignature.fold(itf2.callSignature)(cs => Some(cs)) ), exported || exp)) - case _ => () + case _ => if (overrided) members.update(name, (tp, exported)) } def `export`(name: String): Unit = @@ -125,7 +125,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: case overload: TSIgnoredOverload => writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) - case TSInterfaceType(name, _, _, _) if (name =/= "") => + case TSInterfaceType(name, _, _, _, _) if (name =/= "") => writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) case TSRenamedType(name, original) => @@ -137,7 +137,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: private def generateUMD(name: String, writer: JSWriter, indent: String)(implicit ns: TSNamespace) = members(name)._1 match { case TSReferenceType(realType) => ns.get(realType) match { - case TSInterfaceType(itf, members, _, _) => + case TSInterfaceType(itf, members, _, _, _) => members.foreach{ case (name, TSMemberType(tp, _)) => writer.writeln(s"${indent}export val ${Converter.escapeIdent(name)}: ${Converter.convert(tp, false)("")}") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 67c594e25..d1bfafdd9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -167,7 +167,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType else if (obj.isIntersectionType) getStructuralType(obj.types, false) else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) else if (obj.isTypeParameterSubstitution) { - val baseName = getSymbolFullname(obj.symbol) + val baseName = getSymbolFullname(if (obj.symbol.isUndefined) obj.aliasSymbol else obj.symbol) if (baseName.contains(".")) TSPartialUnsupportedType // A.B is not supported in mlscript else TSSubstitutionType(TSReferenceType(baseName), getSubstitutionArguments(obj.typeArguments)) } @@ -175,7 +175,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) - TSInterfaceType("", props, List(), List()) + TSInterfaceType("", props, List(), List(), None) else TSPartialUnsupportedType } else TSReferenceType(getSymbolFullname(obj.symbol)) @@ -208,7 +208,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType // get the type of variables in classes/named interfaces/anonymous interfaces private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = { val res: TSType = - if (node.isIndexSignature || node.isCallSignature || node.isConstructSignature) + if (node.isIndexSignature || node.isConstructSignature) markUnsupported(node) else if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) @@ -320,7 +320,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType }) private def getInterfacePropertiesType(list: TSNodeArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = - list.foldLeft(Map[String, TSMemberType]())((mp, p) => addMember(getMemberType(p), p, p.symbol.escapedName, mp)) + list.foldLeft(Map[String, TSMemberType]())((mp, p) => + if (p.isCallSignature) mp else addMember(getMemberType(p), p, p.symbol.escapedName, mp)) private def getAnonymousPropertiesType(list: TSSymbolArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => @@ -331,10 +332,17 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType if (isClass) TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), getTypeParameters(node), Nil, getConstructorList(node.members)) - else TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), Nil) + else + TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), Nil, parseCallSignature(node.members)) if (res.unsupported) markUnsupported(node) else res } + private def parseCallSignature(list: TSNodeArray)(implicit ns: TSNamespace) = + list.foldLeft[Option[TSFunctionType]](None)((cs, node) => + if (node.isCallSignature) Some(getFunctionType(node, false)) + else cs + ) + private def parseNamespaceLocals(map: TSSymbolMap, exports: TSSymbolMap)(implicit ns: TSNamespace) = map.foreach((sym) => { val node = sym.declaration @@ -364,7 +372,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType ns.put(name, if (alias.unsupported) TSTypeAlias(name, markUnsupported(node), Nil) else alias, exported, false) } else if (node.isObjectLiteral) { - val obj = TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List()) + val obj = TSInterfaceType("", getObjectLiteralMembers(node.initializer.properties), List(), List(), None) ns.put(name, if (obj.unsupported) markUnsupported(node) else obj, exported, false) } else if (node.isVariableDeclaration) ns.put(name, getMemberType(node), exported, false) @@ -383,10 +391,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType case _ => throw new AssertionError(s"$name is not a class") } else if (node.isInterfaceDeclaration) ns.get(name) match { - case TSInterfaceType(_, members, typeVars, parents) => + case TSInterfaceType(_, members, typeVars, parents, cs) => val list = getHeritageList(node, members.keySet) if (!list.isEmpty) { - val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet)) + val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet), cs) ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) } case t if (t.unsupported) => () // ignore types that have been marked as unsupported. diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index dcd0bbcd6..4296e2ba4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -59,8 +59,14 @@ object Converter { case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members - case TSInterfaceType(name, members, typeVars, parents) => - convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) + case TSInterfaceType(name, members, typeVars, parents, callSignature) => + callSignature match { + case Some(cs) if cs.typeVars.isEmpty => + val prefix = if (exported) s"${indent}export declare " else s"${indent}declare " + val tp = if (typeVars.isEmpty) "" else s"[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]" + s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)} ${convertRecord("", members, Nil, Nil, Map(), List(), false)(indent)}" + case _ => convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) + } case TSClassType(name, members, statics, typeVars, parents, cons) => convertRecord(s"class ${escapeIdent(name)}", members, typeVars, parents, statics, cons, exported)(indent) case TSSubstitutionType(TSReferenceType(base), applied) => s"${base}[${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}]" @@ -109,7 +115,7 @@ object Converter { else s"{\n${lst.reduceLeft((bd, m) => s"$bd$m")}$indent}" } - if (typeName === "trait ") body // anonymous interfaces + if (typeName.isEmpty() || typeName === "trait ") body // anonymous interfaces else { // named interfaces and classes val exp = if (exported) "export " else "" val inheritance = diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index d8b02c080..6c2ee16d4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -66,13 +66,15 @@ case class TSInterfaceType( members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], parents: List[TSType], + callSignature: Option[TSFunctionType] ) extends TSType { override val unsupported: Boolean = - typeVars.foldLeft(false)((r, t) => r || t.unsupported) || parents.foldLeft(false)((r, t) => t match { - case cls: TSClassType => cls.members.values.foldLeft(r || cls.unsupported)((r, t) => r || t.unsupported) - case itf: TSInterfaceType => itf.members.values.foldLeft(r || itf.unsupported)((r, t) => r || t.unsupported) - case _ => r || t.unsupported - }) + typeVars.foldLeft(callSignature.fold(false)(cs => cs.unsupported))((r, t) => r || t.unsupported) || + parents.foldLeft(false)((r, t) => t match { + case cls: TSClassType => cls.members.values.foldLeft(r || cls.unsupported)((r, t) => r || t.unsupported) + case itf: TSInterfaceType => itf.members.values.foldLeft(r || itf.unsupported)((r, t) => r || t.unsupported) + case _ => r || t.unsupported + }) } sealed abstract class TSStructuralType(lhs: TSType, rhs: TSType, notion: String) extends TSType { diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index 21a9b6319..c875617f0 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,9 +1,7 @@ export declare module Dec { fun getName(id: (Str) | (Num)): Str fun render(callback: (() => unit) | (undefined)): Str - declare trait Get { - val __call: unsupported["(id: string): string", "Dec.d.ts", 4, 22] - } + declare trait Get: (args0: Str) => Str {} declare class Person { constructor(name: Str, age: Num) fun getName(args0: Num): Str diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 12fe3aeb5..767a1da1f 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -35,8 +35,7 @@ declare class Object { fun isPrototypeOf(args0: Object): (false) | (true) fun toString(): Str } -declare trait ObjectConstructor { - val __call: unsupported["(value: any): any;", "ES5.d.ts", 139, 12] +declare trait ObjectConstructor: (args0: anything) => anything { fun getOwnPropertyNames(args0: anything): MutArray[Str] fun isFrozen(args0: anything): (false) | (true) fun getPrototypeOf(args0: anything): anything @@ -63,19 +62,18 @@ declare trait Function { val caller: Function val arguments: anything } -declare trait FunctionConstructor { +declare trait FunctionConstructor: (args0: (Str) | (MutArray[Str])) => Function { val __new: unsupported["new(...args: string[]): Function;", "ES5.d.ts", 291, 31] - val __call: unsupported["(...args: string[]): Function;", "ES5.d.ts", 296, 37] val prototype: Function } type ThisParameterType = unsupported["type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;", "ES5.d.ts", 301, 42] type OmitThisParameter = unsupported["type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;", "ES5.d.ts", 306, 91] -declare trait CallableFunction extends Function { +declare trait CallableFunction { fun apply[T, A, R](args0: T, args1: A): R /* warning: the overload of function apply is not supported yet. */ fun call[T, A, R](args0: T, args1: A): R fun bind[T, AX, R](args0: T, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ } -declare trait NewableFunction extends Function { +declare trait NewableFunction { fun apply[T, A](args0: T, args1: A): unit /* warning: the overload of function apply is not supported yet. */ fun call[T, A](args0: T, args1: A): unit fun bind[AX, R](args0: anything, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ @@ -109,9 +107,8 @@ declare trait String { fun search(args0: (Str) | (RegExp)): Num fun charAt(args0: Num): Str } -declare trait StringConstructor { +declare trait StringConstructor: (args0: (anything) | (undefined)) => Str { val __new: unsupported["new(value?: any): String;", "ES5.d.ts", 503, 29] - val __call: unsupported["(value?: any): string;", "ES5.d.ts", 504, 29] val prototype: String fun fromCharCode(args0: (Num) | (MutArray[Num])): Str } @@ -120,7 +117,6 @@ declare class Bool { } declare trait BooleanConstructor { val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 520, 30] - val __call: unsupported["(value?: T): boolean;", "ES5.d.ts", 521, 27] val prototype: Bool } val Boolean: BooleanConstructor @@ -131,8 +127,7 @@ declare trait Number { fun toFixed(args0: (Num) | (undefined)): Str fun toPrecision(args0: (Num) | (undefined)): Str } -declare trait NumberConstructor { - val __call: unsupported["(value?: any): number;", "ES5.d.ts", 558, 29] +declare trait NumberConstructor: (args0: (anything) | (undefined)) => Num { val NaN: Num val MIN_VALUE: Num val __new: unsupported["new(value?: any): Number;", "ES5.d.ts", 557, 29] @@ -141,7 +136,7 @@ declare trait NumberConstructor { val MAX_VALUE: Num val prototype: Number } -declare trait TemplateStringsArray extends ReadonlyArray[Str] { +declare trait TemplateStringsArray { val raw: ReadonlyArray[Str] } declare trait ImportMeta {} @@ -224,20 +219,19 @@ declare trait Date { fun setUTCHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num fun toJSON(args0: (anything) | (undefined)): Str } -declare trait DateConstructor { - val __call: unsupported["(): string;", "ES5.d.ts", 898, 128] +declare trait DateConstructor: () => Str { fun UTC(args0: Num, args1: Num, args2: (Num) | (undefined), args3: (Num) | (undefined), args4: (Num) | (undefined), args5: (Num) | (undefined), args6: (Num) | (undefined)): Num val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 887, 38] fun now(): Num fun parse(args0: Str): Num val prototype: Date } -declare trait RegExpMatchArray extends Array[Str] { +declare trait RegExpMatchArray { val index: (Num) | (undefined) val input: (Str) | (undefined) val id"0": Str } -declare trait RegExpExecArray extends Array[Str] { +declare trait RegExpExecArray { val index: Num val input: Str val id"0": Str @@ -252,7 +246,7 @@ declare trait RegExp { val ignoreCase: (false) | (true) fun exec(args0: Str): RegExpExecArray } -declare trait RegExpConstructor { +declare trait RegExpConstructor: (args0: Str, args1: (Str) | (undefined)) => RegExp { val id"$4": Str val rightContext: Str val lastParen: Str @@ -265,7 +259,6 @@ declare trait RegExpConstructor { val prototype: RegExp val id"$`": Str val id"$_": Str - val __call: unsupported["(pattern: string, flags?: string): RegExp;", "ES5.d.ts", 989, 39] val lastMatch: Str val id"$9": Str val id"$6": Str @@ -281,22 +274,21 @@ declare trait Error { val message: Str val stack: (Str) | (undefined) } -declare trait ErrorConstructor { +declare trait ErrorConstructor: (args0: (Str) | (undefined)) => Error { val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1042, 28] - val __call: unsupported["(message?: string): Error;", "ES5.d.ts", 1043, 33] val prototype: Error } -declare trait EvalError extends Error {} +declare trait EvalError {} val EvalErrorConstructor: unsupported["interface EvalErrorConstructor extends ErrorConstructor { new(message?: string): EvalError; (message?: string): EvalError; readonly prototype: EvalError; }", "ES5.d.ts", 1051, 1] -declare trait RangeError extends Error {} +declare trait RangeError {} val RangeErrorConstructor: unsupported["interface RangeErrorConstructor extends ErrorConstructor { new(message?: string): RangeError; (message?: string): RangeError; readonly prototype: RangeError; }", "ES5.d.ts", 1062, 1] -declare trait ReferenceError extends Error {} +declare trait ReferenceError {} val ReferenceErrorConstructor: unsupported["interface ReferenceErrorConstructor extends ErrorConstructor { new(message?: string): ReferenceError; (message?: string): ReferenceError; readonly prototype: ReferenceError; }", "ES5.d.ts", 1073, 1] -declare trait SyntaxError extends Error {} +declare trait SyntaxError {} val SyntaxErrorConstructor: unsupported["interface SyntaxErrorConstructor extends ErrorConstructor { new(message?: string): SyntaxError; (message?: string): SyntaxError; readonly prototype: SyntaxError; }", "ES5.d.ts", 1084, 1] -declare trait TypeError extends Error {} +declare trait TypeError {} val TypeErrorConstructor: unsupported["interface TypeErrorConstructor extends ErrorConstructor { new(message?: string): TypeError; (message?: string): TypeError; readonly prototype: TypeError; }", "ES5.d.ts", 1095, 1] -declare trait URIError extends Error {} +declare trait URIError {} val URIErrorConstructor: unsupported["interface URIErrorConstructor extends ErrorConstructor { new(message?: string): URIError; (message?: string): URIError; readonly prototype: URIError; }", "ES5.d.ts", 1106, 1] declare trait JSON { fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything @@ -353,7 +345,6 @@ declare trait Array[T] { } declare trait ArrayConstructor { val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1470, 38] - val __call: unsupported["(...items: T[]): T[];", "ES5.d.ts", 1473, 34] fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 7bcdc9755..a58c57703 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -13,14 +13,11 @@ export declare module InterfaceMember { declare trait IEvent { fun callback(): (x: Num) => unit } - declare trait SearchFunc { - val __call: unsupported["(source: string, subString: string): boolean;", "InterfaceMember.ts", 24, 22] - } + declare trait SearchFunc: (args0: Str, args1: Str) => (false) | (true) {} declare trait StringArray { val __index: unsupported["[index: number]: string;", "InterfaceMember.ts", 28, 23] } - declare trait Counter { - val __call: unsupported["(start: number): string;", "InterfaceMember.ts", 32, 19] + declare trait Counter: (args0: Num) => Str { val interval: Num fun reset(): unit } @@ -31,7 +28,7 @@ export declare module InterfaceMember { declare trait Simple2[T] { val abc: T } - declare trait Next extends Simple {} + declare trait Next {} declare trait TTT[T] { fun ttt(x: T): T } From 8864ca3c95316785e8619b39aeb338ca675ea82f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 26 Jun 2023 22:23:57 +0800 Subject: [PATCH 137/202] WIP: Fix some bugs(not ready) --- .../test/scala/driver/DriverDiffTests.scala | 4 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 2 + .../js/src/main/scala/ts2mls/TSModules.scala | 8 +- .../src/main/scala/ts2mls/TSNamespace.scala | 97 +++++++++++-------- .../js/src/main/scala/ts2mls/TSProgram.scala | 13 ++- .../src/main/scala/ts2mls/TSSourceFile.scala | 35 ++++--- .../main/scala/ts2mls/types/Converter.scala | 11 ++- 7 files changed, 102 insertions(+), 68 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 841f9a515..483601837 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -97,8 +97,8 @@ object DriverDiffTests { esEntry("Self", expectError = true), esEntry("C", ignoreTypeError = true, expectError = true), esEntry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members - esEntry("Output", Some("./tsconfig.json")), - esEntry("Output2", Some("./tsconfig.json")), + esEntry("Output", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position + esEntry("Output2", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position esEntry("MLS2TheMax", Some("./tsconfig.json")), esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 971ae5248..ad70def37 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -71,6 +71,7 @@ object TypeScript { def isExportDeclaration(node: js.Dynamic) = ts.isExportDeclaration(node) def isImportEqualsDeclaration(node: js.Dynamic) = ts.isImportEqualsDeclaration(node) def isExportAssignment(node: js.Dynamic) = ts.isExportAssignment(node) + def isNamespaceExportDeclaration(node: js.Dynamic) = ts.isNamespaceExportDeclaration(node) def isArrayTypeNode(node: js.Dynamic) = ts.isArrayTypeNode(node) def isTupleTypeNode(node: js.Dynamic) = ts.isTupleTypeNode(node) @@ -182,6 +183,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isSourceFile = TypeScript.isSourceFile(node) lazy val isExportDeclaration = TypeScript.isExportDeclaration(node) lazy val isExportAssignment = TypeScript.isExportAssignment(node) + lazy val exportedAsNamespace = TypeScript.isNamespaceExportDeclaration(node) // if a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 3529fd0cb..6900668ee 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -67,6 +67,12 @@ class TSImportList { else singleList.addOne((fullPath, imp)) } + def remove(fullPath: String): Unit = { + singleList.remove(fullPath) + fullList.remove(fullPath) + () + } + def resolveTypeAlias(modulePath: String, name: String): String = { val singleAlias = if (singleList.contains(modulePath)) singleList(modulePath).resolveTypeAlias(name) @@ -77,7 +83,7 @@ class TSImportList { val fullAlias = if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) else None - fullAlias.getOrElse(throw new AssertionError(s"unresolved imported name $name at $modulePath.")) + fullAlias.getOrElse(name) // cjs modules have no prefix } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 724b5314c..5e13e6e3e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -8,15 +8,14 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: // name -> (namespace/type, export) private val subSpace = HashMap[String, (TSNamespace, Boolean)]() private val members = HashMap[String, (TSType, Boolean)]() - private lazy val umd = - members.keys.find(name => subSpace.contains(name)).fold[Option[String]](None)( - name => Option.when(members(name)._2)(name) - ) + private val cjsExport = HashMap[String, String]() // write down the order of members // easier to check the output one by one private val order = ListBuffer.empty[Either[String, String]] + def isCommonJS = !cjsExport.isEmpty + override def toString(): String = parent match { case Some(parent) if !parent.toString().isEmpty() => s"${parent.toString()}.$name" case _ => name @@ -56,6 +55,17 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: else if (subSpace.contains(name)) subSpace.update(name, (subSpace(name)._1, true)) + def renameExport(from: String, to: String): Unit = + if (members.contains(from)) { + cjsExport.put(from, to) + members.update(from, (members(from)._1, true)) + } + else if (subSpace.contains(from)) { + cjsExport.put(from, to) + subSpace.update(from, (subSpace(from)._1, true)) + } + else throw new Exception(s"member $from not found.") + def exported(name: String): Boolean = if (members.contains(name)) members(name)._2 else throw new Exception(s"member $name not found.") @@ -104,59 +114,66 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: newDefs = true ) - private def generateInOrder(order: List[Either[String, String]], writer: JSWriter, indent: String) = + private def generateNS(name: String, writer: JSWriter, indent: String): Unit = { + val ss = subSpace(name) + val realName = cjsExport.getOrElse(name, name) + val exp = expStr(realName =/= name || ss._2) + writer.writeln(s"${indent}${exp}declare module ${Converter.escapeIdent(realName)} {") + ss._1.generate(writer, indent + " ") + writer.writeln(s"$indent}") + } + + private def merge(name: String, writer: JSWriter, indent: String): Unit = { + (members(name), subSpace(name)._1) match { + case ((TSReferenceType(realType), exp), ns) => ns.get(realType) match { + case TSInterfaceType(itf, members, _, _, _) => + ns.subSpace.mapValuesInPlace { + case (_, (ns, _)) => (ns, false) + } + ns.members.mapValuesInPlace { + case (_, (mem, _)) => (mem, false) + } + members.foreach{ + case (name, TSMemberType(tp, _)) => + ns.put(name, tp, true, true) + } + case _ => () // if merging is not supported, do nothing + } + case _ => () // if merging is not supported, do nothing + } + generateNS(name, writer, indent) + } + + def generate(writer: JSWriter, indent: String): Unit = order.toList.foreach((p) => p match { - case Left(subName) => - val ss = subSpace(subName) - writer.writeln(s"${indent}${expStr(ss._2)}declare module ${Converter.escapeIdent(subName)} {") - ss._1.generate(writer, indent + " ") - writer.writeln(s"$indent}") + case Left(subName) if (!members.contains(subName)) => + generateNS(subName, writer, indent) case Right(name) => if (typer.reservedTypeNames.contains(name) && !allowReservedTypes) writer.writeln(s"$indent// WARNING: type $name is reserved") - else if (subSpace.contains(name)) writer.writeln(s"$indent// WARNING: namespace $name has been declared") + else if (subSpace.contains(name)) + merge(name, writer, indent) else { val (mem, exp) = members(name) + val realName = cjsExport.getOrElse(name, name) mem match { case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, name, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(inter, realName, !cjsExport.isEmpty, exp)(indent)) case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, name, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(f, realName, !cjsExport.isEmpty, exp)(indent)) case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, name, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(overload, realName, !cjsExport.isEmpty, exp)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) - case TSInterfaceType(name, _, _, _, _) if (name =/= "") => + case TSInterfaceType(name, _, _, _, _) if (name =/= "") => // TODO: rename? writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) case TSRenamedType(name, original) => - writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)} = ${Converter.convert(original)("")}") - case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(name)}: ${Converter.convert(mem)("")}") + writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(realName)} = ${Converter.convert(original)("")}") + case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(realName)}: ${Converter.convert(mem)("")}") } } + case _ => () }) - - private def generateUMD(name: String, writer: JSWriter, indent: String)(implicit ns: TSNamespace) = members(name)._1 match { - case TSReferenceType(realType) => ns.get(realType) match { - case TSInterfaceType(itf, members, _, _, _) => - members.foreach{ - case (name, TSMemberType(tp, _)) => - writer.writeln(s"${indent}export val ${Converter.escapeIdent(name)}: ${Converter.convert(tp, false)("")}") - } - generateInOrder(order.toList.filter{ - case Left(value) => value =/= name - case Right(value) => value =/= name && value =/= itf - }, writer, indent) - ns.generate(writer, indent) - case _ => generateInOrder(order.toList, writer, indent) - } - case _ => generateInOrder(order.toList, writer, indent) - } - - def generate(writer: JSWriter, indent: String): Unit = - umd match { - case Some(name) => generateUMD(name, writer, indent)(subSpace(name)._1) - case _ => generateInOrder(order.toList, writer, indent) - } } object TSNamespace { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index e890f21f3..5cb66631e 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -26,18 +26,17 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str private def generate(file: FileInfo, ns: Option[TSNamespace])(implicit stack: List[String]): Boolean = { val filename = file.resolve + val moduleName = file.moduleName val globalNamespace = ns.getOrElse(TSNamespace(!uesTopLevelModule)) val sfObj = program.getSourceFileByPath(filename) val sourceFile = if (IsUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") - else TSSourceFile(sfObj, globalNamespace) + else TSSourceFile(sfObj, globalNamespace, moduleName) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList cache.addOne(filename, globalNamespace) val relatedPath = relative(file.workDir, dirname(filename)) - val moduleName = file.moduleName - val (cycleList, otherList) = importList.partitionMap(imp => { val newFile = file.`import`(imp.filename) @@ -82,19 +81,19 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } sourceFile.referencedFiles.forEach((s: js.Dynamic) => { - generate(file.`import`(s.toString()), Some(globalNamespace))(filename :: stack) + generate(file.`import`(s.toString()), sourceFile.getUMDModule)(filename :: stack) }) sourceFile.postProcess if (ns.isEmpty) { - generate(writer, globalNamespace, moduleName) + generate(writer, globalNamespace, moduleName, globalNamespace.isCommonJS) writer.close() } else false } - private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String): Unit = - if (!uesTopLevelModule) globalNamespace.generate(writer, "") // will be imported directly and has no dependency + private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String, commonJS: Boolean): Unit = + if (!uesTopLevelModule || commonJS) globalNamespace.generate(writer, "") else { writer.writeln(s"export declare module ${Converter.escapeIdent(moduleName)} {") globalNamespace.generate(writer, " ") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index d1bfafdd9..c4a15e81c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -7,13 +7,16 @@ import mlscript.utils._ import scala.collection.mutable.{ListBuffer, HashMap} import ts2mls.TSPathResolver -class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker, config: js.Dynamic) { +class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = TSImportList() private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() + private var umdModuleName: Option[String] = None val referencedFiles = sf.referencedFiles.map((x: js.Dynamic) => x.fileName.toString()) + def getUMDModule: Option[TSNamespace] = + umdModuleName.fold[Option[TSNamespace] ](Some(global))(name => Some(global.derive(name, false))) // parse import TypeScript.forEachChild(sf, (node: js.Dynamic) => { @@ -37,13 +40,6 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } }) - def postProcess: Unit = // handle parents - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) - handleParents(nodeObject, nodeObject.symbol.escapedName)(global) - }) - // check export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) @@ -55,10 +51,19 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType } else if (nodeObject.isExportAssignment) { val name = nodeObject.idExpression.escapedText - global.`export`(name) + global.renameExport(name, topName) } + else if (nodeObject.exportedAsNamespace) + umdModuleName = Some(nodeObject.symbol.escapedName) }) + def postProcess: Unit = // handle parents + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) + handleParents(nodeObject, nodeObject.symbol.escapedName)(global) + }) + def getImportList: List[TSImport] = importList.getFilelist def getReExportList: List[TSReExport] = reExportList.toList @@ -415,12 +420,16 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSType private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = { val name = node.symbol.escapedName - parseNamespaceLocals(node.locals, node.exports)(if (name.contains("\"")) ns else ns.derive(name, node.isExported)) + if (name.contains("\"")) { // Ambient Modules + val fullname = TypeScript.resolveModuleName(name.substring(1, name.length() - 1), resolvedPath, config) + importList.remove(fullname) + parseNamespaceLocals(node.locals, node.exports) + } + else parseNamespaceLocals(node.locals, node.exports)(ns.derive(name, node.isExported)) } - } object TSSourceFile { - def apply(sf: js.Dynamic, global: TSNamespace)(implicit checker: TSTypeChecker, config: js.Dynamic) = - new TSSourceFile(sf, global) + def apply(sf: js.Dynamic, global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) = + new TSSourceFile(sf, global, topName) } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 4296e2ba4..4ca2212af 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -35,14 +35,15 @@ object Converter { case (tp, i) => convert(tp)("") }.reduceLeft((r, p) => s"$r, $p") - def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { + def generateFunDeclaration(tsType: TSType, name: String, declared: Boolean, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = generateFunParamsList(params) val tpList = if (typeVars.isEmpty) "" else s"[${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}]" val exp = if (exported) "export " else "" - s"${indent}${exp}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + val dec = if (declared) "declare " else "" + s"${indent}${exp}${dec}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, exported)} ${overload.warning}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, declared, exported)} ${overload.warning}" case _ => throw new AssertionError("non-function type is not allowed.") } @@ -89,8 +90,8 @@ object Converter { case Public => if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { - case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" - case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" + case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" case _ => s"${indent} val ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members From 4119fad608c1a387177d13c556a4e33e3d0d9c0a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 11:38:14 +0800 Subject: [PATCH 138/202] WIP: Fix declarations --- .../src/main/scala/ts2mls/TSSourceFile.scala | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index c4a15e81c..b20589cb3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -31,8 +31,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) // for functions/classes/interfaces - addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) + if (!nodeObject.symbol.isUndefined) { // for functions + if (nodeObject.isFunctionLike) + addFunctionIntoNamespace(nodeObject.symbol, nodeObject, nodeObject.symbol.escapedName)(global) + else // for classes/interfaces/namespace + addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) + } else if (!nodeObject.declarationList.isUndefined) { // for variables val decNode = nodeObject.declarationList.declaration addNodeIntoNamespace(decNode, decNode.symbol.escapedName, decNode.isExported)(global) @@ -352,23 +356,26 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici map.foreach((sym) => { val node = sym.declaration val name = sym.escapedName - if (!node.isToken) - addNodeIntoNamespace(node, name, exports.contains(name), if (node.isFunctionLike) Some(sym.declarations) else None) + if (node.isFunctionLike) addFunctionIntoNamespace(sym, node, name) + else if (!node.isToken) + sym.declarations.foreach(dec => + addNodeIntoNamespace(dec, name, exports.contains(name)) + ) }) - private def addFunctionIntoNamespace(fun: TSFunctionType, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = - if (fun.unsupported) ns.put(name, markUnsupported(node), node.isExported, false) - else if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) - else - ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // the implementation is always after declarations + private def addFunctionIntoNamespace(sym: TSSymbolObject, node: TSNodeObject, name: String)(implicit ns: TSNamespace) = + sym.declarations.foreach(d => { + val fun = getFunctionType(d, true) + if (fun.unsupported) ns.put(name, markUnsupported(node), node.isExported, false) + else if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) + else + ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // the implementation is always after declarations + }) // overload functions in a sub-namespace need to provide an overload array // because the namespace merely exports symbols rather than node objects themselves - private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean, overload: Option[TSNodeArray] = None)(implicit ns: TSNamespace) = - if (node.isFunctionLike) overload.fold( - addFunctionIntoNamespace(getFunctionType(node, true), node, name) - )(decs => decs.foreach(d => addFunctionIntoNamespace(getFunctionType(d, true), d, name))) - else if (node.isClassDeclaration) + private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean)(implicit ns: TSNamespace) = + if (node.isClassDeclaration) ns.put(name, parseMembers(name, node, true), exported, false) else if (node.isInterfaceDeclaration) ns.put(name, parseMembers(name, node, false), exported, false) From 0b84df2fe343b70aa712cf8bac1ea00e5908e1de Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 11:43:39 +0800 Subject: [PATCH 139/202] WIP: Rerun test --- ts2mls/js/src/test/diff/ES5.mlsi | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 767a1da1f..547558409 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -783,6 +783,7 @@ declare module Intl { export declare trait Collator { fun compare(args0: Str, args1: Str): Num fun resolvedOptions(): ResolvedCollatorOptions + fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (CollatorOptions) | (undefined)): MutArray[Str] } export declare trait NumberFormatOptions { val minimumSignificantDigits: (Num) | (undefined) @@ -811,6 +812,8 @@ declare module Intl { export declare trait NumberFormat { fun format(args0: Num): Str fun resolvedOptions(): ResolvedNumberFormatOptions + fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (NumberFormatOptions) | (undefined)): MutArray[Str] + val prototype: NumberFormat } export declare trait DateTimeFormatOptions { val minute: ((Str) | (Str)) | (undefined) @@ -846,5 +849,7 @@ declare module Intl { export declare trait DateTimeFormat { fun format(args0: ((Num) | (Date)) | (undefined)): Str fun resolvedOptions(): ResolvedDateTimeFormatOptions + fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (DateTimeFormatOptions) | (undefined)): MutArray[Str] + val prototype: DateTimeFormat } } From 46342ded016a623106035179418f5918ec438ca4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 12:43:12 +0800 Subject: [PATCH 140/202] WIP: Fix forall translation --- .../src/main/scala/ts2mls/TSSourceFile.scala | 6 +- .../main/scala/ts2mls/types/Converter.scala | 12 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 10 +- ts2mls/js/src/test/diff/ES5.mlsi | 228 +++++++++--------- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 12 +- ts2mls/js/src/test/diff/Intersection.mlsi | 12 +- ts2mls/js/src/test/diff/Optional.mlsi | 6 +- ts2mls/js/src/test/diff/Overload.mlsi | 6 +- ts2mls/js/src/test/diff/TSArray.mlsi | 10 +- ts2mls/js/src/test/diff/Tuple.mlsi | 4 +- ts2mls/js/src/test/diff/Type.mlsi | 10 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 34 +-- ts2mls/js/src/test/diff/Union.mlsi | 2 +- .../js/src/test/typescript/TypeParameter.ts | 3 + 14 files changed, 180 insertions(+), 175 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index b20589cb3..9534285b9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -194,10 +194,8 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici // the function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = - if (tn.isFunctionLike) { - if (tn.typeParameters.isUndefined) getFunctionType(tn, true) - else markUnsupported(tn) // type parameters in lambda functions are not supported - } + if (tn.isFunctionLike) + getFunctionType(tn, true) else if (tn.isTupleTypeNode) TSTupleType(getTupleElements(tn.typeNode.typeArguments)) else getObjectType(tn.typeNode) match { case TSPrimitiveType("intrinsic") => markUnsupported(tn) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 4ca2212af..aeff2fa23 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -50,19 +50,21 @@ object Converter { def convert(tsType: TSType, exported: Boolean = false)(implicit indent: String = ""): String = tsType match { case TSPrimitiveType(typeName) => primitiveName(typeName) case TSReferenceType(name) => name - case TSFunctionType(params, res, _) => + case TSFunctionType(params, res, typeVars) => + val tpNames = typeVars.map(_.name) + val tpList = tpNames.foldLeft("")((res, tp) => s"${res}forall '$tp; ") val pList = generateFunParamsList(params) - s"($pList) => ${convert(res)}" + s"$tpList($pList) => ${convert(res)}" case TSUnionType(lhs, rhs) => s"(${convert(lhs)}) | (${convert(rhs)})" case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" - case TSTypeParameter(name, _) => name // constraints should be translated where the type parameters were created rather than be used + case TSTypeParameter(name, _) => s"'$name" // constraints should be translated where the type parameters were created rather than be used case TSTupleType(lst) => s"(${lst.foldLeft("")((p, t) => s"$p${convert(t)}, ")})" case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members case TSInterfaceType(name, members, typeVars, parents, callSignature) => callSignature match { - case Some(cs) if cs.typeVars.isEmpty => + case Some(cs) => val prefix = if (exported) s"${indent}export declare " else s"${indent}declare " val tp = if (typeVars.isEmpty) "" else s"[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]" s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)} ${convertRecord("", members, Nil, Nil, Map(), List(), false)(indent)}" @@ -124,7 +126,7 @@ object Converter { else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" else - s"${indent}${exp}declare $typeName[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints + s"${indent}${exp}declare $typeName[${typeVars.map(convert(_)).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints } } } diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index 938cc47af..be89f9378 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -6,8 +6,8 @@ export declare module ClassMember { fun addScore(args0: Str, args1: Num): unit fun getID(): Num } - declare class Foo[T] { - fun bar(args0: T): unit + declare class Foo['T] { + fun bar(args0: 'T): unit } declare class EZ { fun inc(args0: Num): Num @@ -17,8 +17,8 @@ export declare module ClassMember { val a: Num } } - declare class TTT[T] { - fun ttt(args0: T): T - fun ttt2(x: T): T + declare class TTT['T] { + fun ttt(args0: 'T): 'T + fun ttt2(x: 'T): 'T } } diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 547558409..9d832a53f 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -39,16 +39,16 @@ declare trait ObjectConstructor: (args0: anything) => anything { fun getOwnPropertyNames(args0: anything): MutArray[Str] fun isFrozen(args0: anything): (false) | (true) fun getPrototypeOf(args0: anything): anything - fun defineProperty[T](args0: T, args1: ((Str) | (Num)) | (Symbol), args2: (PropertyDescriptor) & (ThisType[anything])): T + fun defineProperty['T](args0: 'T, args1: ((Str) | (Num)) | (Symbol), args2: (PropertyDescriptor) & (ThisType[anything])): 'T val prototype: Object fun isSealed(args0: anything): (false) | (true) - fun defineProperties[T](args0: T, args1: (PropertyDescriptorMap) & (ThisType[anything])): T - fun preventExtensions[T](args0: T): T + fun defineProperties['T](args0: 'T, args1: (PropertyDescriptorMap) & (ThisType[anything])): 'T + fun preventExtensions['T](args0: 'T): 'T fun create(args0: Object, args1: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ val freeze: unsupported["freeze(o: T): Readonly;", "ES5.d.ts", 210, 143] val __new: unsupported["new(value?: any): Object;", "ES5.d.ts", 137, 29] fun getOwnPropertyDescriptor(args0: anything, args1: ((Str) | (Num)) | (Symbol)): PropertyDescriptor - fun seal[T](args0: T): T + fun seal['T](args0: 'T): 'T fun keys(args0: Object): MutArray[Str] fun isExtensible(args0: anything): (false) | (true) } @@ -69,14 +69,14 @@ declare trait FunctionConstructor: (args0: (Str) | (MutArray[Str])) => Function type ThisParameterType = unsupported["type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;", "ES5.d.ts", 301, 42] type OmitThisParameter = unsupported["type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;", "ES5.d.ts", 306, 91] declare trait CallableFunction { - fun apply[T, A, R](args0: T, args1: A): R /* warning: the overload of function apply is not supported yet. */ - fun call[T, A, R](args0: T, args1: A): R - fun bind[T, AX, R](args0: T, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ + fun apply['T, 'A, 'R](args0: 'T, args1: 'A): 'R /* warning: the overload of function apply is not supported yet. */ + fun call['T, 'A, 'R](args0: 'T, args1: 'A): 'R + fun bind['T, 'AX, 'R](args0: 'T, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ } declare trait NewableFunction { - fun apply[T, A](args0: T, args1: A): unit /* warning: the overload of function apply is not supported yet. */ - fun call[T, A](args0: T, args1: A): unit - fun bind[AX, R](args0: anything, args1: (AX) | (MutArray[AX])): (args: (AX) | (MutArray[AX])) => R /* warning: the overload of function bind is not supported yet. */ + fun apply['T, 'A](args0: 'T, args1: 'A): unit /* warning: the overload of function apply is not supported yet. */ + fun call['T, 'A](args0: 'T, args1: 'A): unit + fun bind['AX, 'R](args0: anything, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ } declare trait IArguments { val __index: unsupported["[index: number]: any;", "ES5.d.ts", 373, 22] @@ -115,7 +115,7 @@ declare trait StringConstructor: (args0: (anything) | (undefined)) => Str { declare class Bool { fun valueOf(): (false) | (true) } -declare trait BooleanConstructor { +declare trait BooleanConstructor: forall 'T; (args0: ('T) | (undefined)) => (false) | (true) { val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 520, 30] val prototype: Bool } @@ -240,7 +240,7 @@ declare trait RegExp { fun test(args0: Str): (false) | (true) val multiline: (false) | (true) val source: Str - fun compile(args0: Str, args1: (Str) | (undefined)): RegExp + fun compile(args0: Str, args1: (Str) | (undefined)): 'RegExp val global: (false) | (true) val lastIndex: Num val ignoreCase: (false) | (true) @@ -294,78 +294,78 @@ declare trait JSON { fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ } -declare trait ReadonlyArray[T] { - fun lastIndexOf(args0: T, args1: (Num) | (undefined)): Num - fun every(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun forEach(args0: (value: T, index: Num, array: ReadonlyArray[T]) => unit, args1: (anything) | (undefined)): unit - fun filter(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ +declare trait ReadonlyArray['T] { + fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num + fun every(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun forEach(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => unit, args1: (anything) | (undefined)): unit + fun filter(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1272, 136] - fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ + fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ fun join(args0: (Str) | (undefined)): Str - fun map[U](args0: (value: T, index: Num, array: ReadonlyArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] - fun concat(args0: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun map['U](args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] + fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ fun toLocaleString(): Str - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] - fun reduce[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: ReadonlyArray[T]) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] + fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(args0: (value: T, index: Num, array: ReadonlyArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: T, args1: (Num) | (undefined)): Num + fun some(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num } -declare trait ConcatArray[T] { +declare trait ConcatArray['T] { val length: Num val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1278, 28] fun join(args0: (Str) | (undefined)): Str - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] -} -declare trait Array[T] { - fun lastIndexOf(args0: T, args1: (Num) | (undefined)): Num - fun every(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun push(args0: (T) | (MutArray[T])): Num - fun forEach(args0: (value: T, index: Num, array: MutArray[T]) => unit, args1: (anything) | (undefined)): unit - fun reduceRight[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun unshift(args0: (T) | (MutArray[T])): Num - fun sort(args0: ((a: T, b: T) => Num) | (undefined)): Array + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] +} +declare trait Array['T] { + fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num + fun every(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + fun push(args0: ('T) | (MutArray['T])): Num + fun forEach(args0: (value: 'T, index: Num, array: MutArray['T]) => unit, args1: (anything) | (undefined)): unit + fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun unshift(args0: ('T) | (MutArray['T])): Num + fun sort(args0: ((a: 'T, b: 'T) => Num) | (undefined)): 'Array fun join(args0: (Str) | (undefined)): Str - fun map[U](args0: (value: T, index: Num, array: MutArray[T]) => U, args1: (anything) | (undefined)): MutArray[U] - fun pop(): T - fun shift(): T - fun concat(args0: ((T) | (ConcatArray[T])) | (MutArray[(T) | (ConcatArray[T])])): MutArray[T] /* warning: the overload of function concat is not supported yet. */ + fun map['U](args0: (value: 'T, index: Num, array: MutArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] + fun pop(): 'T + fun shift(): 'T + fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ fun toLocaleString(): Str - fun reverse(): MutArray[T] - fun filter(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): MutArray[T] /* warning: the overload of function filter is not supported yet. */ + fun reverse(): MutArray['T] + fun filter(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1463, 127] - fun splice(args0: Num, args1: Num, args2: (T) | (MutArray[T])): MutArray[T] /* warning: the overload of function splice is not supported yet. */ - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray[T] - fun reduce[U](args0: (previousValue: U, currentValue: T, currentIndex: Num, array: MutArray[T]) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun splice(args0: Num, args1: Num, args2: ('T) | (MutArray['T])): MutArray['T] /* warning: the overload of function splice is not supported yet. */ + fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] + fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num - fun some(args0: (value: T, index: Num, array: MutArray[T]) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: T, args1: (Num) | (undefined)): Num + fun some(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) + fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num } -declare trait ArrayConstructor { +declare trait ArrayConstructor: forall 'T; (args0: ('T) | (MutArray['T])) => MutArray['T] { val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1470, 38] fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } -declare trait TypedPropertyDescriptor[T] { +declare trait TypedPropertyDescriptor['T] { val configurable: ((false) | (true)) | (undefined) - val set: ((value: T) => unit) | (undefined) + val set: ((value: 'T) => unit) | (undefined) val enumerable: ((false) | (true)) | (undefined) - val get: (() => T) | (undefined) + val get: (() => 'T) | (undefined) val writable: ((false) | (true)) | (undefined) - val value: (T) | (undefined) + val value: ('T) | (undefined) } -type PromiseConstructorLike = unsupported["declare type PromiseConstructorLike = new (executor: (resolve: (value: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike;", "ES5.d.ts", 1488, 1] -declare trait PromiseLike[T] { - fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): PromiseLike[(TResult1) | (TResult2)] +type PromiseConstructorLike = forall 'T; (executor: (resolve: (value: ('T) | (PromiseLike['T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike['T] +declare trait PromiseLike['T] { + fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): PromiseLike[('TResult1) | ('TResult2)] } -declare trait Promise[T] { - fun id"then"[TResult1, TResult2](args0: ((value: T) => (TResult1) | (PromiseLike[TResult1])) | (undefined), args1: ((reason: anything) => (TResult2) | (PromiseLike[TResult2])) | (undefined)): Promise[(TResult1) | (TResult2)] - fun catch[TResult](args0: ((reason: anything) => (TResult) | (PromiseLike[TResult])) | (undefined)): Promise[(T) | (TResult)] +declare trait Promise['T] { + fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): Promise[('TResult1) | ('TResult2)] + fun catch['TResult](args0: ((reason: anything) => ('TResult) | (PromiseLike['TResult])) | (undefined)): Promise[('T) | ('TResult)] } type Awaited = unsupported["type Awaited = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T;", "ES5.d.ts", 1520, 1] -declare trait ArrayLike[T] { +declare trait ArrayLike['T] { val length: Num val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1534, 28] } @@ -377,7 +377,7 @@ type Record = unsupported["type Record = { [P in K]: type Exclude = unsupported["type Exclude = T extends U ? never : T;", "ES5.d.ts", 1571, 2] type Extract = unsupported["type Extract = T extends U ? T : never;", "ES5.d.ts", 1576, 45] type Omit = unsupported["type Omit = Pick>;", "ES5.d.ts", 1581, 45] -type NonNullable[T] = (T) & ({}) +type NonNullable['T] = ('T) & ({}) type Parameters = unsupported["type Parameters any> = T extends (...args: infer P) => any ? P : never;", "ES5.d.ts", 1591, 29] type ConstructorParameters = unsupported["type ConstructorParameters any> = T extends abstract new (...args: infer P) => any ? P : never;", "ES5.d.ts", 1596, 99] type ReturnType = unsupported["type ReturnType any> = T extends (...args: any) => infer R ? R : any;", "ES5.d.ts", 1601, 136] @@ -386,7 +386,7 @@ type Uppercase = unsupported["type Uppercase = intrinsic;", "E type Lowercase = unsupported["type Lowercase = intrinsic;", "ES5.d.ts", 1616, 45] type Capitalize = unsupported["type Capitalize = intrinsic;", "ES5.d.ts", 1621, 45] type Uncapitalize = unsupported["type Uncapitalize = intrinsic;", "ES5.d.ts", 1626, 46] -declare trait ThisType[T] {} +declare trait ThisType['T] {} declare trait ArrayBuffer { val byteLength: Num fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer @@ -437,11 +437,11 @@ declare trait Int8Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2065, 25] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int8Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int8Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int8Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array fun find(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array fun join(args0: (Str) | (undefined)): Str @@ -453,7 +453,7 @@ declare trait Int8Array { fun filter(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): Int8Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int8Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -462,7 +462,7 @@ declare trait Int8Array { } declare trait Int8ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ES5.d.ts", 2072, 63] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array fun id"of"(args0: (Num) | (MutArray[Num])): Int8Array val BYTES_PER_ELEMENT: Num @@ -474,11 +474,11 @@ declare trait Uint8Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2347, 26] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array fun find(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array fun join(args0: (Str) | (undefined)): Str @@ -490,7 +490,7 @@ declare trait Uint8Array { fun filter(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): Uint8Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -499,7 +499,7 @@ declare trait Uint8Array { } declare trait Uint8ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ES5.d.ts", 2355, 64] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint8Array val BYTES_PER_ELEMENT: Num @@ -511,11 +511,11 @@ declare trait Uint8ClampedArray { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2629, 33] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8ClampedArray - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint8ClampedArray + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8ClampedArray val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint8ClampedArray + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray fun find(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray fun join(args0: (Str) | (undefined)): Str @@ -527,7 +527,7 @@ declare trait Uint8ClampedArray { fun filter(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): Uint8ClampedArray fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -536,7 +536,7 @@ declare trait Uint8ClampedArray { } declare trait Uint8ClampedArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ES5.d.ts", 2637, 71] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray fun id"of"(args0: (Num) | (MutArray[Num])): Uint8ClampedArray val BYTES_PER_ELEMENT: Num @@ -548,11 +548,11 @@ declare trait Int16Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2909, 26] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int16Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int16Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int16Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array fun find(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array fun join(args0: (Str) | (undefined)): Str @@ -564,7 +564,7 @@ declare trait Int16Array { fun filter(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): Int16Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int16Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -573,7 +573,7 @@ declare trait Int16Array { } declare trait Int16ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ES5.d.ts", 2917, 64] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array fun id"of"(args0: (Num) | (MutArray[Num])): Int16Array val BYTES_PER_ELEMENT: Num @@ -585,11 +585,11 @@ declare trait Uint16Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3192, 27] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint16Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint16Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint16Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array fun find(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array fun join(args0: (Str) | (undefined)): Str @@ -601,7 +601,7 @@ declare trait Uint16Array { fun filter(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): Uint16Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint16Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -610,7 +610,7 @@ declare trait Uint16Array { } declare trait Uint16ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ES5.d.ts", 3200, 65] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint16Array val BYTES_PER_ELEMENT: Num @@ -622,11 +622,11 @@ declare trait Int32Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3475, 26] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Int32Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Int32Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array fun find(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array fun join(args0: (Str) | (undefined)): Str @@ -638,7 +638,7 @@ declare trait Int32Array { fun filter(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): Int32Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Int32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -647,7 +647,7 @@ declare trait Int32Array { } declare trait Int32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ES5.d.ts", 3483, 64] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array fun id"of"(args0: (Num) | (MutArray[Num])): Int32Array val BYTES_PER_ELEMENT: Num @@ -659,11 +659,11 @@ declare trait Uint32Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3756, 27] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Uint32Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Uint32Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array fun find(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array fun join(args0: (Str) | (undefined)): Str @@ -675,7 +675,7 @@ declare trait Uint32Array { fun filter(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): Uint32Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Uint32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -684,7 +684,7 @@ declare trait Uint32Array { } declare trait Uint32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ES5.d.ts", 3764, 65] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array fun id"of"(args0: (Num) | (MutArray[Num])): Uint32Array val BYTES_PER_ELEMENT: Num @@ -696,11 +696,11 @@ declare trait Float32Array { fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4038, 28] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float32Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float32Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array fun find(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array fun join(args0: (Str) | (undefined)): Str @@ -712,7 +712,7 @@ declare trait Float32Array { fun filter(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): Float32Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float32Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -721,7 +721,7 @@ declare trait Float32Array { } declare trait Float32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ES5.d.ts", 4046, 66] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array fun id"of"(args0: (Num) | (MutArray[Num])): Float32Array val BYTES_PER_ELEMENT: Num @@ -732,11 +732,11 @@ declare trait Float64Array { fun every(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4312, 28] - fun reduceRight[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, args1: U): U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float64Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): Float64Array + fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array + fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float64Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Float64Array + fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array fun find(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array fun join(args0: (Str) | (undefined)): Str @@ -748,7 +748,7 @@ declare trait Float64Array { fun filter(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): Float64Array fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array val byteLength: Num - fun reduce[U](args0: (previousValue: U, currentValue: Num, currentIndex: Num, array: Float64Array) => U, args1: U): U /* warning: the overload of function reduce is not supported yet. */ + fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ fun toString(): Str val length: Num fun some(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) @@ -757,7 +757,7 @@ declare trait Float64Array { } declare trait Float64ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ES5.d.ts", 4320, 66] - fun from[T](args0: ArrayLike[T], args1: (v: T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array fun id"of"(args0: (Num) | (MutArray[Num])): Float64Array val BYTES_PER_ELEMENT: Num diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index a58c57703..7e5d4b044 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -5,8 +5,8 @@ export declare module InterfaceMember { fun c(): (false) | (true) fun d(x: Str): unit } - declare trait II[T] { - fun test(x: T): Num + declare trait II['T] { + fun test(x: 'T): Num } fun create(): {v: Num,} fun get(x: {t: Str,}): Str @@ -25,11 +25,11 @@ export declare module InterfaceMember { val a: Num fun b(x: (false) | (true)): Str } - declare trait Simple2[T] { - val abc: T + declare trait Simple2['T] { + val abc: 'T } declare trait Next {} - declare trait TTT[T] { - fun ttt(x: T): T + declare trait TTT['T] { + fun ttt(x: 'T): 'T } } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 43596563a..9324b0474 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,6 +1,6 @@ export declare module Intersection { - fun extend[T, U](first: T, second: U): (T) & (U) - fun foo[T, U](x: (T) & (U)): unit + fun extend['T, 'U](first: 'T, second: 'U): ('T) & ('U) + fun foo['T, 'U](x: ('T) & ('U)): unit fun over(f: ((x: Num) => Str) & ((x: Object) => Str)): Str declare trait IA { val x: Num @@ -9,10 +9,10 @@ export declare module Intersection { val y: Num } fun iii(x: (IA) & (IB)): (IA) & (IB) - fun uu[U, V, T, P](x: ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P))): ((((U) & (T)) | ((U) & (P))) | ((V) & (T))) | ((V) & (P)) - fun iiii[U, T, V](x: ((U) & (T)) & (V)): ((U) & (T)) & (V) - fun arr[U, T](a: (MutArray[U]) & (MutArray[T])): (MutArray[U]) & (MutArray[T]) - fun tt[U, T, V](x: ((U, T, )) & ((V, V, ))): ((U, T, )) & ((V, V, )) + fun uu['U, 'V, 'T, 'P](x: (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P))): (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P)) + fun iiii['U, 'T, 'V](x: (('U) & ('T)) & ('V)): (('U) & ('T)) & ('V) + fun arr['U, 'T](a: (MutArray['U]) & (MutArray['T])): (MutArray['U]) & (MutArray['T]) + fun tt['U, 'T, 'V](x: (('U, 'T, )) & (('V, 'V, ))): (('U, 'T, )) & (('V, 'V, )) declare class A {} declare class B {} fun inter(c: (A) & (B)): (A) & (B) diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index ce190e93c..2e1212726 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -14,9 +14,9 @@ export declare module Optional { fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit fun err(msg: ((Num, Str, )) | (undefined)): unit fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str - fun boo[T, U](x: ((T) & (U)) | (undefined)): unit - declare class B[T] { - val b: T + fun boo['T, 'U](x: (('T) & ('U)) | (undefined)): unit + declare class B['T] { + val b: 'T } fun boom(b: (B[nothing]) | (undefined)): anything } diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 8bde45d3b..9cd60050e 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -13,12 +13,12 @@ export declare module Overload { fun op(x: anything, y: anything): unit /* warning: the overload of function op is not supported yet. */ fun swap(x: anything): MutArray[anything] /* warning: the overload of function swap is not supported yet. */ fun u(x: anything): Str /* warning: the overload of function u is not supported yet. */ - fun doSome[T, U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ + fun doSome['T, 'U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ declare module XX { - export fun f[T](x: T, n: anything): Str /* warning: the overload of function f is not supported yet. */ + export fun f['T](x: 'T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { - fun F[T](args0: T): T /* warning: the overload of function F is not supported yet. */ + fun F['T](args0: 'T): 'T /* warning: the overload of function F is not supported yet. */ } fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } diff --git a/ts2mls/js/src/test/diff/TSArray.mlsi b/ts2mls/js/src/test/diff/TSArray.mlsi index 2cfcc0131..6f0a6ae3d 100644 --- a/ts2mls/js/src/test/diff/TSArray.mlsi +++ b/ts2mls/js/src/test/diff/TSArray.mlsi @@ -9,13 +9,13 @@ export declare module TSArray { } fun doCs(c: MutArray[C]): MutArray[C] fun doIs(i: MutArray[I]): MutArray[I] - fun inter[U, T](x: MutArray[(U) & (T)]): MutArray[(U) & (T)] + fun inter['U, 'T](x: MutArray[('U) & ('T)]): MutArray[('U) & ('T)] fun clean(x: MutArray[(Str, Num, )]): MutArray[(Str, Num, )] - fun translate[T, U](x: MutArray[T]): MutArray[U] + fun translate['T, 'U](x: MutArray['T]): MutArray['U] fun uu(x: MutArray[((Num) | (false)) | (true)]): MutArray[((Num) | (false)) | (true)] - declare class Temp[T] { - val x: T + declare class Temp['T] { + val x: 'T } fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] - fun tat[T](ts: MutArray[Temp[T]]): MutArray[Temp[T]] + fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] } diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index fba29602f..d6684ce7f 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -7,8 +7,8 @@ export declare module Tuple { fun tupleIt(x: Str): (() => Str, ) fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) - fun ex[T, U](x: T, y: U): (T, U, (T) & (U), ) - fun foo[T, U](x: ((T) & (U), )): unit + fun ex['T, 'U](x: 'T, y: 'U): ('T, 'U, ('T) & ('U), ) + fun foo['T, 'U](x: (('T) & ('U), )): unit fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) declare class A { val x: Num diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 3094ef5f1..f47db1055 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -2,11 +2,11 @@ export declare module Type { declare trait None { val _tag: "None" } - declare trait Some[A] { + declare trait Some['A] { val _tag: "Some" - val value: A + val value: 'A } - type Option[A] = (None) | (Some[A]) + type Option['A] = (None) | (Some['A]) type Func = (x: Num) => Num type S2 = (Str, Str, ) declare trait I1 {} @@ -16,7 +16,7 @@ export declare module Type { type SomeInterface = {x: Num,y: Num,} declare class ABC {} type DEF = ABC - type TP[A, B, C] = (A, B, C, ) + type TP['A, 'B, 'C] = ('A, 'B, 'C, ) declare module NA { fun fb(b: Str): unit export type B = Str @@ -26,5 +26,5 @@ export declare module Type { } type G = ABC val none: {_tag: "None",} - fun some[A](a: A): (None) | (Some[A]) + fun some['A](a: 'A): (None) | (Some['A]) } diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 9d7c7ea9e..b1de4572e 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,27 +1,29 @@ export declare module TypeParameter { - fun inc[T](x: T): Num - declare class CC[T] { - fun print(args0: T): unit + fun inc['T](x: 'T): Num + declare class CC['T] { + fun print(args0: 'T): unit } - fun con[U, T](t: T): U - declare class Printer[T] { - fun print(args0: T): unit + fun con['U, 'T](t: 'T): 'U + declare class Printer['T] { + fun print(args0: 'T): unit } fun setStringPrinter(p: Printer[Str]): unit fun getStringPrinter(): Printer[Str] - fun foo[T](p: Printer[T], x: T): T - fun foo2[T](p: Printer[T], x: T): T - declare class F[T] { - val x: T - fun GG[U](args0: U): T + fun foo['T](p: Printer['T], x: 'T): 'T + fun foo2['T](p: Printer['T], x: 'T): 'T + declare class F['T] { + val x: 'T + fun GG['U](args0: 'U): 'T } - declare trait I[T] { - val x: T - fun GG[U](args0: U): T + declare trait I['T] { + val x: 'T + fun GG['U](args0: 'U): 'T } - declare class FFF[T] { - fun fff(args0: T): unit + declare class FFF['T] { + fun fff(args0: 'T): unit } fun fff(p: FFF[Str], s: Str): unit fun getFFF(): FFF[Num] + type PolyToString = forall 'T; (x: 'T) => Str + type PolyID = forall 'T; (x: 'T) => 'T } diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index a533249e5..b87a51680 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -4,6 +4,6 @@ export declare module Union { fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything fun get(arr: (MutArray[Num]) | (MutArray[Str])): unit fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str - fun typeVar[T, U](x: (T) | (U)): (T) | (U) + fun typeVar['T, 'U](x: ('T) | ('U)): ('T) | ('U) fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) } diff --git a/ts2mls/js/src/test/typescript/TypeParameter.ts b/ts2mls/js/src/test/typescript/TypeParameter.ts index 7b7d915c4..4b26bae3a 100644 --- a/ts2mls/js/src/test/typescript/TypeParameter.ts +++ b/ts2mls/js/src/test/typescript/TypeParameter.ts @@ -56,3 +56,6 @@ function fff(p: FFF, s: string) { function getFFF(): FFF { return new FFF(); } + +type PolyToString = (x: T) => string +type PolyID = (x: T) => T From 699082cd3beb8823d1554d822bc600507c28d20a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 13:33:20 +0800 Subject: [PATCH 141/202] WIP: Refactor converter --- .../main/scala/ts2mls/types/Converter.scala | 71 +++++++++++-------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index aeff2fa23..09dfbfbdd 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -62,16 +62,11 @@ object Converter { case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members - case TSInterfaceType(name, members, typeVars, parents, callSignature) => - callSignature match { - case Some(cs) => - val prefix = if (exported) s"${indent}export declare " else s"${indent}declare " - val tp = if (typeVars.isEmpty) "" else s"[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]" - s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)} ${convertRecord("", members, Nil, Nil, Map(), List(), false)(indent)}" - case _ => convertRecord(s"trait ${escapeIdent(name)}", members, typeVars, parents, Map(), List(), exported)(indent) - } - case TSClassType(name, members, statics, typeVars, parents, cons) => - convertRecord(s"class ${escapeIdent(name)}", members, typeVars, parents, statics, cons, exported)(indent) + case itf: TSInterfaceType => + if (itf.name.isEmpty()) convertRecord(itf.members, Nil, Nil, Map(), Nil, true) // anonymous interfaces + else convertClassOrInterface(Right(itf), exported) + case cls: TSClassType => + convertClassOrInterface(Left(cls), exported) case TSSubstitutionType(TSReferenceType(base), applied) => s"${base}[${applied.map((app) => convert(app)).reduceLeft((res, s) => s"$res, $s")}]" case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${escapeIdent(name)}: ${convert(tp)}" @@ -86,11 +81,40 @@ object Converter { case tp => throw new AssertionError(s"unexpected type $tp.") } - private def convertRecord(typeName: String, members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], - parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType], exported: Boolean)(implicit indent: String) = { + private def convertClassOrInterface(tp: Either[TSClassType, TSInterfaceType], exported: Boolean)(implicit indent: String) = { + val exp = if (exported) "export " else "" + def combineWithTypeVars(body: String, parents: List[TSType], typeName: String, typeVars: List[TSTypeParameter]) = { + val inheritance = + if (parents.isEmpty) "" + else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) + if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" + else + s"${indent}${exp}declare $typeName[${typeVars.map(convert(_)).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints + } + tp match { + case Left(TSClassType(name, members, statics, typeVars, parents, cons)) => + val body = convertRecord(members, typeVars, parents, statics, cons, false) + val typeName = s"class ${escapeIdent(name)}" + combineWithTypeVars(body, parents, typeName, typeVars) + case Right(TSInterfaceType(name, members, typeVars, parents, callSignature)) => + callSignature match { + case Some(cs) => + val prefix = s"${indent}${exp}declare " + val tp = if (typeVars.isEmpty) "" else s"[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]" + s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)} ${convertRecord(members, Nil, Nil, Map(), List(), false)}" + case _ => + val body = convertRecord(members, typeVars, parents, Map(), List(), false) + val typeName = s"trait ${escapeIdent(name)}" + combineWithTypeVars(body, parents, typeName, typeVars) + } + } + } + + private def convertRecord(members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], parents: List[TSType], + statics: Map[String, TSMemberType], constructorList: List[TSType], anonymous: Boolean)(implicit indent: String) = { val allRecs = members.toList.map((m) => m._2.modifier match { case Public => - if (typeName === "trait ") s"${escapeIdent(m._1)}: ${convert(m._2)}," + if (anonymous) s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" @@ -111,22 +135,9 @@ object Converter { else s"${indent} constructor(${constructorList.map(p => s"${convert(p)("")}").reduceLeft((res, p) => s"$res, $p")})\n" - val body = { // members without independent type parameters, translate them directly - val lst = (ctor :: allRecs).filter((s) => !s.isEmpty()) - if (lst.isEmpty) s"{}" - else if (typeName === "trait ") s"{${lst.reduceLeft((bd, m) => s"$bd$m")}}" - else s"{\n${lst.reduceLeft((bd, m) => s"$bd$m")}$indent}" - } - - if (typeName.isEmpty() || typeName === "trait ") body // anonymous interfaces - else { // named interfaces and classes - val exp = if (exported) "export " else "" - val inheritance = - if (parents.isEmpty) "" - else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) - if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" - else - s"${indent}${exp}declare $typeName[${typeVars.map(convert(_)).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints - } + val lst = (ctor :: allRecs).filter((s) => !s.isEmpty()) + if (lst.isEmpty) s"{}" + else if (anonymous) s"{${lst.reduceLeft((bd, m) => s"$bd$m")}}" + else s"{\n${lst.reduceLeft((bd, m) => s"$bd$m")}$indent}" } } From 3f010f517e7374d37a3ed341176edb71c30b72bd Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 13:46:53 +0800 Subject: [PATCH 142/202] WIP: Fix interface parents --- .../src/main/scala/ts2mls/TSNamespace.scala | 3 ++- .../src/main/scala/ts2mls/TSSourceFile.scala | 4 ++-- ts2mls/js/src/test/diff/ES5.mlsi | 22 +++++++++---------- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 5e13e6e3e..0bb87eac5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -35,6 +35,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: order += Right(name) members.put(name, (tp, exported)) } + else if (overrided) members.update(name, (tp, exported)) else (members(name), tp) match { case ((cls: TSClassType, exp), itf: TSInterfaceType) => members.update(name, (TSClassType( @@ -46,7 +47,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: name, itf1.members ++ itf2.members, itf1.typeVars, itf1.parents, itf1.callSignature.fold(itf2.callSignature)(cs => Some(cs)) ), exported || exp)) - case _ => if (overrided) members.update(name, (tp, exported)) + case _ => () } def `export`(name: String): Unit = diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 9534285b9..5db9834f5 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -401,10 +401,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici case _ => throw new AssertionError(s"$name is not a class") } else if (node.isInterfaceDeclaration) ns.get(name) match { - case TSInterfaceType(_, members, typeVars, parents, cs) => + case TSInterfaceType(_, members, typeVars, _, cs) => val list = getHeritageList(node, members.keySet) if (!list.isEmpty) { - val itf = TSInterfaceType(name, members, typeVars, getHeritageList(node, members.keySet), cs) + val itf = TSInterfaceType(name, members, typeVars, list, cs) ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) } case t if (t.unsupported) => () // ignore types that have been marked as unsupported. diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 9d832a53f..d565d9498 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -68,12 +68,12 @@ declare trait FunctionConstructor: (args0: (Str) | (MutArray[Str])) => Function } type ThisParameterType = unsupported["type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;", "ES5.d.ts", 301, 42] type OmitThisParameter = unsupported["type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;", "ES5.d.ts", 306, 91] -declare trait CallableFunction { +declare trait CallableFunction extends Function { fun apply['T, 'A, 'R](args0: 'T, args1: 'A): 'R /* warning: the overload of function apply is not supported yet. */ fun call['T, 'A, 'R](args0: 'T, args1: 'A): 'R fun bind['T, 'AX, 'R](args0: 'T, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ } -declare trait NewableFunction { +declare trait NewableFunction extends Function { fun apply['T, 'A](args0: 'T, args1: 'A): unit /* warning: the overload of function apply is not supported yet. */ fun call['T, 'A](args0: 'T, args1: 'A): unit fun bind['AX, 'R](args0: anything, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ @@ -136,7 +136,7 @@ declare trait NumberConstructor: (args0: (anything) | (undefined)) => Num { val MAX_VALUE: Num val prototype: Number } -declare trait TemplateStringsArray { +declare trait TemplateStringsArray extends ReadonlyArray[Str] { val raw: ReadonlyArray[Str] } declare trait ImportMeta {} @@ -226,12 +226,12 @@ declare trait DateConstructor: () => Str { fun parse(args0: Str): Num val prototype: Date } -declare trait RegExpMatchArray { +declare trait RegExpMatchArray extends Array[Str] { val index: (Num) | (undefined) val input: (Str) | (undefined) val id"0": Str } -declare trait RegExpExecArray { +declare trait RegExpExecArray extends Array[Str] { val index: Num val input: Str val id"0": Str @@ -278,17 +278,17 @@ declare trait ErrorConstructor: (args0: (Str) | (undefined)) => Error { val __new: unsupported["new(message?: string): Error;", "ES5.d.ts", 1042, 28] val prototype: Error } -declare trait EvalError {} +declare trait EvalError extends Error {} val EvalErrorConstructor: unsupported["interface EvalErrorConstructor extends ErrorConstructor { new(message?: string): EvalError; (message?: string): EvalError; readonly prototype: EvalError; }", "ES5.d.ts", 1051, 1] -declare trait RangeError {} +declare trait RangeError extends Error {} val RangeErrorConstructor: unsupported["interface RangeErrorConstructor extends ErrorConstructor { new(message?: string): RangeError; (message?: string): RangeError; readonly prototype: RangeError; }", "ES5.d.ts", 1062, 1] -declare trait ReferenceError {} +declare trait ReferenceError extends Error {} val ReferenceErrorConstructor: unsupported["interface ReferenceErrorConstructor extends ErrorConstructor { new(message?: string): ReferenceError; (message?: string): ReferenceError; readonly prototype: ReferenceError; }", "ES5.d.ts", 1073, 1] -declare trait SyntaxError {} +declare trait SyntaxError extends Error {} val SyntaxErrorConstructor: unsupported["interface SyntaxErrorConstructor extends ErrorConstructor { new(message?: string): SyntaxError; (message?: string): SyntaxError; readonly prototype: SyntaxError; }", "ES5.d.ts", 1084, 1] -declare trait TypeError {} +declare trait TypeError extends Error {} val TypeErrorConstructor: unsupported["interface TypeErrorConstructor extends ErrorConstructor { new(message?: string): TypeError; (message?: string): TypeError; readonly prototype: TypeError; }", "ES5.d.ts", 1095, 1] -declare trait URIError {} +declare trait URIError extends Error {} val URIErrorConstructor: unsupported["interface URIErrorConstructor extends ErrorConstructor { new(message?: string): URIError; (message?: string): URIError; readonly prototype: URIError; }", "ES5.d.ts", 1106, 1] declare trait JSON { fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 7e5d4b044..9b004131b 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -28,7 +28,7 @@ export declare module InterfaceMember { declare trait Simple2['T] { val abc: 'T } - declare trait Next {} + declare trait Next extends Simple {} declare trait TTT['T] { fun ttt(x: 'T): 'T } From dd9a47b6444d6621f36609729b42f4b0ad34a045 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 17:36:22 +0800 Subject: [PATCH 143/202] WIP: Fix several problems --- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 3 + .../js/src/main/scala/ts2mls/TSModules.scala | 5 +- .../src/main/scala/ts2mls/TSNamespace.scala | 8 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 9 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 88 +++++++++++-------- .../src/main/scala/ts2mls/types/TSType.scala | 12 ++- .../scala/ts2mls/TSTypeGenerationTests.scala | 3 - 8 files changed, 72 insertions(+), 58 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 483601837..4136ec1fc 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -34,7 +34,7 @@ class DriverDiffTests extends AnyFunSuite { object DriverDiffTests { // For local environment, we may change the driver so forcing compiling is necessary // but we can ban it during CI - private val forceCompiling = sys.env.get("CI").isEmpty + private val forceCompiling = true private val diffPath = "driver/js/src/test/" private val outputPath = s"${diffPath}output/" diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index ad70def37..66b599df0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -248,6 +248,9 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val idExpression = TSIdentifierObject(node.expression) lazy val isVarParam = !IsUndefined(node.dotDotDotToken) lazy val hasmoduleReference = !IsUndefined(node.moduleReference) + lazy val moduleAugmentation = + if (IsUndefined(node.moduleAugmentations)) TSTokenObject(g.undefined) + else TSTokenObject(node.moduleAugmentations.selectDynamic("0")) } object TSNodeObject { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 6900668ee..69ffb70d1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -83,10 +83,13 @@ class TSImportList { val fullAlias = if (fullList.contains(modulePath)) fullList(modulePath).resolveTypeAlias(name) else None - fullAlias.getOrElse(name) // cjs modules have no prefix + fullAlias.getOrElse(throw new Exception(s"$name is not found at $modulePath")) } } + def contains(modulePath: String): Boolean = + singleList.contains(modulePath) || fullList.contains(modulePath) + def getFilelist: List[TSImport] = (singleList.values.toList ::: fullList.values.toList) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 0bb87eac5..af92a50d3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -126,7 +126,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: private def merge(name: String, writer: JSWriter, indent: String): Unit = { (members(name), subSpace(name)._1) match { - case ((TSReferenceType(realType), exp), ns) => ns.get(realType) match { + case ((ref: TSReferenceType, exp), ns) => get(ref.nameList) match { case TSInterfaceType(itf, members, _, _, _) => ns.subSpace.mapValuesInPlace { case (_, (ns, _)) => (ns, false) @@ -138,9 +138,11 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: case (name, TSMemberType(tp, _)) => ns.put(name, tp, true, true) } - case _ => () // if merging is not supported, do nothing + case _ => + writer.writeln(s"$indent// WARNING: duplicate $name") // if merging is not supported, do nothing } - case _ => () // if merging is not supported, do nothing + case _ => + writer.writeln(s"$indent// WARNING: duplicate $name") // if merging is not supported, do nothing } generateNS(name, writer, indent) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 5cb66631e..05ed17d69 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -24,10 +24,10 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str def generate: Boolean = generate(file, None)(Nil) - private def generate(file: FileInfo, ns: Option[TSNamespace])(implicit stack: List[String]): Boolean = { + private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Boolean = { val filename = file.resolve val moduleName = file.moduleName - val globalNamespace = ns.getOrElse(TSNamespace(!uesTopLevelModule)) + val globalNamespace = ambientNS.getOrElse(TSNamespace(!uesTopLevelModule)) val sfObj = program.getSourceFileByPath(filename) val sourceFile = if (IsUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") @@ -59,7 +59,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } }) cycleList.foreach(imp => { - if (ns.isEmpty || stack.indexOf(filename) > 0) { + if (ambientNS.isEmpty || stack.indexOf(filename) > 0) { writer.writeln(s"declare module ${Converter.escapeIdent(imp.moduleName)} {") cache(imp.resolve).generate(writer, " ") writer.writeln("}") @@ -84,8 +84,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str generate(file.`import`(s.toString()), sourceFile.getUMDModule)(filename :: stack) }) - sourceFile.postProcess - if (ns.isEmpty) { + if (ambientNS.isEmpty) { generate(writer, globalNamespace, moduleName, globalNamespace.isCommonJS) writer.close() } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 5db9834f5..c401065e9 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -5,7 +5,6 @@ import js.DynamicImplicits._ import types._ import mlscript.utils._ import scala.collection.mutable.{ListBuffer, HashMap} -import ts2mls.TSPathResolver class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) @@ -16,7 +15,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici val referencedFiles = sf.referencedFiles.map((x: js.Dynamic) => x.fileName.toString()) def getUMDModule: Option[TSNamespace] = - umdModuleName.fold[Option[TSNamespace] ](Some(global))(name => Some(global.derive(name, false))) + umdModuleName.fold[Option[TSNamespace]](Some(global))(name => Some(global.derive(name, false))) // parse import TypeScript.forEachChild(sf, (node: js.Dynamic) => { @@ -44,30 +43,28 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } }) + // handle parents + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) + handleParents(nodeObject, nodeObject.symbol.escapedName)(global) + }) + // check export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isExportDeclaration) { if (!nodeObject.moduleSpecifier.isUndefined) // re-export parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) - else + else // ES modules parseExportDeclaration(nodeObject.exportClause.elements) } - else if (nodeObject.isExportAssignment) { - val name = nodeObject.idExpression.escapedText - global.renameExport(name, topName) - } - else if (nodeObject.exportedAsNamespace) + else if (nodeObject.isExportAssignment) // commonJS + global.renameExport(nodeObject.idExpression.escapedText, topName) + else if (nodeObject.exportedAsNamespace) // UMD umdModuleName = Some(nodeObject.symbol.escapedName) }) - def postProcess: Unit = // handle parents - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) - handleParents(nodeObject, nodeObject.symbol.escapedName)(global) - }) - def getImportList: List[TSImport] = importList.getFilelist def getReExportList: List[TSReExport] = reExportList.toList @@ -134,32 +131,47 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici case tp: TSTypeObject => lst :+ getObjectType(tp) }) - private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = + private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = { + def simplify(symName: String, nsName: String): String = + if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) + else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) + else symName if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) - else if (!sym.parent.isUndefined && sym.parent.isMerged && sym.parent.escapedName === "_") { + else if (!sym.parent.isUndefined && sym.parent.isMerged) { def findDecFile(node: TSNodeObject): String = if (node.parent.isUndefined) "" - else if (node.parent.isSourceFile) node.parent.resolvedPath + else if (node.parent.isSourceFile) { + if (node.parent.moduleAugmentation.isUndefined) + node.parent.resolvedPath + else { + val base = node.parent.resolvedPath + val rel = node.parent.moduleAugmentation.text + if (TSPathResolver.isLocal(rel)) TypeScript.resolveModuleName(rel, base, config) + else base + } + } else findDecFile(node.parent) - val filename = findDecFile(sym.declaration) - if (filename === resolvedPath) sym.escapedName - else importList.resolveTypeAlias(filename, sym.escapedName) + val filename = sym.declarations.foldLeft[Option[String]](None)((filename, dec) => filename match { + case filename: Some[String] => filename + case _ => + val res = findDecFile(dec) + Option.when((res === resolvedPath) || importList.contains(res))(res) + }) + filename.fold(sym.escapedName)(filename => // not found: this file is referenced by `///`. directly use the name is safe + if (filename === resolvedPath) // in the same file + simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) + else importList.resolveTypeAlias(filename, sym.escapedName) // in an imported file + ) } else if (sym.parent.isUndefined) { val name = sym.escapedName if (name.contains("\"")) TSPathResolver.basename(name.substring(1, name.length() - 1)) - else if (name === "_") "" // for UMD else name } - else { - def simplify(symName: String, nsName: String): String = - if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) - else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) - else symName - val p = getSymbolFullname(sym.parent) - simplify(s"${if (p.isEmpty()) "" else s"$p."}${sym.escapedName}", ns.toString()) - } + else + simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) + } private def markUnsupported(node: TSNodeObject): TSUnsupportedType = lineHelper.getPos(node.pos) match { @@ -168,7 +180,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } private def getObjectType(obj: TSTypeObject)(implicit ns: TSNamespace): TSType = - if (obj.isMapped) TSPartialUnsupportedType + if (obj.isMapped) TSNoInfoUnsupported else if (obj.isEnumType) TSEnumType else if (obj.isFunctionLike) getFunctionType(obj.symbol.declaration, true) else if (obj.isTupleType) TSTupleType(getTupleElements(obj.typeArguments)) @@ -177,7 +189,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) else if (obj.isTypeParameterSubstitution) { val baseName = getSymbolFullname(if (obj.symbol.isUndefined) obj.aliasSymbol else obj.symbol) - if (baseName.contains(".")) TSPartialUnsupportedType // A.B is not supported in mlscript + if (baseName.contains(".")) TSNoInfoUnsupported // A.B is not supported in mlscript else TSSubstitutionType(TSReferenceType(baseName), getSubstitutionArguments(obj.typeArguments)) } else if (obj.isObject) @@ -185,11 +197,11 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici val props = getAnonymousPropertiesType(obj.properties) if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) TSInterfaceType("", props, List(), List(), None) - else TSPartialUnsupportedType + else TSNoInfoUnsupported } else TSReferenceType(getSymbolFullname(obj.symbol)) else if (obj.isTypeParameter) TSTypeParameter(obj.symbol.escapedName) - else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) TSPartialUnsupportedType + else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) TSNoInfoUnsupported else TSPrimitiveType(obj.intrinsicName) // the function `getMemberType` can't process function/tuple type alias correctly @@ -264,14 +276,14 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici private def getHeritageList(node: TSNodeObject, members: Set[String])(implicit ns: TSNamespace): List[TSType] = node.heritageClauses.foldLeftIndexed(List[TSType]())((lst, h, index) => { - def run(ref: TSReferenceType) = ns.get(ref.names) match { + def run(ref: TSReferenceType) = ns.get(ref.nameList) match { case itf: TSInterfaceType if (itf.members.foldLeft(itf.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => - TSPartialUnsupportedType + TSNoInfoUnsupported case cls: TSClassType if (cls.members.foldLeft(cls.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => - TSPartialUnsupportedType - case t if (t.unsupported) => TSPartialUnsupportedType + TSNoInfoUnsupported + case t if (t.unsupported) => TSNoInfoUnsupported case t => ref } lst :+ (getObjectType(h.types.get(index).typeNode) match { diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index 6c2ee16d4..b6cafe6ea 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -1,7 +1,5 @@ package ts2mls.types -import ts2mls.TSNamespace - sealed abstract class TSAccessModifier case object Public extends TSAccessModifier case object Private extends TSAccessModifier @@ -12,20 +10,20 @@ sealed abstract class TSType { } // record both parameter's name and parameter's type -case class TSParameterType(name: String, val tp: TSType) extends TSType { +case class TSParameterType(name: String, tp: TSType) extends TSType { override val unsupported: Boolean = tp.unsupported } -case class TSMemberType(val base: TSType, val modifier: TSAccessModifier = Public) extends TSType { +case class TSMemberType(base: TSType, modifier: TSAccessModifier = Public) extends TSType { override val unsupported: Boolean = base.unsupported } -case class TSTypeParameter(val name: String, constraint: Option[TSType] = None) extends TSType { +case class TSTypeParameter(name: String, constraint: Option[TSType] = None) extends TSType { override val unsupported: Boolean = constraint.fold(false)(c => c.unsupported) } case class TSPrimitiveType(typeName: String) extends TSType case class TSReferenceType(name: String) extends TSType { - val names = if (name.contains(".")) name.split("\\.").toList else name :: Nil + val nameList = if (name.contains(".")) name.split("\\.").toList else name :: Nil } case object TSEnumType extends TSType case class TSTupleType(types: List[TSType]) extends TSType { @@ -104,6 +102,6 @@ case class TSLiteralType(value: String, isString: Boolean) extends TSType case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType { override val unsupported: Boolean = true } -object TSPartialUnsupportedType extends TSType { +object TSNoInfoUnsupported extends TSType { // unsupported type without code and location information override val unsupported: Boolean = true } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 42383d5fd..7ae272065 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -1,9 +1,6 @@ package ts2mls import org.scalatest.funsuite.AnyFunSuite -import scala.collection.immutable -import TSPathResolver.basename -import ts2mls.TSPathResolver class TSTypeGenerationTest extends AnyFunSuite { import TSTypeGenerationTest._ From 861251216b20ec4b84953b6d4d7d6ca9949ea1a8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 20:08:25 +0800 Subject: [PATCH 144/202] WIP: Fix re-export names --- shared/src/main/scala/mlscript/Typer.scala | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 12 +++++------ .../js/src/main/scala/ts2mls/TSProgram.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 20 ++++++------------- ts2mls/js/src/test/diff/Export.mlsi | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-) diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 70347d0fb..313c68445 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -1484,7 +1484,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, var ne } case ex @ Extruded(p, SkolemTag(_, tv)) => if (p) tv.asPosExtrudedTypeVar else tv.asNegExtrudedTypeVar - case _: Unsupported => Bot // TODO: do we need pol? + case _: Unsupported => Bot case TypeRef(td, Nil) => td case tr @ TypeRef(td, targs) => AppliedType(td, tr.mapTargs(S(true)) { case ta @ ((S(true), TopType) | (S(false), BotType)) => Bounds(Bot, Top) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index af92a50d3..d74d9c026 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -92,20 +92,18 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: case _ => throw new Exception(s"member ${names.mkString(".")} not found.") } - def getTop(name: String): Option[TSType] = + def exportWithAlias(name: String, alias: String): Unit = if (members.contains(name)) members(name)._1 match { - case cls: TSClassType => Some(TSReferenceType(cls.name)) - case itf: TSInterfaceType => Some(TSReferenceType(itf.name)) + case _: TSClassType => put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) + case _: TSInterfaceType => put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) case _: TSTypeAlias => None // type alias in ts would be erased. - case tp => Some(tp) // variables & functions + case tp => put(alias, TSRenamedType(alias, tp), true, false) // variables & functions } - else if (subSpace.contains(name)) Some(TSReferenceType(name)) - else None + else if (subSpace.contains(name)) put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) def containsMember(name: String, searchParent: Boolean = true): Boolean = if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) - private def expStr(exp: Boolean) = if (exp) "export " else "" private val typer = new mlscript.Typer( diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 05ed17d69..1820ff1cb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -76,7 +76,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str val moduleName = basename(absName) memberName.fold( globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true, false) - )(name => ns.getTop(name).fold[Unit](())(tp => globalNamespace.put(alias, TSRenamedType(alias, tp), true, false))) + )(name => globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(s"$moduleName.$name")), true, false)) } } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index c401065e9..74f6ee584 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -4,14 +4,14 @@ import scala.scalajs.js import js.DynamicImplicits._ import types._ import mlscript.utils._ -import scala.collection.mutable.{ListBuffer, HashMap} +import scala.collection.mutable.ListBuffer class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = TSImportList() private val reExportList = new ListBuffer[TSReExport]() private val resolvedPath = sf.resolvedPath.toString() - private var umdModuleName: Option[String] = None + private var umdModuleName: Option[String] = None // `export as namespace` in ts val referencedFiles = sf.referencedFiles.map((x: js.Dynamic) => x.fileName.toString()) def getUMDModule: Option[TSNamespace] = @@ -43,17 +43,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } }) - // handle parents + // handle parents & export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) handleParents(nodeObject, nodeObject.symbol.escapedName)(global) - }) - - // check export - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (nodeObject.isExportDeclaration) { + else if (nodeObject.isExportDeclaration) { if (!nodeObject.moduleSpecifier.isUndefined) // re-export parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) else // ES modules @@ -89,10 +84,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici elements.foreach(ele => if (ele.propertyName.isUndefined) global.`export`(ele.symbol.escapedName) - else { - val alias = ele.symbol.escapedName - global.getTop(ele.propertyName.escapedText).fold(())(tp => global.put(alias, TSRenamedType(alias, tp), true, false)) - } + else global.exportWithAlias(ele.propertyName.escapedText, ele.symbol.escapedName) ) } @@ -189,7 +181,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (obj.isArrayType) TSArrayType(getObjectType(obj.elementTypeOfArray)) else if (obj.isTypeParameterSubstitution) { val baseName = getSymbolFullname(if (obj.symbol.isUndefined) obj.aliasSymbol else obj.symbol) - if (baseName.contains(".")) TSNoInfoUnsupported // A.B is not supported in mlscript + if (baseName.contains(".")) TSNoInfoUnsupported // A.B is not supported in mlscript so far else TSSubstitutionType(TSReferenceType(baseName), getSubstitutionArguments(obj.typeArguments)) } else if (obj.isObject) diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index fb23f1e11..dd8be9966 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -13,6 +13,6 @@ export declare module Export { fun default(x: anything): anything export declare class E {} export val F = E - export val G = B + export val G = Dependency.B export val H = Dependency } From 9073753aca925efcc42e9acac9c579a5389bf1a1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 27 Jun 2023 20:47:12 +0800 Subject: [PATCH 145/202] WIP: Move imports outside typing units --- .../scala/mlscript/compiler/ClassLifter.scala | 2 +- driver/js/src/main/scala/driver/Driver.scala | 14 +++++++------- shared/src/main/scala/mlscript/JSBackend.scala | 6 +++--- shared/src/main/scala/mlscript/NewParser.scala | 18 ++++++++++++++++-- shared/src/main/scala/mlscript/Typer.scala | 2 +- shared/src/main/scala/mlscript/helpers.scala | 4 ---- shared/src/main/scala/mlscript/syntax.scala | 2 +- 7 files changed, 29 insertions(+), 19 deletions(-) diff --git a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala index f13b0eca7..38a919e73 100644 --- a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala +++ b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala @@ -371,7 +371,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nTs = targs.map(liftType).unzip (TyApp(ret._1, nTs._1), nTs._2.fold(ret._2)(_ ++ _)) case With(trm, fields) => ??? - case New(Some((t: TypeName, prm: Tup)), TypingUnit(Nil, _)) => + case New(Some((t: TypeName, prm: Tup)), TypingUnit(Nil)) => val ret = liftConstr(t, prm) (New(Some((ret._1, ret._2)), TypingUnit(Nil)), ret._3) case New(Some((t: TypeName, prm: Tup)), tu) => diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 798f406e1..0722e32aa 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -98,14 +98,14 @@ class Driver(options: DriverOptions) { def doPrintDbg(msg: => String): Unit = if (dbg) println(msg) } - val tu = parser.parseAll(parser.typingUnit) + val (tu, depList) = parser.parseAll(parser.tuWithImports) val (definitions, declarations) = tu.entities.partitionMap { case nt: NuTypeDef if (nt.isDecl) => Right(nt) case nf @ NuFunDef(_, _, _, Right(_)) => Right(nf) case t => Left(t) } - (definitions, declarations, tu.depList, origin) + (definitions, declarations, depList, origin) } private def isInterfaceOutdate(origin: String, inter: String): Boolean = { @@ -131,7 +131,7 @@ class Driver(options: DriverOptions) { private def extractSig(filename: String, moduleName: String): TypingUnit = parseAndRun(filename, { case (_, declarations, _, origin) => TypingUnit( - NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations, Nil))(S(Loc(0, 1, origin)), N, N) :: Nil, Nil) + NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations))(S(Loc(0, 1, origin)), N, N) :: Nil) }) // if the current file is es5.mlsi, we allow overriding builtin type(like String and Object) @@ -155,7 +155,7 @@ class Driver(options: DriverOptions) { raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] - ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst, Nil), true)) + ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst), true)) // translate mlscirpt import paths into js import paths private def resolveImportPath(file: FileInfo, imp: String) = @@ -222,13 +222,13 @@ class Driver(options: DriverOptions) { parseAndRun(s"${options.path}/${file.interfaceFilename}", { case (_, declarations, imports, _) => imports.foreach(d => importModule(file.`import`(d.path))) - `type`(TypingUnit(declarations, Nil), false) + `type`(TypingUnit(declarations), false) }) otherList.foreach(d => importModule(file.`import`(d))) if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + - packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions, Nil), false).show) + packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show) val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") saveToFile(mlsiFile, interfaces) @@ -238,7 +238,7 @@ class Driver(options: DriverOptions) { } ), exported || importedModule(file.filename)) } - else `type`(TypingUnit(declarations, Nil), false) // for ts/mlsi files, we only check interface files + else `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files true } else false // no need to recompile diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 00da14ce1..34842e4bd 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -290,14 +290,14 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { case Inst(bod) => translateTerm(bod) case iff: If => throw CodeGenError(s"if expression was not desugared") - case New(N, TypingUnit(Nil, _)) => JSRecord(Nil) - case New(S(TypeName(className) -> Tup(args)), TypingUnit(Nil, _)) => + case New(N, TypingUnit(Nil)) => JSRecord(Nil) + case New(S(TypeName(className) -> Tup(args)), TypingUnit(Nil)) => val callee = translateVar(className, true) match { case n: JSNew => n case t => JSNew(t) } callee(args.map { case (_, Fld(_, _, arg)) => translateTerm(arg) }: _*) - case New(_, TypingUnit(_, _)) => + case New(_, TypingUnit(_)) => throw CodeGenError("custom class body is not supported yet") case Forall(_, bod) => translateTerm(bod) case TyApp(base, _) => translateTerm(base) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index a1640fc78..e5f8a8124 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -215,7 +215,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D } */ - final def typingUnit: TypingUnit = { + final def tuWithImports: (TypingUnit, Ls[Import]) = { val ts = block(Nil)(false, false) val (es, dp) = ts.partitionMap { case R(imp: Import) => R(imp) @@ -232,7 +232,21 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], raiseFun: D case _ => ??? }, dp) } - TypingUnit(es, dp) + (TypingUnit(es), dp) + } + + final def typingUnit: TypingUnit = { + val ts = block(Nil)(false, false) + val es = ts.map { + case L(t) => + err(msg"Unexpected 'then'/'else' clause" -> t.toLoc :: Nil) + errExpr + case R(d: NuDecl) => d + case R(e: Term) => e + case R(c: Constructor) => c + case _ => ??? + } + TypingUnit(es) } final def typingUnitMaybeIndented(implicit fe: FoundErr): TypingUnit = yeetSpaces match { case (br @ BRACKETS(Indent, toks), _) :: _ => diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 313c68445..b1c03d7c4 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -1131,7 +1131,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, var ne try typeTerm(desugarIf(elf)) catch { case e: ucs.DesugaringException => err(e.messages) } - case New(S((nmedTy, trm)), TypingUnit(Nil, _)) => + case New(S((nmedTy, trm)), TypingUnit(Nil)) => typeMonomorphicTerm(App(Var(nmedTy.base.name).withLocOf(nmedTy), trm)) case New(base, args) => err(msg"Currently unsupported `new` syntax", term.toCoveringLoc) case TyApp(_, _) => diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index 90dcfc5be..4f91c6480 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -435,10 +435,6 @@ trait TypingUnitImpl extends Located { self: TypingUnit => case _ => die }.mkString("{", "; ", "}") lazy val children: List[Located] = entities - - override def toString(): String = - if (depList.isEmpty) s"TypingUnit(${entities.toString()})" - else s"TypingUnit(${entities.toString()}, ${depList.toString()})" } trait TypeNameImpl extends Ordered[TypeName] { self: TypeName => diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index acccd4f47..01e1c4e7d 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -179,7 +179,7 @@ final case class PolyType(targs: Ls[TypeName \/ TypeVar], body: Type) extends Ty // New Definitions AST -final case class TypingUnit(entities: Ls[Statement], depList: Ls[Import] = Nil) extends TypingUnitImpl +final case class TypingUnit(entities: Ls[Statement]) extends TypingUnitImpl // final case class TypingUnit(entities: Ls[Statement]) extends TypeLike with PgrmOrTypingUnit with TypingUnitImpl final case class Signature(members: Ls[NuDecl], result: Opt[Type]) extends TypeLike with SignatureImpl From 121acf47f43aac4d999bb0f8d295bc8586300b0e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 28 Jun 2023 11:32:51 +0800 Subject: [PATCH 146/202] WIP: Improve unsupported and fix interface parents --- .../scala/mlscript/ConstraintSolver.scala | 1 + .../main/scala/mlscript/TyperDatatypes.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 60 ++----------------- .../main/scala/ts2mls/types/Converter.scala | 10 ++-- ts2mls/js/src/test/diff/ES5.mlsi | 30 ++++++++-- 5 files changed, 37 insertions(+), 66 deletions(-) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index ac3ad8b60..c40ac3cbb 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -766,6 +766,7 @@ class ConstraintSolver extends NormalForms { self: Typer => case (p @ ProvType(und), _) => rec(und, rhs, true) case (_, p @ ProvType(und)) => rec(lhs, und, true) case (_: TypeTag, _: TypeTag) if lhs === rhs => () + case (lhs: Unsupported, rhs: Unsupported) => () case (NegType(lhs), NegType(rhs)) => rec(rhs, lhs, true) case (ClassTag(Var(nme), _), rt: RecordType) if newDefs && nme.isCapitalized => diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index 58bb3d1ae..20fc98675 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -389,7 +389,7 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => case (obj1: ObjectTag, obj2: ObjectTag) => obj1.id compare obj2.id case (SkolemTag(_, id1), SkolemTag(_, id2)) => id1 compare id2 case (Extruded(_, id1), Extruded(_, id2)) => id1 compare id2 - case (uns1: Unsupported, uns2: Unsupported) => uns1.id compare uns2.id + case (uns1: Unsupported, uns2: Unsupported) => 0 case (_: ObjectTag, _) => 0 case (_: SkolemTag, _) => 1 case (_: UnusableLike, _) => 2 diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 74f6ee584..0c6812425 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -46,9 +46,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici // handle parents & export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken && !nodeObject.symbol.isUndefined) - handleParents(nodeObject, nodeObject.symbol.escapedName)(global) - else if (nodeObject.isExportDeclaration) { + if (nodeObject.isExportDeclaration) { if (!nodeObject.moduleSpecifier.isUndefined) // re-export parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) else // ES modules @@ -266,25 +264,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici private def getTupleElements(elements: TSTypeArray)(implicit ns: TSNamespace): List[TSType] = elements.foldLeft(List[TSType]())((lst, ele) => lst :+ getObjectType(ele)) - private def getHeritageList(node: TSNodeObject, members: Set[String])(implicit ns: TSNamespace): List[TSType] = + private def getHeritageList(node: TSNodeObject)(implicit ns: TSNamespace): List[TSType] = node.heritageClauses.foldLeftIndexed(List[TSType]())((lst, h, index) => { - def run(ref: TSReferenceType) = ns.get(ref.nameList) match { - case itf: TSInterfaceType - if (itf.members.foldLeft(itf.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => - TSNoInfoUnsupported - case cls: TSClassType - if (cls.members.foldLeft(cls.unsupported)((r, t) => r || (t._2.base.unsupported && members(t._1)))) => - TSNoInfoUnsupported - case t if (t.unsupported) => TSNoInfoUnsupported - case t => ref - } lst :+ (getObjectType(h.types.get(index).typeNode) match { case TSArrayType(ele) => TSSubstitutionType(TSReferenceType("Array"), ele :: Nil) - case ref: TSReferenceType => run(ref) - case TSSubstitutionType(base, app) => run(base) match { - case ref: TSReferenceType => TSSubstitutionType(ref, app) - case t => t - } case t => t }) }) @@ -342,9 +325,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici val res = // do not handle parents here. we have not had enough information so far. if (isClass) TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), - getTypeParameters(node), Nil, getConstructorList(node.members)) + getTypeParameters(node), getHeritageList(node), getConstructorList(node.members)) else - TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), Nil, parseCallSignature(node.members)) + TSInterfaceType(name, getInterfacePropertiesType(node.members), getTypeParameters(node), + getHeritageList(node), parseCallSignature(node.members)) if (res.unsupported) markUnsupported(node) else res } @@ -393,40 +377,6 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (node.isNamespace) parseNamespace(node) - private def handleParents(node: TSNodeObject, name: String)(implicit ns: TSNamespace): Unit = - if (node.isClassDeclaration) ns.get(name) match { - case TSClassType(_, members, statics, typeVars, _, constructor) => - val list = getHeritageList(node, members.keySet) - if (!list.isEmpty) { - val cls = TSClassType(name, members, statics, typeVars, list, constructor) - ns.put(name, if (cls.unsupported) markUnsupported(node) else cls, ns.exported(name), true) - } - case t if (t.unsupported) => () // ignore types that have been marked as unsupported. - case _ => throw new AssertionError(s"$name is not a class") - } - else if (node.isInterfaceDeclaration) ns.get(name) match { - case TSInterfaceType(_, members, typeVars, _, cs) => - val list = getHeritageList(node, members.keySet) - if (!list.isEmpty) { - val itf = TSInterfaceType(name, members, typeVars, list, cs) - ns.put(name, if (itf.unsupported) markUnsupported(node) else itf, ns.exported(name), true) - } - case t if (t.unsupported) => () // ignore types that have been marked as unsupported. - case _ => throw new AssertionError(s"$name is not an interface") - } - else if (node.isNamespace) { - val name = node.symbol.escapedName - - if (!name.contains("\"")) { - val sub = ns.derive(name, false) - node.locals.foreach((sym) => { - val node = sym.declaration - val name = sym.escapedName - if (!node.isToken) handleParents(node, name)(sub) - }) - } - } - private def parseNamespace(node: TSNodeObject)(implicit ns: TSNamespace): Unit = { val name = node.symbol.escapedName if (name.contains("\"")) { // Ambient Modules diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 09dfbfbdd..e966e6ff8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -83,10 +83,11 @@ object Converter { private def convertClassOrInterface(tp: Either[TSClassType, TSInterfaceType], exported: Boolean)(implicit indent: String) = { val exp = if (exported) "export " else "" + def convertParents(parents: List[TSType]) = + if (parents.isEmpty) "" + else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) def combineWithTypeVars(body: String, parents: List[TSType], typeName: String, typeVars: List[TSTypeParameter]) = { - val inheritance = - if (parents.isEmpty) "" - else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) + val inheritance = convertParents(parents) if (typeVars.isEmpty) s"${indent}${exp}declare $typeName$inheritance $body" else s"${indent}${exp}declare $typeName[${typeVars.map(convert(_)).reduceLeft((p, s) => s"$p, $s")}]$inheritance $body" // TODO: add constraints @@ -100,8 +101,9 @@ object Converter { callSignature match { case Some(cs) => val prefix = s"${indent}${exp}declare " + val inheritance = convertParents(parents) val tp = if (typeVars.isEmpty) "" else s"[${typeVars.map((tv) => tv.name).reduceLeft((p, s) => s"$p, $s")}]" - s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)} ${convertRecord(members, Nil, Nil, Map(), List(), false)}" + s"${prefix}trait ${escapeIdent(name)}$tp: ${convert(cs)}$inheritance ${convertRecord(members, Nil, Nil, Map(), List(), false)}" case _ => val body = convertRecord(members, typeVars, parents, Map(), List(), false) val typeName = s"trait ${escapeIdent(name)}" diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index d565d9498..99c4d9aef 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -279,17 +279,35 @@ declare trait ErrorConstructor: (args0: (Str) | (undefined)) => Error { val prototype: Error } declare trait EvalError extends Error {} -val EvalErrorConstructor: unsupported["interface EvalErrorConstructor extends ErrorConstructor { new(message?: string): EvalError; (message?: string): EvalError; readonly prototype: EvalError; }", "ES5.d.ts", 1051, 1] +declare trait EvalErrorConstructor: (args0: (Str) | (undefined)) => EvalError extends ErrorConstructor { + val __new: unsupported["new(message?: string): EvalError;", "ES5.d.ts", 1053, 57] + val prototype: EvalError +} declare trait RangeError extends Error {} -val RangeErrorConstructor: unsupported["interface RangeErrorConstructor extends ErrorConstructor { new(message?: string): RangeError; (message?: string): RangeError; readonly prototype: RangeError; }", "ES5.d.ts", 1062, 1] +declare trait RangeErrorConstructor: (args0: (Str) | (undefined)) => RangeError extends ErrorConstructor { + val __new: unsupported["new(message?: string): RangeError;", "ES5.d.ts", 1064, 58] + val prototype: RangeError +} declare trait ReferenceError extends Error {} -val ReferenceErrorConstructor: unsupported["interface ReferenceErrorConstructor extends ErrorConstructor { new(message?: string): ReferenceError; (message?: string): ReferenceError; readonly prototype: ReferenceError; }", "ES5.d.ts", 1073, 1] +declare trait ReferenceErrorConstructor: (args0: (Str) | (undefined)) => ReferenceError extends ErrorConstructor { + val __new: unsupported["new(message?: string): ReferenceError;", "ES5.d.ts", 1075, 62] + val prototype: ReferenceError +} declare trait SyntaxError extends Error {} -val SyntaxErrorConstructor: unsupported["interface SyntaxErrorConstructor extends ErrorConstructor { new(message?: string): SyntaxError; (message?: string): SyntaxError; readonly prototype: SyntaxError; }", "ES5.d.ts", 1084, 1] +declare trait SyntaxErrorConstructor: (args0: (Str) | (undefined)) => SyntaxError extends ErrorConstructor { + val __new: unsupported["new(message?: string): SyntaxError;", "ES5.d.ts", 1086, 59] + val prototype: SyntaxError +} declare trait TypeError extends Error {} -val TypeErrorConstructor: unsupported["interface TypeErrorConstructor extends ErrorConstructor { new(message?: string): TypeError; (message?: string): TypeError; readonly prototype: TypeError; }", "ES5.d.ts", 1095, 1] +declare trait TypeErrorConstructor: (args0: (Str) | (undefined)) => TypeError extends ErrorConstructor { + val __new: unsupported["new(message?: string): TypeError;", "ES5.d.ts", 1097, 57] + val prototype: TypeError +} declare trait URIError extends Error {} -val URIErrorConstructor: unsupported["interface URIErrorConstructor extends ErrorConstructor { new(message?: string): URIError; (message?: string): URIError; readonly prototype: URIError; }", "ES5.d.ts", 1106, 1] +declare trait URIErrorConstructor: (args0: (Str) | (undefined)) => URIError extends ErrorConstructor { + val __new: unsupported["new(message?: string): URIError;", "ES5.d.ts", 1108, 56] + val prototype: URIError +} declare trait JSON { fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ From 4f24820775052da74bdbb31fbca47c03725cefbe Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 28 Jun 2023 12:49:45 +0800 Subject: [PATCH 147/202] WIP: Update test --- driver/js/src/test/scala/driver/DriverDiffTests.scala | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 4136ec1fc..905a503e8 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -34,7 +34,7 @@ class DriverDiffTests extends AnyFunSuite { object DriverDiffTests { // For local environment, we may change the driver so forcing compiling is necessary // but we can ban it during CI - private val forceCompiling = true + private val forceCompiling = !sys.env.get("CI").isDefined private val diffPath = "driver/js/src/test/" private val outputPath = s"${diffPath}output/" @@ -95,26 +95,26 @@ object DriverDiffTests { esEntry("Simple"), esEntry("Cycle2"), esEntry("Self", expectError = true), - esEntry("C", ignoreTypeError = true, expectError = true), + esEntry("C", expectError = true), esEntry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members esEntry("Output", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position esEntry("Output2", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position esEntry("MLS2TheMax", Some("./tsconfig.json")), esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection + cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection/trait types esEntry("Builtin"), cjsEntry("CJS1"), ts2mlsEntry("BasicFunctions", ignoreTypeError = true), ts2mlsEntry("ClassMember"), ts2mlsEntry("Cycle1", ignoreTypeError = true), - ts2mlsEntry("Dec", ignoreTypeError = true), + ts2mlsEntry("Dec"), ts2mlsEntry("Enum"), ts2mlsEntry("Escape"), ts2mlsEntry("Export", ignoreTypeError = true), ts2mlsEntry("Heritage", ignoreTypeError = true), ts2mlsEntry("HighOrderFunc"), ts2mlsEntry("Import"), - ts2mlsEntry("InterfaceMember", ignoreTypeError = true), + ts2mlsEntry("InterfaceMember"), ts2mlsEntry("Intersection", ignoreTypeError = true), ts2mlsEntry("Literal"), ts2mlsEntry("Namespace", expectError = true), From e004f8f683c37901e9c1f032c1717e14c5dda42f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 28 Jun 2023 16:06:50 +0800 Subject: [PATCH 148/202] WIP: Fix several problems --- driver/js/src/main/scala/driver/Driver.scala | 56 +++---------------- .../src/main/scala/mlscript/Diagnostic.scala | 56 +++++++++++++++++++ .../src/main/scala/mlscript/NuTypeDefs.scala | 4 +- .../src/test/scala/mlscript/DiffTests.scala | 50 +---------------- .../js/src/main/scala/ts2mls/FileInfo.scala | 39 +++++++------ .../src/main/scala/ts2mls/JSFileSystem.scala | 6 +- .../js/src/main/scala/ts2mls/JSWriter.scala | 1 - ts2mls/js/src/main/scala/ts2mls/TSData.scala | 4 +- .../js/src/main/scala/ts2mls/TSModules.scala | 7 --- .../src/main/scala/ts2mls/TSNamespace.scala | 9 ++- .../main/scala/ts2mls/TSPathResolver.scala | 2 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 3 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 34 +++++------ .../main/scala/ts2mls/types/Converter.scala | 12 ++-- 14 files changed, 126 insertions(+), 157 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 0722e32aa..0fce5da6f 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -8,6 +8,7 @@ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo} +import ts2mls.IsUndefined class Driver(options: DriverOptions) { import Driver._ @@ -111,7 +112,7 @@ class Driver(options: DriverOptions) { private def isInterfaceOutdate(origin: String, inter: String): Boolean = { val mtime = getModificationTime(origin) val imtime = getModificationTime(inter) - imtime.isEmpty || mtime.compareTo(imtime) >= 0 + mtime >= imtime } private def packTopModule(moduleName: Option[String], content: String) = @@ -158,7 +159,7 @@ class Driver(options: DriverOptions) { ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst), true)) // translate mlscirpt import paths into js import paths - private def resolveImportPath(file: FileInfo, imp: String) = + private def resolveJSPath(file: FileInfo, imp: String) = if (isLocal(imp) && !isMLScirpt(imp)) { // local ts files: locate by checking tsconfig.json val tsPath = TypeScript.getOutputFileNames(s"${TSPathResolver.dirname(file.filename)}/$imp", config) val outputBase = TSPathResolver.dirname(TSPathResolver.normalize(s"${options.outputDir}${file.jsFilename}")) @@ -229,11 +230,11 @@ class Driver(options: DriverOptions) { if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show) - val interfaces = otherList.map(s => Import(FileInfo.importPath(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") saveToFile(mlsiFile, interfaces) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( - imp => new Import(resolveImportPath(file, imp.path)) with ModuleType { + imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } ), exported || importedModule(file.filename)) @@ -289,60 +290,19 @@ object Driver { writer.close() } - // TODO factor with duplicated logic in DiffTests private def report(diag: Diagnostic, ignoreTypeError: Boolean): Unit = { - val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") - val headStr = diag match { + diag match { case ErrorReport(msg, loco, src) => src match { case Diagnostic.Lexing => totalErrors += 1 - s"╔══[LEXICAL ERROR] " case Diagnostic.Parsing => totalErrors += 1 - s"╔══[PARSE ERROR] " case _ => if (!ignoreTypeError) totalErrors += 1 - s"╔══[ERROR] " } - case WarningReport(msg, loco, src) => - s"╔══[WARNING] " + case WarningReport(msg, loco, src) => () } - val lastMsgNum = diag.allMsgs.size - 1 - diag.allMsgs.zipWithIndex.foreach { case ((msg, loco), msgNum) => - val isLast = msgNum =:= lastMsgNum - val msgStr = msg.showIn(sctx) - if (msgNum =:= 0) report(headStr + msgStr) - else report(s"${if (isLast && loco.isEmpty) "╙──" else "╟──"} ${msgStr}") - if (loco.isEmpty && diag.allMsgs.size =:= 1) report("╙──") - loco.foreach { loc => - val (startLineNum, startLineStr, startLineCol) = - loc.origin.fph.getLineColAt(loc.spanStart) - val (endLineNum, endLineStr, endLineCol) = - loc.origin.fph.getLineColAt(loc.spanEnd) - var l = startLineNum - var c = startLineCol - while (l <= endLineNum) { - val globalLineNum = loc.origin.startLineNum + l - 1 - val shownLineNum = "l." + globalLineNum - val prepre = "║ " - val pre = s"$shownLineNum: " - val curLine = loc.origin.fph.lines(l - 1) - report(prepre + pre + "\t" + curLine) - val tickBuilder = new StringBuilder() - tickBuilder ++= ( - (if (isLast && l =:= endLineNum) "╙──" else prepre) - + " " * pre.length + "\t" + " " * (c - 1)) - val lastCol = if (l =:= endLineNum) endLineCol else curLine.length + 1 - while (c < lastCol) { tickBuilder += ('^'); c += 1 } - if (c =:= startLineCol) tickBuilder += ('^') - report(tickBuilder.toString) - c = 1 - l += 1 - } - } - } - if (diag.allMsgs.isEmpty) report("╙──") - () + Diagnostic.report(diag, report, 0, false) } } diff --git a/shared/src/main/scala/mlscript/Diagnostic.scala b/shared/src/main/scala/mlscript/Diagnostic.scala index d99c1b26e..c3acaa753 100644 --- a/shared/src/main/scala/mlscript/Diagnostic.scala +++ b/shared/src/main/scala/mlscript/Diagnostic.scala @@ -23,6 +23,62 @@ object Diagnostic { case object Compilation extends Source case object Runtime extends Source + def report(diag: Diagnostic, output: Str => Unit, blockLineNum: Int, showRelativeLineNums: Bool): Unit = { + val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") + val headStr = diag match { + case ErrorReport(msg, loco, src) => + src match { + case Diagnostic.Lexing => + s"╔══[LEXICAL ERROR] " + case Diagnostic.Parsing => + s"╔══[PARSE ERROR] " + case _ => // TODO customize too + s"╔══[ERROR] " + } + case WarningReport(msg, loco, src) => + s"╔══[WARNING] " + } + val lastMsgNum = diag.allMsgs.size - 1 + var globalLineNum = blockLineNum // solely used for reporting useful test failure messages + diag.allMsgs.zipWithIndex.foreach { case ((msg, loco), msgNum) => + val isLast = msgNum =:= lastMsgNum + val msgStr = msg.showIn(sctx) + if (msgNum =:= 0) output(headStr + msgStr) + else output(s"${if (isLast && loco.isEmpty) "╙──" else "╟──"} ${msgStr}") + if (loco.isEmpty && diag.allMsgs.size =:= 1) output("╙──") + loco.foreach { loc => + val (startLineNum, startLineStr, startLineCol) = + loc.origin.fph.getLineColAt(loc.spanStart) + if (globalLineNum =:= 0) globalLineNum += startLineNum - 1 + val (endLineNum, endLineStr, endLineCol) = + loc.origin.fph.getLineColAt(loc.spanEnd) + var l = startLineNum + var c = startLineCol + while (l <= endLineNum) { + val globalLineNum = loc.origin.startLineNum + l - 1 + val relativeLineNum = globalLineNum - blockLineNum + 1 + val shownLineNum = + if (showRelativeLineNums && relativeLineNum > 0) s"l.+$relativeLineNum" + else "l." + globalLineNum + val prepre = "║ " + val pre = s"$shownLineNum: " + val curLine = loc.origin.fph.lines(l - 1) + output(prepre + pre + "\t" + curLine) + val tickBuilder = new StringBuilder() + tickBuilder ++= ( + (if (isLast && l =:= endLineNum) "╙──" else prepre) + + " " * pre.length + "\t" + " " * (c - 1)) + val lastCol = if (l =:= endLineNum) endLineCol else curLine.length + 1 + while (c < lastCol) { tickBuilder += ('^'); c += 1 } + if (c =:= startLineCol) tickBuilder += ('^') + output(tickBuilder.toString) + c = 1 + l += 1 + } + } + } + if (diag.allMsgs.isEmpty) output("╙──") + } } final case class ErrorReport(mainMsg: Str, allMsgs: Ls[Message -> Opt[Loc]], source: Source) extends Diagnostic(mainMsg) { diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index 05d26b263..279519abb 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -463,7 +463,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => /** Type checks a typing unit, which is a sequence of possibly-mutually-recursive type and function definitions * interleaved with plain statements. */ - def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer], isES5: Bool = false) + def typeTypingUnit(tu: TypingUnit, outer: Opt[Outer], isPredef: Bool = false) (implicit ctx: Ctx, raise: Raise, vars: Map[Str, SimpleType]): TypedTypingUnit = trace(s"${ctx.lvl}. Typing $tu") { @@ -506,7 +506,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => fd.copy()(fd.declareLoc, fd.exportLoc, fd.signature, outer) } case td: NuTypeDef => - if ((td.nme.name in reservedTypeNames) && !isES5) + if ((td.nme.name in reservedTypeNames) && !isPredef) err(msg"Type name '${td.nme.name}' is reserved", td.toLoc) td } diff --git a/shared/src/test/scala/mlscript/DiffTests.scala b/shared/src/test/scala/mlscript/DiffTests.scala index 66c364cf3..f4df4fda9 100644 --- a/shared/src/test/scala/mlscript/DiffTests.scala +++ b/shared/src/test/scala/mlscript/DiffTests.scala @@ -317,65 +317,21 @@ class DiffTests // report errors and warnings def report(diags: Ls[mlscript.Diagnostic], output: Str => Unit = output): Unit = { diags.foreach { diag => - val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") - val headStr = diag match { + diag match { case ErrorReport(msg, loco, src) => src match { case Diagnostic.Lexing => totalParseErrors += 1 - s"╔══[LEXICAL ERROR] " case Diagnostic.Parsing => totalParseErrors += 1 - s"╔══[PARSE ERROR] " case _ => // TODO customize too totalTypeErrors += 1 - s"╔══[ERROR] " } case WarningReport(msg, loco, src) => totalWarnings += 1 - s"╔══[WARNING] " } - val lastMsgNum = diag.allMsgs.size - 1 - var globalLineNum = blockLineNum // solely used for reporting useful test failure messages - diag.allMsgs.zipWithIndex.foreach { case ((msg, loco), msgNum) => - val isLast = msgNum =:= lastMsgNum - val msgStr = msg.showIn(sctx) - if (msgNum =:= 0) output(headStr + msgStr) - else output(s"${if (isLast && loco.isEmpty) "╙──" else "╟──"} ${msgStr}") - if (loco.isEmpty && diag.allMsgs.size =:= 1) output("╙──") - loco.foreach { loc => - val (startLineNum, startLineStr, startLineCol) = - loc.origin.fph.getLineColAt(loc.spanStart) - if (globalLineNum =:= 0) globalLineNum += startLineNum - 1 - val (endLineNum, endLineStr, endLineCol) = - loc.origin.fph.getLineColAt(loc.spanEnd) - var l = startLineNum - var c = startLineCol - while (l <= endLineNum) { - val globalLineNum = loc.origin.startLineNum + l - 1 - val relativeLineNum = globalLineNum - blockLineNum + 1 - val shownLineNum = - if (showRelativeLineNums && relativeLineNum > 0) s"l.+$relativeLineNum" - else "l." + globalLineNum - val prepre = "║ " - val pre = s"$shownLineNum: " - val curLine = loc.origin.fph.lines(l - 1) - output(prepre + pre + "\t" + curLine) - val tickBuilder = new StringBuilder() - tickBuilder ++= ( - (if (isLast && l =:= endLineNum) "╙──" else prepre) - + " " * pre.length + "\t" + " " * (c - 1)) - val lastCol = if (l =:= endLineNum) endLineCol else curLine.length + 1 - while (c < lastCol) { tickBuilder += ('^'); c += 1 } - if (c =:= startLineCol) tickBuilder += ('^') - output(tickBuilder.toString) - c = 1 - l += 1 - } - } - } - if (diag.allMsgs.isEmpty) output("╙──") - + val globalLineNum = blockLineNum + Diagnostic.report(diag, output, blockLineNum, showRelativeLineNums) if (!mode.fixme) { if (!allowTypeErrors && !mode.expectTypeErrors && diag.isInstanceOf[ErrorReport] && diag.source =:= Diagnostic.Typing) diff --git a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala index 684996944..43268d33b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala @@ -28,15 +28,29 @@ final case class FileInfo( else if (nodeModulesNested) localFilename else localFilename.replace(extname(localFilename), "") - lazy val importedMlsi: String = - FileInfo.importPath( - if (!isNodeModule) localFilename - else if (nodeModulesNested) { - val p = dirname(TSImport.createInterfaceForNode(parent.getOrElse(workDir))) - s"./${normalize(TSPathResolver.relative(p, localFilename))}" + def translateImportToInterface(file: FileInfo)(implicit config: js.Dynamic): String = { + val importedPath = + if (!file.isNodeModule) { + val rel = normalize(TSPathResolver.relative(dirname(localFilename), file.localFilename)) + if (isLocal(rel)) rel else s"./$rel" } - else filename - ) + else if (file.nodeModulesNested) { // node_modules, but relatoive path + val p = dirname(TSImport.createInterfaceForNode(resolve)) + val rel = normalize(TSPathResolver.relative(p, file.localFilename)) + if (isLocal(rel)) rel else s"./$rel" + } + else + file.localFilename + val ext = TSPathResolver.extname(importedPath) + if (!ext.isEmpty()) + importedPath.replace(ext, ".mlsi") + else importedPath + ".mlsi" + } + + def translateImportToInterface(path: String)(implicit config: js.Dynamic): String = { + val file = `import`(path) + translateImportToInterface(file) + } def resolve(implicit config: js.Dynamic) = if (isNodeModule && !nodeModulesNested) TypeScript.resolveModuleName(filename, parent.getOrElse(""), config) @@ -68,12 +82,3 @@ final case class FileInfo( } else FileInfo(workDir, path, interfaceDir, Some(resolve)) } - -object FileInfo { - def importPath(filename: String): String = { - val ext = TSPathResolver.extname(filename) - if (!ext.isEmpty()) - filename.replace(ext, ".mlsi") - else filename + ".mlsi" - } -} diff --git a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala index a70a32de1..9c1bf0f82 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala @@ -21,10 +21,10 @@ object JSFileSystem { fs.writeFileSync(filename, content) } - def getModificationTime(filename: String): String = - if (!exists(filename)) "" + def getModificationTime(filename: String): Double = + if (!exists(filename)) 0.0 else { val state = fs.statSync(filename) - state.mtimeMs.toString + state.mtimeMs.asInstanceOf[Double] } } diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index c9266a32b..7d0910193 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -1,7 +1,6 @@ package ts2mls import scala.scalajs.js -import js.Dynamic.{global => g} import js.DynamicImplicits._ import mlscript.utils._ import scala.collection.mutable.StringBuilder diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index e3be3c4fb..3925eb607 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -33,8 +33,8 @@ abstract class TSArray[T <: TSAny](arr: js.Dynamic) extends TSAny(arr) { def mapToList[U](f: T => U, index: Int = 0, res: List[U] = Nil): List[U] = if (!isUndefined && index < length) - mapToList(f, index + 1, res :+ f(get(index))) - else res + mapToList(f, index + 1, f(get(index)) :: res) + else res.reverse } class TSNodeArray(arr: js.Dynamic)(implicit checker: TSTypeChecker) extends TSArray[TSNodeObject](arr) { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala index 69ffb70d1..e271aebc3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSModules.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSModules.scala @@ -27,13 +27,6 @@ trait TSImport { self => TSReExport(alias.getOrElse(name), filename, Some(name)) } } - - def generate(ns: TSNamespace, writer: JSWriter): Unit = self match { - case _: TSFullImport => ns.generate(writer, " ") - case TSSingleImport(_, items) => items.foreach((pair) => pair match { - case (name, _) => writer.writeln(Converter.convert(ns.get(name), true)(" ")) - }) - } } object TSImport { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index d74d9c026..4b51f513c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -104,8 +104,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: def containsMember(name: String, searchParent: Boolean = true): Boolean = if (parent.isEmpty) members.contains(name) else (members.contains(name) || (searchParent && parent.get.containsMember(name))) - private def expStr(exp: Boolean) = if (exp) "export " else "" - private val typer = + private lazy val typer = new mlscript.Typer( dbg = false, verbose = false, @@ -116,7 +115,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: private def generateNS(name: String, writer: JSWriter, indent: String): Unit = { val ss = subSpace(name) val realName = cjsExport.getOrElse(name, name) - val exp = expStr(realName =/= name || ss._2) + val exp = Converter.genExport(realName =/= name || ss._2) writer.writeln(s"${indent}${exp}declare module ${Converter.escapeIdent(realName)} {") ss._1.generate(writer, indent + " ") writer.writeln(s"$indent}") @@ -169,8 +168,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: writer.writeln(Converter.convert(mem, exp)(indent)) case _: TSTypeAlias => writer.writeln(Converter.convert(mem, exp)(indent)) case TSRenamedType(name, original) => - writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(realName)} = ${Converter.convert(original)("")}") - case _ => writer.writeln(s"${indent}${expStr(exp)}val ${Converter.escapeIdent(realName)}: ${Converter.convert(mem)("")}") + writer.writeln(s"${indent}${Converter.genExport(exp)}val ${Converter.escapeIdent(realName)} = ${Converter.convert(original)("")}") + case _ => writer.writeln(s"${indent}${Converter.genExport(exp)}val ${Converter.escapeIdent(realName)}: ${Converter.convert(mem)("")}") } } case _ => () diff --git a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala index 4735b6885..8b4bb849d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala @@ -18,7 +18,7 @@ object TSPathResolver { def relative(from: String, to: String) = np.relative(from, to).toString() def extname(path: String) = - if (path.endsWith(".d.ts")) ".d.ts" + if (path.endsWith(".d.ts")) ".d.ts" // `filename.d.ts`'s extname is `.ts` by default else np.extname(path).toString() def basename(filename: String) = np.basename(filename, extname(filename)).toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 1820ff1cb..c15faf3b6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -4,7 +4,6 @@ import scala.scalajs.js import js.DynamicImplicits._ import ts2mls.types._ import scala.collection.mutable.{HashSet, HashMap} -import ts2mls.TSPathResolver // for general ts, we still consider that there is a top-level module // and in mls we will import ts file like this: @@ -52,7 +51,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str val imported = new HashSet[String]() otherList.foreach(imp => { - val name = imp.importedMlsi + val name = file.translateImportToInterface(imp) if (!imported(name)) { imported += name writer.writeln(s"""import "$name"""") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 0c6812425..c34ba5477 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -122,13 +122,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici }) private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = { - def simplify(symName: String, nsName: String): String = + def simplify(symName: String, nsName: String): String = // remove unnecessary namespaces prefixes if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) else symName - if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) + if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) // imported from another file importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) - else if (!sym.parent.isUndefined && sym.parent.isMerged) { + else if (!sym.parent.isUndefined && sym.parent.isMerged) { // merged with other declarations def findDecFile(node: TSNodeObject): String = if (node.parent.isUndefined) "" else if (node.parent.isSourceFile) { @@ -154,7 +154,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else importList.resolveTypeAlias(filename, sym.escapedName) // in an imported file ) } - else if (sym.parent.isUndefined) { + else if (sym.parent.isUndefined) { // already top-level symbol val name = sym.escapedName if (name.contains("\"")) TSPathResolver.basename(name.substring(1, name.length() - 1)) else name @@ -185,6 +185,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (obj.isObject) if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) + // upper case field names are not supported in records in mlscript so far if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) TSInterfaceType("", props, List(), List(), None) else TSNoInfoUnsupported @@ -215,18 +216,19 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici }) // get the type of variables in classes/named interfaces/anonymous interfaces - private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = { - val res: TSType = - if (node.isIndexSignature || node.isConstructSignature) - markUnsupported(node) - else if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts - else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) - else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) - else getObjectType(node.`type`.typeNode) - if (res.unsupported) markUnsupported(node) - else if (node.symbol.isOptionalMember) TSUnionType(res, TSPrimitiveType("undefined")) - else res - } + private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = + if (node.isIndexSignature || node.isConstructSignature) + markUnsupported(node) + else { + val res = + if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts + else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) + else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) + else getObjectType(node.`type`.typeNode) + if (res.unsupported) markUnsupported(node) + else if (node.symbol.isOptionalMember) TSUnionType(res, TSPrimitiveType("undefined")) + else res + } private def getTypeParameters(node: TSNodeObject)(implicit ns: TSNamespace): List[TSTypeParameter] = node.typeParameters.foldLeft(List[TSTypeParameter]())((lst, tp) => diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index e966e6ff8..fdd31d8c7 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -28,6 +28,8 @@ object Converter { s"""id"$name"""" else name } + + def genExport(exported: Boolean) = if (exported) "export " else "" private def generateFunParamsList(params: List[TSParameterType]) = if (params.isEmpty) "" @@ -39,9 +41,8 @@ object Converter { case TSFunctionType(params, res, typeVars) => { val pList = generateFunParamsList(params) val tpList = if (typeVars.isEmpty) "" else s"[${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}]" - val exp = if (exported) "export " else "" val dec = if (declared) "declare " else "" - s"${indent}${exp}${dec}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + s"${indent}${genExport(exported)}${dec}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, declared, exported)} ${overload.warning}" case _ => throw new AssertionError("non-function type is not allowed.") @@ -71,9 +72,8 @@ object Converter { case overload @ TSIgnoredOverload(base, _) => s"${convert(base)} ${overload.warning}" case TSParameterType(name, tp) => s"${escapeIdent(name)}: ${convert(tp)}" case TSTypeAlias(name, ori, tp) => { - val exp = if (exported) "export " else "" - if (tp.isEmpty) s"${indent}${exp}type ${escapeIdent(name)} = ${convert(ori)}" - else s"${indent}${exp}type ${escapeIdent(name)}[${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}] = ${convert(ori)}" + if (tp.isEmpty) s"${indent}${genExport(exported)}type ${escapeIdent(name)} = ${convert(ori)}" + else s"${indent}${genExport(exported)}type ${escapeIdent(name)}[${tp.map(t => convert(t)).reduceLeft((s, t) => s"$s, $t")}] = ${convert(ori)}" } case TSLiteralType(value, isString) => if (isString) s"\"$value\"" else value case TSUnsupportedType(code, filename, line, column) => @@ -82,7 +82,7 @@ object Converter { } private def convertClassOrInterface(tp: Either[TSClassType, TSInterfaceType], exported: Boolean)(implicit indent: String) = { - val exp = if (exported) "export " else "" + val exp = genExport(exported) def convertParents(parents: List[TSType]) = if (parents.isEmpty) "" else parents.foldLeft(s" extends ")((b, p) => s"$b${convert(p)}, ").dropRight(2) From f7190472774c6dd633d351f4f18c2e174c1b128b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 28 Jun 2023 16:38:32 +0800 Subject: [PATCH 149/202] WIP: Update CI --- .github/workflows/scala.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 374e4e001..0db345210 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -21,6 +21,12 @@ jobs: node-version: '17.x' - name: Install TypeScript run: npm ci + - name: Install test libraries for es projects + working-directory: ./driver/js/src/test/esprojects + run: npm ci + - name: Install test libraries for cjs projects + working-directory: ./driver/js/src/test/cjsprojects + run: npm ci - name: Run tests run: sbt test - name: Check no changes From 2f05887a1535a0ab14aaf09e7a7ac4d9c15173c1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 29 Jun 2023 10:43:45 +0800 Subject: [PATCH 150/202] WIP: Try to fix jvm memory problem and fix error printing --- .github/workflows/scala.yml | 2 +- driver/js/src/main/scala/driver/Driver.scala | 20 ++++++++++--------- .../src/main/scala/driver/DriverOptions.scala | 1 + .../test/scala/driver/DriverDiffTests.scala | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 0db345210..7c6e9453c 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -28,6 +28,6 @@ jobs: working-directory: ./driver/js/src/test/cjsprojects run: npm ci - name: Run tests - run: sbt test + run: sbt test -J-XX:+UseG1GC - name: Check no changes run: git diff-files -p --exit-code diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 0fce5da6f..6bbaf6ec0 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -59,7 +59,7 @@ class Driver(options: DriverOptions) { try { Driver.totalErrors = 0 implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.ignoreTypeError) + implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.ignoreTypeError, options.expectError) implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() @@ -69,10 +69,10 @@ class Driver(options: DriverOptions) { } catch { case err: Diagnostic => - report(err, options.ignoreTypeError) + report(err, options.ignoreTypeError, options.expectError) false case t : Throwable => - report(s"unexpected error: ${t.toString()}") + printErr(s"unexpected error: ${t.toString()}", options.expectError || options.ignoreTypeError) t.printStackTrace() false } @@ -262,10 +262,10 @@ class Driver(options: DriverOptions) { } catch { case CodeGenError(err) => totalErrors += 1 - report(s"codegen error: $err") + printErr(s"codegen error: $err", options.ignoreTypeError || options.expectError) case t : Throwable => totalErrors += 1 - report(s"unexpected error: ${t.toString()}") + printErr(s"unexpected error: ${t.toString()}", options.ignoreTypeError || options.expectError) t.printStackTrace() } } @@ -279,8 +279,10 @@ object Driver { "./driver/js/src/test/predefs/Predef.mlsi" ) - private def report(msg: String): Unit = - System.err.println(msg) + // avoid writing to stderr if the error is expected + private def printErr(msg: String, expectError: Boolean): Unit = + if (expectError) System.out.println(msg) + else System.err.println(msg) private var totalErrors = 0 @@ -290,7 +292,7 @@ object Driver { writer.close() } - private def report(diag: Diagnostic, ignoreTypeError: Boolean): Unit = { + private def report(diag: Diagnostic, ignoreTypeError: Boolean, expectError: Boolean): Unit = { diag match { case ErrorReport(msg, loco, src) => src match { @@ -303,6 +305,6 @@ object Driver { } case WarningReport(msg, loco, src) => () } - Diagnostic.report(diag, report, 0, false) + Diagnostic.report(diag, (msg: String) => printErr(msg, expectError), 0, false) } } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index 87951ffc9..b4935f352 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -13,5 +13,6 @@ final case class DriverOptions( interfaceDir: String, commonJS: Boolean, // generate common js or es5 ignoreTypeError: Boolean, // ignore type errors for test + expectError: Boolean, // the test should raise errors force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 905a503e8..3384224d4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -13,7 +13,7 @@ class DriverDiffTests extends AnyFunSuite { testCases.foreach { case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, ignoreTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, ignoreTypeError, forceCompiling) + DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, ignoreTypeError, expectError, forceCompiling) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val success = driver.execute From 1779ba6528472eb08d68708a73cd809249a1b393 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 29 Jun 2023 11:00:40 +0800 Subject: [PATCH 151/202] WIP: Fix parameters and update test cases --- driver/js/src/main/scala/driver/Driver.scala | 2 +- driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js | 2 +- driver/js/src/test/esprojects/ts/MyPrint.ts | 2 +- driver/js/src/test/output/TS.check | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 6bbaf6ec0..1605a2f45 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -305,6 +305,6 @@ object Driver { } case WarningReport(msg, loco, src) => () } - Diagnostic.report(diag, (msg: String) => printErr(msg, expectError), 0, false) + Diagnostic.report(diag, (msg: String) => printErr(msg, expectError || ignoreTypeError), 0, false) } } diff --git a/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js b/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js index c5d6864d3..a80a68b32 100644 --- a/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js +++ b/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js @@ -4,6 +4,6 @@ export class DatePrint { } print(msg) { let date = new Date(1145141919810); - console.log(`[${this.prefix}] ${msg}. (${date})`); + console.log(`[${this.prefix}] ${msg}. (${date.toLocaleString("en-US", { timeZone: "America/New_York" })})`); } } diff --git a/driver/js/src/test/esprojects/ts/MyPrint.ts b/driver/js/src/test/esprojects/ts/MyPrint.ts index 51f09eca7..168ce0eff 100644 --- a/driver/js/src/test/esprojects/ts/MyPrint.ts +++ b/driver/js/src/test/esprojects/ts/MyPrint.ts @@ -6,6 +6,6 @@ export class DatePrint { print(msg: string) { let date = new Date(1145141919810) - console.log(`[${this.prefix}] ${msg}. (${date})`) + console.log(`[${this.prefix}] ${msg}. (${date.toLocaleString("en-US", { timeZone: "America/New_York" })})`) } } diff --git a/driver/js/src/test/output/TS.check b/driver/js/src/test/output/TS.check index 87cffa027..a5908a56a 100644 --- a/driver/js/src/test/output/TS.check +++ b/driver/js/src/test/output/TS.check @@ -1 +1 @@ -[love from ts] hello world!. (Sun Apr 16 2006 06:58:39 GMT+0800 (China Standard Time)) +[love from ts] hello world!. (4/15/2006, 6:58:39 PM) From 299a3ec51a1b0e93f343d05072401d337fb51738 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 29 Jun 2023 11:56:24 +0800 Subject: [PATCH 152/202] WIP: Try to avoid printing red errors if they are expected --- driver/js/src/main/scala/driver/Driver.scala | 14 ++++----- .../src/main/scala/mlscript/Diagnostic.scala | 29 ++++++++++--------- .../src/test/scala/mlscript/DiffTests.scala | 2 +- 3 files changed, 22 insertions(+), 23 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 1605a2f45..9a7186b50 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -72,7 +72,7 @@ class Driver(options: DriverOptions) { report(err, options.ignoreTypeError, options.expectError) false case t : Throwable => - printErr(s"unexpected error: ${t.toString()}", options.expectError || options.ignoreTypeError) + printErr(s"unexpected error: ${t.toString()}") t.printStackTrace() false } @@ -262,10 +262,10 @@ class Driver(options: DriverOptions) { } catch { case CodeGenError(err) => totalErrors += 1 - printErr(s"codegen error: $err", options.ignoreTypeError || options.expectError) + printErr(s"codegen error: $err") case t : Throwable => totalErrors += 1 - printErr(s"unexpected error: ${t.toString()}", options.ignoreTypeError || options.expectError) + printErr(s"unexpected error: ${t.toString()}") t.printStackTrace() } } @@ -279,10 +279,8 @@ object Driver { "./driver/js/src/test/predefs/Predef.mlsi" ) - // avoid writing to stderr if the error is expected - private def printErr(msg: String, expectError: Boolean): Unit = - if (expectError) System.out.println(msg) - else System.err.println(msg) + private def printErr(msg: String): Unit = + System.err.println(msg) private var totalErrors = 0 @@ -305,6 +303,6 @@ object Driver { } case WarningReport(msg, loco, src) => () } - Diagnostic.report(diag, (msg: String) => printErr(msg, expectError || ignoreTypeError), 0, false) + Diagnostic.report(diag, printErr, 0, false, ignoreTypeError || expectError) } } diff --git a/shared/src/main/scala/mlscript/Diagnostic.scala b/shared/src/main/scala/mlscript/Diagnostic.scala index c3acaa753..abefa9a10 100644 --- a/shared/src/main/scala/mlscript/Diagnostic.scala +++ b/shared/src/main/scala/mlscript/Diagnostic.scala @@ -23,21 +23,22 @@ object Diagnostic { case object Compilation extends Source case object Runtime extends Source - def report(diag: Diagnostic, output: Str => Unit, blockLineNum: Int, showRelativeLineNums: Bool): Unit = { + def report(diag: Diagnostic, output: Str => Unit, blockLineNum: Int, showRelativeLineNums: Bool, expected: Bool): Unit = { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") - val headStr = diag match { - case ErrorReport(msg, loco, src) => - src match { - case Diagnostic.Lexing => - s"╔══[LEXICAL ERROR] " - case Diagnostic.Parsing => - s"╔══[PARSE ERROR] " - case _ => // TODO customize too - s"╔══[ERROR] " - } - case WarningReport(msg, loco, src) => - s"╔══[WARNING] " - } + val headStr = if (expected) s"╔══[EXPECTED] " else + diag match { + case ErrorReport(msg, loco, src) => + src match { + case Diagnostic.Lexing => + s"╔══[LEXICAL ERROR] " + case Diagnostic.Parsing => + s"╔══[PARSE ERROR] " + case _ => // TODO customize too + s"╔══[ERROR] " + } + case WarningReport(msg, loco, src) => + s"╔══[WARNING] " + } val lastMsgNum = diag.allMsgs.size - 1 var globalLineNum = blockLineNum // solely used for reporting useful test failure messages diag.allMsgs.zipWithIndex.foreach { case ((msg, loco), msgNum) => diff --git a/shared/src/test/scala/mlscript/DiffTests.scala b/shared/src/test/scala/mlscript/DiffTests.scala index f4df4fda9..c38347fe2 100644 --- a/shared/src/test/scala/mlscript/DiffTests.scala +++ b/shared/src/test/scala/mlscript/DiffTests.scala @@ -331,7 +331,7 @@ class DiffTests totalWarnings += 1 } val globalLineNum = blockLineNum - Diagnostic.report(diag, output, blockLineNum, showRelativeLineNums) + Diagnostic.report(diag, output, blockLineNum, showRelativeLineNums, false) if (!mode.fixme) { if (!allowTypeErrors && !mode.expectTypeErrors && diag.isInstanceOf[ErrorReport] && diag.source =:= Diagnostic.Typing) From 3704d159daab396e588416f5327771f4c1f44ce0 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 29 Jun 2023 12:21:01 +0800 Subject: [PATCH 153/202] WIP: Update test cases --- .../.interfaces/mlscript/MLS2TheMax.mlsi | 2 +- .../test/esprojects/js/mlscript/MLS2TheMax.js | 22 +++++++++---------- driver/js/src/test/esprojects/mlscript/A.mls | 2 +- driver/js/src/test/esprojects/mlscript/B.mls | 2 +- .../src/test/esprojects/mlscript/Cycle1.mls | 2 +- .../src/test/esprojects/mlscript/Cycle2.mls | 4 ++-- .../test/esprojects/mlscript/MLS2TheMax.mls | 10 ++++----- .../src/test/esprojects/mlscript/Opened.mls | 2 +- .../test/esprojects/mlscript/tools/Inc.mls | 2 +- 9 files changed, 24 insertions(+), 24 deletions(-) diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi index 273387baa..b9fc6400d 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi @@ -3,7 +3,7 @@ import "./tools/Concat.mlsi" declare module MLS2TheMax() { fun ask: (question: Str,) -> Str class Some[A](value: A) - class None() + module None fun parse: (s: Str,) -> (None | Some[Num]) class Game(name: Str) { fun check: (x: Num,) -> unit diff --git a/driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js b/driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js index 124f5e968..644711d2c 100644 --- a/driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js +++ b/driver/js/src/test/esprojects/js/mlscript/MLS2TheMax.js @@ -4,8 +4,8 @@ import { Concat } from "./tools/Concat.js" const MLS2TheMax = new class MLS2TheMax { #Some; - #None; #Game; + #None; constructor() { } ask(question) { @@ -18,7 +18,7 @@ const MLS2TheMax = new class MLS2TheMax { const self = this; return ((() => { let i = parseInt(s, undefined); - return isNaN(i) === true ? self.None() : self.Some(i); + return isNaN(i) === true ? self.None : self.Some(i); })()); } get main() { @@ -29,6 +29,15 @@ const MLS2TheMax = new class MLS2TheMax { return self.Game(name).loop; })()); } + get None() { + const outer = this; + if (this.#None === undefined) { + class None {} + this.#None = new None(); + this.#None.class = None; + } + return this.#None; + } get Some() { const outer = this; if (this.#Some === undefined) { @@ -44,15 +53,6 @@ const MLS2TheMax = new class MLS2TheMax { } return this.#Some; } - get None() { - const outer = this; - if (this.#None === undefined) { - class None {}; - this.#None = (() => Object.freeze(new None())); - this.#None.class = None; - } - return this.#None; - } get Game() { const outer = this; if (this.#Game === undefined) { diff --git a/driver/js/src/test/esprojects/mlscript/A.mls b/driver/js/src/test/esprojects/mlscript/A.mls index 7696d1135..710ed1e06 100644 --- a/driver/js/src/test/esprojects/mlscript/A.mls +++ b/driver/js/src/test/esprojects/mlscript/A.mls @@ -1 +1 @@ -class Foo(x: Int) {} +export class Foo(x: Int) {} diff --git a/driver/js/src/test/esprojects/mlscript/B.mls b/driver/js/src/test/esprojects/mlscript/B.mls index b43d7fb0b..51c99d11a 100644 --- a/driver/js/src/test/esprojects/mlscript/B.mls +++ b/driver/js/src/test/esprojects/mlscript/B.mls @@ -1,4 +1,4 @@ import "./A.mls" // FIXME: access to class member not yet supported -fun foo = A.Foo(12) +export fun foo = A.Foo(12) diff --git a/driver/js/src/test/esprojects/mlscript/Cycle1.mls b/driver/js/src/test/esprojects/mlscript/Cycle1.mls index bdcca299d..ff3eca7cb 100644 --- a/driver/js/src/test/esprojects/mlscript/Cycle1.mls +++ b/driver/js/src/test/esprojects/mlscript/Cycle1.mls @@ -1,5 +1,5 @@ import "./Cycle2.mls" -fun f(x: Int): Int = if x is +export fun f(x: Int): Int = if x is 0 then 114 _ then Cycle2.g(x - 1) diff --git a/driver/js/src/test/esprojects/mlscript/Cycle2.mls b/driver/js/src/test/esprojects/mlscript/Cycle2.mls index 4b7859aea..c45f4adc8 100644 --- a/driver/js/src/test/esprojects/mlscript/Cycle2.mls +++ b/driver/js/src/test/esprojects/mlscript/Cycle2.mls @@ -1,6 +1,6 @@ import "./Cycle1.mls" -fun g(x: Int): Int -fun g(x: Int): Int = Cycle1.f(x) +export fun g(x: Int): Int +export fun g(x: Int): Int = Cycle1.f(x) log(g(42)) diff --git a/driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls b/driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls index 28da0f12c..f12dfd48a 100644 --- a/driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls +++ b/driver/js/src/test/esprojects/mlscript/MLS2TheMax.mls @@ -5,14 +5,14 @@ fun ask(question: Str) = console.log(question) ReadLine.getStrLn() -class Some(value: A) -class None() +class Some[A](value: A) +module None fun parse(s: Str) = let i = parseInt(s, undefined) - if - isNaN(i) then None() - _ then Some(i) + if isNaN(i) + then None + else Some(i) class Game(name: Str) { let number = 4 // fixed, or we can not apply diff test diff --git a/driver/js/src/test/esprojects/mlscript/Opened.mls b/driver/js/src/test/esprojects/mlscript/Opened.mls index cc2a66b45..a96a22fd7 100644 --- a/driver/js/src/test/esprojects/mlscript/Opened.mls +++ b/driver/js/src/test/esprojects/mlscript/Opened.mls @@ -1,5 +1,5 @@ import "./tools/Inc.mls" -fun hello(x: Int) = log(("hello!", Inc.inc(x))) +export fun hello(x: Int) = log(("hello!", Inc.inc(x))) hello(114513) diff --git a/driver/js/src/test/esprojects/mlscript/tools/Inc.mls b/driver/js/src/test/esprojects/mlscript/tools/Inc.mls index 3aa64e5ce..339f71cb8 100644 --- a/driver/js/src/test/esprojects/mlscript/tools/Inc.mls +++ b/driver/js/src/test/esprojects/mlscript/tools/Inc.mls @@ -1 +1 @@ -fun inc(x: Int) = x + 1 +export fun inc(x: Int) = x + 1 From 329618798b233e5d0b183b5cd8ec24c57aab8f88 Mon Sep 17 00:00:00 2001 From: "Cunyuan(Holden) Gao" Date: Thu, 29 Jun 2023 13:02:13 +0800 Subject: [PATCH 154/202] Update shared/src/main/scala/mlscript/ConstraintSolver.scala Co-authored-by: Lionel Parreaux --- shared/src/main/scala/mlscript/ConstraintSolver.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index c40ac3cbb..5cc518389 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -36,7 +36,8 @@ class ConstraintSolver extends NormalForms { self: Typer => if (info.isComputing) { L(ErrorReport( - msg"${info.decl.kind.str.capitalize} `${info.decl.name}` is not supported yet." -> fld.toLoc :: Nil)) + // TODO improve + msg"${info.decl.kind.str.capitalize} `${info.decl.name}` has a cyclic type dependency that is not supported yet." -> fld.toLoc :: Nil)) } else info.complete() match { From 2764b3c52fea756d0cc5e064ce906b241be5b869 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 29 Jun 2023 12:42:50 +0800 Subject: [PATCH 155/202] WIP: Rerun test --- shared/src/test/diff/nu/MethodSignatures.mls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/src/test/diff/nu/MethodSignatures.mls b/shared/src/test/diff/nu/MethodSignatures.mls index 76612e996..6f0752d26 100644 --- a/shared/src/test/diff/nu/MethodSignatures.mls +++ b/shared/src/test/diff/nu/MethodSignatures.mls @@ -170,7 +170,7 @@ module M { fun a: M.A fun a = 1 } -//│ ╔══[ERROR] Module `M` is not supported yet. +//│ ╔══[ERROR] Module `M` has a cyclic type dependency that is not supported yet. //│ ║ l.170: fun a: M.A //│ ╙── ^^ //│ module M { From 44f319775d357207f3ce2218b2f6befab9e3c9fe Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sun, 2 Jul 2023 10:48:02 +0800 Subject: [PATCH 156/202] WIP: Minor changes --- .../js/src/test/esprojects/package-lock.json | 26 +-------- .../test/scala/driver/DriverDiffTests.scala | 56 +++++++++---------- .../scala/mlscript/ConstraintSolver.scala | 2 +- 3 files changed, 30 insertions(+), 54 deletions(-) diff --git a/driver/js/src/test/esprojects/package-lock.json b/driver/js/src/test/esprojects/package-lock.json index a066f3c89..65c3e4dce 100644 --- a/driver/js/src/test/esprojects/package-lock.json +++ b/driver/js/src/test/esprojects/package-lock.json @@ -1,21 +1,14 @@ { - "name": "projects", + "name": "esprojects", "lockfileVersion": 2, "requires": true, "packages": { "": { "dependencies": { - "@types/lodash": "^4.14.195", "fp-ts": "^2.16.0", - "json5": "^2.2.3", - "lodash": "^4.17.21" + "json5": "^2.2.3" } }, - "node_modules/@types/lodash": { - "version": "4.14.195", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", - "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" - }, "node_modules/fp-ts": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", @@ -31,19 +24,9 @@ "engines": { "node": ">=6" } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } }, "dependencies": { - "@types/lodash": { - "version": "4.14.195", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.195.tgz", - "integrity": "sha512-Hwx9EUgdwf2GLarOjQp5ZH8ZmblzcbTBC2wtQWNKARBSxM9ezRIAUpeDTgoQRAFB0+8CNWXVA9+MaSOzOF3nPg==" - }, "fp-ts": { "version": "2.16.0", "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.16.0.tgz", @@ -53,11 +36,6 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" - }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" } } } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 3384224d4..d9b91c12b 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -11,9 +11,9 @@ class DriverDiffTests extends AnyFunSuite { import ts2mls.JSFileSystem._ testCases.foreach { - case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, ignoreTypeError, expectError) => test(filename) { + case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, ignoreTypeError, expectError, forceCompiling) + DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, forceCompiling) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val success = driver.execute @@ -32,9 +32,7 @@ class DriverDiffTests extends AnyFunSuite { } object DriverDiffTests { - // For local environment, we may change the driver so forcing compiling is necessary - // but we can ban it during CI - private val forceCompiling = !sys.env.get("CI").isDefined + private val forceCompiling = true // TODO: check based on git private val diffPath = "driver/js/src/test/" private val outputPath = s"${diffPath}output/" @@ -48,7 +46,7 @@ object DriverDiffTests { commonJS: Boolean, execution: Option[(String, String)], tsconfig: Option[String], - ignoreTypeError: Boolean, + expectTypeError: Boolean, expectError: Boolean ) @@ -57,7 +55,7 @@ object DriverDiffTests { tsconfig: Option[String], workDir: String, jsPath: String, - ignoreTypeError: Boolean, + expectTypeError: Boolean, expectError: Boolean, commonJS: Boolean ) = TestOption( @@ -68,62 +66,62 @@ object DriverDiffTests { commonJS, Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), tsconfig, - ignoreTypeError, + expectTypeError, expectError ) private def cjsEntry( entryModule: String, tsconfig: Option[String] = None, - ignoreTypeError: Boolean = false, + expectTypeError: Boolean = false, expectError: Boolean = false ) = driverEntry(entryModule, tsconfig, s"${diffPath}cjsprojects/", - s"${diffPath}cjsprojects/js/", ignoreTypeError, expectError, true) + s"${diffPath}cjsprojects/js/", expectTypeError, expectError, true) private def esEntry( entryModule: String, tsconfig: Option[String] = None, - ignoreTypeError: Boolean = false, + expectTypeError: Boolean = false, expectError: Boolean = false ) = driverEntry(entryModule, tsconfig, s"${diffPath}esprojects/", - s"${diffPath}esprojects/js/", ignoreTypeError, expectError, false) + s"${diffPath}esprojects/js/", expectTypeError, expectError, false) - private def ts2mlsEntry(entryModule: String, ignoreTypeError: Boolean = false, expectError: Boolean = false) = - TestOption(s"./${entryModule}.mlsi", ts2mlsPath, "", ".", false, None, None, ignoreTypeError, expectError) + private def ts2mlsEntry(entryModule: String, expectTypeError: Boolean = false, expectError: Boolean = false) = + TestOption(s"./${entryModule}.mlsi", ts2mlsPath, "", ".", false, None, None, expectTypeError, expectError) private val testCases = List[TestOption]( esEntry("Simple"), esEntry("Cycle2"), esEntry("Self", expectError = true), esEntry("C", expectError = true), - esEntry("TS", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type members - esEntry("Output", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position - esEntry("Output2", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: type parameter position + esEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members + esEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position + esEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position esEntry("MLS2TheMax", Some("./tsconfig.json")), esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - cjsEntry("Lodash", Some("./tsconfig.json"), ignoreTypeError = true), // TODO: module member selection/trait types + cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types esEntry("Builtin"), cjsEntry("CJS1"), - ts2mlsEntry("BasicFunctions", ignoreTypeError = true), + ts2mlsEntry("BasicFunctions", expectTypeError = true), ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", ignoreTypeError = true), + ts2mlsEntry("Cycle1", expectTypeError = true), ts2mlsEntry("Dec"), ts2mlsEntry("Enum"), ts2mlsEntry("Escape"), - ts2mlsEntry("Export", ignoreTypeError = true), - ts2mlsEntry("Heritage", ignoreTypeError = true), + ts2mlsEntry("Export", expectTypeError = true), + ts2mlsEntry("Heritage", expectTypeError = true), ts2mlsEntry("HighOrderFunc"), ts2mlsEntry("Import"), ts2mlsEntry("InterfaceMember"), - ts2mlsEntry("Intersection", ignoreTypeError = true), + ts2mlsEntry("Intersection", expectTypeError = true), ts2mlsEntry("Literal"), ts2mlsEntry("Namespace", expectError = true), - ts2mlsEntry("Optional", ignoreTypeError = true), - ts2mlsEntry("Overload", ignoreTypeError = true), - ts2mlsEntry("TSArray", ignoreTypeError = true), - ts2mlsEntry("Tuple", ignoreTypeError = true), - ts2mlsEntry("Type", ignoreTypeError = true), - ts2mlsEntry("TypeParameter", ignoreTypeError = true), + ts2mlsEntry("Optional", expectTypeError = true), + ts2mlsEntry("Overload", expectTypeError = true), + ts2mlsEntry("TSArray", expectTypeError = true), + ts2mlsEntry("Tuple", expectTypeError = true), + ts2mlsEntry("Type", expectTypeError = true), + ts2mlsEntry("TypeParameter", expectTypeError = true), ts2mlsEntry("Union"), ts2mlsEntry("Variables", expectError = true), ) diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 5cc518389..fa3438647 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -766,7 +766,7 @@ class ConstraintSolver extends NormalForms { self: Typer => case (_, TypeBounds(lb, ub)) => rec(lhs, lb, true) case (p @ ProvType(und), _) => rec(und, rhs, true) case (_, p @ ProvType(und)) => rec(lhs, und, true) - case (_: TypeTag, _: TypeTag) if lhs === rhs => () + case (_: TypeTag, _: TypeTag) if lhs === rhs => () // required to allow signature overriding checks in declarations case (lhs: Unsupported, rhs: Unsupported) => () case (NegType(lhs), NegType(rhs)) => rec(rhs, lhs, true) From 708ce7186f819fba370ab32fb0d8f967fd4f9086 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 3 Jul 2023 10:04:55 +0800 Subject: [PATCH 157/202] WIP: Update test --- .../test/scala/driver/DriverDiffTests.scala | 48 +++++++++---------- .../scala/ts2mls/TSTypeGenerationTests.scala | 32 ++----------- 2 files changed, 29 insertions(+), 51 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index d9b91c12b..0886ba8cc 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -86,8 +86,8 @@ object DriverDiffTests { ) = driverEntry(entryModule, tsconfig, s"${diffPath}esprojects/", s"${diffPath}esprojects/js/", expectTypeError, expectError, false) - private def ts2mlsEntry(entryModule: String, expectTypeError: Boolean = false, expectError: Boolean = false) = - TestOption(s"./${entryModule}.mlsi", ts2mlsPath, "", ".", false, None, None, expectTypeError, expectError) + private def ts2mlsEntry(entryFile: String, expectTypeError: Boolean = false, expectError: Boolean = false) = + TestOption(s"./${entryFile}", "ts2mls/js/src/test/typescript", "", "../diff", false, None, None, expectTypeError, expectError) private val testCases = List[TestOption]( esEntry("Simple"), @@ -102,28 +102,28 @@ object DriverDiffTests { cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types esEntry("Builtin"), cjsEntry("CJS1"), - ts2mlsEntry("BasicFunctions", expectTypeError = true), - ts2mlsEntry("ClassMember"), - ts2mlsEntry("Cycle1", expectTypeError = true), - ts2mlsEntry("Dec"), - ts2mlsEntry("Enum"), - ts2mlsEntry("Escape"), - ts2mlsEntry("Export", expectTypeError = true), - ts2mlsEntry("Heritage", expectTypeError = true), - ts2mlsEntry("HighOrderFunc"), - ts2mlsEntry("Import"), - ts2mlsEntry("InterfaceMember"), - ts2mlsEntry("Intersection", expectTypeError = true), - ts2mlsEntry("Literal"), - ts2mlsEntry("Namespace", expectError = true), - ts2mlsEntry("Optional", expectTypeError = true), - ts2mlsEntry("Overload", expectTypeError = true), - ts2mlsEntry("TSArray", expectTypeError = true), - ts2mlsEntry("Tuple", expectTypeError = true), - ts2mlsEntry("Type", expectTypeError = true), - ts2mlsEntry("TypeParameter", expectTypeError = true), - ts2mlsEntry("Union"), - ts2mlsEntry("Variables", expectError = true), + ts2mlsEntry("BasicFunctions.ts", expectTypeError = true), + ts2mlsEntry("ClassMember.ts"), + ts2mlsEntry("Cycle1.ts", expectTypeError = true), + ts2mlsEntry("Dec.d.ts"), + ts2mlsEntry("Enum.ts"), + ts2mlsEntry("Escape.ts"), + ts2mlsEntry("Export.ts", expectTypeError = true), + ts2mlsEntry("Heritage.ts", expectTypeError = true), + ts2mlsEntry("HighOrderFunc.ts"), + ts2mlsEntry("Import.ts"), + ts2mlsEntry("InterfaceMember.ts"), + ts2mlsEntry("Intersection.ts", expectTypeError = true), + ts2mlsEntry("Literal.ts"), + ts2mlsEntry("Namespace.ts"), + ts2mlsEntry("Optional.ts", expectTypeError = true), + ts2mlsEntry("Overload.ts", expectTypeError = true), + ts2mlsEntry("TSArray.ts", expectTypeError = true), + ts2mlsEntry("Tuple.ts", expectTypeError = true), + ts2mlsEntry("Type.ts", expectTypeError = true), + ts2mlsEntry("TypeParameter.ts", expectTypeError = true), + ts2mlsEntry("Union.ts"), + ts2mlsEntry("Variables.ts"), ) private val cp = g.require("child_process") diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 7ae272065..706fdec35 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -8,40 +8,18 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), - !directlyImportedSet.contains(filename), - None - ) + false, None) program.generate }) } object TSTypeGenerationTest { + // we only generate type information for builtin declarations here. + // user-defined scripts may contain errors and printing error messages can lead to test failure + // if we use the two-pass test. + // builtin declarations should never contain an error. private val testsData = List( - "./BasicFunctions.ts", - "./ClassMember.ts", - "./Cycle1.ts", - "./Dec.d.ts", "./Dom.d.ts", - "./Enum.ts", "./ES5.d.ts", - "./Escape.ts", - "./Export.ts", - "./Heritage.ts", - "./HighOrderFunc.ts", - "./Import.ts", - "./InterfaceMember.ts", - "./Intersection.ts", - "./Literal.ts", - "./Namespace.ts", - "./Optional.ts", - "./Overload.ts", - "./TSArray.ts", - "./Tuple.ts", - "./Type.ts", - "./TypeParameter.ts", - "./Union.ts", - "./Variables.ts", ) - - private val directlyImportedSet = Set[String]("./ES5.d.ts", "./Dom.d.ts") } From 118071d161bb2d6224e0b8bb41f27840215eb3a8 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 3 Jul 2023 13:15:29 +0800 Subject: [PATCH 158/202] WIP: Redirect error messages --- driver/js/src/main/scala/driver/Driver.scala | 132 +++++++++++++----- .../src/main/scala/driver/DriverOptions.scala | 2 +- .../esprojects/.interfaces/mlscript/B.mlsi | 3 + .../esprojects/.interfaces/mlscript/C.mlsi | 12 ++ .../.interfaces/mlscript/MyPartialOrder.mlsi | 9 ++ .../esprojects/.interfaces/mlscript/Self.mlsi | 4 + .../esprojects/.interfaces/mlscript/TS.mlsi | 3 + .../js/src/test/esprojects/js/mlscript/C.js | 1 + .../test/scala/driver/DriverDiffTests.scala | 4 +- .../src/main/scala/mlscript/Diagnostic.scala | 4 +- .../src/test/scala/mlscript/DiffTests.scala | 2 +- .../js/src/main/scala/ts2mls/JSWriter.scala | 6 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 7 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 12 ++ ts2mls/js/src/test/diff/Cycle2.mlsi | 6 + ts2mls/js/src/test/diff/Export.mlsi | 9 ++ ts2mls/js/src/test/diff/Heritage.mlsi | 3 + ts2mls/js/src/test/diff/Intersection.mlsi | 24 ++++ ts2mls/js/src/test/diff/Namespace.mlsi | 4 + ts2mls/js/src/test/diff/Optional.mlsi | 9 ++ ts2mls/js/src/test/diff/TSArray.mlsi | 24 ++++ ts2mls/js/src/test/diff/Tuple.mlsi | 12 ++ ts2mls/js/src/test/diff/Type.mlsi | 6 + ts2mls/js/src/test/diff/TypeParameter.mlsi | 18 +++ ts2mls/js/src/test/diff/Variables.mlsi | 7 + .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 26 files changed, 276 insertions(+), 49 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/C.js diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 9a7186b50..4eea2f32a 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -30,6 +30,9 @@ class Driver(options: DriverOptions) { println(msg) } + // errors in imported files should be printed in their own files to avoid redundant + private val noRedundantRaise = (diag: Diagnostic) => () + private val importedModule = MutSet[String]() private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) @@ -59,7 +62,7 @@ class Driver(options: DriverOptions) { try { Driver.totalErrors = 0 implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.ignoreTypeError, options.expectError) + implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.expectTypeError, options.expectError) implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() @@ -68,15 +71,11 @@ class Driver(options: DriverOptions) { Driver.totalErrors == 0 } catch { - case err: Diagnostic => - report(err, options.ignoreTypeError, options.expectError) - false - case t : Throwable => - printErr(s"unexpected error: ${t.toString()}") - t.printStackTrace() + case err: Diagnostic => // we can not find a file to store the error message. print on the screen + report(err, options.expectTypeError, options.expectError) false } - + def genPackageJson(): Unit = { val content = // TODO: more settings? if (!options.commonJS) "{ \"type\": \"module\" }\n" @@ -151,6 +150,27 @@ class Driver(options: DriverOptions) { case (_, declarations, _, _) => declarations })) + private def checkTSInterface(file: FileInfo, writer: JSWriter): Unit = parse(file.filename, writer.getContent) match { + case (_, declarations, imports, origin) => + var ctx: Ctx = Ctx.init + val extrCtx: Opt[typer.ExtrCtx] = N + val vars: Map[Str, typer.SimpleType] = Map.empty + initTyper(ctx, noRedundantRaise, extrCtx, vars) + val reportRaise = (diag: Diagnostic) => + Diagnostic.report(diag, (s: String) => writer.writeErr(s), 0, false) + val tu = TypingUnit(declarations) + try { + imports.foreach(d => importModule(file.`import`(d.path))(ctx, extrCtx, vars)) + `type`(tu, false)(ctx, reportRaise, extrCtx, vars) + } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + writer.writeErr(t.toString()) + () + } + } + private def initTyper( implicit ctx: Ctx, raise: Raise, @@ -167,32 +187,53 @@ class Driver(options: DriverOptions) { } else imp // mlscript & node_module: use the original name + private def importModule(file: FileInfo)( + implicit ctx: Ctx, + extrCtx: Opt[typer.ExtrCtx], + vars: Map[Str, typer.SimpleType] + ): Unit = + parseAndRun(s"${options.path}/${file.interfaceFilename}", { + case (_, declarations, imports, _) => + imports.foreach(d => importModule(file.`import`(d.path))) + `type`(TypingUnit(declarations), false)(ctx, noRedundantRaise, extrCtx, vars) + }) + // return true if this file is recompiled. private def compile( file: FileInfo, exported: Boolean )( implicit ctx: Ctx, - raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType], stack: List[String] ): Boolean = { - val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") if (!isMLScirpt(file.filename)) { // TypeScript + System.out.println(s"generating interface for ${file.filename}...") val tsprog = - TSProgram(file, true, options.tsconfig) + TSProgram(file, true, options.tsconfig, checkTSInterface) return tsprog.generate } + + val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") + val mlsiWriter = JSWriter(mlsiFile) + implicit val raise: Raise = (diag: Diagnostic) => + Diagnostic.report(diag, (s: String) => mlsiWriter.writeErr(s), 0, false) parseAndRun(file.filename, { case (definitions, declarations, imports, _) => { val depList = imports.map(_.path) - val (cycleList, otherList) = depList.partitionMap { dep => { + val (cycleList, otherList) = depList.filter(dep => { val depFile = file.`import`(dep) - if (depFile.filename === file.filename) - throw ErrorReport(Ls((s"can not import ${file.filename} itself", None)), Diagnostic.Compilation) - else if (stack.contains(depFile.filename)) L(depFile) + if (depFile.filename === file.filename) { + totalErrors += 1 + mlsiWriter.writeErr(s"can not import ${file.filename} itself") + false + } + else true + }).partitionMap { dep => { + val depFile = file.`import`(dep) + if (stack.contains(depFile.filename)) L(depFile) else R(dep) } } @@ -214,32 +255,48 @@ class Driver(options: DriverOptions) { initTyper val newFilename = file.`import`(dp) importedModule += newFilename.filename - compile(newFilename, true)(newCtx, raise, newExtrCtx, newVars, stack :+ file.filename) + compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) } || nr) if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { System.out.println(s"compiling ${file.filename}...") - def importModule(file: FileInfo): Unit = - parseAndRun(s"${options.path}/${file.interfaceFilename}", { - case (_, declarations, imports, _) => - imports.foreach(d => importModule(file.`import`(d.path))) - `type`(TypingUnit(declarations), false) - }) - - otherList.foreach(d => importModule(file.`import`(d))) + try { otherList.foreach(d => importModule(file.`import`(d))) } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + mlsiWriter.writeErr(t.toString()) + } if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files - val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + + val expStr = try { + cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show) + } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + mlsiWriter.writeErr(t.toString()) + "" + } val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - saveToFile(mlsiFile, interfaces) - generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( - imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { - val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) - } - ), exported || importedModule(file.filename)) + mlsiWriter.write(interfaces) + mlsiWriter.close() + if (totalErrors == 0) + generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( + imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { + val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) + } + ), exported || importedModule(file.filename)) + } + else try { + `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files + } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + mlsiWriter.writeErr(t.toString()) + "" } - else `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files true } else false // no need to recompile @@ -262,11 +319,10 @@ class Driver(options: DriverOptions) { } catch { case CodeGenError(err) => totalErrors += 1 - printErr(s"codegen error: $err") + saveToFile(filename, s"//| codegen error: $err") case t : Throwable => totalErrors += 1 - printErr(s"unexpected error: ${t.toString()}") - t.printStackTrace() + saveToFile(filename, s"//| unexpected error: ${t.toString()}") } } @@ -290,7 +346,7 @@ object Driver { writer.close() } - private def report(diag: Diagnostic, ignoreTypeError: Boolean, expectError: Boolean): Unit = { + private def report(diag: Diagnostic, expectTypeError: Boolean, expectError: Boolean): Unit = { diag match { case ErrorReport(msg, loco, src) => src match { @@ -299,10 +355,10 @@ object Driver { case Diagnostic.Parsing => totalErrors += 1 case _ => - if (!ignoreTypeError) totalErrors += 1 + if (!expectTypeError) totalErrors += 1 } case WarningReport(msg, loco, src) => () } - Diagnostic.report(diag, printErr, 0, false, ignoreTypeError || expectError) + Diagnostic.report(diag, printErr, 0, false) } } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index b4935f352..54cace6c2 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -12,7 +12,7 @@ final case class DriverOptions( tsconfig: Option[String], interfaceDir: String, commonJS: Boolean, // generate common js or es5 - ignoreTypeError: Boolean, // ignore type errors for test + expectTypeError: Boolean, // ignore type errors for test expectError: Boolean, // the test should raise errors force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi index 483b49f9e..99af7e4a2 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi @@ -2,3 +2,6 @@ import "./A.mlsi" declare module B() { fun foo: error } +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.4: export fun foo = A.Foo(12) +//| ╙── ^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi index 8d8ba6285..6b325e2c2 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi @@ -4,3 +4,15 @@ declare module C() { let b: error unit } +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.4: let b = A.Foo(0) // not allowed, unless we import "A.mls" +//| ╙── ^^^^ +//| ╔══[ERROR] Type mismatch in field selection: +//| ║ l.5: console.log(a.x) +//| ║ ^^^ +//| ╟── type `error` does not have field 'x' +//| ║ l.3: fun foo: error +//| ║ ^^^^^ +//| ╟── but it flows into reference with expected type `{x: ?x}` +//| ║ l.5: console.log(a.x) +//| ╙── ^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi new file mode 100644 index 000000000..fab41cad0 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi @@ -0,0 +1,9 @@ +import "fp-ts/BoundedMeetSemilattice.mlsi" +declare module MyPartialOrder() { + class MyPartialOrder + let order: MyPartialOrder +} +//| java.lang.Exception: Internal Error: Program reached and unexpected state. +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.3: class MyPartialOrder extends BoundedMeetSemilattice.BoundedMeetSemilattice { +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi new file mode 100644 index 000000000..080bf0a58 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi @@ -0,0 +1,4 @@ +declare module Self() { + class Foo() +} +//| can not import driver/js/src/test/esprojects/mlscript/Self.mls itself diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi index 2faaaa941..9db659d00 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi @@ -4,3 +4,6 @@ declare module TS() { let printer: error error } +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.3: let tspt = MyPrint.DatePrint +//| ╙── ^^^^^^^^^^ diff --git a/driver/js/src/test/esprojects/js/mlscript/C.js b/driver/js/src/test/esprojects/js/mlscript/C.js new file mode 100644 index 000000000..978d4e339 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/C.js @@ -0,0 +1 @@ +//| codegen error: unresolved symbol A \ No newline at end of file diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 0886ba8cc..c8f785913 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -115,7 +115,7 @@ object DriverDiffTests { ts2mlsEntry("InterfaceMember.ts"), ts2mlsEntry("Intersection.ts", expectTypeError = true), ts2mlsEntry("Literal.ts"), - ts2mlsEntry("Namespace.ts"), + ts2mlsEntry("Namespace.ts", expectError = true), ts2mlsEntry("Optional.ts", expectTypeError = true), ts2mlsEntry("Overload.ts", expectTypeError = true), ts2mlsEntry("TSArray.ts", expectTypeError = true), @@ -123,7 +123,7 @@ object DriverDiffTests { ts2mlsEntry("Type.ts", expectTypeError = true), ts2mlsEntry("TypeParameter.ts", expectTypeError = true), ts2mlsEntry("Union.ts"), - ts2mlsEntry("Variables.ts"), + ts2mlsEntry("Variables.ts", expectError = true), ) private val cp = g.require("child_process") diff --git a/shared/src/main/scala/mlscript/Diagnostic.scala b/shared/src/main/scala/mlscript/Diagnostic.scala index abefa9a10..7ba6f4928 100644 --- a/shared/src/main/scala/mlscript/Diagnostic.scala +++ b/shared/src/main/scala/mlscript/Diagnostic.scala @@ -23,9 +23,9 @@ object Diagnostic { case object Compilation extends Source case object Runtime extends Source - def report(diag: Diagnostic, output: Str => Unit, blockLineNum: Int, showRelativeLineNums: Bool, expected: Bool): Unit = { + def report(diag: Diagnostic, output: Str => Unit, blockLineNum: Int, showRelativeLineNums: Bool): Unit = { val sctx = Message.mkCtx(diag.allMsgs.iterator.map(_._1), "?") - val headStr = if (expected) s"╔══[EXPECTED] " else + val headStr = diag match { case ErrorReport(msg, loco, src) => src match { diff --git a/shared/src/test/scala/mlscript/DiffTests.scala b/shared/src/test/scala/mlscript/DiffTests.scala index c38347fe2..f4df4fda9 100644 --- a/shared/src/test/scala/mlscript/DiffTests.scala +++ b/shared/src/test/scala/mlscript/DiffTests.scala @@ -331,7 +331,7 @@ class DiffTests totalWarnings += 1 } val globalLineNum = blockLineNum - Diagnostic.report(diag, output, blockLineNum, showRelativeLineNums, false) + Diagnostic.report(diag, output, blockLineNum, showRelativeLineNums) if (!mode.fixme) { if (!allowTypeErrors && !mode.expectTypeErrors && diag.isInstanceOf[ErrorReport] && diag.source =:= Diagnostic.Typing) diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 7d0910193..d2ebbf241 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -9,18 +9,22 @@ class JSWriter(filename: String) { import JSFileSystem._ private val buffer = new StringBuilder() + private val err = new StringBuilder() def writeln(str: String): Unit = write(str + "\n") def write(str: String): Unit = buffer ++= str + def writeErr(str: String): Unit = err ++= s"//| $str\n" // return true if the file has been updated def close(): Boolean = { - val str = buffer.toString() + val str = buffer.toString() + err.toString() val origin = readFile(filename).getOrElse("") val updated = str =/= origin if (updated) writeFile(filename, str) updated } + + def getContent: String = buffer.toString() } object JSWriter { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index c15faf3b6..ee76b4166 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -10,7 +10,7 @@ import scala.collection.mutable.{HashSet, HashMap} // import * as TopLevelModuleName from "filename" // for es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files -class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String]) { +class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String], typer: (FileInfo, JSWriter) => Unit) { private implicit val configContent = TypeScript.parseOption(file.workDir, tsconfig) private val program = TypeScript.createProgram(Seq( if (file.isNodeModule) file.resolve @@ -85,6 +85,7 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str if (ambientNS.isEmpty) { generate(writer, globalNamespace, moduleName, globalNamespace.isCommonJS) + typer(file, writer) writer.close() } else false @@ -100,6 +101,6 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } object TSProgram { - def apply(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String]) = - new TSProgram(file, uesTopLevelModule, tsconfig) + def apply(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String], typer: (FileInfo, JSWriter) => Unit) = + new TSProgram(file, uesTopLevelModule, tsconfig, typer) } diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 9db221c75..1c8f81cbe 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -24,3 +24,15 @@ export declare module BasicFunctions { fun inn2(b: Barrrrrrrrr): unit fun out2(): Barrrrrrrrr } +//| ╔══[ERROR] type identifier not found: Foooooo +//| ║ l.19: fun inn(f: Foooooo): unit +//| ╙── ^^^^^^^ +//| ╔══[ERROR] type identifier not found: Foooooo +//| ║ l.20: fun out1(): Foooooo +//| ╙── ^^^^^^^ +//| ╔══[ERROR] type identifier not found: Barrrrrrrrr +//| ║ l.24: fun inn2(b: Barrrrrrrrr): unit +//| ╙── ^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Barrrrrrrrr +//| ║ l.25: fun out2(): Barrrrrrrrr +//| ╙── ^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi index 1dbbfe48a..b4c950651 100644 --- a/ts2mls/js/src/test/diff/Cycle2.mlsi +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -6,3 +6,9 @@ export declare module Cycle2 { export declare class B {} val a: Cycle1.A } +//| ╔══[ERROR] Module `Cycle1` has a cyclic type dependency that is not supported yet. +//| ║ l.7: val a: Cycle1.A +//| ╙── ^^ +//| ╔══[ERROR] Module `Cycle1` has a cyclic type dependency that is not supported yet. +//| ║ l.7: val a: Cycle1.A +//| ╙── ^^ diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index dd8be9966..798b37bf9 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -16,3 +16,12 @@ export declare module Export { export val G = Dependency.B export val H = Dependency } +//| ╔══[ERROR] type identifier not found: IBar +//| ║ l.4: export fun Baz(aa: Str): IBar +//| ╙── ^^^^ +//| ╔══[ERROR] type identifier not found: IBar +//| ║ l.11: export val baz: IBar +//| ╙── ^^^^ +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.16: export val G = Dependency.B +//| ╙── ^^ diff --git a/ts2mls/js/src/test/diff/Heritage.mlsi b/ts2mls/js/src/test/diff/Heritage.mlsi index 8a36b93f6..39481956e 100644 --- a/ts2mls/js/src/test/diff/Heritage.mlsi +++ b/ts2mls/js/src/test/diff/Heritage.mlsi @@ -6,3 +6,6 @@ export declare module Heritage { } declare class Y extends Five.ROTK {} } +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.7: declare class Y extends Five.ROTK {} +//| ╙── ^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 9324b0474..16373ce21 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -17,3 +17,27 @@ export declare module Intersection { declare class B {} fun inter(c: (A) & (B)): (A) & (B) } +//| ╔══[ERROR] type identifier not found: IA +//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ +//| ╔══[ERROR] type identifier not found: IB +//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ +//| ╔══[ERROR] type identifier not found: IA +//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ +//| ╔══[ERROR] type identifier not found: IB +//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ +//| ╔══[ERROR] type identifier not found: A +//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ +//| ╔══[ERROR] type identifier not found: A +//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index e204e92d3..8b8a2a920 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -28,3 +28,7 @@ export declare module Namespace { fun f1(x: N1.C): N1.C fun f2(x: AA.C): AA.C } +//| ╔══[ERROR] type identifier not found: N1 +//| ║ l.28: fun f1(x: N1.C): N1.C +//| ╙── ^^ +//| java.lang.Exception: Internal Error: Program reached and unexpected state. diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 2e1212726..8993e5cfb 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -20,3 +20,12 @@ export declare module Optional { } fun boom(b: (B[nothing]) | (undefined)): anything } +//| ╔══[ERROR] type identifier not found: ABC +//| ║ l.13: fun testABC(abc: (ABC) | (undefined)): unit +//| ╙── ^^^^^ +//| ╔══[ERROR] type identifier not found: SquareConfig +//| ║ l.14: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit +//| ╙── ^^^^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.21: fun boom(b: (B[nothing]) | (undefined)): anything +//| ╙── ^^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/TSArray.mlsi b/ts2mls/js/src/test/diff/TSArray.mlsi index 6f0a6ae3d..7869243ab 100644 --- a/ts2mls/js/src/test/diff/TSArray.mlsi +++ b/ts2mls/js/src/test/diff/TSArray.mlsi @@ -19,3 +19,27 @@ export declare module TSArray { fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] } +//| ╔══[ERROR] type identifier not found: C +//| ║ l.10: fun doCs(c: MutArray[C]): MutArray[C] +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: C +//| ║ l.10: fun doCs(c: MutArray[C]): MutArray[C] +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: I +//| ║ l.11: fun doIs(i: MutArray[I]): MutArray[I] +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: I +//| ║ l.11: fun doIs(i: MutArray[I]): MutArray[I] +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: Temp +//| ║ l.19: fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Temp +//| ║ l.19: fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Temp +//| ║ l.20: fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] +//| ╙── ^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Temp +//| ║ l.20: fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] +//| ╙── ^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index d6684ce7f..8c1c32923 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -16,3 +16,15 @@ export declare module Tuple { declare class B {} fun swap(x: (A, B, )): (B, A, ) } +//| ╔══[ERROR] type identifier not found: A +//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ +//| ╔══[ERROR] type identifier not found: A +//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index f47db1055..e6259fc68 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -28,3 +28,9 @@ export declare module Type { val none: {_tag: "None",} fun some['A](a: 'A): (None) | (Some['A]) } +//| ╔══[ERROR] type identifier not found: None +//| ║ l.29: fun some['A](a: 'A): (None) | (Some['A]) +//| ╙── ^^^^^^ +//| ╔══[ERROR] type identifier not found: Some +//| ║ l.29: fun some['A](a: 'A): (None) | (Some['A]) +//| ╙── ^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index b1de4572e..96ddaca1e 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -27,3 +27,21 @@ export declare module TypeParameter { type PolyToString = forall 'T; (x: 'T) => Str type PolyID = forall 'T; (x: 'T) => 'T } +//| ╔══[ERROR] type identifier not found: Printer +//| ║ l.10: fun setStringPrinter(p: Printer[Str]): unit +//| ╙── ^^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Printer +//| ║ l.11: fun getStringPrinter(): Printer[Str] +//| ╙── ^^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Printer +//| ║ l.12: fun foo['T](p: Printer['T], x: 'T): 'T +//| ╙── ^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: Printer +//| ║ l.13: fun foo2['T](p: Printer['T], x: 'T): 'T +//| ╙── ^^^^^^^^^^^ +//| ╔══[ERROR] type identifier not found: FFF +//| ║ l.25: fun fff(p: FFF[Str], s: Str): unit +//| ╙── ^^^^^^^^ +//| ╔══[ERROR] type identifier not found: FFF +//| ║ l.26: fun getFFF(): FFF[Num] +//| ╙── ^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Variables.mlsi b/ts2mls/js/src/test/diff/Variables.mlsi index 6741892d2..cd0d11a87 100644 --- a/ts2mls/js/src/test/diff/Variables.mlsi +++ b/ts2mls/js/src/test/diff/Variables.mlsi @@ -14,3 +14,10 @@ export declare module Variables { val bar: Num } } +//| ╔══[ERROR] type identifier not found: FooBar +//| ║ l.7: val fb: FooBar +//| ╙── ^^^^^^ +//| ╔══[ERROR] type identifier not found: ABC +//| ║ l.11: val d: ABC.DEF +//| ╙── ^^^ +//| java.lang.Exception: Internal Error: Program reached and unexpected state. diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 706fdec35..0a22e0ac5 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -8,7 +8,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), - false, None) + false, None, (file: FileInfo, writer: JSWriter) => ()) // no need for builtin program.generate }) } From 815c31fe26c396e0dc9f1bd7a605d5c739ddc5c7 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 3 Jul 2023 13:55:16 +0800 Subject: [PATCH 159/202] WIP: Add typing debug option --- driver/js/src/main/scala/driver/Driver.scala | 20 +- .../.interfaces/mlscript/TyperDebug.mlsi | 577 ++++++++++++++++++ .../test/esprojects/js/mlscript/TyperDebug.js | 33 + .../test/esprojects/mlscript/TyperDebug.mls | 6 + driver/js/src/test/output/TyperDebug.check | 1 + .../test/scala/driver/DriverDiffTests.scala | 1 + .../js/src/main/scala/ts2mls/JSWriter.scala | 4 +- 7 files changed, 638 insertions(+), 4 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/TyperDebug.js create mode 100644 driver/js/src/test/esprojects/mlscript/TyperDebug.mls create mode 100644 driver/js/src/test/output/TyperDebug.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 4eea2f32a..6b07599b0 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -15,13 +15,19 @@ class Driver(options: DriverOptions) { import JSFileSystem._ import JSDriverBackend.ModuleType + private var dbgWriter: Option[JSWriter] = None + private def printDbg(msg: String) = + dbgWriter.fold(println(msg))(writer => writer.writeDbg(msg)) + private val typer = new mlscript.Typer( dbg = false, verbose = false, explainErrors = false, newDefs = true - ) + ) { + override def emitDbg(str: String): Unit = printDbg(str) + } import typer._ @@ -89,6 +95,10 @@ class Driver(options: DriverOptions) { import fastparse.Parsed.{Success, Failure} val lines = content.splitSane('\n').toIndexedSeq + lines.headOption match { + case S(head) => typer.dbg = head.startsWith("//") && head.endsWith(":d") + case _ => typer.dbg = false + } val fph = new mlscript.FastParseHelpers(content, lines) val origin = Origin(filename, 1, fph) val lexer = new NewLexer(origin, throw _, dbg = false) @@ -268,8 +278,12 @@ class Driver(options: DriverOptions) { } if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = try { - cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + - packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show) + cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + { + dbgWriter = Some(mlsiWriter); + val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show); + dbgWriter = None + res + } } catch { case t : Throwable => diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi new file mode 100644 index 000000000..91ed5a8ed --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi @@ -0,0 +1,577 @@ +declare module TyperDebug() { + class A(x: Int) { + fun add: (y: Int,) -> Int + } + let aa: A + unit +} +//| 0. Typing TypingUnit(List(class A(x: Int,) {fun add = (y: Int,) => + (x,) (y,)}, let aa = A (42,), (console).log ((aa).add (6,),))) +//| | 0. Created lazy type info for class A(x: Int,) {fun add = (y: Int,) => + (x,) (y,)} +//| | 0. Created lazy type info for let aa = A (42,) +//| | Completing class A(x: Int,) {fun add = (y: Int,) => + (x,) (y,)} +//| | | UNSTASHING... (out) +//| | | Type params +//| | | Typing type TypeName(Int) +//| | | | vars=Map() newDefsInfo=Map() +//| | | | 1. type TypeName(Int) +//| | | | => Int +//| | | => Int ——— +//| | | UNSTASHING... (out) +//| | | Params (x,Int) +//| | | UNSTASHING... (out) +//| | | UNSTASHING... (out) +//| | | 1. Finalizing inheritance with ({} w/ {x: Int} & A) <: a829' +//| | | | CONSTRAIN ({} w/ {x: Int} & A) ) + (x,) (y,))) +//| | | | 1. Created lazy type info for fun add = (y: Int,) => + (x,) (y,) +//| | | | Completing fun add = (y: Int,) => + (x,) (y,) +//| | | | | UNSTASHING... (out) +//| | | | | Type params +//| | | | | UNSTASHING... (out) +//| | | | | Params +//| | | | | 2. Typing term (y: Int,) => + (x,) (y,) +//| | | | | | 2. Typing pattern y: Int, +//| | | | | | | 2. Typing pattern y : Int +//| | | | | | | | Typing type TypeName(Int) +//| | | | | | | | | vars=Map() newDefsInfo=Map() +//| | | | | | | | | 2. type TypeName(Int) +//| | | | | | | | | => Int +//| | | | | | | | => Int ——— +//| | | | | | | 2. : Int +//| | | | | | 2. : (y: Int,) +//| | | | | | 2. Typing term + (x,) (y,) +//| | | | | | | 2. Typing term + (x,) +//| | | | | | | | 2. Typing term + +//| | | | | | | | 2. : (Int -> (Int -> Int)) +//| | | | | | | | 2. Typing term x +//| | | | | | | | 2. : Int +//| | | | | | | | CONSTRAIN (Int -> (Int -> Int)) α830'') +//| | | | | | | | where +//| | | | | | | | 2. C (Int -> (Int -> Int)) α830'') (0) +//| | | | | | | | | 2. C (Int -> (Int -> Int)) α830'') (0) +//| | | | | | | | | | 2. C (Int -> (Int -> Int)) α830'') (0) +//| | | | | | | | | | | 2. C (Int,) Int) α831'') +//| | | | | | | where + α830'' :> (Int -> Int) +//| | | | | | | 2. C α830'' α831'') (0) +//| | | | | | | | 2. C α830'' α831'') (0) +//| | | | | | | | | NEW α830'' UB (2) +//| | | | | | | | | 2. C (Int -> Int) α831'') (2) +//| | | | | | | | | | 2. C (Int -> Int) α831'') (2) +//| | | | | | | | | | | 2. C (Int,) α831'') +//| | | | | UNSTASHING... (out) +//| | | | | CONSTRAIN ((y: Int,) -> α831'') Int +//| | | | | 2. C ((y: Int,) -> α831'') α831'') + (x,) (y,),((y: Int,) -> α831'')) where + α831'' :> Int +//| | | | Typing unit statements +//| | | | : None +//| | | Checking base class implementations... +//| | | | (List(),List(TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831'')))) +//| | | | UNSTASHING... (out) +//| | | Checking new implementations... +//| | | | Checking overriding for `add`... +//| | | | Checking overriding for `x`... +//| | | | UNSTASHING... (out) +//| | | UNSTASHING... (out) +//| | | Computing variances of A +//| | | | Trav(+)(({} w/ {x: Int} & A)) +//| | | | | Trav(+)({} w/ {x: Int}) +//| | | | | | Trav(+)(({}\x & {x: Int})) +//| | | | | | | Trav(+)({}\x) +//| | | | | | | | Trav(+)({}) +//| | | | | | | Trav(+)({x: Int}) +//| | | | | | | | Trav(+)(Int) +//| | | | | Trav(+)(A) +//| | | = HashMap() +//| | | UNSTASHING... (out) +//| | Completed TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831''))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) where + α831'' :> Int +//| | Completing let aa = A (42,) +//| | | UNSTASHING... (out) +//| | | Type params +//| | | UNSTASHING... (out) +//| | | Params +//| | | 0. Typing term A (42,) +//| | | | 0. Typing term A +//| | | | 0. : ((x: Int,) -> A) +//| | | | 0. Typing term 42 +//| | | | 0. : 42 +//| | | | CONSTRAIN ((x: Int,) -> A) ,) -> α833) +//| | | | where +//| | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) +//| | | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) +//| | | | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) +//| | | | | | | 0. C (42,) A +//| | | 1. C α833 A +//| | Typing unit statements +//| | | 0. Typing term (console).log ((aa).add (6,),) +//| | | | 0. Typing term (console).log +//| | | | | 0. Typing term console +//| | | | | 0. : ‹∀ 0. Console› +//| | | | | CONSTRAIN ‹∀ 0. Console› Unit)) where +//| | | | | | | | | | | | | Fresh[0] Console.log : Some(((args0: (Anything | MutArray[Anything]),) -> Unit)) where Some() +//| | | | | | | | | | | | | & None (from refinement) +//| | | | | | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) Unit) A +//| | | | | | 0. C α833 α831'')›) where + α831'' :> Int +//| | | | | | | | | | | | Fresh[0] A.add : Some(‹∀ 1. ((y: Int,) -> α831'')›) where Some( + α831'' :> Int) +//| | | | | | | | | | | | & None (from refinement) +//| | | | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› +//| | | | | CONSTRAIN add836 ,) -> α837) +//| | | | | where + α831'' :> Int + add836 :> ‹∀ 1. ((y: Int,) -> α831'')› +//| | | | | 0. C add836 ,) -> α837) (0) +//| | | | | | 0. C add836 ,) -> α837) (0) +//| | | | | | | NEW add836 UB (0) +//| | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | | | | INST [1] ‹∀ 1. ((y: Int,) -> α831'')› +//| | | | | | | | | | where + α831'' :> Int +//| | | | | | | | | | TO [0] ~> ((y: Int,) -> α831_838) +//| | | | | | | | | | where + α831_838 :> Int +//| | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) +//| | | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) +//| | | | | | | | | | | | 0. C (6,) α839) +//| | | | where + log835 :> ((args0: (Anything | MutArray[Anything]),) -> Unit) + α837 :> Int +//| | | | 0. C log835 α839) (0) +//| | | | | 0. C log835 α839) (0) +//| | | | | | NEW log835 UB (0) +//| | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α839) (2) +//| | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α839) (2) +//| | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α839) (2) +//| | | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α839) (2) +//| | | | | | | | | | 0. C (α837,) + (x,) (y,),((y: Int,) -> α831''))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),α833) + Some(α839)) +//| where: + α831'' :> Int + α833 :> A <: {add: add836} + add836 :> ‹∀ 1. ((y: Int,) -> α831'')› <: ((6,) -> α837) + α837 :> Int <: (Anything | MutArray[Anything]) + α839 :> Unit +//| allVarPols: +α831'', +α833, +α839 +//| Renewed α831'' ~> α831_840'' +//| Renewed α833 ~> α833_841 +//| Renewed α839 ~> α839_842 +//| ⬤ Cleaned up: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),α833_841) + Some(α839_842)) +//| where: + α831_840'' :> Int + α833_841 :> A + α839_842 :> Unit +//| allVarPols: +α831_840'', +α833_841, +α839_842 +//| consed: Map((true,Int) -> α831_840'', (true,A) -> α833_841, (true,Unit) -> α839_842) +//| !unskid-1! Int -> α831_840'' +//| !unskid-1! Int -> α831_840'' +//| !unskid-1! Int -> α831_840'' +//| !unskid-1! A -> α833_841 +//| ⬤ Unskid: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,α831_840'')), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) + (x,NuParam(x,α831_840'')), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),α833_841) + Some(α839_842)) +//| where: + α831_840'' :> Int + α833_841 :> A + α839_842 :> Unit +//| analyze1[+] α831_840'' +//| | analyze1[+;@[+](0)] Int +//| analyze1[+] ((y: Int,) -> α831_840'') +//| | analyze1[+;-] (y: Int,) +//| | | analyze1[+;-] Int +//| | analyze1[+] α831_840'' +//| analyze1[+] α831_840'' +//| analyze1[+;-] ⊤ +//| analyze1[+;-] ⊤ +//| analyze1[+] α833_841 +//| | analyze1[+;@[+](0)] A +//| analyze1[+] α839_842 +//| | analyze1[+;@[+](0)] Unit +//| [inv] +//| [nums] +α831_840'' 3 ; +α833_841 1 ; +α839_842 1 +//| analyze2[+] α831_840'' +//| | >> Processing α831_840'' at [+] +//| | go α831_840'' () +//| | | go Int (α831_840'') +//| | >> Occurrences HashSet(α831_840'', Int) +//| | >>>> occs[+α831_840''] := HashSet(α831_840'', Int) <~ None +//| | analyze2[+] Int +//| analyze2[+] ((y: Int,) -> α831_840'') +//| | analyze2[+;-] (y: Int,) +//| | | analyze2[+;-] Int +//| | analyze2[+] α831_840'' +//| analyze2[+] α831_840'' +//| analyze2[+;-] ⊤ +//| analyze2[+;-] ⊤ +//| analyze2[+] α833_841 +//| | >> Processing α833_841 at [+] +//| | go α833_841 () +//| | | go A (α833_841) +//| | >> Occurrences HashSet(A, α833_841) +//| | >>>> occs[+α833_841] := HashSet(A, α833_841) <~ None +//| | analyze2[+] A +//| analyze2[+] α839_842 +//| | >> Processing α839_842 at [+] +//| | go α839_842 () +//| | | go Unit (α839_842) +//| | >> Occurrences HashSet(Unit, α839_842) +//| | >>>> occs[+α839_842] := HashSet(Unit, α839_842) <~ None +//| | analyze2[+] Unit +//| [occs] +α831_840'' {α831_840'',Int} ; +α833_841 {A,α833_841} ; +α839_842 {Unit,α839_842} +//| [vars] TreeSet(α831_840'', α833_841, α839_842) +//| [rec] Set() +//| 0[1] α833_841 +//| 0[1] α839_842 +//| 1[!] α831_840'' +//| 1[!] α833_841 +//| 1[!] α839_842 +//| [sub] α831_840'' -> None, α833_841 -> None, α839_842 -> None +//| [bounds] + α831_840'' :> Int + α833_841 :> A + α839_842 :> Unit +//| [rec] Set() +//| transform[+] α831_840'' () + None +//| | -> bound Some(true) +//| | transform[+] Int (α831_840'') +;@[+](0) None +//| | ~> Int +//| ~> Int +//| transform[+] ((y: Int,) -> α831_840'') () + None +//| | transform[-] (y: Int,) () +;- None +//| | | transform[-] Int () +;- None +//| | | ~> Int +//| | ~> (y: Int,) +//| | transform[+] α831_840'' () + None +//| | | -> bound Some(true) +//| | | transform[+] Int (α831_840'') +;@[+](0) None +//| | | ~> Int +//| | ~> Int +//| ~> ((y: Int,) -> Int) +//| transform[+] α831_840'' () + None +//| | -> bound Some(true) +//| | transform[+] Int (α831_840'') +;@[+](0) None +//| | ~> Int +//| ~> Int +//| transform[-] ⊤ () +;- None +//| ~> ⊤ +//| transform[+] ⊤ () + None +//| ~> ⊤ +//| transform[+] (⊤ w/ {x: α831_840''} & α833_841) () + None +//| | transform[+] ⊤ w/ {x: α831_840''} () + None +//| | | transform[+] ⊤ () + None +//| | | ~> ⊤ +//| | | transform[+] α831_840'' () + None +//| | | | -> bound Some(true) +//| | | | transform[+] Int (α831_840'') +;@[+](0) None +//| | | | ~> Int +//| | | ~> Int +//| | ~> ⊤ w/ {x: Int} +//| | transform[+] α833_841 () + None +//| | | -> bound Some(true) +//| | | transform[+] A (α833_841) +;@[+](0) None +//| | | ~> A +//| | ~> A +//| ~> (⊤ w/ {x: Int} & A) +//| transform[+] α833_841 () + None +//| | -> bound Some(true) +//| | transform[+] A (α833_841) +;@[+](0) None +//| | ~> A +//| ~> A +//| transform[+] α839_842 () + None +//| | -> bound Some(true) +//| | transform[+] Unit (α839_842) +;@[+](0) None +//| | ~> Unit +//| ~> Unit +//| ⬤ Type after simplification: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(Unit)) +//| where: +//| allVarPols: +//| normLike[+] TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(Unit)) +//| | norm[+] Int +//| | | DNF: DNF(0, Int{}) +//| | ~> Int +//| | norm[+] ((y: Int,) -> Int) +//| | | DNF: DNF(0, ((y: Int,) -> Int){}) +//| | | norm[-] (y: Int,) +//| | | | DNF: DNF(0, (y: Int,){}) +//| | | | norm[-] Int +//| | | | | DNF: DNF(0, Int{}) +//| | | | ~> Int +//| | | ~> (y: Int,) +//| | | norm[+] Int +//| | | | DNF: DNF(0, Int{}) +//| | | ~> Int +//| | ~> ((y: Int,) -> Int) +//| | norm[+] Int +//| | | DNF: DNF(0, Int{}) +//| | ~> Int +//| | norm[-] ⊤ +//| | | DNF: DNF(0, ) +//| | ~> ⊤ +//| | norm[+] ⊤ +//| | | DNF: DNF(0, ) +//| | ~> ⊤ +//| | norm[+] (⊤ w/ {x: Int} & A) +//| | | DNF: DNF(0, A{x: Int}) +//| | | norm[+] Int +//| | | | DNF: DNF(0, Int{}) +//| | | ~> Int +//| | | rcd2 {x: Int} +//| | | typeRef A +//| | | clsFields +//| | ~> (A & {x: Int}) +//| | norm[+] A +//| | | DNF: DNF(0, A{}) +//| | | rcd2 {} +//| | | typeRef A +//| | | clsFields +//| | ~> A +//| | norm[+] Unit +//| | | DNF: DNF(0, unit<>{}) +//| | ~> unit<> +//| ⬤ Normalized: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(unit<>)) +//| where: +//| allVarPols: +//| ⬤ Cleaned up: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(unit<>)) +//| where: +//| allVarPols: +//| consed: Map() +//| ⬤ Unskid: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(unit<>)) +//| where: +//| analyze1[+] Int +//| analyze1[+] ((y: Int,) -> Int) +//| | analyze1[+;-] (y: Int,) +//| | | analyze1[+;-] Int +//| | analyze1[+] Int +//| analyze1[+] Int +//| analyze1[+;-] ⊤ +//| analyze1[+;-] ⊤ +//| analyze1[+] A +//| analyze1[+] unit<> +//| [inv] +//| [nums] +//| analyze2[+] Int +//| analyze2[+] ((y: Int,) -> Int) +//| | analyze2[+;-] (y: Int,) +//| | | analyze2[+;-] Int +//| | analyze2[+] Int +//| analyze2[+] Int +//| analyze2[+;-] ⊤ +//| analyze2[+;-] ⊤ +//| analyze2[+] A +//| analyze2[+] unit<> +//| [occs] +//| [vars] TreeSet() +//| [rec] Set() +//| [sub] +//| [bounds] +//| [rec] Set() +//| transform[+] Int () + None +//| ~> Int +//| transform[+] ((y: Int,) -> Int) () + None +//| | transform[-] (y: Int,) () +;- None +//| | | transform[-] Int () +;- None +//| | | ~> Int +//| | ~> (y: Int,) +//| | transform[+] Int () + None +//| | ~> Int +//| ~> ((y: Int,) -> Int) +//| transform[+] Int () + None +//| ~> Int +//| transform[-] ⊤ () +;- None +//| ~> ⊤ +//| transform[+] ⊤ () + None +//| ~> ⊤ +//| transform[+] (A & {x: Int}) () + None +//| | transform[+] A () + None +//| | ~> A +//| | transform[+] {x: Int} () + None +//| | | transform[+] Int () + None +//| | | ~> Int +//| | ~> {x: Int} +//| ~> (A & {x: Int}) +//| transform[+] A () + None +//| ~> A +//| transform[+] unit<> () + None +//| ~> unit<> +//| ⬤ Resim: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(unit<>)) +//| where: +//| allVarPols: +//| [subs] HashMap() +//| ⬤ Factored: TypedTypingUnit( + TypedNuCls(0, TypeName(A), + List(), + List((x,Int)), + this: ⊤, + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) + (x,NuParam(x,Int)), + : ⊤, Set(), Map()) + TypedNuFun(0,let aa = A (42,),A) + Some(unit<>)) +//| where: diff --git a/driver/js/src/test/esprojects/js/mlscript/TyperDebug.js b/driver/js/src/test/esprojects/js/mlscript/TyperDebug.js new file mode 100644 index 000000000..ac66fc63c --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/TyperDebug.js @@ -0,0 +1,33 @@ +const TyperDebug = new class TyperDebug { + #A; + #aa; + get aa() { return this.#aa; } + constructor() { + } + get A() { + const outer = this; + if (this.#A === undefined) { + class A { + #x; + get x() { return this.#x; } + constructor(x) { + this.#x = x; + } + add(y) { + const x = this.#x; + return x + y; + } + }; + this.#A = ((x) => Object.freeze(new A(x))); + this.#A.class = A; + } + return this.#A; + } + $init() { + const self = this; + this.#aa = self.A(42); + const aa = this.#aa; + console.log(aa.add(6)); + } +}; +TyperDebug.$init(); diff --git a/driver/js/src/test/esprojects/mlscript/TyperDebug.mls b/driver/js/src/test/esprojects/mlscript/TyperDebug.mls new file mode 100644 index 000000000..0ea6a1503 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/TyperDebug.mls @@ -0,0 +1,6 @@ +// :d +class A(x: Int) { + fun add(y: Int) = x + y +} +let aa = A(42) +console.log(aa.add(6)) diff --git a/driver/js/src/test/output/TyperDebug.check b/driver/js/src/test/output/TyperDebug.check new file mode 100644 index 000000000..21e72e8ac --- /dev/null +++ b/driver/js/src/test/output/TyperDebug.check @@ -0,0 +1 @@ +48 diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index c8f785913..f510d1369 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -102,6 +102,7 @@ object DriverDiffTests { cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types esEntry("Builtin"), cjsEntry("CJS1"), + esEntry("TyperDebug"), ts2mlsEntry("BasicFunctions.ts", expectTypeError = true), ts2mlsEntry("ClassMember.ts"), ts2mlsEntry("Cycle1.ts", expectTypeError = true), diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index d2ebbf241..fcbab15bb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -9,15 +9,17 @@ class JSWriter(filename: String) { import JSFileSystem._ private val buffer = new StringBuilder() + private val dbg = new StringBuilder() private val err = new StringBuilder() def writeln(str: String): Unit = write(str + "\n") def write(str: String): Unit = buffer ++= str def writeErr(str: String): Unit = err ++= s"//| $str\n" + def writeDbg(str: String): Unit = dbg ++= s"//| $str\n" // return true if the file has been updated def close(): Boolean = { - val str = buffer.toString() + err.toString() + val str = buffer.toString() + dbg.toString() + err.toString() val origin = readFile(filename).getOrElse("") val updated = str =/= origin if (updated) writeFile(filename, str) From ee0bac3ec5915d898d4520825960c92c6e649f19 Mon Sep 17 00:00:00 2001 From: "Cunyuan(Holden) Gao" Date: Mon, 3 Jul 2023 14:06:26 +0800 Subject: [PATCH 160/202] WIP: Update driver/js/src/main/scala/driver/Driver.scala Co-authored-by: Lionel Parreaux --- driver/js/src/main/scala/driver/Driver.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 6b07599b0..00affedd2 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -36,7 +36,7 @@ class Driver(options: DriverOptions) { println(msg) } - // errors in imported files should be printed in their own files to avoid redundant + // errors in imported files should be printed in their own files to avoid redundancy private val noRedundantRaise = (diag: Diagnostic) => () private val importedModule = MutSet[String]() From dcfee9a9b0e8c49bf1b4514571c20a606a1fd966 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 3 Jul 2023 14:22:22 +0800 Subject: [PATCH 161/202] WIP: Minor changes --- driver/js/src/main/scala/driver/Driver.scala | 4 ++-- .../js/src/test/esprojects/.interfaces/mlscript/Self.mlsi | 2 +- ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 00affedd2..ec9b955c5 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -135,7 +135,7 @@ class Driver(options: DriverOptions) { case Some(content) => f(parse(filename, content)) case _ => throw - ErrorReport(Ls((s"can not open file $filename", None)), Diagnostic.Compilation) + ErrorReport(Ls((s"Cannot open file $filename", None)), Diagnostic.Compilation) } private def extractSig(filename: String, moduleName: String): TypingUnit = @@ -237,7 +237,7 @@ class Driver(options: DriverOptions) { val depFile = file.`import`(dep) if (depFile.filename === file.filename) { totalErrors += 1 - mlsiWriter.writeErr(s"can not import ${file.filename} itself") + mlsiWriter.writeErr(s"Cannot import ${file.filename} from itself") false } else true diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi index 080bf0a58..592e3db79 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi @@ -1,4 +1,4 @@ declare module Self() { class Foo() } -//| can not import driver/js/src/test/esprojects/mlscript/Self.mls itself +//| Cannot import driver/js/src/test/esprojects/mlscript/Self.mls from itself diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 0a22e0ac5..f3d075e7a 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -14,10 +14,10 @@ class TSTypeGenerationTest extends AnyFunSuite { } object TSTypeGenerationTest { - // we only generate type information for builtin declarations here. - // user-defined scripts may contain errors and printing error messages can lead to test failure + // We only generate type information for builtin declarations here. + // User-defined scripts may contain errors and printing error messages can lead to test failure // if we use the two-pass test. - // builtin declarations should never contain an error. + // Builtin declarations should never contain an error. private val testsData = List( "./Dom.d.ts", "./ES5.d.ts", From 068d4dad0ded42c74ddd5c8b9f55918c40ad9129 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 3 Jul 2023 16:28:36 +0800 Subject: [PATCH 162/202] WIP: Fix getSourceFile and remove IsUndefined --- driver/js/src/main/scala/driver/Driver.scala | 1 - .../main/scala/ts2mls/TSCompilerInfo.scala | 28 +++++++++++-------- ts2mls/js/src/main/scala/ts2mls/TSData.scala | 8 ++---- .../js/src/main/scala/ts2mls/TSProgram.scala | 4 +-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index ec9b955c5..e9bcff81f 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -8,7 +8,6 @@ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo} -import ts2mls.IsUndefined class Driver(options: DriverOptions) { import Driver._ diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 66b599df0..8f18ed98c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -6,6 +6,7 @@ import js.DynamicImplicits._ import js.JSConverters._ import ts2mls.types._ import mlscript.utils._ +import js.isUndefined object TypeScript { private def load(moduleName: String) = try g.require(moduleName) catch { @@ -19,6 +20,9 @@ object TypeScript { private val ts: js.Dynamic = load("typescript") private val json: js.Dynamic = load("json5") private val sys: js.Dynamic = ts.sys + private val process: js.Dynamic = g.require("process") + + lazy val isLinux: Boolean = process.platform.toString().toLowerCase === "linux" // tsconfig.json def parseOption(basePath: String, filename: Option[String]): js.Dynamic = { @@ -38,7 +42,7 @@ object TypeScript { def resolveModuleName(importName: String, containingName: String, config: js.Dynamic): String = { val res = ts.resolveModuleName(importName, containingName, config, sys) - if (!IsUndefined(res.resolvedModule) && !IsUndefined(res.resolvedModule.resolvedFileName)) + if (!isUndefined(res.resolvedModule) && !isUndefined(res.resolvedModule.resolvedFileName)) res.resolvedModule.resolvedFileName.toString() else throw new Exception(s"can not resolve module $importName in $containingName.") @@ -96,18 +100,18 @@ object TypeScript { def isESModule(config: js.Dynamic, isJS: Boolean): Boolean = if (isJS) { val tp = config.selectDynamic("type") - if (IsUndefined(tp)) false + if (isUndefined(tp)) false else tp.toString() === "module" } else { val raw = config.selectDynamic("raw") - if (IsUndefined(raw)) false + if (isUndefined(raw)) false else { val opt = raw.selectDynamic("compilerOptions") - if (IsUndefined(opt)) false + if (isUndefined(opt)) false else { val mdl = opt.selectDynamic("module") - if (IsUndefined(mdl)) false + if (isUndefined(mdl)) false else mdl.toString() =/= "CommonJS" } } @@ -148,7 +152,7 @@ class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends T lazy val isOptionalMember = (flags & TypeScript.symbolFlagsOptional) > 0 lazy val valueDeclaration = TSNodeObject(sym.valueDeclaration) - lazy val isMerged = !IsUndefined(sym.mergeId) + lazy val isMerged = !js.isUndefined(sym.mergeId) } object TSSymbolObject { @@ -230,7 +234,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS // TODO: multiline string support override def toString(): String = - if (IsUndefined(node)) "" else node.getText().toString().replaceAll("\n", " ").replaceAll("\"", "'") + if (js.isUndefined(node)) "" else node.getText().toString().replaceAll("\n", " ").replaceAll("\"", "'") lazy val filename: String = if (parent.isUndefined) node.fileName.toString() else parent.filename @@ -246,10 +250,10 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val moduleReference = TSNodeObject(node.moduleReference) lazy val expression = TSTokenObject(node.expression) lazy val idExpression = TSIdentifierObject(node.expression) - lazy val isVarParam = !IsUndefined(node.dotDotDotToken) - lazy val hasmoduleReference = !IsUndefined(node.moduleReference) + lazy val isVarParam = !js.isUndefined(node.dotDotDotToken) + lazy val hasmoduleReference = !js.isUndefined(node.moduleReference) lazy val moduleAugmentation = - if (IsUndefined(node.moduleAugmentations)) TSTokenObject(g.undefined) + if (js.isUndefined(node.moduleAugmentations)) TSTokenObject(g.undefined) else TSTokenObject(node.moduleAugmentations.selectDynamic("0")) } @@ -276,14 +280,14 @@ object TSTokenObject { class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSAny(obj) { private lazy val flags = obj.flags - private lazy val objectFlags: js.Dynamic = if (IsUndefined(obj.objectFlags)) 0 else obj.objectFlags + private lazy val objectFlags: js.Dynamic = if (js.isUndefined(obj.objectFlags)) 0 else obj.objectFlags private lazy val baseType = TSTypeObject(checker.getBaseType(obj)) lazy val symbol = TSSymbolObject(obj.symbol) lazy val aliasSymbol = TSSymbolObject(obj.aliasSymbol) lazy val typeArguments = TSTypeArray(checker.getTypeArguments(obj)) lazy val intrinsicName: String = - if (!IsUndefined(obj.intrinsicName)) obj.intrinsicName.toString + if (!js.isUndefined(obj.intrinsicName)) obj.intrinsicName.toString else baseType.intrinsicName lazy val `type` = TSTypeObject(obj.selectDynamic("type")) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index 3925eb607..0b8163a86 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -5,11 +5,7 @@ import js.DynamicImplicits._ import js.JSConverters._ abstract class TSAny(v: js.Dynamic) { - val isUndefined: Boolean = IsUndefined(v) -} - -object IsUndefined { - def apply(v: js.Dynamic): Boolean = js.isUndefined(v) + val isUndefined: Boolean = js.isUndefined(v) } // array for information object in tsc @@ -85,7 +81,7 @@ class TSLineStartsHelper(arr: js.Dynamic) extends TSAny(arr) { if (isUndefined) throw new AssertionError("can not read line starts from the source file.") // line, column in string - def getPos(pos: js.Dynamic): (String, String) = if (IsUndefined(pos)) ("-1", "-1") else { + def getPos(pos: js.Dynamic): (String, String) = if (js.isUndefined(pos)) ("-1", "-1") else { val len = arr.length def run(index: Int): (String, String) = if (index >= len) throw new AssertionError(s"invalid pos parameter $pos.") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index ee76b4166..5dd3fe7ae 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -24,12 +24,12 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str def generate: Boolean = generate(file, None)(Nil) private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Boolean = { - val filename = file.resolve + val filename = if (TypeScript.isLinux) file.resolve else file.resolve.toLowerCase() val moduleName = file.moduleName val globalNamespace = ambientNS.getOrElse(TSNamespace(!uesTopLevelModule)) val sfObj = program.getSourceFileByPath(filename) val sourceFile = - if (IsUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") + if (js.isUndefined(sfObj)) throw new Exception(s"can not load source file $filename.") else TSSourceFile(sfObj, globalNamespace, moduleName) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList From 6d0f9a9631bb48d5df5b094bc19e8d52e1be20bf Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 4 Jul 2023 12:56:56 +0800 Subject: [PATCH 163/202] WIP: Use git diff logic for all test cases --- .../test/scala/mlscript/compiler/Test.scala | 9 +- driver/js/src/main/scala/driver/Driver.scala | 89 +++++++++--------- .../src/main/scala/driver/DriverOptions.scala | 1 - .../test/scala/driver/DriverDiffTests.scala | 90 +++++++++++-------- .../src/test/scala/driver/JSGitHelper.scala | 26 ++++++ .../src/test/scala/mlscript/DiffTests.scala | 54 +---------- .../src/test/scala/mlscript/GitHelper.scala | 70 +++++++++++++++ .../js/src/main/scala/ts2mls/JSWriter.scala | 4 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 5 +- 9 files changed, 197 insertions(+), 151 deletions(-) create mode 100644 driver/js/src/test/scala/driver/JSGitHelper.scala create mode 100644 shared/src/test/scala/mlscript/GitHelper.scala diff --git a/compiler/shared/test/scala/mlscript/compiler/Test.scala b/compiler/shared/test/scala/mlscript/compiler/Test.scala index df325ec59..4a0f48799 100644 --- a/compiler/shared/test/scala/mlscript/compiler/Test.scala +++ b/compiler/shared/test/scala/mlscript/compiler/Test.scala @@ -25,10 +25,7 @@ class DiffTestCompiler extends DiffTests { "\n" ++ err.getStackTrace().map(_.toString()).mkString("\n") outputBuilder.toString().linesIterator.toList - override protected lazy val files = allFiles.filter { file => - val fileName = file.baseName - validExt(file.ext) && filter(file.relativeTo(pwd)) - } + override protected lazy val files = gitHelper.getFiles(allFiles) } object DiffTestCompiler { @@ -39,7 +36,5 @@ object DiffTestCompiler { private val allFiles = os.walk(dir).filter(_.toIO.isFile) private val validExt = Set("fun", "mls") - - private def filter(file: os.RelPath) = DiffTests.filter(file) - + private val gitHelper = JVMGitHelper(pwd, dir) } diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index e9bcff81f..28af1f014 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -207,7 +207,6 @@ class Driver(options: DriverOptions) { `type`(TypingUnit(declarations), false)(ctx, noRedundantRaise, extrCtx, vars) }) - // return true if this file is recompiled. private def compile( file: FileInfo, exported: Boolean @@ -216,12 +215,13 @@ class Driver(options: DriverOptions) { extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType], stack: List[String] - ): Boolean = { + ): Unit = { if (!isMLScirpt(file.filename)) { // TypeScript System.out.println(s"generating interface for ${file.filename}...") val tsprog = TSProgram(file, true, options.tsconfig, checkTSInterface) - return tsprog.generate + tsprog.generate + return } val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") @@ -246,14 +246,11 @@ class Driver(options: DriverOptions) { else R(dep) } } - val (cycleSigs, cycleRecomp) = cycleList.foldLeft((Ls[TypingUnit](), false))((r, file) => r match { - case (sigs, recomp) => { - importedModule += file.filename - (sigs :+ extractSig(file.filename, file.moduleName), - recomp || isInterfaceOutdate(file.filename, s"${options.path}/${file.interfaceFilename}")) - } + val cycleSigs = cycleList.foldLeft(Ls[TypingUnit]())((sigs, file) => { + importedModule += file.filename + sigs :+ extractSig(file.filename, file.moduleName) }) - val needRecomp = otherList.foldLeft(cycleRecomp)((nr, dp) => { + otherList.foreach(dp => { // We need to create another new context when compiling other files // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" // If we forget to add `import "D.mls"` in C, we need to raise an error @@ -265,44 +262,23 @@ class Driver(options: DriverOptions) { val newFilename = file.`import`(dp) importedModule += newFilename.filename compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) - } || nr) + }) - if (options.force || needRecomp || isInterfaceOutdate(file.filename, mlsiFile)) { - System.out.println(s"compiling ${file.filename}...") - try { otherList.foreach(d => importModule(file.`import`(d))) } - catch { - case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 - mlsiWriter.writeErr(t.toString()) - } - if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files - val expStr = try { - cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + { - dbgWriter = Some(mlsiWriter); - val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show); - dbgWriter = None - res - } - } - catch { - case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 - mlsiWriter.writeErr(t.toString()) - "" + System.out.println(s"compiling ${file.filename}...") + try { otherList.foreach(d => importModule(file.`import`(d))) } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + mlsiWriter.writeErr(t.toString()) + } + if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files + val expStr = try { + cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + { + dbgWriter = Some(mlsiWriter); + val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show); + dbgWriter = None + res } - val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") - - mlsiWriter.write(interfaces) - mlsiWriter.close() - if (totalErrors == 0) - generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( - imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { - val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) - } - ), exported || importedModule(file.filename)) - } - else try { - `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files } catch { case t : Throwable => @@ -310,9 +286,26 @@ class Driver(options: DriverOptions) { mlsiWriter.writeErr(t.toString()) "" } - true + val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + + mlsiWriter.write(interfaces) + mlsiWriter.close() + if (totalErrors == 0) + generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( + imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { + val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) + } + ), exported || importedModule(file.filename)) + } + else try { + `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files + } + catch { + case t : Throwable => + if (!options.expectTypeError) totalErrors += 1 + mlsiWriter.writeErr(t.toString()) + "" } - else false // no need to recompile } }) } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index 54cace6c2..e94aa5f0f 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -14,5 +14,4 @@ final case class DriverOptions( commonJS: Boolean, // generate common js or es5 expectTypeError: Boolean, // ignore type errors for test expectError: Boolean, // the test should raise errors - force: Boolean // force to recompile if it is true ) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index f510d1369..74a96a210 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -10,33 +10,40 @@ class DriverDiffTests extends AnyFunSuite { import DriverDiffTests._ import ts2mls.JSFileSystem._ - testCases.foreach { - case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, expectTypeError, expectError) => test(filename) { - val options = - DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, forceCompiling) - val driver = Driver(options) - if (!outputDir.isEmpty()) driver.genPackageJson() - val success = driver.execute - - assert(success != expectError, s"failed when compiling $filename.") - - if (!expectError) execution match { - case Some((executionFile, outputFile)) => - val output = cp.execSync(s"node $executionFile").toString() - val original = readFile(outputFile).getOrElse("") - if (original =/= output) fs.writeFileSync(outputFile, output) - case None => () + private def run(cases: List[TestOption], helper: JSGitHelper) = { + val diffFiles = helper.getFiles(cases.map(_.toString()).toIndexedSeq).toSet + cases.filter(opt => diffFiles(opt.toString())).foreach { + case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, expectTypeError, expectError) => test(filename) { + val options = + DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError) + val driver = Driver(options) + if (!outputDir.isEmpty()) driver.genPackageJson() + val success = driver.execute + + assert(success != expectError, s"failed when compiling $filename.") + + if (!expectError) execution match { + case Some((executionFile, outputFile)) => + val output = cp.execSync(s"node $executionFile").toString() + val original = readFile(outputFile).getOrElse("") + if (original =/= output) fs.writeFileSync(outputFile, output) + case None => () + } } } } + + run(ts2mlsCases, ts2mlsHelper) + run(esCases, esHelper) + run(cjsCases, cjsHelper) } object DriverDiffTests { - private val forceCompiling = true // TODO: check based on git - private val diffPath = "driver/js/src/test/" private val outputPath = s"${diffPath}output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" + private val esPath = s"${diffPath}esprojects/" + private val cjsPath = s"${diffPath}cjsprojects/" private case class TestOption( filename: String, @@ -48,7 +55,9 @@ object DriverDiffTests { tsconfig: Option[String], expectTypeError: Boolean, expectError: Boolean - ) + ) { + override def toString() = ts2mls.TSPathResolver.normalize(s"$workDir/$filename") + } private def driverEntry( entryModule: String, @@ -75,34 +84,19 @@ object DriverDiffTests { tsconfig: Option[String] = None, expectTypeError: Boolean = false, expectError: Boolean = false - ) = driverEntry(entryModule, tsconfig, s"${diffPath}cjsprojects/", - s"${diffPath}cjsprojects/js/", expectTypeError, expectError, true) + ) = driverEntry(entryModule, tsconfig, cjsPath, s"${cjsPath}/js/", expectTypeError, expectError, true) private def esEntry( entryModule: String, tsconfig: Option[String] = None, expectTypeError: Boolean = false, expectError: Boolean = false - ) = driverEntry(entryModule, tsconfig, s"${diffPath}esprojects/", - s"${diffPath}esprojects/js/", expectTypeError, expectError, false) + ) = driverEntry(entryModule, tsconfig, esPath, s"${esPath}/js/", expectTypeError, expectError, false) private def ts2mlsEntry(entryFile: String, expectTypeError: Boolean = false, expectError: Boolean = false) = TestOption(s"./${entryFile}", "ts2mls/js/src/test/typescript", "", "../diff", false, None, None, expectTypeError, expectError) - private val testCases = List[TestOption]( - esEntry("Simple"), - esEntry("Cycle2"), - esEntry("Self", expectError = true), - esEntry("C", expectError = true), - esEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members - esEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position - esEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position - esEntry("MLS2TheMax", Some("./tsconfig.json")), - esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules - cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types - esEntry("Builtin"), - cjsEntry("CJS1"), - esEntry("TyperDebug"), + private val ts2mlsCases = List( ts2mlsEntry("BasicFunctions.ts", expectTypeError = true), ts2mlsEntry("ClassMember.ts"), ts2mlsEntry("Cycle1.ts", expectTypeError = true), @@ -127,6 +121,28 @@ object DriverDiffTests { ts2mlsEntry("Variables.ts", expectError = true), ) + private val esCases = List( + esEntry("Simple"), + esEntry("Cycle2"), + esEntry("Self", expectError = true), + esEntry("C", expectError = true), + esEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members + esEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position + esEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position + esEntry("MLS2TheMax", Some("./tsconfig.json")), + esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + esEntry("Builtin"), + esEntry("TyperDebug"), + ) + + private val cjsCases = List( + cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types + cjsEntry("CJS1"), + ) + private val cp = g.require("child_process") private val fs = g.require("fs") + private val ts2mlsHelper = JSGitHelper(".", ts2mlsPath) + private val esHelper = JSGitHelper(".", s"${esPath}/mlscript") + private val cjsHelper = JSGitHelper(".", s"${cjsPath}/mlscript") } diff --git a/driver/js/src/test/scala/driver/JSGitHelper.scala b/driver/js/src/test/scala/driver/JSGitHelper.scala new file mode 100644 index 000000000..c54770802 --- /dev/null +++ b/driver/js/src/test/scala/driver/JSGitHelper.scala @@ -0,0 +1,26 @@ +package driver + +import mlscript.GitHelper +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import ts2mls.TSPathResolver + +class JSGitHelper(rootDir: String, workDir: String) extends GitHelper[String, String](rootDir, workDir) { + override protected def str2RelPath(s: String): String = s + override protected def diff: Iterator[String] = { + val res = JSGitHelper.cp.execSync(s"git status --porcelain $workDir").toString() + if (res.isEmpty()) Iterator() + else res.split("\n").iterator + } + + override protected def filter(file: String): Boolean = + modified(TSPathResolver.normalize(file)) || modified.isEmpty +} + +object JSGitHelper { + def apply(rootDir: String, workDir: String): JSGitHelper = + new JSGitHelper(rootDir, workDir) + + private val cp = g.require("child_process") +} diff --git a/shared/src/test/scala/mlscript/DiffTests.scala b/shared/src/test/scala/mlscript/DiffTests.scala index f4df4fda9..dc343c489 100644 --- a/shared/src/test/scala/mlscript/DiffTests.scala +++ b/shared/src/test/scala/mlscript/DiffTests.scala @@ -58,11 +58,7 @@ class DiffTests // scala test will not execute a test if the test class has constructor parameters. // override this to get the correct paths of test files. - protected lazy val files = allFiles.filter { file => - val fileName = file.baseName - // validExt(file.ext) && filter(fileName) - validExt(file.ext) && filter(file.relativeTo(pwd)) - } + protected lazy val files = gitHelper.getFiles(allFiles) val timeLimit = TimeLimit @@ -977,52 +973,6 @@ object DiffTests { private val pwd = os.pwd private val dir = pwd/"shared"/"src"/"test"/"diff" - private val allFiles = os.walk(dir).filter(_.toIO.isFile) - - private val validExt = Set("fun", "mls") - - // Aggregate unstaged modified files to only run the tests on them, if there are any - private val modified: Set[os.RelPath] = - try os.proc("git", "status", "--porcelain", dir).call().out.lines().iterator.flatMap { gitStr => - println(" [git] " + gitStr) - val prefix = gitStr.take(2) - val filePath = os.RelPath(gitStr.drop(3)) - if (prefix =:= "A " || prefix =:= "M " || prefix =:= "R " || prefix =:= "D ") - N // * Disregard modified files that are staged - else S(filePath) - }.toSet catch { - case err: Throwable => System.err.println("/!\\ git command failed with: " + err) - Set.empty - } - - // Allow overriding which specific tests to run, sometimes easier for development: - private val focused = Set[Str]( - // "LetRec" - // "Ascribe", - // "Repro", - // "RecursiveTypes", - // "Simple", - // "Inherit", - // "Basics", - // "Paper", - // "Negations", - // "RecFuns", - // "With", - // "Annoying", - // "Tony", - // "Lists", - // "Traits", - // "BadTraits", - // "TraitMatching", - // "Subsume", - // "Methods", - ).map(os.RelPath(_)) - // private def filter(name: Str): Bool = - def filter(file: os.RelPath): Bool = { - if (focused.nonEmpty) focused(file) else modified(file) || modified.isEmpty && - true - // name.startsWith("new/") - // file.segments.toList.init.lastOption.contains("parser") - } + private val gitHelper = JVMGitHelper(pwd, dir) } diff --git a/shared/src/test/scala/mlscript/GitHelper.scala b/shared/src/test/scala/mlscript/GitHelper.scala new file mode 100644 index 000000000..56a0ef79f --- /dev/null +++ b/shared/src/test/scala/mlscript/GitHelper.scala @@ -0,0 +1,70 @@ +package mlscript + +import mlscript.utils._, shorthands._ +import os.FilePath +import os.Path +import scala.collection.Iterator + +abstract class GitHelper[PathType, RelPathType](rootDir: PathType, workDir: PathType) { + protected def diff: Iterator[Str] + protected def str2RelPath(s: Str): RelPathType + protected def filter(file: PathType): Bool + + // Aggregate unstaged modified files to only run the tests on them, if there are any + final protected lazy val modified: Set[RelPathType] = try diff.flatMap { gitStr => + println(" [git] " + gitStr) + val prefix = gitStr.take(2) + val filePath = str2RelPath(gitStr.drop(3)) + if (prefix =:= "A " || prefix =:= "M " || prefix =:= "R " || prefix =:= "D ") + N // * Disregard modified files that are staged + else S(filePath) + }.toSet catch { + case err: Throwable => System.err.println("/!\\ git command failed with: " + err) + Set.empty + } + + final def getFiles(allFiles: IndexedSeq[PathType]): IndexedSeq[PathType] = allFiles.filter(filter(_)) +} + +class JVMGitHelper(rootDir: os.Path, workDir: os.Path) extends GitHelper[os.Path, os.RelPath](rootDir, workDir) { + override protected def str2RelPath(s: Str): os.RelPath = os.RelPath(s) + override protected def diff: Iterator[Str] = + os.proc("git", "status", "--porcelain", workDir).call().out.lines().iterator + override protected def filter(file: Path): Bool = { + JVMGitHelper.validExt(file.ext) && filter(file.relativeTo(rootDir)) + } + + // Allow overriding which specific tests to run, sometimes easier for development: + private val focused = Set[Str]( + // "LetRec" + // "Ascribe", + // "Repro", + // "RecursiveTypes", + // "Simple", + // "Inherit", + // "Basics", + // "Paper", + // "Negations", + // "RecFuns", + // "With", + // "Annoying", + // "Tony", + // "Lists", + // "Traits", + // "BadTraits", + // "TraitMatching", + // "Subsume", + // "Methods", + ).map(os.RelPath(_)) + def filter(file: os.RelPath): Bool = { + if (focused.nonEmpty) focused(file) else modified(file) || modified.isEmpty && + true + } +} + +object JVMGitHelper { + def apply(rootDir: os.Path, workDir: os.Path): JVMGitHelper = + new JVMGitHelper(rootDir, workDir) + + private val validExt = Set("fun", "mls") +} diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index fcbab15bb..0bc45ef08 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -17,13 +17,11 @@ class JSWriter(filename: String) { def writeErr(str: String): Unit = err ++= s"//| $str\n" def writeDbg(str: String): Unit = dbg ++= s"//| $str\n" - // return true if the file has been updated - def close(): Boolean = { + def close(): Unit = { val str = buffer.toString() + dbg.toString() + err.toString() val origin = readFile(filename).getOrElse("") val updated = str =/= origin if (updated) writeFile(filename, str) - updated } def getContent: String = buffer.toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 5dd3fe7ae..8e6787621 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -21,9 +21,9 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate: Boolean = generate(file, None)(Nil) + def generate: Unit = generate(file, None)(Nil) - private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Boolean = { + private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Unit = { val filename = if (TypeScript.isLinux) file.resolve else file.resolve.toLowerCase() val moduleName = file.moduleName val globalNamespace = ambientNS.getOrElse(TSNamespace(!uesTopLevelModule)) @@ -88,7 +88,6 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str typer(file, writer) writer.close() } - else false } private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String, commonJS: Boolean): Unit = From cff370961b3a8a1058722d9798e162eecc8e2cb2 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 4 Jul 2023 13:11:53 +0800 Subject: [PATCH 164/202] WIP: Rerun test --- .../.interfaces/mlscript/TyperDebug.mlsi | 260 +++++++++--------- 1 file changed, 130 insertions(+), 130 deletions(-) diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi index 91ed5a8ed..ee9e774f8 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi @@ -20,10 +20,10 @@ declare module TyperDebug() { //| | | Params (x,Int) //| | | UNSTASHING... (out) //| | | UNSTASHING... (out) -//| | | 1. Finalizing inheritance with ({} w/ {x: Int} & A) <: a829' -//| | | | CONSTRAIN ({} w/ {x: Int} & A) ) <: a829' +//| | | | CONSTRAIN ({} w/ {x: Int} & #A) ) ) + (x,) (y,))) //| | | | 1. Created lazy type info for fun add = (y: Int,) => + (x,) (y,) @@ -93,14 +93,14 @@ declare module TyperDebug() { //| | | | UNSTASHING... (out) //| | | UNSTASHING... (out) //| | | Computing variances of A -//| | | | Trav(+)(({} w/ {x: Int} & A)) +//| | | | Trav(+)(({} w/ {x: Int} & #A)) //| | | | | Trav(+)({} w/ {x: Int}) //| | | | | | Trav(+)(({}\x & {x: Int})) //| | | | | | | Trav(+)({}\x) //| | | | | | | | Trav(+)({}) //| | | | | | | Trav(+)({x: Int}) //| | | | | | | | Trav(+)(Int) -//| | | | | Trav(+)(A) +//| | | | | Trav(+)(#A) //| | | = HashMap() //| | | UNSTASHING... (out) //| | Completed TypedNuCls(0, TypeName(A), @@ -118,26 +118,26 @@ declare module TyperDebug() { //| | | Params //| | | 0. Typing term A (42,) //| | | | 0. Typing term A -//| | | | 0. : ((x: Int,) -> A) +//| | | | 0. : ((x: Int,) -> #A) //| | | | 0. Typing term 42 -//| | | | 0. : 42 -//| | | | CONSTRAIN ((x: Int,) -> A) ,) -> α833) +//| | | | 0. : #42 +//| | | | CONSTRAIN ((x: Int,) -> #A) ,) -> α833) //| | | | where -//| | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) -//| | | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) -//| | | | | | 0. C ((x: Int,) -> A) ,) -> α833) (0) -//| | | | | | | 0. C (42,) #A) ,) -> α833) (0) +//| | | | | 0. C ((x: Int,) -> #A) ,) -> α833) (0) +//| | | | | | 0. C ((x: Int,) -> #A) ,) -> α833) (0) +//| | | | | | | 0. C (#42,) A + α833 :> #A //| | | 1. C α833 A + α833 :> #A //| | Typing unit statements //| | | 0. Typing term (console).log ((aa).add (6,),) //| | | | 0. Typing term (console).log @@ -148,14 +148,14 @@ declare module TyperDebug() { //| | | | | 0. C ‹∀ 0. Console› ) <: DNF(0, {log: log835}) //| | | | | | | | | Possible: List({log: log835}) -//| | | | | | | | | 0. A {}∧#Console % List() % List() % List() % List() ) & {...} //| | | | | | | | | | | | | Lookup Console.log : Some(((args0: (Anything | MutArray[Anything]),) -> Unit)) where //| | | | | | | | | | | | | Fresh[0] Console.log : Some(((args0: (Anything | MutArray[Anything]),) -> Unit)) where Some() //| | | | | | | | | | | | | & None (from refinement) @@ -169,13 +169,13 @@ declare module TyperDebug() { //| | | | | | 0. : α833 //| | | | | | CONSTRAIN α833 A + α833 :> #A //| | | | | | 0. C α833 α831'')›) where α831'' :> Int @@ -186,26 +186,26 @@ declare module TyperDebug() { //| | | | | | | | | | | | NEW add836 LB (0) //| | | | | 0. : add836 //| | | | | 0. Typing term 6 -//| | | | | 0. : 6 -//| | | | | CONSTRAIN add836 ,) -> α837) +//| | | | | 0. : #6 +//| | | | | CONSTRAIN add836 ,) -> α837) //| | | | | where α831'' :> Int add836 :> ‹∀ 1. ((y: Int,) -> α831'')› -//| | | | | 0. C add836 ,) -> α837) (0) -//| | | | | | 0. C add836 ,) -> α837) (0) +//| | | | | 0. C add836 ,) -> α837) (0) +//| | | | | | 0. C add836 ,) -> α837) (0) //| | | | | | | NEW add836 UB (0) -//| | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) -//| | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) -//| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) +//| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) //| | | | | | | | | | INST [1] ‹∀ 1. ((y: Int,) -> α831'')› //| | | | | | | | | | where α831'' :> Int //| | | | | | | | | | TO [0] ~> ((y: Int,) -> α831_838) //| | | | | | | | | | where α831_838 :> Int -//| | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) -//| | | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) -//| | | | | | | | | | | | 0. C (6,) α831_838) ,) -> α837) (4) +//| | | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) +//| | | | | | | | | | | | 0. C (#6,) Int - α833 :> A <: {add: add836} - add836 :> ‹∀ 1. ((y: Int,) -> α831'')› <: ((6,) -> α837) + α833 :> #A <: {add: add836} + add836 :> ‹∀ 1. ((y: Int,) -> α831'')› <: ((#6,) -> α837) α837 :> Int <: (Anything | MutArray[Anything]) α839 :> Unit //| allVarPols: +α831'', +α833, +α839 @@ -265,14 +265,14 @@ declare module TyperDebug() { Some(α839_842)) //| where: α831_840'' :> Int - α833_841 :> A + α833_841 :> #A α839_842 :> Unit //| allVarPols: +α831_840'', +α833_841, +α839_842 -//| consed: Map((true,Int) -> α831_840'', (true,A) -> α833_841, (true,Unit) -> α839_842) +//| consed: Map((true,Int) -> α831_840'', (true,#A) -> α833_841, (true,Unit) -> α839_842) //| !unskid-1! Int -> α831_840'' //| !unskid-1! Int -> α831_840'' //| !unskid-1! Int -> α831_840'' -//| !unskid-1! A -> α833_841 +//| !unskid-1! #A -> α833_841 //| ⬤ Unskid: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), @@ -285,7 +285,7 @@ declare module TyperDebug() { Some(α839_842)) //| where: α831_840'' :> Int - α833_841 :> A + α833_841 :> #A α839_842 :> Unit //| analyze1[+] α831_840'' //| | analyze1[+;@[+](0)] Int @@ -297,7 +297,7 @@ declare module TyperDebug() { //| analyze1[+;-] ⊤ //| analyze1[+;-] ⊤ //| analyze1[+] α833_841 -//| | analyze1[+;@[+](0)] A +//| | analyze1[+;@[+](0)] #A //| analyze1[+] α839_842 //| | analyze1[+;@[+](0)] Unit //| [inv] @@ -319,10 +319,10 @@ declare module TyperDebug() { //| analyze2[+] α833_841 //| | >> Processing α833_841 at [+] //| | go α833_841 () -//| | | go A (α833_841) -//| | >> Occurrences HashSet(A, α833_841) -//| | >>>> occs[+α833_841] := HashSet(A, α833_841) <~ None -//| | analyze2[+] A +//| | | go #A (α833_841) +//| | >> Occurrences HashSet(#A, α833_841) +//| | >>>> occs[+α833_841] := HashSet(#A, α833_841) <~ None +//| | analyze2[+] #A //| analyze2[+] α839_842 //| | >> Processing α839_842 at [+] //| | go α839_842 () @@ -330,7 +330,7 @@ declare module TyperDebug() { //| | >> Occurrences HashSet(Unit, α839_842) //| | >>>> occs[+α839_842] := HashSet(Unit, α839_842) <~ None //| | analyze2[+] Unit -//| [occs] +α831_840'' {α831_840'',Int} ; +α833_841 {A,α833_841} ; +α839_842 {Unit,α839_842} +//| [occs] +α831_840'' {α831_840'',Int} ; +α833_841 {#A,α833_841} ; +α839_842 {Unit,α839_842} //| [vars] TreeSet(α831_840'', α833_841, α839_842) //| [rec] Set() //| 0[1] α833_841 @@ -341,7 +341,7 @@ declare module TyperDebug() { //| [sub] α831_840'' -> None, α833_841 -> None, α839_842 -> None //| [bounds] α831_840'' :> Int - α833_841 :> A + α833_841 :> #A α839_842 :> Unit //| [rec] Set() //| transform[+] α831_840'' () + None @@ -381,15 +381,15 @@ declare module TyperDebug() { //| | ~> ⊤ w/ {x: Int} //| | transform[+] α833_841 () + None //| | | -> bound Some(true) -//| | | transform[+] A (α833_841) +;@[+](0) None -//| | | ~> A -//| | ~> A -//| ~> (⊤ w/ {x: Int} & A) +//| | | transform[+] #A (α833_841) +;@[+](0) None +//| | | ~> #A +//| | ~> #A +//| ~> (⊤ w/ {x: Int} & #A) //| transform[+] α833_841 () + None //| | -> bound Some(true) -//| | transform[+] A (α833_841) +;@[+](0) None -//| | ~> A -//| ~> A +//| | transform[+] #A (α833_841) +;@[+](0) None +//| | ~> #A +//| ~> #A //| transform[+] α839_842 () + None //| | -> bound Some(true) //| | transform[+] Unit (α839_842) +;@[+](0) None @@ -403,7 +403,7 @@ declare module TyperDebug() { (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) (x,NuParam(x,Int)), : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) + TypedNuFun(0,let aa = A (42,),#A) Some(Unit)) //| where: //| allVarPols: @@ -415,163 +415,163 @@ declare module TyperDebug() { (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) (x,NuParam(x,Int)), : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) + TypedNuFun(0,let aa = A (42,),#A) Some(Unit)) //| | norm[+] Int -//| | | DNF: DNF(0, Int{}) -//| | ~> Int +//| | | DNF: DNF(0, #Int{}) +//| | ~> #Int //| | norm[+] ((y: Int,) -> Int) //| | | DNF: DNF(0, ((y: Int,) -> Int){}) //| | | norm[-] (y: Int,) //| | | | DNF: DNF(0, (y: Int,){}) //| | | | norm[-] Int -//| | | | | DNF: DNF(0, Int{}) -//| | | | ~> Int -//| | | ~> (y: Int,) +//| | | | | DNF: DNF(0, #Int{}) +//| | | | ~> #Int +//| | | ~> (y: #Int,) //| | | norm[+] Int -//| | | | DNF: DNF(0, Int{}) -//| | | ~> Int -//| | ~> ((y: Int,) -> Int) +//| | | | DNF: DNF(0, #Int{}) +//| | | ~> #Int +//| | ~> ((y: #Int,) -> #Int) //| | norm[+] Int -//| | | DNF: DNF(0, Int{}) -//| | ~> Int +//| | | DNF: DNF(0, #Int{}) +//| | ~> #Int //| | norm[-] ⊤ //| | | DNF: DNF(0, ) //| | ~> ⊤ //| | norm[+] ⊤ //| | | DNF: DNF(0, ) //| | ~> ⊤ -//| | norm[+] (⊤ w/ {x: Int} & A) -//| | | DNF: DNF(0, A{x: Int}) +//| | norm[+] (⊤ w/ {x: Int} & #A) +//| | | DNF: DNF(0, #A{x: Int}) //| | | norm[+] Int -//| | | | DNF: DNF(0, Int{}) -//| | | ~> Int -//| | | rcd2 {x: Int} +//| | | | DNF: DNF(0, #Int{}) +//| | | ~> #Int +//| | | rcd2 {x: #Int} //| | | typeRef A //| | | clsFields -//| | ~> (A & {x: Int}) -//| | norm[+] A -//| | | DNF: DNF(0, A{}) +//| | ~> (A & {x: #Int}) +//| | norm[+] #A +//| | | DNF: DNF(0, #A{}) //| | | rcd2 {} //| | | typeRef A //| | | clsFields //| | ~> A //| | norm[+] Unit -//| | | DNF: DNF(0, unit<>{}) -//| | ~> unit<> +//| | | DNF: DNF(0, #unit<>{}) +//| | ~> #unit<> //| ⬤ Normalized: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), - List((x,Int)), + List((x,#Int)), this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) + (x,NuParam(x,#Int)), : ⊤, Set(), Map()) TypedNuFun(0,let aa = A (42,),A) - Some(unit<>)) + Some(#unit<>)) //| where: //| allVarPols: //| ⬤ Cleaned up: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), - List((x,Int)), + List((x,#Int)), this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) + (x,NuParam(x,#Int)), : ⊤, Set(), Map()) TypedNuFun(0,let aa = A (42,),A) - Some(unit<>)) + Some(#unit<>)) //| where: //| allVarPols: //| consed: Map() //| ⬤ Unskid: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), - List((x,Int)), + List((x,#Int)), this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) + (x,NuParam(x,#Int)), : ⊤, Set(), Map()) TypedNuFun(0,let aa = A (42,),A) - Some(unit<>)) + Some(#unit<>)) //| where: -//| analyze1[+] Int -//| analyze1[+] ((y: Int,) -> Int) -//| | analyze1[+;-] (y: Int,) -//| | | analyze1[+;-] Int -//| | analyze1[+] Int -//| analyze1[+] Int +//| analyze1[+] #Int +//| analyze1[+] ((y: #Int,) -> #Int) +//| | analyze1[+;-] (y: #Int,) +//| | | analyze1[+;-] #Int +//| | analyze1[+] #Int +//| analyze1[+] #Int //| analyze1[+;-] ⊤ //| analyze1[+;-] ⊤ //| analyze1[+] A -//| analyze1[+] unit<> +//| analyze1[+] #unit<> //| [inv] //| [nums] -//| analyze2[+] Int -//| analyze2[+] ((y: Int,) -> Int) -//| | analyze2[+;-] (y: Int,) -//| | | analyze2[+;-] Int -//| | analyze2[+] Int -//| analyze2[+] Int +//| analyze2[+] #Int +//| analyze2[+] ((y: #Int,) -> #Int) +//| | analyze2[+;-] (y: #Int,) +//| | | analyze2[+;-] #Int +//| | analyze2[+] #Int +//| analyze2[+] #Int //| analyze2[+;-] ⊤ //| analyze2[+;-] ⊤ //| analyze2[+] A -//| analyze2[+] unit<> +//| analyze2[+] #unit<> //| [occs] //| [vars] TreeSet() //| [rec] Set() //| [sub] //| [bounds] //| [rec] Set() -//| transform[+] Int () + None -//| ~> Int -//| transform[+] ((y: Int,) -> Int) () + None -//| | transform[-] (y: Int,) () +;- None -//| | | transform[-] Int () +;- None -//| | | ~> Int -//| | ~> (y: Int,) -//| | transform[+] Int () + None -//| | ~> Int -//| ~> ((y: Int,) -> Int) -//| transform[+] Int () + None -//| ~> Int +//| transform[+] #Int () + None +//| ~> #Int +//| transform[+] ((y: #Int,) -> #Int) () + None +//| | transform[-] (y: #Int,) () +;- None +//| | | transform[-] #Int () +;- None +//| | | ~> #Int +//| | ~> (y: #Int,) +//| | transform[+] #Int () + None +//| | ~> #Int +//| ~> ((y: #Int,) -> #Int) +//| transform[+] #Int () + None +//| ~> #Int //| transform[-] ⊤ () +;- None //| ~> ⊤ //| transform[+] ⊤ () + None //| ~> ⊤ -//| transform[+] (A & {x: Int}) () + None +//| transform[+] (A & {x: #Int}) () + None //| | transform[+] A () + None //| | ~> A -//| | transform[+] {x: Int} () + None -//| | | transform[+] Int () + None -//| | | ~> Int -//| | ~> {x: Int} -//| ~> (A & {x: Int}) +//| | transform[+] {x: #Int} () + None +//| | | transform[+] #Int () + None +//| | | ~> #Int +//| | ~> {x: #Int} +//| ~> (A & {x: #Int}) //| transform[+] A () + None //| ~> A -//| transform[+] unit<> () + None -//| ~> unit<> +//| transform[+] #unit<> () + None +//| ~> #unit<> //| ⬤ Resim: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), - List((x,Int)), + List((x,#Int)), this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) + (x,NuParam(x,#Int)), : ⊤, Set(), Map()) TypedNuFun(0,let aa = A (42,),A) - Some(unit<>)) + Some(#unit<>)) //| where: //| allVarPols: //| [subs] HashMap() //| ⬤ Factored: TypedTypingUnit( TypedNuCls(0, TypeName(A), List(), - List((x,Int)), + List((x,#Int)), this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), + (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) + (x,NuParam(x,#Int)), : ⊤, Set(), Map()) TypedNuFun(0,let aa = A (42,),A) - Some(unit<>)) + Some(#unit<>)) //| where: From 38091b08e65a32bb4ee24a146a9b2dc454df7480 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 4 Jul 2023 16:48:22 +0800 Subject: [PATCH 165/202] WIP: Fail when expected errors are not raised --- driver/js/src/main/scala/driver/Driver.scala | 79 ++++++++----------- .../.interfaces/mlscript/MyPartialOrder.mlsi | 1 - .../esprojects/js/mlscript/MyPartialOrder.js | 1 + .../test/scala/driver/DriverDiffTests.scala | 12 +-- 4 files changed, 40 insertions(+), 53 deletions(-) create mode 100644 driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 28af1f014..e73d3f510 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -37,12 +37,16 @@ class Driver(options: DriverOptions) { // errors in imported files should be printed in their own files to avoid redundancy private val noRedundantRaise = (diag: Diagnostic) => () + private val noRedundantOutput = (s: String) => () private val importedModule = MutSet[String]() private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) import TSPathResolver.{normalize, isLocal, isMLScirpt, dirname} + private def expected = + ((Driver.totalErrors > 0) == options.expectError) && ((Driver.totalTypeErrors > 0) == options.expectTypeError) + private def checkESModule(filename: String, from: String) = if (isMLScirpt(filename)) None else if (isLocal(filename)) // local files: check tsconfig.json @@ -66,19 +70,20 @@ class Driver(options: DriverOptions) { def execute: Boolean = try { Driver.totalErrors = 0 + Driver.totalTypeErrors = 0 implicit var ctx: Ctx = Ctx.init - implicit val raise: Raise = (diag: Diagnostic) => report(diag, options.expectTypeError, options.expectError) + implicit val raise: Raise = (diag: Diagnostic) => report(diag, printErr) implicit val extrCtx: Opt[typer.ExtrCtx] = N implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() initTyper compile(FileInfo(options.path, options.filename, options.interfaceDir), false) - Driver.totalErrors == 0 + expected } catch { case err: Diagnostic => // we can not find a file to store the error message. print on the screen - report(err, options.expectTypeError, options.expectError) - false + report(err, printErr) + options.expectError } def genPackageJson(): Unit = { @@ -144,15 +149,20 @@ class Driver(options: DriverOptions) { }) // if the current file is es5.mlsi, we allow overriding builtin type(like String and Object) - private def `type`(tu: TypingUnit, isES5: Boolean)( + private def `type`(tu: TypingUnit, isES5: Boolean, errOutput: String => Unit)( implicit ctx: Ctx, raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] - ) = { + ) = try { val tpd = typer.typeTypingUnit(tu, N, isES5) val sim = SimplifyPipeline(tpd, all = false) typer.expandType(sim) + } catch { + case t: Throwable => + totalTypeErrors += 1 + errOutput(t.toString()) + mlscript.Bot } private lazy val jsBuiltinDecs = Driver.jsBuiltinPaths.map(path => parseAndRun(path, { @@ -165,19 +175,10 @@ class Driver(options: DriverOptions) { val extrCtx: Opt[typer.ExtrCtx] = N val vars: Map[Str, typer.SimpleType] = Map.empty initTyper(ctx, noRedundantRaise, extrCtx, vars) - val reportRaise = (diag: Diagnostic) => - Diagnostic.report(diag, (s: String) => writer.writeErr(s), 0, false) + val reportRaise = (diag: Diagnostic) => report(diag, writer.writeErr) val tu = TypingUnit(declarations) - try { - imports.foreach(d => importModule(file.`import`(d.path))(ctx, extrCtx, vars)) - `type`(tu, false)(ctx, reportRaise, extrCtx, vars) - } - catch { - case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 - writer.writeErr(t.toString()) - () - } + imports.foreach(d => importModule(file.`import`(d.path))(ctx, extrCtx, vars)) + `type`(tu, false, writer.writeErr)(ctx, reportRaise, extrCtx, vars) } private def initTyper( @@ -185,7 +186,7 @@ class Driver(options: DriverOptions) { raise: Raise, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] - ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst), true)) + ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst), true, printErr)) // translate mlscirpt import paths into js import paths private def resolveJSPath(file: FileInfo, imp: String) = @@ -204,7 +205,7 @@ class Driver(options: DriverOptions) { parseAndRun(s"${options.path}/${file.interfaceFilename}", { case (_, declarations, imports, _) => imports.foreach(d => importModule(file.`import`(d.path))) - `type`(TypingUnit(declarations), false)(ctx, noRedundantRaise, extrCtx, vars) + `type`(TypingUnit(declarations), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) }) private def compile( @@ -226,8 +227,7 @@ class Driver(options: DriverOptions) { val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") val mlsiWriter = JSWriter(mlsiFile) - implicit val raise: Raise = (diag: Diagnostic) => - Diagnostic.report(diag, (s: String) => mlsiWriter.writeErr(s), 0, false) + implicit val raise: Raise = (diag: Diagnostic) => report(diag, mlsiWriter.writeErr) parseAndRun(file.filename, { case (definitions, declarations, imports, _) => { val depList = imports.map(_.path) @@ -268,44 +268,30 @@ class Driver(options: DriverOptions) { try { otherList.foreach(d => importModule(file.`import`(d))) } catch { case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 + totalTypeErrors += 1 mlsiWriter.writeErr(t.toString()) } if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files - val expStr = try { - cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false).show}") + { + val expStr = + cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false, mlsiWriter.writeErr).show}") + { dbgWriter = Some(mlsiWriter); - val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false).show); + val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false, mlsiWriter.writeErr).show); dbgWriter = None res } - } - catch { - case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 - mlsiWriter.writeErr(t.toString()) - "" - } val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") mlsiWriter.write(interfaces) mlsiWriter.close() - if (totalErrors == 0) + if (Driver.totalErrors == 0) generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } ), exported || importedModule(file.filename)) } - else try { - `type`(TypingUnit(declarations), false) // for ts/mlsi files, we only check interface files - } - catch { - case t : Throwable => - if (!options.expectTypeError) totalErrors += 1 - mlsiWriter.writeErr(t.toString()) - "" - } + else + `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // for ts/mlsi files, we only check interface files } }) } @@ -345,6 +331,7 @@ object Driver { System.err.println(msg) private var totalErrors = 0 + private var totalTypeErrors = 0 private def saveToFile(filename: String, content: String) = { val writer = JSWriter(filename) @@ -352,7 +339,7 @@ object Driver { writer.close() } - private def report(diag: Diagnostic, expectTypeError: Boolean, expectError: Boolean): Unit = { + private def report(diag: Diagnostic, output: Str => Unit): Unit = { diag match { case ErrorReport(msg, loco, src) => src match { @@ -361,10 +348,10 @@ object Driver { case Diagnostic.Parsing => totalErrors += 1 case _ => - if (!expectTypeError) totalErrors += 1 + totalTypeErrors += 1 } case WarningReport(msg, loco, src) => () } - Diagnostic.report(diag, printErr, 0, false) + Diagnostic.report(diag, output, 0, false) } } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi index fab41cad0..529fe8fac 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi @@ -3,7 +3,6 @@ declare module MyPartialOrder() { class MyPartialOrder let order: MyPartialOrder } -//| java.lang.Exception: Internal Error: Program reached and unexpected state. //| ╔══[ERROR] Unsupported parent specification //| ║ l.3: class MyPartialOrder extends BoundedMeetSemilattice.BoundedMeetSemilattice { //| ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js new file mode 100644 index 000000000..8a684875c --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js @@ -0,0 +1 @@ +//| codegen error: unexpected parent symbol value BoundedMeetSemilattice. \ No newline at end of file diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 74a96a210..6b80069bf 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -20,7 +20,7 @@ class DriverDiffTests extends AnyFunSuite { if (!outputDir.isEmpty()) driver.genPackageJson() val success = driver.execute - assert(success != expectError, s"failed when compiling $filename.") + assert(success, s"failed when compiling $filename.") if (!expectError) execution match { case Some((executionFile, outputFile)) => @@ -110,27 +110,27 @@ object DriverDiffTests { ts2mlsEntry("InterfaceMember.ts"), ts2mlsEntry("Intersection.ts", expectTypeError = true), ts2mlsEntry("Literal.ts"), - ts2mlsEntry("Namespace.ts", expectError = true), + ts2mlsEntry("Namespace.ts", expectTypeError = true), ts2mlsEntry("Optional.ts", expectTypeError = true), - ts2mlsEntry("Overload.ts", expectTypeError = true), + ts2mlsEntry("Overload.ts"), ts2mlsEntry("TSArray.ts", expectTypeError = true), ts2mlsEntry("Tuple.ts", expectTypeError = true), ts2mlsEntry("Type.ts", expectTypeError = true), ts2mlsEntry("TypeParameter.ts", expectTypeError = true), ts2mlsEntry("Union.ts"), - ts2mlsEntry("Variables.ts", expectError = true), + ts2mlsEntry("Variables.ts", expectTypeError = true), ) private val esCases = List( esEntry("Simple"), esEntry("Cycle2"), esEntry("Self", expectError = true), - esEntry("C", expectError = true), + esEntry("C", expectError = true, expectTypeError = true), esEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members esEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position esEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position esEntry("MLS2TheMax", Some("./tsconfig.json")), - esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true), // TODO: type traits in modules + esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules esEntry("Builtin"), esEntry("TyperDebug"), ) From 0cef3d73586d2347bb3b537758d33d929e614e77 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 8 Jul 2023 10:48:08 +0800 Subject: [PATCH 166/202] WIP: Parse selection in inheritance --- .../esprojects/js/mlscript/MyPartialOrder.js | 2 +- .../src/main/scala/mlscript/JSBackend.scala | 71 +++-- .../main/scala/mlscript/codegen/Codegen.scala | 2 +- .../test/diff/codegen/ModuleInheritance.mls | 246 ++++++++++++++++++ 4 files changed, 297 insertions(+), 24 deletions(-) create mode 100644 shared/src/test/diff/codegen/ModuleInheritance.mls diff --git a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js index 8a684875c..a9cc19292 100644 --- a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js +++ b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js @@ -1 +1 @@ -//| codegen error: unexpected parent symbol value BoundedMeetSemilattice. \ No newline at end of file +//| codegen error: type selection BoundedMeetSemilattice.BoundedMeetSemilattice is not supported in inheritance now. \ No newline at end of file diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 34842e4bd..3c05a7c8d 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -596,32 +596,59 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { def resolveName(term: Term): Str = term match { case App(lhs, _) => resolveName(lhs) case Var(name) => name - case Sel(_, Var(fieldName)) => fieldName + case Sel(parent, Var(fieldName)) => s"${resolveName(parent)}.$fieldName" case TyApp(lhs, _) => resolveName(lhs) case _ => throw CodeGenError("unsupported parents.") } - val name = resolveName(current) - - scope.resolveValue(name) match { - case Some(CapturedSymbol(_, _: TraitSymbol)) => base // TODO: - case Some(CapturedSymbol(out, sym: MixinSymbol)) => - JSInvoke(translateCapture(CapturedSymbol(out, sym)), Ls(base)) - case Some(CapturedSymbol(out, sym: NuTypeSymbol)) if !mixinOnly => - if (sym.isPlainJSClass) - translateCapture(CapturedSymbol(out, sym)) - else - translateCapture(CapturedSymbol(out, sym)).member("class") - case Some(_: TraitSymbol) => base // TODO: - case Some(sym: MixinSymbol) => - JSInvoke(translateVar(name, false), Ls(base)) - case Some(sym: NuTypeSymbol) if !mixinOnly => - if (sym.isPlainJSClass) - translateVar(name, false) - else - translateVar(name, false).member("class") - case Some(t) => throw CodeGenError(s"unexpected parent symbol $t.") - case N => throw CodeGenError(s"unresolved parent $name.") + val fullname = resolveName(current).split("\\.").toList + fullname match { + case name :: Nil => scope.resolveValue(name) match { + case Some(CapturedSymbol(_, _: TraitSymbol)) => base // TODO: + case Some(CapturedSymbol(out, sym: MixinSymbol)) => + JSInvoke(translateCapture(CapturedSymbol(out, sym)), Ls(base)) + case Some(CapturedSymbol(out, sym: NuTypeSymbol)) if !mixinOnly => + if (sym.isPlainJSClass) + translateCapture(CapturedSymbol(out, sym)) + else + translateCapture(CapturedSymbol(out, sym)).member("class") + case Some(_: TraitSymbol) => base // TODO: + case Some(sym: MixinSymbol) => + JSInvoke(translateVar(name, false), Ls(base)) + case Some(sym: NuTypeSymbol) if !mixinOnly => + if (sym.isPlainJSClass) + translateVar(name, false) + else + translateVar(name, false).member("class") + case Some(t) => throw CodeGenError(s"unexpected parent symbol $t.") + case N => throw CodeGenError(s"unresolved parent $name.") + } + case top :: rest => { + def insertParent(parent: Str, child: JSExpr): JSExpr = child match { + case JSIdent(name) => JSIdent(parent).member(name) + case field: JSField => insertParent(parent, field.`object`).member(field.property.name) + case _ => throw new AssertionError("unsupported parent expression.") + } + def resolveSelection(restNames: Ls[Str], nested: Ls[NuTypeDef], res: JSExpr): JSExpr = restNames match { + case name :: Nil => nested.find(_.nme.name === name).fold( + throw CodeGenError(s"parent $name not found.") + )(p => if (p.isPlainJSClass) res.member(name) else res.member(name).member("class")) + case cur :: rest => (nested.find { + case nd: NuTypeDef => nd.kind === Mod && nd.nme.name === cur + case _ => false + }).fold[JSExpr]( + throw CodeGenError(s"module $cur not found.") + )(md => resolveSelection(rest, md.body.entities.collect{ case nd: NuTypeDef => nd }, insertParent(cur, res))) + case Nil => throw new AssertionError("unexpected code state in resolve selection.") + } + scope.resolveValue(top) match { + case Some(sym: ModuleSymbol) => resolveSelection(rest, sym.nested, JSIdent(sym.lexicalName)) + case Some(CapturedSymbol(out, sym: ModuleSymbol)) => + resolveSelection(rest, sym.nested, JSIdent(out.runtimeName).member(sym.lexicalName)) + case _ => throw CodeGenError(s"type selection ${fullname.mkString(".")} is not supported in inheritance now.") + } + } + case _ => throw CodeGenError(s"unresolved parent ${fullname.mkString(".")}.") } } diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index dd90f1b0a..95f447252 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -598,7 +598,7 @@ object JSMember { def apply(`object`: JSExpr, property: JSExpr): JSMember = new JSMember(`object`, property) } -class JSField(`object`: JSExpr, val property: JSIdent) extends JSMember(`object`, property) { +class JSField(val `object`: JSExpr, val property: JSIdent) extends JSMember(`object`, property) { override def toSourceCode: SourceCode = `object`.toSourceCode.parenthesized( `object`.precedence < precedence || `object`.isInstanceOf[JSRecord] diff --git a/shared/src/test/diff/codegen/ModuleInheritance.mls b/shared/src/test/diff/codegen/ModuleInheritance.mls new file mode 100644 index 000000000..2d436deda --- /dev/null +++ b/shared/src/test/diff/codegen/ModuleInheritance.mls @@ -0,0 +1,246 @@ +:NewParser +:NewDefs + +module A { + class B(x: Int) { + fun add(y: Int) = x + y + } + class C {} +} +//│ module A { +//│ class B(x: Int) { +//│ fun add: (y: Int,) -> Int +//│ } +//│ class C +//│ } + +:e +:js +class C() extends A.B(1) +class CC() extends A.C +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.19: class C() extends A.B(1) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.20: class CC() extends A.C +//│ ╙── ^^^ +//│ class C() +//│ class CC() +//│ // Prelude +//│ class TypingUnit1 { +//│ #C; +//│ #CC; +//│ constructor() { +//│ } +//│ get C() { +//│ const outer = this; +//│ if (this.#C === undefined) { +//│ class C extends A.B.class { +//│ constructor() { +//│ super(1); +//│ } +//│ }; +//│ this.#C = (() => Object.freeze(new C())); +//│ this.#C.class = C; +//│ } +//│ return this.#C; +//│ } +//│ get CC() { +//│ const outer = this; +//│ if (this.#CC === undefined) { +//│ class CC extends A.C { +//│ constructor() { +//│ super(); +//│ } +//│ }; +//│ this.#CC = (() => Object.freeze(new CC())); +//│ this.#CC.class = CC; +//│ } +//│ return this.#CC; +//│ } +//│ } +//│ const typing_unit1 = new TypingUnit1; +//│ globalThis.C = typing_unit1.C; +//│ globalThis.CC = typing_unit1.CC; +//│ // End of generated code + +:e +C().add(3) +//│ ╔══[ERROR] Type `C` does not contain member `add` +//│ ║ l.68: C().add(3) +//│ ╙── ^^^^ +//│ error +//│ res +//│ = 4 + +:e +:js +module B { + class C() + class D() extends B.C { + val x = 42 + } +} +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.80: class D() extends B.C { +//│ ╙── ^^^ +//│ module B { +//│ class C() +//│ class D() { +//│ let x: 42 +//│ } +//│ } +//│ // Prelude +//│ class TypingUnit3 { +//│ #B; +//│ constructor() { +//│ } +//│ get B() { +//│ const outer = this; +//│ if (this.#B === undefined) { +//│ class B { +//│ #C; +//│ #D; +//│ constructor() { +//│ } +//│ get C() { +//│ const outer1 = this; +//│ if (this.#C === undefined) { +//│ class C {}; +//│ this.#C = (() => Object.freeze(new C())); +//│ this.#C.class = C; +//│ } +//│ return this.#C; +//│ } +//│ get D() { +//│ const outer1 = this; +//│ if (this.#D === undefined) { +//│ class D extends outer.B.C.class { +//│ #x; +//│ get x() { return this.#x; } +//│ constructor() { +//│ super(); +//│ this.#x = 42; +//│ const x = this.#x; +//│ } +//│ }; +//│ this.#D = (() => Object.freeze(new D())); +//│ this.#D.class = D; +//│ } +//│ return this.#D; +//│ } +//│ } +//│ this.#B = new B(); +//│ this.#B.class = B; +//│ } +//│ return this.#B; +//│ } +//│ } +//│ const typing_unit3 = new TypingUnit3; +//│ globalThis.B = typing_unit3.B; +//│ // End of generated code + +:e +let dd = B.D() +dd.x +//│ ╔══[ERROR] access to class member not yet supported +//│ ║ l.144: let dd = B.D() +//│ ╙── ^^ +//│ let dd: error +//│ error +//│ dd +//│ = D {} +//│ res +//│ = 42 + +:e +:js +module C { + module D { + class E() + } + class F(x: Int) extends D.E +} +//│ ╔══[ERROR] Unsupported parent specification +//│ ║ l.162: class F(x: Int) extends D.E +//│ ╙── ^^^ +//│ module C { +//│ module D { +//│ class E() +//│ } +//│ class F(x: Int) +//│ } +//│ // Prelude +//│ class TypingUnit5 { +//│ #C; +//│ constructor() { +//│ } +//│ get C() { +//│ const outer = this; +//│ if (this.#C === undefined) { +//│ class C { +//│ #F; +//│ #D; +//│ constructor() { +//│ } +//│ get D() { +//│ const outer1 = this; +//│ if (this.#D === undefined) { +//│ class D { +//│ #E; +//│ constructor() { +//│ } +//│ get E() { +//│ const outer2 = this; +//│ if (this.#E === undefined) { +//│ class E {}; +//│ this.#E = (() => Object.freeze(new E())); +//│ this.#E.class = E; +//│ } +//│ return this.#E; +//│ } +//│ } +//│ this.#D = new D(); +//│ this.#D.class = D; +//│ } +//│ return this.#D; +//│ } +//│ get F() { +//│ const outer1 = this; +//│ if (this.#F === undefined) { +//│ class F extends outer1.D.E.class { +//│ #x; +//│ get x() { return this.#x; } +//│ constructor(x) { +//│ super(); +//│ this.#x = x; +//│ } +//│ }; +//│ this.#F = ((x) => Object.freeze(new F(x))); +//│ this.#F.class = F; +//│ } +//│ return this.#F; +//│ } +//│ } +//│ this.#C = new C(); +//│ this.#C.class = C; +//│ } +//│ return this.#C; +//│ } +//│ } +//│ const typing_unit5 = new TypingUnit5; +//│ globalThis.C = typing_unit5.C; +//│ // End of generated code + +:e +let fff = C.F(24) +fff.x +//│ ╔══[ERROR] access to class member not yet supported +//│ ║ l.236: let fff = C.F(24) +//│ ╙── ^^ +//│ let fff: error +//│ error +//│ fff +//│ = F {} +//│ res +//│ = 24 From ff607d5ec371ca9ea21ea13186e13532c6c036f1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 10 Jul 2023 09:55:12 +0800 Subject: [PATCH 167/202] WIP: Handle imported symbols in driver --- driver/js/src/main/scala/driver/Driver.scala | 12 +++-- .../src/main/scala/driver/DriverBackend.scala | 3 +- .../.interfaces/mlscript/Child.mlsi | 20 +++++++ .../.interfaces/mlscript/Parent.mlsi | 8 +++ .../src/test/esprojects/js/mlscript/Child.js | 54 +++++++++++++++++++ .../src/test/esprojects/js/mlscript/Parent.js | 41 ++++++++++++++ .../js/src/test/esprojects/mlscript/Child.mls | 9 ++++ .../src/test/esprojects/mlscript/Parent.mls | 7 +++ driver/js/src/test/output/Child.check | 2 + .../test/scala/driver/DriverDiffTests.scala | 1 + 10 files changed, 151 insertions(+), 6 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/Child.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Parent.js create mode 100644 driver/js/src/test/esprojects/mlscript/Child.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Parent.mls create mode 100644 driver/js/src/test/output/Child.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index e73d3f510..995b5d1b9 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -169,6 +169,7 @@ class Driver(options: DriverOptions) { case (_, declarations, _, _) => declarations })) + // Check if generated ts interfaces are correct private def checkTSInterface(file: FileInfo, writer: JSWriter): Unit = parse(file.filename, writer.getContent) match { case (_, declarations, imports, origin) => var ctx: Ctx = Ctx.init @@ -201,11 +202,12 @@ class Driver(options: DriverOptions) { implicit ctx: Ctx, extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] - ): Unit = + ): List[NuDecl] = parseAndRun(s"${options.path}/${file.interfaceFilename}", { case (_, declarations, imports, _) => imports.foreach(d => importModule(file.`import`(d.path))) `type`(TypingUnit(declarations), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) + declarations }) private def compile( @@ -265,11 +267,12 @@ class Driver(options: DriverOptions) { }) System.out.println(s"compiling ${file.filename}...") - try { otherList.foreach(d => importModule(file.`import`(d))) } + val importedSym = try { otherList.map(d => importModule(file.`import`(d))) } catch { case t : Throwable => totalTypeErrors += 1 mlsiWriter.writeErr(t.toString()) + Nil } if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = @@ -288,7 +291,7 @@ class Driver(options: DriverOptions) { imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } - ), exported || importedModule(file.filename)) + ), jsBuiltinDecs ++ importedSym, exported || importedModule(file.filename)) } else `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // for ts/mlsi files, we only check interface files @@ -301,10 +304,11 @@ class Driver(options: DriverOptions) { filename: String, moduleName: String, imports: Ls[Import with ModuleType], + predefs: Ls[Ls[NuDecl]], exported: Boolean ): Unit = try { val backend = new JSDriverBackend() - jsBuiltinDecs.foreach(lst => backend.declareJSBuiltin(Pgrm(lst))) + predefs.foreach(pd => backend.declarePredef(Pgrm(pd))) val lines = backend(program, moduleName, imports, exported, options.commonJS) val code = lines.mkString("", "\n", "\n") saveToFile(filename, code) diff --git a/driver/js/src/main/scala/driver/DriverBackend.scala b/driver/js/src/main/scala/driver/DriverBackend.scala index 54097148d..164807341 100644 --- a/driver/js/src/main/scala/driver/DriverBackend.scala +++ b/driver/js/src/main/scala/driver/DriverBackend.scala @@ -7,7 +7,7 @@ import mlscript.codegen.Helpers._ import ts2mls.TSPathResolver class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { - def declareJSBuiltin(pgrm: Pgrm): Unit = { + def declarePredef(pgrm: Pgrm): Unit = { val (typeDefs, otherStmts) = pgrm.tops.partitionMap { case ot: Terms => R(ot) case fd: NuFunDef => R(fd) @@ -63,7 +63,6 @@ class JSDriverBackend extends JSBackend(allowUnresolvedSymbols = false) { def apply(pgrm: Pgrm, topModuleName: Str, imports: Ls[Import with ModuleType], exported: Bool, commonJS: Bool): Ls[Str] = { imports.flatMap (imp => { - topLevelScope.declareValue(TSPathResolver.basename(imp.path), Some(false), false) translateImport(imp, commonJS).toSourceCode.toLines }) ::: generateNewDef(pgrm, topModuleName, exported, commonJS) } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi new file mode 100644 index 000000000..487fef062 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi @@ -0,0 +1,20 @@ +import "./Parent.mlsi" +declare module Child() { + class Child1(x: Int) + class Child2(y: Int) + let c1: Child1 + let c2: Child2 + unit +} +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.3: class Child1(x: Int) extends Parent.Parent1(x + 1) +//| ╙── ^^^^^^^^^^^^^^^^^^^^^ +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.4: class Child2(y: Int) extends Parent.Parent2 +//| ╙── ^^^^^^^^^^^^^^ +//| ╔══[ERROR] Type `Child1` does not contain member `inc` +//| ║ l.8: console.log(c1.inc) +//| ╙── ^^^^ +//| ╔══[ERROR] Type `Child2` does not contain member `x` +//| ║ l.9: console.log(c2.x) +//| ╙── ^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi new file mode 100644 index 000000000..0d993fdba --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi @@ -0,0 +1,8 @@ +declare module Parent() { + class Parent1(x: Int) { + fun inc: Int + } + class Parent2 { + fun x: 42 + } +} diff --git a/driver/js/src/test/esprojects/js/mlscript/Child.js b/driver/js/src/test/esprojects/js/mlscript/Child.js new file mode 100644 index 000000000..b6504d3db --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Child.js @@ -0,0 +1,54 @@ +import { Parent } from "./Parent.js" + +const Child = new class Child { + #Child1; + #Child2; + #c1; + get c1() { return this.#c1; } + #c2; + get c2() { return this.#c2; } + constructor() { + } + get Child1() { + const outer = this; + if (this.#Child1 === undefined) { + class Child1 extends Parent.Parent1.class { + #x; + get x() { return this.#x; } + constructor(x) { + super(x + 1); + this.#x = x; + } + }; + this.#Child1 = ((x) => Object.freeze(new Child1(x))); + this.#Child1.class = Child1; + } + return this.#Child1; + } + get Child2() { + const outer = this; + if (this.#Child2 === undefined) { + class Child2 extends Parent.Parent2 { + #y; + get y() { return this.#y; } + constructor(y) { + super(); + this.#y = y; + } + }; + this.#Child2 = ((y) => Object.freeze(new Child2(y))); + this.#Child2.class = Child2; + } + return this.#Child2; + } + $init() { + const self = this; + this.#c1 = self.Child1(2); + const c1 = this.#c1; + this.#c2 = self.Child2(3); + const c2 = this.#c2; + console.log(c1.inc); + console.log(c2.x); + } +}; +Child.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Parent.js b/driver/js/src/test/esprojects/js/mlscript/Parent.js new file mode 100644 index 000000000..df7a51ced --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Parent.js @@ -0,0 +1,41 @@ +export const Parent = new class Parent { + #Parent1; + #Parent2; + constructor() { + } + get Parent1() { + const outer = this; + if (this.#Parent1 === undefined) { + class Parent1 { + #x; + get x() { return this.#x; } + constructor(x) { + this.#x = x; + } + get inc() { + const x = this.#x; + return x + 1; + } + }; + this.#Parent1 = ((x) => Object.freeze(new Parent1(x))); + this.#Parent1.class = Parent1; + } + return this.#Parent1; + } + get Parent2() { + const outer = this; + if (this.#Parent2 === undefined) { + class Parent2 { + constructor() { + } + get x() { + return 42; + } + }; + this.#Parent2 = Parent2; + } + return this.#Parent2; + } + $init() {} +}; +Parent.$init(); diff --git a/driver/js/src/test/esprojects/mlscript/Child.mls b/driver/js/src/test/esprojects/mlscript/Child.mls new file mode 100644 index 000000000..8dc0a2d5f --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Child.mls @@ -0,0 +1,9 @@ +import "./Parent.mls" + +class Child1(x: Int) extends Parent.Parent1(x + 1) +class Child2(y: Int) extends Parent.Parent2 + +let c1 = Child1(2) +let c2 = Child2(3) +console.log(c1.inc) +console.log(c2.x) diff --git a/driver/js/src/test/esprojects/mlscript/Parent.mls b/driver/js/src/test/esprojects/mlscript/Parent.mls new file mode 100644 index 000000000..d64641d15 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Parent.mls @@ -0,0 +1,7 @@ +export class Parent1(x: Int) { + fun inc = x + 1 +} + +export class Parent2 { + fun x = 42 +} diff --git a/driver/js/src/test/output/Child.check b/driver/js/src/test/output/Child.check new file mode 100644 index 000000000..f259f2362 --- /dev/null +++ b/driver/js/src/test/output/Child.check @@ -0,0 +1,2 @@ +4 +42 diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 6b80069bf..73555b5f7 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -133,6 +133,7 @@ object DriverDiffTests { esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules esEntry("Builtin"), esEntry("TyperDebug"), + esEntry("Child", expectTypeError = true) ) private val cjsCases = List( From 56e079b468e0927b789664815000bdecafe4d406 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 10 Jul 2023 10:01:31 +0800 Subject: [PATCH 168/202] WIP: Fix cycle signatures handling --- driver/js/src/main/scala/driver/Driver.scala | 6 +++--- driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 995b5d1b9..47969c9f6 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -267,13 +267,13 @@ class Driver(options: DriverOptions) { }) System.out.println(s"compiling ${file.filename}...") - val importedSym = try { otherList.map(d => importModule(file.`import`(d))) } + val importedSym = (try { otherList.map(d => importModule(file.`import`(d))) } catch { case t : Throwable => totalTypeErrors += 1 mlsiWriter.writeErr(t.toString()) Nil - } + }) ++ cycleSigs.map(tu => tu.entities) if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false, mlsiWriter.writeErr).show}") + { @@ -304,7 +304,7 @@ class Driver(options: DriverOptions) { filename: String, moduleName: String, imports: Ls[Import with ModuleType], - predefs: Ls[Ls[NuDecl]], + predefs: Ls[Ls[Statement]], exported: Boolean ): Unit = try { val backend = new JSDriverBackend() diff --git a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js index a9cc19292..57f4d1f6a 100644 --- a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js +++ b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js @@ -1 +1 @@ -//| codegen error: type selection BoundedMeetSemilattice.BoundedMeetSemilattice is not supported in inheritance now. \ No newline at end of file +//| codegen error: parent BoundedMeetSemilattice not found. \ No newline at end of file From 2b9f4e0faaa28b98e6a7a820061bd6c93f57670c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 10 Jul 2023 11:45:12 +0800 Subject: [PATCH 169/202] WIP: Fix several problems --- .../cjsprojects/.interfaces/mlscript/Bar.mlsi | 15 +++++++++ .../.interfaces/mlscript/BazBaz.mlsi | 12 +++++++ .../test/cjsprojects/.interfaces/ts/Baz.mlsi | 6 ++++ .../test/cjsprojects/.interfaces/ts/Foo.mlsi | 3 ++ .../src/test/cjsprojects/js/mlscript/Bar.js | 33 +++++++++++++++++++ .../test/cjsprojects/js/mlscript/BazBaz.js | 29 ++++++++++++++++ driver/js/src/test/cjsprojects/js/ts/Baz.js | 28 ++++++++++++++++ driver/js/src/test/cjsprojects/js/ts/Foo.js | 7 ++++ .../js/src/test/cjsprojects/mlscript/Bar.mls | 9 +++++ .../src/test/cjsprojects/mlscript/BazBaz.mls | 6 ++++ driver/js/src/test/cjsprojects/ts/Baz.ts | 16 +++++++++ driver/js/src/test/cjsprojects/ts/Foo.ts | 7 ++++ .../.interfaces/mlscript/NewTSClass.mlsi | 11 +++++++ .../esprojects/.interfaces/ts/MyClass.mlsi | 5 +++ .../test/esprojects/js/mlscript/NewTSClass.js | 25 ++++++++++++++ .../test/esprojects/js/my_ts_path/MyClass.js | 5 +++ .../test/esprojects/mlscript/NewTSClass.mls | 4 +++ driver/js/src/test/esprojects/ts/MyClass.ts | 5 +++ driver/js/src/test/output/Bar.check | 2 ++ driver/js/src/test/output/BazBaz.check | 2 ++ driver/js/src/test/output/NewTSClass.check | 1 + .../test/scala/driver/DriverDiffTests.scala | 5 ++- .../main/scala/ts2mls/TSCompilerInfo.scala | 2 ++ .../src/main/scala/ts2mls/TSSourceFile.scala | 19 +++++++++-- .../main/scala/ts2mls/types/Converter.scala | 2 +- 25 files changed, 254 insertions(+), 5 deletions(-) create mode 100644 driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi create mode 100644 driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi create mode 100644 driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi create mode 100644 driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi create mode 100644 driver/js/src/test/cjsprojects/js/mlscript/Bar.js create mode 100644 driver/js/src/test/cjsprojects/js/mlscript/BazBaz.js create mode 100644 driver/js/src/test/cjsprojects/js/ts/Baz.js create mode 100644 driver/js/src/test/cjsprojects/js/ts/Foo.js create mode 100644 driver/js/src/test/cjsprojects/mlscript/Bar.mls create mode 100644 driver/js/src/test/cjsprojects/mlscript/BazBaz.mls create mode 100644 driver/js/src/test/cjsprojects/ts/Baz.ts create mode 100644 driver/js/src/test/cjsprojects/ts/Foo.ts create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/NewTSClass.js create mode 100644 driver/js/src/test/esprojects/js/my_ts_path/MyClass.js create mode 100644 driver/js/src/test/esprojects/mlscript/NewTSClass.mls create mode 100644 driver/js/src/test/esprojects/ts/MyClass.ts create mode 100644 driver/js/src/test/output/Bar.check create mode 100644 driver/js/src/test/output/BazBaz.check create mode 100644 driver/js/src/test/output/NewTSClass.check diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi new file mode 100644 index 000000000..c2d6c9ca5 --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi @@ -0,0 +1,15 @@ +import "../ts/Foo.mlsi" +declare module Bar() { + class Bar() extends Foo { + fun bar: "bar" + fun foo: () -> Str + } + let bf: Bar + unit +} +//| ╔══[ERROR] Member `foo` is declared in parent but not implemented in `Bar` +//| ║ l.3: class Bar() extends Foo { +//| ║ ^^^ +//| ╟── Declared here: +//| ║ l.2: fun foo(): Str +//| ╙── ^^^^^^^^^^ diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi new file mode 100644 index 000000000..f63e7141c --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi @@ -0,0 +1,12 @@ +import "../ts/Baz.mlsi" +declare module BazBaz() { + class BazBaz() + let bazbaz: BazBaz + error +} +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.3: class BazBaz() extends Baz.Baz(2) +//| ╙── ^^^^^^^^^^ +//| ╔══[ERROR] Type `BazBaz` does not contain member `baz` +//| ║ l.6: bazbaz.baz() +//| ╙── ^^^^ diff --git a/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi b/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi new file mode 100644 index 000000000..02b850045 --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi @@ -0,0 +1,6 @@ +export declare module Baz { + export declare class Baz { + constructor(t: Num) + fun baz(): unit + } +} diff --git a/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi b/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi new file mode 100644 index 000000000..3a980698c --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi @@ -0,0 +1,3 @@ +export declare class Foo { + fun foo(): Str +} diff --git a/driver/js/src/test/cjsprojects/js/mlscript/Bar.js b/driver/js/src/test/cjsprojects/js/mlscript/Bar.js new file mode 100644 index 000000000..ae629cc42 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/mlscript/Bar.js @@ -0,0 +1,33 @@ +const Foo = require("../ts/Foo.js") + +const Bar = new class Bar { + #Bar; + #bf; + get bf() { return this.#bf; } + constructor() { + } + get Bar() { + const outer = this; + if (this.#Bar === undefined) { + class Bar extends Foo { + constructor() { + super(); + } + get bar() { + return "bar"; + } + }; + this.#Bar = (() => Object.freeze(new Bar())); + this.#Bar.class = Bar; + } + return this.#Bar; + } + $init() { + const self = this; + this.#bf = self.Bar(); + const bf = this.#bf; + console.log(bf.bar); + console.log(bf.foo()); + } +}; +Bar.$init(); diff --git a/driver/js/src/test/cjsprojects/js/mlscript/BazBaz.js b/driver/js/src/test/cjsprojects/js/mlscript/BazBaz.js new file mode 100644 index 000000000..6686099af --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/mlscript/BazBaz.js @@ -0,0 +1,29 @@ +const Baz = require("../ts/Baz.js") + +const BazBaz = new class BazBaz { + #BazBaz; + #bazbaz; + get bazbaz() { return this.#bazbaz; } + constructor() { + } + get BazBaz() { + const outer = this; + if (this.#BazBaz === undefined) { + class BazBaz extends Baz.Baz { + constructor() { + super(2); + } + }; + this.#BazBaz = (() => Object.freeze(new BazBaz())); + this.#BazBaz.class = BazBaz; + } + return this.#BazBaz; + } + $init() { + const self = this; + this.#bazbaz = self.BazBaz(); + const bazbaz = this.#bazbaz; + bazbaz.baz(); + } +}; +BazBaz.$init(); diff --git a/driver/js/src/test/cjsprojects/js/ts/Baz.js b/driver/js/src/test/cjsprojects/js/ts/Baz.js new file mode 100644 index 000000000..7ffc30d13 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/ts/Baz.js @@ -0,0 +1,28 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Baz_times; +class Baz { + constructor(t) { + _Baz_times.set(this, void 0); + __classPrivateFieldSet(this, _Baz_times, t, "f"); + } + baz() { + for (let i = 0; i < __classPrivateFieldGet(this, _Baz_times, "f"); ++i) { + console.log("baz"); + } + } +} +_Baz_times = new WeakMap(); +module.exports = { + Baz: Baz +}; diff --git a/driver/js/src/test/cjsprojects/js/ts/Foo.js b/driver/js/src/test/cjsprojects/js/ts/Foo.js new file mode 100644 index 000000000..d6f4f2210 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/ts/Foo.js @@ -0,0 +1,7 @@ +"use strict"; +class Foo { + foo() { + return "foo"; + } +} +module.exports = Foo; diff --git a/driver/js/src/test/cjsprojects/mlscript/Bar.mls b/driver/js/src/test/cjsprojects/mlscript/Bar.mls new file mode 100644 index 000000000..c767f5021 --- /dev/null +++ b/driver/js/src/test/cjsprojects/mlscript/Bar.mls @@ -0,0 +1,9 @@ +import "../ts/Foo.ts" + +class Bar() extends Foo { + fun bar = "bar" +} + +let bf = Bar() +console.log(bf.bar) +console.log(bf.foo()) diff --git a/driver/js/src/test/cjsprojects/mlscript/BazBaz.mls b/driver/js/src/test/cjsprojects/mlscript/BazBaz.mls new file mode 100644 index 000000000..db1796717 --- /dev/null +++ b/driver/js/src/test/cjsprojects/mlscript/BazBaz.mls @@ -0,0 +1,6 @@ +import "../ts/Baz.ts" + +class BazBaz() extends Baz.Baz(2) + +let bazbaz = BazBaz() +bazbaz.baz() diff --git a/driver/js/src/test/cjsprojects/ts/Baz.ts b/driver/js/src/test/cjsprojects/ts/Baz.ts new file mode 100644 index 000000000..16c5af51a --- /dev/null +++ b/driver/js/src/test/cjsprojects/ts/Baz.ts @@ -0,0 +1,16 @@ +class Baz { + #times + constructor(t: number) { + this.#times = t; + } + + baz() { + for (let i = 0; i < this.#times; ++i) { + console.log("baz") + } + } +} + +export = { + Baz: Baz +} diff --git a/driver/js/src/test/cjsprojects/ts/Foo.ts b/driver/js/src/test/cjsprojects/ts/Foo.ts new file mode 100644 index 000000000..9b47306cc --- /dev/null +++ b/driver/js/src/test/cjsprojects/ts/Foo.ts @@ -0,0 +1,7 @@ +class Foo { + foo() { + return "foo"; + } +} + +export = Foo diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi new file mode 100644 index 000000000..f2353d07d --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi @@ -0,0 +1,11 @@ +import "../ts/MyClass.mlsi" +declare module NewTSClass() { + class Bar() + error +} +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.3: class Bar() extends MyClass.FooClass +//| ╙── ^^^^^^^^^^^^^^^^ +//| ╔══[ERROR] Type `Bar` does not contain member `foo` +//| ║ l.4: Bar().foo() +//| ╙── ^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi new file mode 100644 index 000000000..ceb0308a4 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi @@ -0,0 +1,5 @@ +export declare module MyClass { + export declare class FooClass { + fun foo(): unit + } +} diff --git a/driver/js/src/test/esprojects/js/mlscript/NewTSClass.js b/driver/js/src/test/esprojects/js/mlscript/NewTSClass.js new file mode 100644 index 000000000..4e41e3cc1 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/NewTSClass.js @@ -0,0 +1,25 @@ +import * as MyClass from "../my_ts_path/MyClass.js" + +const NewTSClass = new class NewTSClass { + #Bar; + constructor() { + } + get Bar() { + const outer = this; + if (this.#Bar === undefined) { + class Bar extends MyClass.FooClass { + constructor() { + super(); + } + }; + this.#Bar = (() => Object.freeze(new Bar())); + this.#Bar.class = Bar; + } + return this.#Bar; + } + $init() { + const self = this; + self.Bar().foo(); + } +}; +NewTSClass.$init(); diff --git a/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js b/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js new file mode 100644 index 000000000..0aadeb152 --- /dev/null +++ b/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js @@ -0,0 +1,5 @@ +export class FooClass { + foo() { + console.log("foo"); + } +} diff --git a/driver/js/src/test/esprojects/mlscript/NewTSClass.mls b/driver/js/src/test/esprojects/mlscript/NewTSClass.mls new file mode 100644 index 000000000..8b228b064 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/NewTSClass.mls @@ -0,0 +1,4 @@ +import "../ts/MyClass.ts" + +class Bar() extends MyClass.FooClass +Bar().foo() diff --git a/driver/js/src/test/esprojects/ts/MyClass.ts b/driver/js/src/test/esprojects/ts/MyClass.ts new file mode 100644 index 000000000..6e6efd3f7 --- /dev/null +++ b/driver/js/src/test/esprojects/ts/MyClass.ts @@ -0,0 +1,5 @@ +export class FooClass { + foo() { + console.log("foo") + } +} diff --git a/driver/js/src/test/output/Bar.check b/driver/js/src/test/output/Bar.check new file mode 100644 index 000000000..128976523 --- /dev/null +++ b/driver/js/src/test/output/Bar.check @@ -0,0 +1,2 @@ +bar +foo diff --git a/driver/js/src/test/output/BazBaz.check b/driver/js/src/test/output/BazBaz.check new file mode 100644 index 000000000..1f553352f --- /dev/null +++ b/driver/js/src/test/output/BazBaz.check @@ -0,0 +1,2 @@ +baz +baz diff --git a/driver/js/src/test/output/NewTSClass.check b/driver/js/src/test/output/NewTSClass.check new file mode 100644 index 000000000..257cc5642 --- /dev/null +++ b/driver/js/src/test/output/NewTSClass.check @@ -0,0 +1 @@ +foo diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 73555b5f7..f82de164e 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -133,12 +133,15 @@ object DriverDiffTests { esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules esEntry("Builtin"), esEntry("TyperDebug"), - esEntry("Child", expectTypeError = true) + esEntry("Child", expectTypeError = true), + esEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true) ) private val cjsCases = List( cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types cjsEntry("CJS1"), + cjsEntry("Bar", Some("./tsconfig.json"), expectTypeError = true), + cjsEntry("BazBaz", Some("./tsconfig.json"), expectTypeError = true), ) private val cp = g.require("child_process") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 8f18ed98c..2f9516dc0 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -212,6 +212,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val heritageClauses = TSNodeArray(node.heritageClauses) lazy val initializer = TSNodeObject(node.initializer) lazy val initToken = TSTokenObject(node.initializer) // for object literal, the initializer is a token. + lazy val initID = TSIdentifierObject(node.initializer) lazy val modifier = if (modifiers.isUndefined) Public else modifiers.foldLeft[TSAccessModifier](Public)( @@ -250,6 +251,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val moduleReference = TSNodeObject(node.moduleReference) lazy val expression = TSTokenObject(node.expression) lazy val idExpression = TSIdentifierObject(node.expression) + lazy val nodeExpression = TSNodeObject(node.expression) lazy val isVarParam = !js.isUndefined(node.dotDotDotToken) lazy val hasmoduleReference = !js.isUndefined(node.moduleReference) lazy val moduleAugmentation = diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index c34ba5477..c764c019d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -43,7 +43,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } }) - // handle parents & export + // parse export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isExportDeclaration) { @@ -52,8 +52,21 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else // ES modules parseExportDeclaration(nodeObject.exportClause.elements) } - else if (nodeObject.isExportAssignment) // commonJS - global.renameExport(nodeObject.idExpression.escapedText, topName) + else if (nodeObject.isExportAssignment) { // commonJS + val name = nodeObject.idExpression.escapedText + if (name === "undefined") { // For exports = { ... }. In this case we still need the top-level module + val props = nodeObject.nodeExpression.properties + props.foreach(node => { + val name = node.initID.escapedText + if (name === "undefined") + addNodeIntoNamespace(node.initializer, node.name.escapedText, true)(global) + else if (node.name.escapedText === name) + global.`export`(name) + else global.put(node.name.escapedText, TSRenamedType(node.name.escapedText, TSReferenceType(name)), true, false) + }) + } + else global.renameExport(name, topName) // Export the member directly + } else if (nodeObject.exportedAsNamespace) // UMD umdModuleName = Some(nodeObject.symbol.escapedName) }) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index fdd31d8c7..2ce38aaf6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -115,7 +115,7 @@ object Converter { private def convertRecord(members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType], anonymous: Boolean)(implicit indent: String) = { val allRecs = members.toList.map((m) => m._2.modifier match { - case Public => + case Public if !m._1.contains("#") => if (anonymous) s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" From 7132edb054775f561e8256536457c678c4fcead4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 10:16:05 +0800 Subject: [PATCH 170/202] WIP: Add declaration check in NuMember and fix declare keyword generation --- driver/js/src/main/scala/driver/Driver.scala | 6 - .../cjsprojects/.interfaces/mlscript/Bar.mlsi | 6 - .../test/cjsprojects/.interfaces/ts/Baz.mlsi | 2 +- .../test/cjsprojects/.interfaces/ts/Foo.mlsi | 2 +- .../esprojects/.interfaces/ts/ConfigGen.mlsi | 2 +- .../esprojects/.interfaces/ts/MyClass.mlsi | 2 +- .../esprojects/.interfaces/ts/MyPrint.mlsi | 2 +- .../esprojects/.interfaces/ts/ReadLine.mlsi | 2 +- .../test/scala/driver/DriverDiffTests.scala | 2 +- .../src/main/scala/mlscript/NuTypeDefs.scala | 11 +- shared/src/test/diff/nu/DeclaredMembers.mls | 16 + .../src/main/scala/ts2mls/TSNamespace.scala | 6 +- .../main/scala/ts2mls/types/Converter.scala | 11 +- ts2mls/js/src/test/diff/BasicFunctions.mlsi | 52 +- ts2mls/js/src/test/diff/ClassMember.mlsi | 14 +- ts2mls/js/src/test/diff/Dec.mlsi | 6 +- ts2mls/js/src/test/diff/Dependency.mlsi | 2 +- ts2mls/js/src/test/diff/Dom.mlsi | 40 +- ts2mls/js/src/test/diff/ES5.mlsi | 840 +++++++++--------- ts2mls/js/src/test/diff/Enum.mlsi | 6 +- ts2mls/js/src/test/diff/Escape.mlsi | 2 +- ts2mls/js/src/test/diff/Export.mlsi | 8 +- ts2mls/js/src/test/diff/HighOrderFunc.mlsi | 6 +- ts2mls/js/src/test/diff/InterfaceMember.mlsi | 20 +- ts2mls/js/src/test/diff/Intersection.mlsi | 50 +- ts2mls/js/src/test/diff/Literal.mlsi | 2 +- ts2mls/js/src/test/diff/Namespace.mlsi | 26 +- ts2mls/js/src/test/diff/Optional.mlsi | 36 +- ts2mls/js/src/test/diff/Overload.mlsi | 30 +- ts2mls/js/src/test/diff/TSArray.mlsi | 56 +- ts2mls/js/src/test/diff/Tuple.mlsi | 40 +- ts2mls/js/src/test/diff/Type.mlsi | 12 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 50 +- ts2mls/js/src/test/diff/Union.mlsi | 14 +- 34 files changed, 697 insertions(+), 685 deletions(-) create mode 100644 shared/src/test/diff/nu/DeclaredMembers.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 47969c9f6..cf211d078 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -122,12 +122,6 @@ class Driver(options: DriverOptions) { (definitions, declarations, depList, origin) } - private def isInterfaceOutdate(origin: String, inter: String): Boolean = { - val mtime = getModificationTime(origin) - val imtime = getModificationTime(inter) - mtime >= imtime - } - private def packTopModule(moduleName: Option[String], content: String) = moduleName.fold(content)(moduleName => s"declare module $moduleName() {\n" + diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi index c2d6c9ca5..7a48fb3fd 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi @@ -7,9 +7,3 @@ declare module Bar() { let bf: Bar unit } -//| ╔══[ERROR] Member `foo` is declared in parent but not implemented in `Bar` -//| ║ l.3: class Bar() extends Foo { -//| ║ ^^^ -//| ╟── Declared here: -//| ║ l.2: fun foo(): Str -//| ╙── ^^^^^^^^^^ diff --git a/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi b/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi index 02b850045..bf7bde4fc 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/ts/Baz.mlsi @@ -1,6 +1,6 @@ export declare module Baz { export declare class Baz { constructor(t: Num) - fun baz(): unit + declare fun baz(): unit } } diff --git a/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi b/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi index 3a980698c..4e9366ee3 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/ts/Foo.mlsi @@ -1,3 +1,3 @@ export declare class Foo { - fun foo(): Str + declare fun foo(): Str } diff --git a/driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi index a6f8d081c..5826e23f2 100644 --- a/driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/ts/ConfigGen.mlsi @@ -1,4 +1,4 @@ import "json5.mlsi" export declare module ConfigGen { - export fun generate(outDir: Str): Str + export declare fun generate(outDir: Str): Str } diff --git a/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi index ceb0308a4..bae9f9256 100644 --- a/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/ts/MyClass.mlsi @@ -1,5 +1,5 @@ export declare module MyClass { export declare class FooClass { - fun foo(): unit + declare fun foo(): unit } } diff --git a/driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi index 7ff6f120e..5cd0a5a98 100644 --- a/driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/ts/MyPrint.mlsi @@ -1,6 +1,6 @@ export declare module MyPrint { export declare class DatePrint { constructor(p: Str) - fun print(args0: Str): unit + declare fun print(args0: Str): unit } } diff --git a/driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi b/driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi index f4815e47b..1288af2b5 100644 --- a/driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/ts/ReadLine.mlsi @@ -1,5 +1,5 @@ export declare module ReadLine { val lines: MutArray[Str] val i: Num - export fun getStrLn(): Str + export declare fun getStrLn(): Str } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index f82de164e..ca58ba674 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -140,7 +140,7 @@ object DriverDiffTests { private val cjsCases = List( cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types cjsEntry("CJS1"), - cjsEntry("Bar", Some("./tsconfig.json"), expectTypeError = true), + cjsEntry("Bar", Some("./tsconfig.json")), cjsEntry("BazBaz", Some("./tsconfig.json"), expectTypeError = true), ) diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index 279519abb..51b6d353c 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -28,6 +28,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def toLoc: Opt[Loc] def level: Level def isImplemented: Bool + def isDecl: Bool def isValueParam: Bool = this match { case p: NuParam => !p.isType @@ -60,6 +61,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def kind: DeclKind = if (isType) Als // FIXME? else Val + + def isDecl: Bool = false def toLoc: Opt[Loc] = nme.toLoc def isImplemented: Bool = true def typeSignature: ST = ty.ub @@ -115,6 +118,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => { def decl: NuTypeDef = td def kind: DeclKind = td.kind + def isDecl: Bool = td.isDecl def name: Str = nme.name def nme: mlscript.TypeName = td.nme def members: Map[Str, NuMember] = Map.empty @@ -161,6 +165,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => { def decl: NuTypeDef = td def kind: DeclKind = td.kind + def isDecl: Bool = td.isDecl def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true @@ -220,6 +225,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => { def decl: NuTypeDef = td def kind: DeclKind = td.kind + def isDecl: Bool = td.isDecl def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true @@ -332,6 +338,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => { def decl: NuTypeDef = td def kind: DeclKind = td.kind + def isDecl: Bool = td.isDecl def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true @@ -374,6 +381,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case class TypedNuDummy(d: NuDecl) extends TypedNuDecl with TypedNuTermDef { def level = MinLevel def kind: DeclKind = Val + def isDecl: Bool = d.isDecl def toLoc: Opt[Loc] = N def name: Str = d.name def isImplemented: Bool = true @@ -394,6 +402,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case class TypedNuFun(level: Level, fd: NuFunDef, bodyType: ST)(val isImplemented: Bool) extends TypedNuDecl with TypedNuTermDef { def kind: DeclKind = Val + def isDecl: Bool = fd.isDecl def name: Str = fd.nme.name def toLoc: Opt[Loc] = fd.toLoc lazy val typeSignature: ST = PolymorphicType.mk(level, bodyType) @@ -981,7 +990,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => toImplement.foreach { m => implemsMap.get(m.name) match { case S(_) => - case N => + case N => if (!m.isDecl) err(msg"Member `${m.name}` is declared in parent but not implemented in `${ td.nme.name}`" -> td.nme.toLoc :: msg"Declared here:" -> m.toLoc :: diff --git a/shared/src/test/diff/nu/DeclaredMembers.mls b/shared/src/test/diff/nu/DeclaredMembers.mls new file mode 100644 index 000000000..0047151d5 --- /dev/null +++ b/shared/src/test/diff/nu/DeclaredMembers.mls @@ -0,0 +1,16 @@ +:NewDefs + +declare class Parent { + declare fun foo: () -> Str // there's an implementation, trust me! +} +//│ declare class Parent { +//│ fun foo: () -> Str +//│ } + +:re +class Child() extends Parent +//│ class Child() extends Parent { +//│ fun foo: () -> Str +//│ } +//│ Runtime error: +//│ ReferenceError: Parent is not defined diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 4b51f513c..862a64259 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -158,11 +158,11 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: val realName = cjsExport.getOrElse(name, name) mem match { case inter: TSIntersectionType => // overloaded functions - writer.writeln(Converter.generateFunDeclaration(inter, realName, !cjsExport.isEmpty, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(inter, realName, exp)(indent)) case f: TSFunctionType => - writer.writeln(Converter.generateFunDeclaration(f, realName, !cjsExport.isEmpty, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(f, realName, exp)(indent)) case overload: TSIgnoredOverload => - writer.writeln(Converter.generateFunDeclaration(overload, realName, !cjsExport.isEmpty, exp)(indent)) + writer.writeln(Converter.generateFunDeclaration(overload, realName, exp)(indent)) case _: TSClassType => writer.writeln(Converter.convert(mem, exp)(indent)) case TSInterfaceType(name, _, _, _, _) if (name =/= "") => // TODO: rename? writer.writeln(Converter.convert(mem, exp)(indent)) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 2ce38aaf6..44e81c3a6 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -37,14 +37,13 @@ object Converter { case (tp, i) => convert(tp)("") }.reduceLeft((r, p) => s"$r, $p") - def generateFunDeclaration(tsType: TSType, name: String, declared: Boolean, exported: Boolean)(implicit indent: String = ""): String = tsType match { + def generateFunDeclaration(tsType: TSType, name: String, exported: Boolean)(implicit indent: String = ""): String = tsType match { case TSFunctionType(params, res, typeVars) => { val pList = generateFunParamsList(params) val tpList = if (typeVars.isEmpty) "" else s"[${typeVars.map(p => convert(p)("")).reduceLeft((r, p) => s"$r, $p")}]" - val dec = if (declared) "declare " else "" - s"${indent}${genExport(exported)}${dec}fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" + s"${indent}${genExport(exported)}declare fun ${escapeIdent(name)}$tpList($pList): ${convert(res)("")}" } - case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, declared, exported)} ${overload.warning}" + case overload @ TSIgnoredOverload(base, _) => s"${generateFunDeclaration(base, name, exported)} ${overload.warning}" case _ => throw new AssertionError("non-function type is not allowed.") } @@ -118,8 +117,8 @@ object Converter { case Public if !m._1.contains("#") => if (anonymous) s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { - case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" - case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false, false)(indent + " ")}\n" + case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" + case _: TSIgnoredOverload => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" case _ => s"${indent} val ${escapeIdent(m._1)}: ${convert(m._2)}\n" } case _ => "" // TODO: deal with private/protected members diff --git a/ts2mls/js/src/test/diff/BasicFunctions.mlsi b/ts2mls/js/src/test/diff/BasicFunctions.mlsi index 1c8f81cbe..5dd9cfaa6 100644 --- a/ts2mls/js/src/test/diff/BasicFunctions.mlsi +++ b/ts2mls/js/src/test/diff/BasicFunctions.mlsi @@ -1,38 +1,38 @@ export declare module BasicFunctions { - fun hello(): unit - fun add(x: Num, y: Num): Num - fun sub(x: Num, y: Num): Num - fun foo(): Num - fun id(x: anything): anything - fun odd(x: Num): (false) | (true) - fun isnull(x: anything): (false) | (true) - fun bar(): anything - fun nu(n: null): null - fun un(n: undefined): undefined - fun fail(): nothing - fun create(): Object - fun pa(x: Num): Num - fun wtf(x: anything): unit + declare fun hello(): unit + declare fun add(x: Num, y: Num): Num + declare fun sub(x: Num, y: Num): Num + declare fun foo(): Num + declare fun id(x: anything): anything + declare fun odd(x: Num): (false) | (true) + declare fun isnull(x: anything): (false) | (true) + declare fun bar(): anything + declare fun nu(n: null): null + declare fun un(n: undefined): undefined + declare fun fail(): nothing + declare fun create(): Object + declare fun pa(x: Num): Num + declare fun wtf(x: anything): unit declare class Foooooo { val ooooooo: Num } - fun inn(f: Foooooo): unit - fun out1(): Foooooo + declare fun inn(f: Foooooo): unit + declare fun out1(): Foooooo declare trait Barrrrrrrrr { val rrrrrrr: Num } - fun inn2(b: Barrrrrrrrr): unit - fun out2(): Barrrrrrrrr + declare fun inn2(b: Barrrrrrrrr): unit + declare fun out2(): Barrrrrrrrr } //| ╔══[ERROR] type identifier not found: Foooooo -//| ║ l.19: fun inn(f: Foooooo): unit -//| ╙── ^^^^^^^ +//| ║ l.19: declare fun inn(f: Foooooo): unit +//| ╙── ^^^^^^^ //| ╔══[ERROR] type identifier not found: Foooooo -//| ║ l.20: fun out1(): Foooooo -//| ╙── ^^^^^^^ +//| ║ l.20: declare fun out1(): Foooooo +//| ╙── ^^^^^^^ //| ╔══[ERROR] type identifier not found: Barrrrrrrrr -//| ║ l.24: fun inn2(b: Barrrrrrrrr): unit -//| ╙── ^^^^^^^^^^^ +//| ║ l.24: declare fun inn2(b: Barrrrrrrrr): unit +//| ╙── ^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Barrrrrrrrr -//| ║ l.25: fun out2(): Barrrrrrrrr -//| ╙── ^^^^^^^^^^^ +//| ║ l.25: declare fun out2(): Barrrrrrrrr +//| ╙── ^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/ClassMember.mlsi b/ts2mls/js/src/test/diff/ClassMember.mlsi index be89f9378..987adcd7f 100644 --- a/ts2mls/js/src/test/diff/ClassMember.mlsi +++ b/ts2mls/js/src/test/diff/ClassMember.mlsi @@ -2,15 +2,15 @@ export declare module ClassMember { declare class Student { constructor(s: Str, age: Num) val name: Str - fun isFriend(args0: Student): (false) | (true) - fun addScore(args0: Str, args1: Num): unit - fun getID(): Num + declare fun isFriend(args0: Student): (false) | (true) + declare fun addScore(args0: Str, args1: Num): unit + declare fun getID(): Num } declare class Foo['T] { - fun bar(args0: 'T): unit + declare fun bar(args0: 'T): unit } declare class EZ { - fun inc(args0: Num): Num + declare fun inc(args0: Num): Num } declare class Outer { declare class Inner { @@ -18,7 +18,7 @@ export declare module ClassMember { } } declare class TTT['T] { - fun ttt(args0: 'T): 'T - fun ttt2(x: 'T): 'T + declare fun ttt(args0: 'T): 'T + declare fun ttt2(x: 'T): 'T } } diff --git a/ts2mls/js/src/test/diff/Dec.mlsi b/ts2mls/js/src/test/diff/Dec.mlsi index c875617f0..7bacaee08 100644 --- a/ts2mls/js/src/test/diff/Dec.mlsi +++ b/ts2mls/js/src/test/diff/Dec.mlsi @@ -1,10 +1,10 @@ export declare module Dec { - fun getName(id: (Str) | (Num)): Str - fun render(callback: (() => unit) | (undefined)): Str + declare fun getName(id: (Str) | (Num)): Str + declare fun render(callback: (() => unit) | (undefined)): Str declare trait Get: (args0: Str) => Str {} declare class Person { constructor(name: Str, age: Num) - fun getName(args0: Num): Str + declare fun getName(args0: Num): Str } declare module OOO { } diff --git a/ts2mls/js/src/test/diff/Dependency.mlsi b/ts2mls/js/src/test/diff/Dependency.mlsi index 266cf0683..65d282d5c 100644 --- a/ts2mls/js/src/test/diff/Dependency.mlsi +++ b/ts2mls/js/src/test/diff/Dependency.mlsi @@ -11,5 +11,5 @@ export declare module Dependency { export declare class D { val d: Num } - fun default(): Num + declare fun default(): Num } diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/ts2mls/js/src/test/diff/Dom.mlsi index f03bb2a2e..ecd0bdf9b 100644 --- a/ts2mls/js/src/test/diff/Dom.mlsi +++ b/ts2mls/js/src/test/diff/Dom.mlsi @@ -1,23 +1,23 @@ declare trait Console { - fun assert(args0: ((false) | (true)) | (undefined), args1: (anything) | (MutArray[anything])): unit - fun count(args0: (Str) | (undefined)): unit - fun timeEnd(args0: (Str) | (undefined)): unit - fun clear(): unit - fun timeStamp(args0: (Str) | (undefined)): unit - fun info(args0: (anything) | (MutArray[anything])): unit - fun debug(args0: (anything) | (MutArray[anything])): unit - fun countReset(args0: (Str) | (undefined)): unit - fun dir(args0: (anything) | (undefined), args1: (anything) | (undefined)): unit - fun error(args0: (anything) | (MutArray[anything])): unit - fun timeLog(args0: (Str) | (undefined), args1: (anything) | (MutArray[anything])): unit - fun time(args0: (Str) | (undefined)): unit - fun group(args0: (anything) | (MutArray[anything])): unit - fun table(args0: (anything) | (undefined), args1: (MutArray[Str]) | (undefined)): unit - fun trace(args0: (anything) | (MutArray[anything])): unit - fun warn(args0: (anything) | (MutArray[anything])): unit - fun groupCollapsed(args0: (anything) | (MutArray[anything])): unit - fun dirxml(args0: (anything) | (MutArray[anything])): unit - fun log(args0: (anything) | (MutArray[anything])): unit - fun groupEnd(): unit + declare fun assert(args0: ((false) | (true)) | (undefined), args1: (anything) | (MutArray[anything])): unit + declare fun count(args0: (Str) | (undefined)): unit + declare fun timeEnd(args0: (Str) | (undefined)): unit + declare fun clear(): unit + declare fun timeStamp(args0: (Str) | (undefined)): unit + declare fun info(args0: (anything) | (MutArray[anything])): unit + declare fun debug(args0: (anything) | (MutArray[anything])): unit + declare fun countReset(args0: (Str) | (undefined)): unit + declare fun dir(args0: (anything) | (undefined), args1: (anything) | (undefined)): unit + declare fun error(args0: (anything) | (MutArray[anything])): unit + declare fun timeLog(args0: (Str) | (undefined), args1: (anything) | (MutArray[anything])): unit + declare fun time(args0: (Str) | (undefined)): unit + declare fun group(args0: (anything) | (MutArray[anything])): unit + declare fun table(args0: (anything) | (undefined), args1: (MutArray[Str]) | (undefined)): unit + declare fun trace(args0: (anything) | (MutArray[anything])): unit + declare fun warn(args0: (anything) | (MutArray[anything])): unit + declare fun groupCollapsed(args0: (anything) | (MutArray[anything])): unit + declare fun dirxml(args0: (anything) | (MutArray[anything])): unit + declare fun log(args0: (anything) | (MutArray[anything])): unit + declare fun groupEnd(): unit } val console: Console diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/ts2mls/js/src/test/diff/ES5.mlsi index 99c4d9aef..6fcf1da75 100644 --- a/ts2mls/js/src/test/diff/ES5.mlsi +++ b/ts2mls/js/src/test/diff/ES5.mlsi @@ -1,19 +1,19 @@ val NaN: Num val Infinity: Num -fun eval(x: Str): anything -fun parseInt(string: Str, radix: (Num) | (undefined)): Num -fun parseFloat(string: Str): Num -fun isNaN(number: Num): (false) | (true) -fun isFinite(number: Num): (false) | (true) -fun decodeURI(encodedURI: Str): Str -fun decodeURIComponent(encodedURIComponent: Str): Str -fun encodeURI(uri: Str): Str -fun encodeURIComponent(uriComponent: (((Str) | (Num)) | (false)) | (true)): Str -fun escape(string: Str): Str -fun unescape(string: Str): Str +declare fun eval(x: Str): anything +declare fun parseInt(string: Str, radix: (Num) | (undefined)): Num +declare fun parseFloat(string: Str): Num +declare fun isNaN(number: Num): (false) | (true) +declare fun isFinite(number: Num): (false) | (true) +declare fun decodeURI(encodedURI: Str): Str +declare fun decodeURIComponent(encodedURIComponent: Str): Str +declare fun encodeURI(uri: Str): Str +declare fun encodeURIComponent(uriComponent: (((Str) | (Num)) | (false)) | (true)): Str +declare fun escape(string: Str): Str +declare fun unescape(string: Str): Str declare trait Symbol { - fun toString(): Str - fun valueOf(): Symbol + declare fun toString(): Str + declare fun valueOf(): Symbol } type PropertyKey = ((Str) | (Num)) | (Symbol) declare trait PropertyDescriptor { @@ -28,36 +28,36 @@ declare trait PropertyDescriptorMap { val __index: unsupported["[key: PropertyKey]: PropertyDescriptor;", "ES5.d.ts", 101, 33] } declare class Object { - fun hasOwnProperty(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun propertyIsEnumerable(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) - fun valueOf(): Object - fun toLocaleString(): Str - fun isPrototypeOf(args0: Object): (false) | (true) - fun toString(): Str + declare fun hasOwnProperty(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) + declare fun propertyIsEnumerable(args0: ((Str) | (Num)) | (Symbol)): (false) | (true) + declare fun valueOf(): Object + declare fun toLocaleString(): Str + declare fun isPrototypeOf(args0: Object): (false) | (true) + declare fun toString(): Str } declare trait ObjectConstructor: (args0: anything) => anything { - fun getOwnPropertyNames(args0: anything): MutArray[Str] - fun isFrozen(args0: anything): (false) | (true) - fun getPrototypeOf(args0: anything): anything - fun defineProperty['T](args0: 'T, args1: ((Str) | (Num)) | (Symbol), args2: (PropertyDescriptor) & (ThisType[anything])): 'T + declare fun getOwnPropertyNames(args0: anything): MutArray[Str] + declare fun isFrozen(args0: anything): (false) | (true) + declare fun getPrototypeOf(args0: anything): anything + declare fun defineProperty['T](args0: 'T, args1: ((Str) | (Num)) | (Symbol), args2: (PropertyDescriptor) & (ThisType[anything])): 'T val prototype: Object - fun isSealed(args0: anything): (false) | (true) - fun defineProperties['T](args0: 'T, args1: (PropertyDescriptorMap) & (ThisType[anything])): 'T - fun preventExtensions['T](args0: 'T): 'T - fun create(args0: Object, args1: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ + declare fun isSealed(args0: anything): (false) | (true) + declare fun defineProperties['T](args0: 'T, args1: (PropertyDescriptorMap) & (ThisType[anything])): 'T + declare fun preventExtensions['T](args0: 'T): 'T + declare fun create(args0: Object, args1: (PropertyDescriptorMap) & (ThisType[anything])): anything /* warning: the overload of function create is not supported yet. */ val freeze: unsupported["freeze(o: T): Readonly;", "ES5.d.ts", 210, 143] val __new: unsupported["new(value?: any): Object;", "ES5.d.ts", 137, 29] - fun getOwnPropertyDescriptor(args0: anything, args1: ((Str) | (Num)) | (Symbol)): PropertyDescriptor - fun seal['T](args0: 'T): 'T - fun keys(args0: Object): MutArray[Str] - fun isExtensible(args0: anything): (false) | (true) + declare fun getOwnPropertyDescriptor(args0: anything, args1: ((Str) | (Num)) | (Symbol)): PropertyDescriptor + declare fun seal['T](args0: 'T): 'T + declare fun keys(args0: Object): MutArray[Str] + declare fun isExtensible(args0: anything): (false) | (true) } declare trait Function { - fun bind(args0: anything, args1: (anything) | (MutArray[anything])): anything - fun apply(args0: anything, args1: (anything) | (undefined)): anything + declare fun bind(args0: anything, args1: (anything) | (MutArray[anything])): anything + declare fun apply(args0: anything, args1: (anything) | (undefined)): anything val prototype: anything - fun call(args0: anything, args1: (anything) | (MutArray[anything])): anything - fun toString(): Str + declare fun call(args0: anything, args1: (anything) | (MutArray[anything])): anything + declare fun toString(): Str val length: Num val caller: Function val arguments: anything @@ -69,14 +69,14 @@ declare trait FunctionConstructor: (args0: (Str) | (MutArray[Str])) => Function type ThisParameterType = unsupported["type ThisParameterType = T extends (this: infer U, ...args: never) => any ? U : unknown;", "ES5.d.ts", 301, 42] type OmitThisParameter = unsupported["type OmitThisParameter = unknown extends ThisParameterType ? T : T extends (...args: infer A) => infer R ? (...args: A) => R : T;", "ES5.d.ts", 306, 91] declare trait CallableFunction extends Function { - fun apply['T, 'A, 'R](args0: 'T, args1: 'A): 'R /* warning: the overload of function apply is not supported yet. */ - fun call['T, 'A, 'R](args0: 'T, args1: 'A): 'R - fun bind['T, 'AX, 'R](args0: 'T, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ + declare fun apply['T, 'A, 'R](args0: 'T, args1: 'A): 'R /* warning: the overload of function apply is not supported yet. */ + declare fun call['T, 'A, 'R](args0: 'T, args1: 'A): 'R + declare fun bind['T, 'AX, 'R](args0: 'T, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ } declare trait NewableFunction extends Function { - fun apply['T, 'A](args0: 'T, args1: 'A): unit /* warning: the overload of function apply is not supported yet. */ - fun call['T, 'A](args0: 'T, args1: 'A): unit - fun bind['AX, 'R](args0: anything, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ + declare fun apply['T, 'A](args0: 'T, args1: 'A): unit /* warning: the overload of function apply is not supported yet. */ + declare fun call['T, 'A](args0: 'T, args1: 'A): unit + declare fun bind['AX, 'R](args0: anything, args1: ('AX) | (MutArray['AX])): (args: ('AX) | (MutArray['AX])) => 'R /* warning: the overload of function bind is not supported yet. */ } declare trait IArguments { val __index: unsupported["[index: number]: any;", "ES5.d.ts", 373, 22] @@ -84,36 +84,36 @@ declare trait IArguments { val callee: Function } declare trait String { - fun replace(args0: (Str) | (RegExp), args1: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ - fun valueOf(): Str - fun toLocaleUpperCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str - fun lastIndexOf(args0: Str, args1: (Num) | (undefined)): Num - fun localeCompare(args0: Str): Num - fun toLocaleLowerCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str - fun match(args0: (Str) | (RegExp)): RegExpMatchArray - fun split(args0: (Str) | (RegExp), args1: (Num) | (undefined)): MutArray[Str] - fun toUpperCase(): Str - fun indexOf(args0: Str, args1: (Num) | (undefined)): Num - fun toLowerCase(): Str - fun concat(args0: (Str) | (MutArray[Str])): Str + declare fun replace(args0: (Str) | (RegExp), args1: (substring: Str, args: (anything) | (MutArray[anything])) => Str): Str /* warning: the overload of function replace is not supported yet. */ + declare fun valueOf(): Str + declare fun toLocaleUpperCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str + declare fun lastIndexOf(args0: Str, args1: (Num) | (undefined)): Num + declare fun localeCompare(args0: Str): Num + declare fun toLocaleLowerCase(args0: ((Str) | (MutArray[Str])) | (undefined)): Str + declare fun match(args0: (Str) | (RegExp)): RegExpMatchArray + declare fun split(args0: (Str) | (RegExp), args1: (Num) | (undefined)): MutArray[Str] + declare fun toUpperCase(): Str + declare fun indexOf(args0: Str, args1: (Num) | (undefined)): Num + declare fun toLowerCase(): Str + declare fun concat(args0: (Str) | (MutArray[Str])): Str val __index: unsupported["readonly [index: number]: string;", "ES5.d.ts", 498, 22] - fun charCodeAt(args0: Num): Num - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Str - fun substr(args0: Num, args1: (Num) | (undefined)): Str - fun toString(): Str + declare fun charCodeAt(args0: Num): Num + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Str + declare fun substr(args0: Num, args1: (Num) | (undefined)): Str + declare fun toString(): Str val length: Num - fun substring(args0: Num, args1: (Num) | (undefined)): Str - fun trim(): Str - fun search(args0: (Str) | (RegExp)): Num - fun charAt(args0: Num): Str + declare fun substring(args0: Num, args1: (Num) | (undefined)): Str + declare fun trim(): Str + declare fun search(args0: (Str) | (RegExp)): Num + declare fun charAt(args0: Num): Str } declare trait StringConstructor: (args0: (anything) | (undefined)) => Str { val __new: unsupported["new(value?: any): String;", "ES5.d.ts", 503, 29] val prototype: String - fun fromCharCode(args0: (Num) | (MutArray[Num])): Str + declare fun fromCharCode(args0: (Num) | (MutArray[Num])): Str } declare class Bool { - fun valueOf(): (false) | (true) + declare fun valueOf(): (false) | (true) } declare trait BooleanConstructor: forall 'T; (args0: ('T) | (undefined)) => (false) | (true) { val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 520, 30] @@ -121,11 +121,11 @@ declare trait BooleanConstructor: forall 'T; (args0: ('T) | (undefined)) => (fal } val Boolean: BooleanConstructor declare trait Number { - fun toExponential(args0: (Num) | (undefined)): Str - fun valueOf(): Num - fun toString(args0: (Num) | (undefined)): Str - fun toFixed(args0: (Num) | (undefined)): Str - fun toPrecision(args0: (Num) | (undefined)): Str + declare fun toExponential(args0: (Num) | (undefined)): Str + declare fun valueOf(): Num + declare fun toString(args0: (Num) | (undefined)): Str + declare fun toFixed(args0: (Num) | (undefined)): Str + declare fun toPrecision(args0: (Num) | (undefined)): Str } declare trait NumberConstructor: (args0: (anything) | (undefined)) => Num { val NaN: Num @@ -147,83 +147,83 @@ declare trait ImportAssertions { val __index: unsupported["[key: string]: string;", "ES5.d.ts", 616, 28] } declare trait Math { - fun random(): Num - fun asin(args0: Num): Num + declare fun random(): Num + declare fun asin(args0: Num): Num val LOG2E: Num - fun min(args0: (Num) | (MutArray[Num])): Num - fun cos(args0: Num): Num + declare fun min(args0: (Num) | (MutArray[Num])): Num + declare fun cos(args0: Num): Num val LOG10E: Num val PI: Num - fun floor(args0: Num): Num + declare fun floor(args0: Num): Num val SQRT2: Num - fun round(args0: Num): Num - fun sin(args0: Num): Num + declare fun round(args0: Num): Num + declare fun sin(args0: Num): Num val E: Num val LN10: Num - fun exp(args0: Num): Num + declare fun exp(args0: Num): Num val LN2: Num - fun atan(args0: Num): Num - fun pow(args0: Num, args1: Num): Num - fun ceil(args0: Num): Num - fun max(args0: (Num) | (MutArray[Num])): Num - fun atan2(args0: Num, args1: Num): Num - fun sqrt(args0: Num): Num - fun tan(args0: Num): Num + declare fun atan(args0: Num): Num + declare fun pow(args0: Num, args1: Num): Num + declare fun ceil(args0: Num): Num + declare fun max(args0: (Num) | (MutArray[Num])): Num + declare fun atan2(args0: Num, args1: Num): Num + declare fun sqrt(args0: Num): Num + declare fun tan(args0: Num): Num val SQRT1_2: Num - fun abs(args0: Num): Num - fun log(args0: Num): Num - fun acos(args0: Num): Num + declare fun abs(args0: Num): Num + declare fun log(args0: Num): Num + declare fun acos(args0: Num): Num } declare trait Date { - fun getUTCMonth(): Num - fun valueOf(): Num - fun getUTCMinutes(): Num - fun setMilliseconds(args0: Num): Num - fun toLocaleString(): Str - fun getDate(): Num - fun getUTCDate(): Num - fun setDate(args0: Num): Num - fun setFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num - fun getMinutes(): Num - fun getFullYear(): Num - fun setUTCDate(args0: Num): Num - fun setMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num - fun setTime(args0: Num): Num - fun toUTCString(): Str - fun toLocaleDateString(): Str - fun setUTCMonth(args0: Num, args1: (Num) | (undefined)): Num - fun setUTCFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num - fun setHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num - fun getTime(): Num - fun setSeconds(args0: Num, args1: (Num) | (undefined)): Num - fun setUTCSeconds(args0: Num, args1: (Num) | (undefined)): Num - fun getUTCFullYear(): Num - fun getUTCHours(): Num - fun getUTCDay(): Num - fun setUTCMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num - fun getHours(): Num - fun toISOString(): Str - fun toTimeString(): Str - fun setUTCMilliseconds(args0: Num): Num - fun getUTCSeconds(): Num - fun getMilliseconds(): Num - fun setMonth(args0: Num, args1: (Num) | (undefined)): Num - fun getDay(): Num - fun toLocaleTimeString(): Str - fun getSeconds(): Num - fun getUTCMilliseconds(): Num - fun toDateString(): Str - fun toString(): Str - fun getMonth(): Num - fun getTimezoneOffset(): Num - fun setUTCHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num - fun toJSON(args0: (anything) | (undefined)): Str + declare fun getUTCMonth(): Num + declare fun valueOf(): Num + declare fun getUTCMinutes(): Num + declare fun setMilliseconds(args0: Num): Num + declare fun toLocaleString(): Str + declare fun getDate(): Num + declare fun getUTCDate(): Num + declare fun setDate(args0: Num): Num + declare fun setFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + declare fun getMinutes(): Num + declare fun getFullYear(): Num + declare fun setUTCDate(args0: Num): Num + declare fun setMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + declare fun setTime(args0: Num): Num + declare fun toUTCString(): Str + declare fun toLocaleDateString(): Str + declare fun setUTCMonth(args0: Num, args1: (Num) | (undefined)): Num + declare fun setUTCFullYear(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + declare fun setHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num + declare fun getTime(): Num + declare fun setSeconds(args0: Num, args1: (Num) | (undefined)): Num + declare fun setUTCSeconds(args0: Num, args1: (Num) | (undefined)): Num + declare fun getUTCFullYear(): Num + declare fun getUTCHours(): Num + declare fun getUTCDay(): Num + declare fun setUTCMinutes(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): Num + declare fun getHours(): Num + declare fun toISOString(): Str + declare fun toTimeString(): Str + declare fun setUTCMilliseconds(args0: Num): Num + declare fun getUTCSeconds(): Num + declare fun getMilliseconds(): Num + declare fun setMonth(args0: Num, args1: (Num) | (undefined)): Num + declare fun getDay(): Num + declare fun toLocaleTimeString(): Str + declare fun getSeconds(): Num + declare fun getUTCMilliseconds(): Num + declare fun toDateString(): Str + declare fun toString(): Str + declare fun getMonth(): Num + declare fun getTimezoneOffset(): Num + declare fun setUTCHours(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined), args3: (Num) | (undefined)): Num + declare fun toJSON(args0: (anything) | (undefined)): Str } declare trait DateConstructor: () => Str { - fun UTC(args0: Num, args1: Num, args2: (Num) | (undefined), args3: (Num) | (undefined), args4: (Num) | (undefined), args5: (Num) | (undefined), args6: (Num) | (undefined)): Num + declare fun UTC(args0: Num, args1: Num, args2: (Num) | (undefined), args3: (Num) | (undefined), args4: (Num) | (undefined), args5: (Num) | (undefined), args6: (Num) | (undefined)): Num val __new: unsupported["new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date;", "ES5.d.ts", 887, 38] - fun now(): Num - fun parse(args0: Str): Num + declare fun now(): Num + declare fun parse(args0: Str): Num val prototype: Date } declare trait RegExpMatchArray extends Array[Str] { @@ -237,14 +237,14 @@ declare trait RegExpExecArray extends Array[Str] { val id"0": Str } declare trait RegExp { - fun test(args0: Str): (false) | (true) + declare fun test(args0: Str): (false) | (true) val multiline: (false) | (true) val source: Str - fun compile(args0: Str, args1: (Str) | (undefined)): 'RegExp + declare fun compile(args0: Str, args1: (Str) | (undefined)): 'RegExp val global: (false) | (true) val lastIndex: Num val ignoreCase: (false) | (true) - fun exec(args0: Str): RegExpExecArray + declare fun exec(args0: Str): RegExpExecArray } declare trait RegExpConstructor: (args0: Str, args1: (Str) | (undefined)) => RegExp { val id"$4": Str @@ -309,61 +309,61 @@ declare trait URIErrorConstructor: (args0: (Str) | (undefined)) => URIError exte val prototype: URIError } declare trait JSON { - fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything - fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ + declare fun parse(args0: Str, args1: ((key: Str, value: anything) => anything) | (undefined)): anything + declare fun stringify(args0: anything, args1: (MutArray[(Str) | (Num)]) | (undefined), args2: ((Str) | (Num)) | (undefined)): Str /* warning: the overload of function stringify is not supported yet. */ } declare trait ReadonlyArray['T] { - fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num - fun every(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun forEach(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => unit, args1: (anything) | (undefined)): unit - fun filter(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ + declare fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + declare fun forEach(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => unit, args1: (anything) | (undefined)): unit + declare fun filter(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1272, 136] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun join(args0: (Str) | (undefined)): Str - fun map['U](args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] - fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ - fun toLocaleString(): Str - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] - fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun join(args0: (Str) | (undefined)): Str + declare fun map['U](args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] + declare fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ + declare fun toLocaleString(): Str + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] + declare fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: ReadonlyArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: 'T, index: Num, array: ReadonlyArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num } declare trait ConcatArray['T] { val length: Num val __index: unsupported["readonly [n: number]: T;", "ES5.d.ts", 1278, 28] - fun join(args0: (Str) | (undefined)): Str - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] + declare fun join(args0: (Str) | (undefined)): Str + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] } declare trait Array['T] { - fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num - fun every(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ - fun push(args0: ('T) | (MutArray['T])): Num - fun forEach(args0: (value: 'T, index: Num, array: MutArray['T]) => unit, args1: (anything) | (undefined)): unit - fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun unshift(args0: ('T) | (MutArray['T])): Num - fun sort(args0: ((a: 'T, b: 'T) => Num) | (undefined)): 'Array - fun join(args0: (Str) | (undefined)): Str - fun map['U](args0: (value: 'T, index: Num, array: MutArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] - fun pop(): 'T - fun shift(): 'T - fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ - fun toLocaleString(): Str - fun reverse(): MutArray['T] - fun filter(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ + declare fun lastIndexOf(args0: 'T, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) /* warning: the overload of function every is not supported yet. */ + declare fun push(args0: ('T) | (MutArray['T])): Num + declare fun forEach(args0: (value: 'T, index: Num, array: MutArray['T]) => unit, args1: (anything) | (undefined)): unit + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun unshift(args0: ('T) | (MutArray['T])): Num + declare fun sort(args0: ((a: 'T, b: 'T) => Num) | (undefined)): 'Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map['U](args0: (value: 'T, index: Num, array: MutArray['T]) => 'U, args1: (anything) | (undefined)): MutArray['U] + declare fun pop(): 'T + declare fun shift(): 'T + declare fun concat(args0: (('T) | (ConcatArray['T])) | (MutArray[('T) | (ConcatArray['T])])): MutArray['T] /* warning: the overload of function concat is not supported yet. */ + declare fun toLocaleString(): Str + declare fun reverse(): MutArray['T] + declare fun filter(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): MutArray['T] /* warning: the overload of function filter is not supported yet. */ val __index: unsupported["[n: number]: T;", "ES5.d.ts", 1463, 127] - fun splice(args0: Num, args1: Num, args2: ('T) | (MutArray['T])): MutArray['T] /* warning: the overload of function splice is not supported yet. */ - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] - fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun splice(args0: Num, args1: Num, args2: ('T) | (MutArray['T])): MutArray['T] /* warning: the overload of function splice is not supported yet. */ + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): MutArray['T] + declare fun reduce['U](args0: (previousValue: 'U, currentValue: 'T, currentIndex: Num, array: MutArray['T]) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num } declare trait ArrayConstructor: forall 'T; (args0: ('T) | (MutArray['T])) => MutArray['T] { val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1470, 38] - fun isArray(args0: anything): (false) | (true) + declare fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] } declare trait TypedPropertyDescriptor['T] { @@ -376,11 +376,11 @@ declare trait TypedPropertyDescriptor['T] { } type PromiseConstructorLike = forall 'T; (executor: (resolve: (value: ('T) | (PromiseLike['T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike['T] declare trait PromiseLike['T] { - fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): PromiseLike[('TResult1) | ('TResult2)] + declare fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): PromiseLike[('TResult1) | ('TResult2)] } declare trait Promise['T] { - fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): Promise[('TResult1) | ('TResult2)] - fun catch['TResult](args0: ((reason: anything) => ('TResult) | (PromiseLike['TResult])) | (undefined)): Promise[('T) | ('TResult)] + declare fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): Promise[('TResult1) | ('TResult2)] + declare fun catch['TResult](args0: ((reason: anything) => ('TResult) | (PromiseLike['TResult])) | (undefined)): Promise[('T) | ('TResult)] } type Awaited = unsupported["type Awaited = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T;", "ES5.d.ts", 1520, 1] declare trait ArrayLike['T] { @@ -407,7 +407,7 @@ type Uncapitalize = unsupported["type Uncapitalize = intrinsic declare trait ThisType['T] {} declare trait ArrayBuffer { val byteLength: Num - fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer + declare fun slice(args0: Num, args1: (Num) | (undefined)): ArrayBuffer } declare trait ArrayBufferTypes { val ArrayBuffer: unsupported["ArrayBuffer: ArrayBuffer;", "ES5.d.ts", 1659, 28] @@ -416,7 +416,7 @@ type ArrayBufferLike = ArrayBuffer declare trait ArrayBufferConstructor { val prototype: ArrayBuffer val __new: unsupported["new(byteLength: number): ArrayBuffer;", "ES5.d.ts", 1665, 36] - fun isView(args0: anything): (false) | (true) + declare fun isView(args0: anything): (false) | (true) } declare trait ArrayBufferView { val buffer: ArrayBuffer @@ -424,24 +424,24 @@ declare trait ArrayBufferView { val byteOffset: Num } declare trait DataView { - fun setInt32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun setUint32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun setFloat64(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun getInt8(args0: Num): Num + declare fun setInt32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun setUint32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun setFloat64(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun getInt8(args0: Num): Num val buffer: ArrayBuffer - fun setInt16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun getUint8(args0: Num): Num + declare fun setInt16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun getUint8(args0: Num): Num val byteLength: Num - fun getFloat64(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun getFloat32(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun getUint16(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun setInt8(args0: Num, args1: Num): unit - fun setUint16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun setFloat32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit - fun getUint32(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun getInt32(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun getInt16(args0: Num, args1: ((false) | (true)) | (undefined)): Num - fun setUint8(args0: Num, args1: Num): unit + declare fun getFloat64(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun getFloat32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun getUint16(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun setInt8(args0: Num, args1: Num): unit + declare fun setUint16(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun setFloat32(args0: Num, args1: Num, args2: ((false) | (true)) | (undefined)): unit + declare fun getUint32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun getInt32(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun getInt16(args0: Num, args1: ((false) | (true)) | (undefined)): Num + declare fun setUint8(args0: Num, args1: Num): unit val byteOffset: Num } declare trait DataViewConstructor { @@ -449,335 +449,335 @@ declare trait DataViewConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, byteLength?: number): DataView;", "ES5.d.ts", 1817, 33] } declare trait Int8Array { - fun valueOf(): Int8Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Int8Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2065, 25] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int8Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array - fun find(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Int8Array) => Num, args1: (anything) | (undefined)): Int8Array - fun forEach(args0: (value: Num, index: Num, array: Int8Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int8Array + declare fun find(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Int8Array) => Num, args1: (anything) | (undefined)): Int8Array + declare fun forEach(args0: (value: Num, index: Num, array: Int8Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Int8Array - fun filter(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): Int8Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Int8Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Int8Array + declare fun filter(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): Int8Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int8Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Int8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Int8ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array;", "ES5.d.ts", 2072, 63] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int8Array /* warning: the overload of function from is not supported yet. */ val prototype: Int8Array - fun id"of"(args0: (Num) | (MutArray[Num])): Int8Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Int8Array val BYTES_PER_ELEMENT: Num } declare trait Uint8Array { - fun valueOf(): Uint8Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Uint8Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2347, 26] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array - fun find(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Uint8Array) => Num, args1: (anything) | (undefined)): Uint8Array - fun forEach(args0: (value: Num, index: Num, array: Uint8Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8Array + declare fun find(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Uint8Array) => Num, args1: (anything) | (undefined)): Uint8Array + declare fun forEach(args0: (value: Num, index: Num, array: Uint8Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Uint8Array - fun filter(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): Uint8Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Uint8Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Uint8Array + declare fun filter(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): Uint8Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Uint8Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint8ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8Array;", "ES5.d.ts", 2355, 64] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint8Array - fun id"of"(args0: (Num) | (MutArray[Num])): Uint8Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Uint8Array val BYTES_PER_ELEMENT: Num } declare trait Uint8ClampedArray { - fun valueOf(): Uint8ClampedArray - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Uint8ClampedArray + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2629, 33] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8ClampedArray + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint8ClampedArray val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray - fun find(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Uint8ClampedArray) => Num, args1: (anything) | (undefined)): Uint8ClampedArray - fun forEach(args0: (value: Num, index: Num, array: Uint8ClampedArray) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint8ClampedArray + declare fun find(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Uint8ClampedArray) => Num, args1: (anything) | (undefined)): Uint8ClampedArray + declare fun forEach(args0: (value: Num, index: Num, array: Uint8ClampedArray) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Uint8ClampedArray - fun filter(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): Uint8ClampedArray - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray + declare fun findIndex(args0: (value: Num, index: Num, obj: Uint8ClampedArray) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Uint8ClampedArray + declare fun filter(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): Uint8ClampedArray + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint8ClampedArray val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint8ClampedArray) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Uint8ClampedArray) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint8ClampedArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint8ClampedArray;", "ES5.d.ts", 2637, 71] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint8ClampedArray /* warning: the overload of function from is not supported yet. */ val prototype: Uint8ClampedArray - fun id"of"(args0: (Num) | (MutArray[Num])): Uint8ClampedArray + declare fun id"of"(args0: (Num) | (MutArray[Num])): Uint8ClampedArray val BYTES_PER_ELEMENT: Num } declare trait Int16Array { - fun valueOf(): Int16Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Int16Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 2909, 26] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int16Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array - fun find(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Int16Array) => Num, args1: (anything) | (undefined)): Int16Array - fun forEach(args0: (value: Num, index: Num, array: Int16Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int16Array + declare fun find(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Int16Array) => Num, args1: (anything) | (undefined)): Int16Array + declare fun forEach(args0: (value: Num, index: Num, array: Int16Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Int16Array - fun filter(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): Int16Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Int16Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Int16Array + declare fun filter(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): Int16Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int16Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Int16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Int16ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int16Array;", "ES5.d.ts", 2917, 64] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int16Array /* warning: the overload of function from is not supported yet. */ val prototype: Int16Array - fun id"of"(args0: (Num) | (MutArray[Num])): Int16Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Int16Array val BYTES_PER_ELEMENT: Num } declare trait Uint16Array { - fun valueOf(): Uint16Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Uint16Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3192, 27] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint16Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint16Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array - fun find(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Uint16Array) => Num, args1: (anything) | (undefined)): Uint16Array - fun forEach(args0: (value: Num, index: Num, array: Uint16Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint16Array + declare fun find(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Uint16Array) => Num, args1: (anything) | (undefined)): Uint16Array + declare fun forEach(args0: (value: Num, index: Num, array: Uint16Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Uint16Array - fun filter(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): Uint16Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Uint16Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Uint16Array + declare fun filter(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): Uint16Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint16Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint16Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Uint16Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint16ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint16Array;", "ES5.d.ts", 3200, 65] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint16Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint16Array - fun id"of"(args0: (Num) | (MutArray[Num])): Uint16Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Uint16Array val BYTES_PER_ELEMENT: Num } declare trait Int32Array { - fun valueOf(): Int32Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Int32Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3475, 26] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int32Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Int32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array - fun find(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Int32Array) => Num, args1: (anything) | (undefined)): Int32Array - fun forEach(args0: (value: Num, index: Num, array: Int32Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Int32Array + declare fun find(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Int32Array) => Num, args1: (anything) | (undefined)): Int32Array + declare fun forEach(args0: (value: Num, index: Num, array: Int32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Int32Array - fun filter(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): Int32Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Int32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Int32Array + declare fun filter(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): Int32Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Int32Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Int32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Int32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Int32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int32Array;", "ES5.d.ts", 3483, 64] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Int32Array /* warning: the overload of function from is not supported yet. */ val prototype: Int32Array - fun id"of"(args0: (Num) | (MutArray[Num])): Int32Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Int32Array val BYTES_PER_ELEMENT: Num } declare trait Uint32Array { - fun valueOf(): Uint32Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Uint32Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 3756, 27] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint32Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Uint32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array - fun find(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Uint32Array) => Num, args1: (anything) | (undefined)): Uint32Array - fun forEach(args0: (value: Num, index: Num, array: Uint32Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Uint32Array + declare fun find(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Uint32Array) => Num, args1: (anything) | (undefined)): Uint32Array + declare fun forEach(args0: (value: Num, index: Num, array: Uint32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Uint32Array - fun filter(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): Uint32Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Uint32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Uint32Array + declare fun filter(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): Uint32Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Uint32Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Uint32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Uint32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Uint32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Uint32Array;", "ES5.d.ts", 3764, 65] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Uint32Array /* warning: the overload of function from is not supported yet. */ val prototype: Uint32Array - fun id"of"(args0: (Num) | (MutArray[Num])): Uint32Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Uint32Array val BYTES_PER_ELEMENT: Num } declare trait Float32Array { - fun valueOf(): Float32Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit - fun toLocaleString(): Str + declare fun valueOf(): Float32Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun toLocaleString(): Str val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4038, 28] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float32Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float32Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array - fun find(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Float32Array) => Num, args1: (anything) | (undefined)): Float32Array - fun forEach(args0: (value: Num, index: Num, array: Float32Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float32Array + declare fun find(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Float32Array) => Num, args1: (anything) | (undefined)): Float32Array + declare fun forEach(args0: (value: Num, index: Num, array: Float32Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Float32Array - fun filter(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): Float32Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Float32Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Float32Array + declare fun filter(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): Float32Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float32Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float32Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Float32Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Float32ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float32Array;", "ES5.d.ts", 4046, 66] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float32Array /* warning: the overload of function from is not supported yet. */ val prototype: Float32Array - fun id"of"(args0: (Num) | (MutArray[Num])): Float32Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Float32Array val BYTES_PER_ELEMENT: Num } declare trait Float64Array { - fun valueOf(): Float64Array - fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num - fun every(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit + declare fun valueOf(): Float64Array + declare fun lastIndexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun every(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun set(args0: ArrayLike[Num], args1: (Num) | (undefined)): unit val __index: unsupported["[index: number]: number;", "ES5.d.ts", 4312, 28] - fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ - fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array - fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float64Array + declare fun reduceRight['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduceRight is not supported yet. */ + declare fun fill(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array + declare fun sort(args0: ((a: Num, b: Num) => Num) | (undefined)): 'Float64Array val BYTES_PER_ELEMENT: Num - fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array - fun find(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array - fun join(args0: (Str) | (undefined)): Str - fun map(args0: (value: Num, index: Num, array: Float64Array) => Num, args1: (anything) | (undefined)): Float64Array - fun forEach(args0: (value: Num, index: Num, array: Float64Array) => unit, args1: (anything) | (undefined)): unit + declare fun copyWithin(args0: Num, args1: (Num) | (undefined), args2: (Num) | (undefined)): 'Float64Array + declare fun find(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun subarray(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array + declare fun join(args0: (Str) | (undefined)): Str + declare fun map(args0: (value: Num, index: Num, array: Float64Array) => Num, args1: (anything) | (undefined)): Float64Array + declare fun forEach(args0: (value: Num, index: Num, array: Float64Array) => unit, args1: (anything) | (undefined)): unit val buffer: ArrayBuffer - fun findIndex(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num - fun reverse(): Float64Array - fun filter(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): Float64Array - fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array + declare fun findIndex(args0: (value: Num, index: Num, obj: Float64Array) => (false) | (true), args1: (anything) | (undefined)): Num + declare fun reverse(): Float64Array + declare fun filter(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): Float64Array + declare fun slice(args0: (Num) | (undefined), args1: (Num) | (undefined)): Float64Array val byteLength: Num - fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ - fun toString(): Str + declare fun reduce['U](args0: (previousValue: 'U, currentValue: Num, currentIndex: Num, array: Float64Array) => 'U, args1: 'U): 'U /* warning: the overload of function reduce is not supported yet. */ + declare fun toString(): Str val length: Num - fun some(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) - fun indexOf(args0: Num, args1: (Num) | (undefined)): Num + declare fun some(args0: (value: Num, index: Num, array: Float64Array) => anything, args1: (anything) | (undefined)): (false) | (true) + declare fun indexOf(args0: Num, args1: (Num) | (undefined)): Num val byteOffset: Num } declare trait Float64ArrayConstructor { val __new: unsupported["new(buffer: ArrayBufferLike, byteOffset?: number, length?: number): Float64Array;", "ES5.d.ts", 4320, 66] - fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ + declare fun from['T](args0: ArrayLike['T], args1: (v: 'T, k: Num) => Num, args2: (anything) | (undefined)): Float64Array /* warning: the overload of function from is not supported yet. */ val prototype: Float64Array - fun id"of"(args0: (Num) | (MutArray[Num])): Float64Array + declare fun id"of"(args0: (Num) | (MutArray[Num])): Float64Array val BYTES_PER_ELEMENT: Num } declare module Intl { @@ -799,9 +799,9 @@ declare module Intl { val collation: Str } export declare trait Collator { - fun compare(args0: Str, args1: Str): Num - fun resolvedOptions(): ResolvedCollatorOptions - fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (CollatorOptions) | (undefined)): MutArray[Str] + declare fun compare(args0: Str, args1: Str): Num + declare fun resolvedOptions(): ResolvedCollatorOptions + declare fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (CollatorOptions) | (undefined)): MutArray[Str] } export declare trait NumberFormatOptions { val minimumSignificantDigits: (Num) | (undefined) @@ -828,9 +828,9 @@ declare module Intl { val minimumFractionDigits: Num } export declare trait NumberFormat { - fun format(args0: Num): Str - fun resolvedOptions(): ResolvedNumberFormatOptions - fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (NumberFormatOptions) | (undefined)): MutArray[Str] + declare fun format(args0: Num): Str + declare fun resolvedOptions(): ResolvedNumberFormatOptions + declare fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (NumberFormatOptions) | (undefined)): MutArray[Str] val prototype: NumberFormat } export declare trait DateTimeFormatOptions { @@ -865,9 +865,9 @@ declare module Intl { val era: (Str) | (undefined) } export declare trait DateTimeFormat { - fun format(args0: ((Num) | (Date)) | (undefined)): Str - fun resolvedOptions(): ResolvedDateTimeFormatOptions - fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (DateTimeFormatOptions) | (undefined)): MutArray[Str] + declare fun format(args0: ((Num) | (Date)) | (undefined)): Str + declare fun resolvedOptions(): ResolvedDateTimeFormatOptions + declare fun supportedLocalesOf(args0: (Str) | (MutArray[Str]), args1: (DateTimeFormatOptions) | (undefined)): MutArray[Str] val prototype: DateTimeFormat } } diff --git a/ts2mls/js/src/test/diff/Enum.mlsi b/ts2mls/js/src/test/diff/Enum.mlsi index 5fd0c17b8..f72b28baf 100644 --- a/ts2mls/js/src/test/diff/Enum.mlsi +++ b/ts2mls/js/src/test/diff/Enum.mlsi @@ -1,5 +1,5 @@ export declare module Enum { - fun pass(c: Int): (false) | (true) - fun stop(): Int - fun g(x: Int): Int + declare fun pass(c: Int): (false) | (true) + declare fun stop(): Int + declare fun g(x: Int): Int } diff --git a/ts2mls/js/src/test/diff/Escape.mlsi b/ts2mls/js/src/test/diff/Escape.mlsi index 668a76998..5e64e9e35 100644 --- a/ts2mls/js/src/test/diff/Escape.mlsi +++ b/ts2mls/js/src/test/diff/Escape.mlsi @@ -5,7 +5,7 @@ export declare module Escape { declare trait id"rec" { val id"fun": Str } - fun id"mixin"(id"module": Str): unit + declare fun id"mixin"(id"module": Str): unit val id"forall": Num declare module id"trait" { declare module id"of" { diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index 798b37bf9..d4aee3377 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -1,7 +1,7 @@ import "./Dependency.mlsi" export declare module Export { export declare module Foo { - export fun Baz(aa: Str): IBar + export declare fun Baz(aa: Str): IBar declare trait IBar { val a: Str } @@ -10,15 +10,15 @@ export declare module Export { } export val baz: IBar } - fun default(x: anything): anything + declare fun default(x: anything): anything export declare class E {} export val F = E export val G = Dependency.B export val H = Dependency } //| ╔══[ERROR] type identifier not found: IBar -//| ║ l.4: export fun Baz(aa: Str): IBar -//| ╙── ^^^^ +//| ║ l.4: export declare fun Baz(aa: Str): IBar +//| ╙── ^^^^ //| ╔══[ERROR] type identifier not found: IBar //| ║ l.11: export val baz: IBar //| ╙── ^^^^ diff --git a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi index 82bfca983..0fa77d46d 100644 --- a/ts2mls/js/src/test/diff/HighOrderFunc.mlsi +++ b/ts2mls/js/src/test/diff/HighOrderFunc.mlsi @@ -1,5 +1,5 @@ export declare module HighOrderFunc { - fun h1(inc: (n: Num) => Num, num: Num): Num - fun h2(hint: Str): () => Str - fun h3(f: (x: Num) => Num, g: (x: Num) => Num): (x: Num) => Num + declare fun h1(inc: (n: Num) => Num, num: Num): Num + declare fun h2(hint: Str): () => Str + declare fun h3(f: (x: Num) => Num, g: (x: Num) => Num): (x: Num) => Num } diff --git a/ts2mls/js/src/test/diff/InterfaceMember.mlsi b/ts2mls/js/src/test/diff/InterfaceMember.mlsi index 9b004131b..f7069f37f 100644 --- a/ts2mls/js/src/test/diff/InterfaceMember.mlsi +++ b/ts2mls/js/src/test/diff/InterfaceMember.mlsi @@ -1,17 +1,17 @@ export declare module InterfaceMember { declare trait IFoo { val a: Str - fun b(x: Num): Num - fun c(): (false) | (true) - fun d(x: Str): unit + declare fun b(x: Num): Num + declare fun c(): (false) | (true) + declare fun d(x: Str): unit } declare trait II['T] { - fun test(x: 'T): Num + declare fun test(x: 'T): Num } - fun create(): {v: Num,} - fun get(x: {t: Str,}): Str + declare fun create(): {v: Num,} + declare fun get(x: {t: Str,}): Str declare trait IEvent { - fun callback(): (x: Num) => unit + declare fun callback(): (x: Num) => unit } declare trait SearchFunc: (args0: Str, args1: Str) => (false) | (true) {} declare trait StringArray { @@ -19,17 +19,17 @@ export declare module InterfaceMember { } declare trait Counter: (args0: Num) => Str { val interval: Num - fun reset(): unit + declare fun reset(): unit } declare trait Simple { val a: Num - fun b(x: (false) | (true)): Str + declare fun b(x: (false) | (true)): Str } declare trait Simple2['T] { val abc: 'T } declare trait Next extends Simple {} declare trait TTT['T] { - fun ttt(x: 'T): 'T + declare fun ttt(x: 'T): 'T } } diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 16373ce21..0b7c59c5a 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -1,43 +1,43 @@ export declare module Intersection { - fun extend['T, 'U](first: 'T, second: 'U): ('T) & ('U) - fun foo['T, 'U](x: ('T) & ('U)): unit - fun over(f: ((x: Num) => Str) & ((x: Object) => Str)): Str + declare fun extend['T, 'U](first: 'T, second: 'U): ('T) & ('U) + declare fun foo['T, 'U](x: ('T) & ('U)): unit + declare fun over(f: ((x: Num) => Str) & ((x: Object) => Str)): Str declare trait IA { val x: Num } declare trait IB { val y: Num } - fun iii(x: (IA) & (IB)): (IA) & (IB) - fun uu['U, 'V, 'T, 'P](x: (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P))): (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P)) - fun iiii['U, 'T, 'V](x: (('U) & ('T)) & ('V)): (('U) & ('T)) & ('V) - fun arr['U, 'T](a: (MutArray['U]) & (MutArray['T])): (MutArray['U]) & (MutArray['T]) - fun tt['U, 'T, 'V](x: (('U, 'T, )) & (('V, 'V, ))): (('U, 'T, )) & (('V, 'V, )) + declare fun iii(x: (IA) & (IB)): (IA) & (IB) + declare fun uu['U, 'V, 'T, 'P](x: (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P))): (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P)) + declare fun iiii['U, 'T, 'V](x: (('U) & ('T)) & ('V)): (('U) & ('T)) & ('V) + declare fun arr['U, 'T](a: (MutArray['U]) & (MutArray['T])): (MutArray['U]) & (MutArray['T]) + declare fun tt['U, 'T, 'V](x: (('U, 'T, )) & (('V, 'V, ))): (('U, 'T, )) & (('V, 'V, )) declare class A {} declare class B {} - fun inter(c: (A) & (B)): (A) & (B) + declare fun inter(c: (A) & (B)): (A) & (B) } //| ╔══[ERROR] type identifier not found: IA -//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) -//| ╙── ^^^^ +//| ║ l.11: declare fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ //| ╔══[ERROR] type identifier not found: IB -//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) -//| ╙── ^^^^ +//| ║ l.11: declare fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ //| ╔══[ERROR] type identifier not found: IA -//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) -//| ╙── ^^^^ +//| ║ l.11: declare fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ //| ╔══[ERROR] type identifier not found: IB -//| ║ l.11: fun iii(x: (IA) & (IB)): (IA) & (IB) -//| ╙── ^^^^ +//| ║ l.11: declare fun iii(x: (IA) & (IB)): (IA) & (IB) +//| ╙── ^^^^ //| ╔══[ERROR] type identifier not found: A -//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) -//| ╙── ^^^ +//| ║ l.18: declare fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) -//| ╙── ^^^ +//| ║ l.18: declare fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ //| ╔══[ERROR] type identifier not found: A -//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) -//| ╙── ^^^ +//| ║ l.18: declare fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.18: fun inter(c: (A) & (B)): (A) & (B) -//| ╙── ^^^ +//| ║ l.18: declare fun inter(c: (A) & (B)): (A) & (B) +//| ╙── ^^^ diff --git a/ts2mls/js/src/test/diff/Literal.mlsi b/ts2mls/js/src/test/diff/Literal.mlsi index 7b5d6c310..1f853f1d7 100644 --- a/ts2mls/js/src/test/diff/Literal.mlsi +++ b/ts2mls/js/src/test/diff/Literal.mlsi @@ -1,5 +1,5 @@ export declare module Literal { val a: {a: "A",b: "B",} val num: {y: 114,} - fun foo(x: {xx: "X",}): {yy: "Y",} + declare fun foo(x: {xx: "X",}): {yy: "Y",} } diff --git a/ts2mls/js/src/test/diff/Namespace.mlsi b/ts2mls/js/src/test/diff/Namespace.mlsi index 8b8a2a920..54183bc43 100644 --- a/ts2mls/js/src/test/diff/Namespace.mlsi +++ b/ts2mls/js/src/test/diff/Namespace.mlsi @@ -1,34 +1,34 @@ export declare module Namespace { declare module N1 { - export fun f(x: anything): Num - fun ff(y: anything): Num + export declare fun f(x: anything): Num + declare fun ff(y: anything): Num export declare class C { - fun f(): unit + declare fun f(): unit } declare trait I { - fun f(): Num + declare fun f(): Num } export declare module N2 { - export fun fff(x: (false) | (true)): Num - fun gg(c: C): C + export declare fun fff(x: (false) | (true)): Num + declare fun gg(c: C): C declare class BBB extends C {} } } declare module AA { - export fun f(x: anything): Str + export declare fun f(x: anything): Str export declare class C { - fun f(): unit + declare fun f(): unit } export declare trait I { - fun f(): Num + declare fun f(): Num } export declare module N2 { } } - fun f1(x: N1.C): N1.C - fun f2(x: AA.C): AA.C + declare fun f1(x: N1.C): N1.C + declare fun f2(x: AA.C): AA.C } //| ╔══[ERROR] type identifier not found: N1 -//| ║ l.28: fun f1(x: N1.C): N1.C -//| ╙── ^^ +//| ║ l.28: declare fun f1(x: N1.C): N1.C +//| ╙── ^^ //| java.lang.Exception: Internal Error: Program reached and unexpected state. diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 8993e5cfb..318f485b5 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -1,31 +1,31 @@ export declare module Optional { - fun buildName(firstName: Str, lastName: (Str) | (undefined)): Str - fun buildName2(firstName: Str, lastName: (Str) | (undefined)): Str - fun buildName3(firstName: Str, lastName: (Str) | (MutArray[Str])): Str - fun buildName4(firstName: Str, lastName: (anything) | (MutArray[anything])): Str + declare fun buildName(firstName: Str, lastName: (Str) | (undefined)): Str + declare fun buildName2(firstName: Str, lastName: (Str) | (undefined)): Str + declare fun buildName3(firstName: Str, lastName: (Str) | (MutArray[Str])): Str + declare fun buildName4(firstName: Str, lastName: (anything) | (MutArray[anything])): Str declare trait SquareConfig { val color: (Str) | (undefined) val width: (Num) | (undefined) } - fun did(x: Num, f: ((x: Num) => Num) | (undefined)): Num - fun getOrElse(arr: (MutArray[Object]) | (undefined)): Object + declare fun did(x: Num, f: ((x: Num) => Num) | (undefined)): Num + declare fun getOrElse(arr: (MutArray[Object]) | (undefined)): Object declare class ABC {} - fun testABC(abc: (ABC) | (undefined)): unit - fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit - fun err(msg: ((Num, Str, )) | (undefined)): unit - fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str - fun boo['T, 'U](x: (('T) & ('U)) | (undefined)): unit + declare fun testABC(abc: (ABC) | (undefined)): unit + declare fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit + declare fun err(msg: ((Num, Str, )) | (undefined)): unit + declare fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str + declare fun boo['T, 'U](x: (('T) & ('U)) | (undefined)): unit declare class B['T] { val b: 'T } - fun boom(b: (B[nothing]) | (undefined)): anything + declare fun boom(b: (B[nothing]) | (undefined)): anything } //| ╔══[ERROR] type identifier not found: ABC -//| ║ l.13: fun testABC(abc: (ABC) | (undefined)): unit -//| ╙── ^^^^^ +//| ║ l.13: declare fun testABC(abc: (ABC) | (undefined)): unit +//| ╙── ^^^^^ //| ╔══[ERROR] type identifier not found: SquareConfig -//| ║ l.14: fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit -//| ╙── ^^^^^^^^^^^^^^ +//| ║ l.14: declare fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit +//| ╙── ^^^^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.21: fun boom(b: (B[nothing]) | (undefined)): anything -//| ╙── ^^^^^^^^^^^^ +//| ║ l.21: declare fun boom(b: (B[nothing]) | (undefined)): anything +//| ╙── ^^^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Overload.mlsi b/ts2mls/js/src/test/diff/Overload.mlsi index 9cd60050e..b8890833c 100644 --- a/ts2mls/js/src/test/diff/Overload.mlsi +++ b/ts2mls/js/src/test/diff/Overload.mlsi @@ -1,24 +1,24 @@ export declare module Overload { - fun f(x: anything): Str /* warning: the overload of function f is not supported yet. */ + declare fun f(x: anything): Str /* warning: the overload of function f is not supported yet. */ declare class M { - fun foo(args0: anything): Str /* warning: the overload of function foo is not supported yet. */ + declare fun foo(args0: anything): Str /* warning: the overload of function foo is not supported yet. */ } - fun app(f: anything, x: anything): unit /* warning: the overload of function app is not supported yet. */ - fun create(x: anything): () => (false) | (true) /* warning: the overload of function create is not supported yet. */ - fun g0(x: anything): Str /* warning: the overload of function g0 is not supported yet. */ - fun db(x: anything): MutArray[Num] /* warning: the overload of function db is not supported yet. */ + declare fun app(f: anything, x: anything): unit /* warning: the overload of function app is not supported yet. */ + declare fun create(x: anything): () => (false) | (true) /* warning: the overload of function create is not supported yet. */ + declare fun g0(x: anything): Str /* warning: the overload of function g0 is not supported yet. */ + declare fun db(x: anything): MutArray[Num] /* warning: the overload of function db is not supported yet. */ declare class N {} - fun id(x: anything): unit /* warning: the overload of function id is not supported yet. */ - fun tst(x: anything): {y: Str,} /* warning: the overload of function tst is not supported yet. */ - fun op(x: anything, y: anything): unit /* warning: the overload of function op is not supported yet. */ - fun swap(x: anything): MutArray[anything] /* warning: the overload of function swap is not supported yet. */ - fun u(x: anything): Str /* warning: the overload of function u is not supported yet. */ - fun doSome['T, 'U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ + declare fun id(x: anything): unit /* warning: the overload of function id is not supported yet. */ + declare fun tst(x: anything): {y: Str,} /* warning: the overload of function tst is not supported yet. */ + declare fun op(x: anything, y: anything): unit /* warning: the overload of function op is not supported yet. */ + declare fun swap(x: anything): MutArray[anything] /* warning: the overload of function swap is not supported yet. */ + declare fun u(x: anything): Str /* warning: the overload of function u is not supported yet. */ + declare fun doSome['T, 'U](x: anything): nothing /* warning: the overload of function doSome is not supported yet. */ declare module XX { - export fun f['T](x: 'T, n: anything): Str /* warning: the overload of function f is not supported yet. */ + export declare fun f['T](x: 'T, n: anything): Str /* warning: the overload of function f is not supported yet. */ } declare class WWW { - fun F['T](args0: 'T): 'T /* warning: the overload of function F is not supported yet. */ + declare fun F['T](args0: 'T): 'T /* warning: the overload of function F is not supported yet. */ } - fun baz(): anything /* warning: the overload of function baz is not supported yet. */ + declare fun baz(): anything /* warning: the overload of function baz is not supported yet. */ } diff --git a/ts2mls/js/src/test/diff/TSArray.mlsi b/ts2mls/js/src/test/diff/TSArray.mlsi index 7869243ab..ea958902b 100644 --- a/ts2mls/js/src/test/diff/TSArray.mlsi +++ b/ts2mls/js/src/test/diff/TSArray.mlsi @@ -1,45 +1,45 @@ export declare module TSArray { - fun first(x: MutArray[Str]): Str - fun getZero3(): MutArray[Num] - fun first2(fs: MutArray[(x: Num) => Num]): (x: Num) => Num - fun doEs(e: MutArray[Int]): MutArray[Int] + declare fun first(x: MutArray[Str]): Str + declare fun getZero3(): MutArray[Num] + declare fun first2(fs: MutArray[(x: Num) => Num]): (x: Num) => Num + declare fun doEs(e: MutArray[Int]): MutArray[Int] declare class C {} declare trait I { val i: Num } - fun doCs(c: MutArray[C]): MutArray[C] - fun doIs(i: MutArray[I]): MutArray[I] - fun inter['U, 'T](x: MutArray[('U) & ('T)]): MutArray[('U) & ('T)] - fun clean(x: MutArray[(Str, Num, )]): MutArray[(Str, Num, )] - fun translate['T, 'U](x: MutArray['T]): MutArray['U] - fun uu(x: MutArray[((Num) | (false)) | (true)]): MutArray[((Num) | (false)) | (true)] + declare fun doCs(c: MutArray[C]): MutArray[C] + declare fun doIs(i: MutArray[I]): MutArray[I] + declare fun inter['U, 'T](x: MutArray[('U) & ('T)]): MutArray[('U) & ('T)] + declare fun clean(x: MutArray[(Str, Num, )]): MutArray[(Str, Num, )] + declare fun translate['T, 'U](x: MutArray['T]): MutArray['U] + declare fun uu(x: MutArray[((Num) | (false)) | (true)]): MutArray[((Num) | (false)) | (true)] declare class Temp['T] { val x: 'T } - fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] - fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] + declare fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] + declare fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] } //| ╔══[ERROR] type identifier not found: C -//| ║ l.10: fun doCs(c: MutArray[C]): MutArray[C] -//| ╙── ^ +//| ║ l.10: declare fun doCs(c: MutArray[C]): MutArray[C] +//| ╙── ^ //| ╔══[ERROR] type identifier not found: C -//| ║ l.10: fun doCs(c: MutArray[C]): MutArray[C] -//| ╙── ^ +//| ║ l.10: declare fun doCs(c: MutArray[C]): MutArray[C] +//| ╙── ^ //| ╔══[ERROR] type identifier not found: I -//| ║ l.11: fun doIs(i: MutArray[I]): MutArray[I] -//| ╙── ^ +//| ║ l.11: declare fun doIs(i: MutArray[I]): MutArray[I] +//| ╙── ^ //| ╔══[ERROR] type identifier not found: I -//| ║ l.11: fun doIs(i: MutArray[I]): MutArray[I] -//| ╙── ^ +//| ║ l.11: declare fun doIs(i: MutArray[I]): MutArray[I] +//| ╙── ^ //| ╔══[ERROR] type identifier not found: Temp -//| ║ l.19: fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] -//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//| ║ l.19: declare fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Temp -//| ║ l.19: fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] -//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//| ║ l.19: declare fun ta(ts: MutArray[Temp[(false) | (true)]]): MutArray[Temp[(false) | (true)]] +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Temp -//| ║ l.20: fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] -//| ╙── ^^^^^^^^ +//| ║ l.20: declare fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] +//| ╙── ^^^^^^^^ //| ╔══[ERROR] type identifier not found: Temp -//| ║ l.20: fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] -//| ╙── ^^^^^^^^ +//| ║ l.20: declare fun tat['T](ts: MutArray[Temp['T]]): MutArray[Temp['T]] +//| ╙── ^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 8c1c32923..00cd8208a 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -1,30 +1,30 @@ export declare module Tuple { - fun key(x: (Str, (false) | (true), )): Str - fun value(x: (Str, (false) | (true), )): (false) | (true) - fun third(x: (Num, Num, Num, )): Num - fun vec2(x: Num, y: Num): (Num, Num, ) - fun twoFunctions(ff: ((x: Num) => Num, (x: Num) => Num, ), x: Num): Num - fun tupleIt(x: Str): (() => Str, ) - fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) - fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) - fun ex['T, 'U](x: 'T, y: 'U): ('T, 'U, ('T) & ('U), ) - fun foo['T, 'U](x: (('T) & ('U), )): unit - fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) + declare fun key(x: (Str, (false) | (true), )): Str + declare fun value(x: (Str, (false) | (true), )): (false) | (true) + declare fun third(x: (Num, Num, Num, )): Num + declare fun vec2(x: Num, y: Num): (Num, Num, ) + declare fun twoFunctions(ff: ((x: Num) => Num, (x: Num) => Num, ), x: Num): Num + declare fun tupleIt(x: Str): (() => Str, ) + declare fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) + declare fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) + declare fun ex['T, 'U](x: 'T, y: 'U): ('T, 'U, ('T) & ('U), ) + declare fun foo['T, 'U](x: (('T) & ('U), )): unit + declare fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) declare class A { val x: Num } declare class B {} - fun swap(x: (A, B, )): (B, A, ) + declare fun swap(x: (A, B, )): (B, A, ) } //| ╔══[ERROR] type identifier not found: A -//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) -//| ╙── ^ +//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) -//| ╙── ^ -//| ╔══[ERROR] type identifier not found: B -//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) +//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) //| ╙── ^ +//| ╔══[ERROR] type identifier not found: B +//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ //| ╔══[ERROR] type identifier not found: A -//| ║ l.17: fun swap(x: (A, B, )): (B, A, ) -//| ╙── ^ +//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ╙── ^ diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index e6259fc68..15f8a5005 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -18,7 +18,7 @@ export declare module Type { type DEF = ABC type TP['A, 'B, 'C] = ('A, 'B, 'C, ) declare module NA { - fun fb(b: Str): unit + declare fun fb(b: Str): unit export type B = Str } declare class NC { @@ -26,11 +26,11 @@ export declare module Type { } type G = ABC val none: {_tag: "None",} - fun some['A](a: 'A): (None) | (Some['A]) + declare fun some['A](a: 'A): (None) | (Some['A]) } //| ╔══[ERROR] type identifier not found: None -//| ║ l.29: fun some['A](a: 'A): (None) | (Some['A]) -//| ╙── ^^^^^^ +//| ║ l.29: declare fun some['A](a: 'A): (None) | (Some['A]) +//| ╙── ^^^^^^ //| ╔══[ERROR] type identifier not found: Some -//| ║ l.29: fun some['A](a: 'A): (None) | (Some['A]) -//| ╙── ^^^^^^^^^^ +//| ║ l.29: declare fun some['A](a: 'A): (None) | (Some['A]) +//| ╙── ^^^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 96ddaca1e..2d3162072 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -1,47 +1,47 @@ export declare module TypeParameter { - fun inc['T](x: 'T): Num + declare fun inc['T](x: 'T): Num declare class CC['T] { - fun print(args0: 'T): unit + declare fun print(args0: 'T): unit } - fun con['U, 'T](t: 'T): 'U + declare fun con['U, 'T](t: 'T): 'U declare class Printer['T] { - fun print(args0: 'T): unit + declare fun print(args0: 'T): unit } - fun setStringPrinter(p: Printer[Str]): unit - fun getStringPrinter(): Printer[Str] - fun foo['T](p: Printer['T], x: 'T): 'T - fun foo2['T](p: Printer['T], x: 'T): 'T + declare fun setStringPrinter(p: Printer[Str]): unit + declare fun getStringPrinter(): Printer[Str] + declare fun foo['T](p: Printer['T], x: 'T): 'T + declare fun foo2['T](p: Printer['T], x: 'T): 'T declare class F['T] { val x: 'T - fun GG['U](args0: 'U): 'T + declare fun GG['U](args0: 'U): 'T } declare trait I['T] { val x: 'T - fun GG['U](args0: 'U): 'T + declare fun GG['U](args0: 'U): 'T } declare class FFF['T] { - fun fff(args0: 'T): unit + declare fun fff(args0: 'T): unit } - fun fff(p: FFF[Str], s: Str): unit - fun getFFF(): FFF[Num] + declare fun fff(p: FFF[Str], s: Str): unit + declare fun getFFF(): FFF[Num] type PolyToString = forall 'T; (x: 'T) => Str type PolyID = forall 'T; (x: 'T) => 'T } //| ╔══[ERROR] type identifier not found: Printer -//| ║ l.10: fun setStringPrinter(p: Printer[Str]): unit -//| ╙── ^^^^^^^^^^^^ +//| ║ l.10: declare fun setStringPrinter(p: Printer[Str]): unit +//| ╙── ^^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Printer -//| ║ l.11: fun getStringPrinter(): Printer[Str] -//| ╙── ^^^^^^^^^^^^ +//| ║ l.11: declare fun getStringPrinter(): Printer[Str] +//| ╙── ^^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Printer -//| ║ l.12: fun foo['T](p: Printer['T], x: 'T): 'T -//| ╙── ^^^^^^^^^^^ +//| ║ l.12: declare fun foo['T](p: Printer['T], x: 'T): 'T +//| ╙── ^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: Printer -//| ║ l.13: fun foo2['T](p: Printer['T], x: 'T): 'T -//| ╙── ^^^^^^^^^^^ +//| ║ l.13: declare fun foo2['T](p: Printer['T], x: 'T): 'T +//| ╙── ^^^^^^^^^^^ //| ╔══[ERROR] type identifier not found: FFF -//| ║ l.25: fun fff(p: FFF[Str], s: Str): unit -//| ╙── ^^^^^^^^ +//| ║ l.25: declare fun fff(p: FFF[Str], s: Str): unit +//| ╙── ^^^^^^^^ //| ╔══[ERROR] type identifier not found: FFF -//| ║ l.26: fun getFFF(): FFF[Num] -//| ╙── ^^^^^^^^ +//| ║ l.26: declare fun getFFF(): FFF[Num] +//| ╙── ^^^^^^^^ diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index b87a51680..16128f502 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -1,9 +1,9 @@ export declare module Union { - fun getString(x: (((Str) | (Num)) | (false)) | (true)): Str - fun test(x: (false) | (true)): (Str) | (Num) - fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything - fun get(arr: (MutArray[Num]) | (MutArray[Str])): unit - fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str - fun typeVar['T, 'U](x: ('T) | ('U)): ('T) | ('U) - fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) + declare fun getString(x: (((Str) | (Num)) | (false)) | (true)): Str + declare fun test(x: (false) | (true)): (Str) | (Num) + declare fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything + declare fun get(arr: (MutArray[Num]) | (MutArray[Str])): unit + declare fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str + declare fun typeVar['T, 'U](x: ('T) | ('U)): ('T) | ('U) + declare fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) } From ac6e0d2b2b8f98e99dc8a37ba35d7f52877c96ac Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 10:34:49 +0800 Subject: [PATCH 171/202] WIP: Fix export check in driver --- driver/js/src/main/scala/driver/Driver.scala | 4 ++-- .../test/cjsprojects/.interfaces/mlscript/Bar.mlsi | 2 +- .../cjsprojects/.interfaces/mlscript/BazBaz.mlsi | 2 +- .../test/cjsprojects/.interfaces/mlscript/CJS1.mlsi | 2 +- .../test/cjsprojects/.interfaces/mlscript/CJS2.mlsi | 2 +- .../test/cjsprojects/.interfaces/mlscript/Call.mlsi | 4 ++++ .../cjsprojects/.interfaces/mlscript/Lodash.mlsi | 2 +- .../src/test/cjsprojects/.interfaces/ts/Funs.mlsi | 3 +++ driver/js/src/test/cjsprojects/js/mlscript/Call.js | 1 + driver/js/src/test/cjsprojects/js/ts/Funs.js | 11 +++++++++++ driver/js/src/test/cjsprojects/mlscript/Call.mls | 5 +++++ driver/js/src/test/cjsprojects/ts/Funs.ts | 13 +++++++++++++ .../src/test/esprojects/.interfaces/mlscript/A.mlsi | 2 +- .../src/test/esprojects/.interfaces/mlscript/B.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Builtin.mlsi | 2 +- .../src/test/esprojects/.interfaces/mlscript/C.mlsi | 2 +- .../test/esprojects/.interfaces/mlscript/Child.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Cycle1.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Cycle2.mlsi | 2 +- .../esprojects/.interfaces/mlscript/MLS2TheMax.mlsi | 2 +- .../.interfaces/mlscript/MyPartialOrder.mlsi | 2 +- .../esprojects/.interfaces/mlscript/NewTSClass.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Opened.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Output.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Output2.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Parent.mlsi | 2 +- .../test/esprojects/.interfaces/mlscript/Self.mlsi | 2 +- .../esprojects/.interfaces/mlscript/Simple.mlsi | 2 +- .../test/esprojects/.interfaces/mlscript/TS.mlsi | 2 +- .../esprojects/.interfaces/mlscript/TyperDebug.mlsi | 2 +- .../.interfaces/mlscript/tools/Concat.mlsi | 2 +- .../esprojects/.interfaces/mlscript/tools/Inc.mlsi | 2 +- .../js/src/test/scala/driver/DriverDiffTests.scala | 1 + 33 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi create mode 100644 driver/js/src/test/cjsprojects/.interfaces/ts/Funs.mlsi create mode 100644 driver/js/src/test/cjsprojects/js/mlscript/Call.js create mode 100644 driver/js/src/test/cjsprojects/js/ts/Funs.js create mode 100644 driver/js/src/test/cjsprojects/mlscript/Call.mls create mode 100644 driver/js/src/test/cjsprojects/ts/Funs.ts diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index cf211d078..01e753058 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -124,7 +124,7 @@ class Driver(options: DriverOptions) { private def packTopModule(moduleName: Option[String], content: String) = moduleName.fold(content)(moduleName => - s"declare module $moduleName() {\n" + + s"export declare module $moduleName() {\n" + content.splitSane('\n').toIndexedSeq.filter(!_.isEmpty()).map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}\n" ) @@ -201,7 +201,7 @@ class Driver(options: DriverOptions) { case (_, declarations, imports, _) => imports.foreach(d => importModule(file.`import`(d.path))) `type`(TypingUnit(declarations), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) - declarations + declarations.filter(_.isExported) }) private def compile( diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi index 7a48fb3fd..4c70bc6b9 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi @@ -1,5 +1,5 @@ import "../ts/Foo.mlsi" -declare module Bar() { +export declare module Bar() { class Bar() extends Foo { fun bar: "bar" fun foo: () -> Str diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi index f63e7141c..2fbc063e9 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi @@ -1,5 +1,5 @@ import "../ts/Baz.mlsi" -declare module BazBaz() { +export declare module BazBaz() { class BazBaz() let bazbaz: BazBaz error diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi index cc6c3e148..ae1b0f95f 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi @@ -1,4 +1,4 @@ import "./CJS2.mlsi" -declare module CJS1() { +export declare module CJS1() { unit } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi index 6ee76e9d2..1f5765a7e 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi @@ -1,3 +1,3 @@ -declare module CJS2() { +export declare module CJS2() { fun add: (x: Int, y: Int,) -> Int } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi new file mode 100644 index 000000000..8d8129fe8 --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi @@ -0,0 +1,4 @@ +import "../ts/Funs.mlsi" +export declare module Call() { + unit +} diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi index 24af2c5de..2d3f3be67 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi @@ -1,5 +1,5 @@ import "lodash/fp.mlsi" -declare module Lodash() { +export declare module Lodash() { fun inc: (x: Int,) -> Int unit } diff --git a/driver/js/src/test/cjsprojects/.interfaces/ts/Funs.mlsi b/driver/js/src/test/cjsprojects/.interfaces/ts/Funs.mlsi new file mode 100644 index 000000000..ca2b2ba8f --- /dev/null +++ b/driver/js/src/test/cjsprojects/.interfaces/ts/Funs.mlsi @@ -0,0 +1,3 @@ +declare fun f(x: Num, y: Num): Num +declare fun g(x: Num): Num +export declare fun Funs(): Num diff --git a/driver/js/src/test/cjsprojects/js/mlscript/Call.js b/driver/js/src/test/cjsprojects/js/mlscript/Call.js new file mode 100644 index 000000000..43237d67e --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/mlscript/Call.js @@ -0,0 +1 @@ +//| codegen error: unresolved symbol g \ No newline at end of file diff --git a/driver/js/src/test/cjsprojects/js/ts/Funs.js b/driver/js/src/test/cjsprojects/js/ts/Funs.js new file mode 100644 index 000000000..f639e9fa1 --- /dev/null +++ b/driver/js/src/test/cjsprojects/js/ts/Funs.js @@ -0,0 +1,11 @@ +"use strict"; +function f(x, y) { + return x + y; +} +function g(x) { + return f(x, x); +} +function h() { + return g(42); +} +module.exports = h; diff --git a/driver/js/src/test/cjsprojects/mlscript/Call.mls b/driver/js/src/test/cjsprojects/mlscript/Call.mls new file mode 100644 index 000000000..af4e0b343 --- /dev/null +++ b/driver/js/src/test/cjsprojects/mlscript/Call.mls @@ -0,0 +1,5 @@ +import "../ts/Funs.ts" + +console.log(Funs()) // ok +console.log(g(5)) // error: g is not exported +console.log(f(1, 2)) // error: f is not exported diff --git a/driver/js/src/test/cjsprojects/ts/Funs.ts b/driver/js/src/test/cjsprojects/ts/Funs.ts new file mode 100644 index 000000000..126229d48 --- /dev/null +++ b/driver/js/src/test/cjsprojects/ts/Funs.ts @@ -0,0 +1,13 @@ +function f(x: number, y: number) { + return x + y; +} + +function g(x: number) { + return f(x, x); +} + +function h() { + return g(42); +} + +export = h; diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi index 1da93cbbb..d76d8e33a 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi @@ -1,3 +1,3 @@ -declare module A() { +export declare module A() { class Foo(x: Int) } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi index 99af7e4a2..eaafadf7a 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi @@ -1,5 +1,5 @@ import "./A.mlsi" -declare module B() { +export declare module B() { fun foo: error } //| ╔══[ERROR] access to class member not yet supported diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi index b3c7ce3af..b1bd7d1fa 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi @@ -1,4 +1,4 @@ -declare module Builtin() { +export declare module Builtin() { let s: "abc" let n: Num unit diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi index 6b325e2c2..6c45ecabd 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi @@ -1,5 +1,5 @@ import "./B.mlsi" -declare module C() { +export declare module C() { let a: error let b: error unit diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi index 487fef062..b47652f77 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi @@ -1,5 +1,5 @@ import "./Parent.mlsi" -declare module Child() { +export declare module Child() { class Child1(x: Int) class Child2(y: Int) let c1: Child1 diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi index 210dc702d..de79e1453 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi @@ -1,6 +1,6 @@ declare module Cycle2() { fun g: (x: Int,) -> Int } -declare module Cycle1() { +export declare module Cycle1() { fun f: (x: Int,) -> Int } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi index 23da93810..2a902232d 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi @@ -1,5 +1,5 @@ import "./Cycle1.mlsi" -declare module Cycle2() { +export declare module Cycle2() { fun g: (x: Int,) -> Int undefined } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi index b9fc6400d..e967dd64b 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi @@ -1,6 +1,6 @@ import "../ts/ReadLine.mlsi" import "./tools/Concat.mlsi" -declare module MLS2TheMax() { +export declare module MLS2TheMax() { fun ask: (question: Str,) -> Str class Some[A](value: A) module None diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi index 529fe8fac..215872ba2 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi @@ -1,5 +1,5 @@ import "fp-ts/BoundedMeetSemilattice.mlsi" -declare module MyPartialOrder() { +export declare module MyPartialOrder() { class MyPartialOrder let order: MyPartialOrder } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi index f2353d07d..e62da64bc 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi @@ -1,5 +1,5 @@ import "../ts/MyClass.mlsi" -declare module NewTSClass() { +export declare module NewTSClass() { class Bar() error } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi index d38ff5494..ffbe00f3c 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi @@ -1,5 +1,5 @@ import "./tools/Inc.mlsi" -declare module Opened() { +export declare module Opened() { fun hello: (x: Int,) -> undefined undefined } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi index 760007f2b..e0ba9d2c0 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi @@ -1,5 +1,5 @@ import "../ts/ConfigGen.mlsi" -declare module Output() { +export declare module Output() { let res: Str undefined } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi index 1460aae42..35b835ce3 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi @@ -1,5 +1,5 @@ import "json5.mlsi" -declare module Output2() { +export declare module Output2() { fun createConfig: (path: Str,) -> nothing let config: nothing undefined diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi index 0d993fdba..4dc82c4c1 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi @@ -1,4 +1,4 @@ -declare module Parent() { +export declare module Parent() { class Parent1(x: Int) { fun inc: Int } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi index 592e3db79..c962f2d36 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi @@ -1,4 +1,4 @@ -declare module Self() { +export declare module Self() { class Foo() } //| Cannot import driver/js/src/test/esprojects/mlscript/Self.mls from itself diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi index 9002b3a71..e4149f1d1 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi @@ -1,5 +1,5 @@ import "./Opened.mlsi" -declare module Simple() { +export declare module Simple() { mixin B() { this: {n: 'n} fun foo: 'n diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi index 9db659d00..ce7e7121a 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi @@ -1,5 +1,5 @@ import "../ts/MyPrint.mlsi" -declare module TS() { +export declare module TS() { let tspt: error let printer: error error diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi index ee9e774f8..8dd016639 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi @@ -1,4 +1,4 @@ -declare module TyperDebug() { +export declare module TyperDebug() { class A(x: Int) { fun add: (y: Int,) -> Int } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi index bad43ee68..6e59e725c 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi @@ -1,4 +1,4 @@ -declare module Concat() { +export declare module Concat() { fun concat2: (Str, Str,) -> Str fun concat3: (Str, Str, Str,) -> Str } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi index 41d83836d..dcc661a31 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi @@ -1,3 +1,3 @@ -declare module Inc() { +export declare module Inc() { fun inc: (x: Int,) -> Int } diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index ca58ba674..f80fc7b8e 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -142,6 +142,7 @@ object DriverDiffTests { cjsEntry("CJS1"), cjsEntry("Bar", Some("./tsconfig.json")), cjsEntry("BazBaz", Some("./tsconfig.json"), expectTypeError = true), + cjsEntry("Call", Some("./tsconfig.json"), expectError = true) ) private val cp = g.require("child_process") From 3b4f5c5761be3fb96b29d102fd3eb81920f6b7e7 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 11:21:03 +0800 Subject: [PATCH 172/202] WIP: Fix driver debug --- driver/js/src/main/scala/driver/Driver.scala | 20 +- .../.interfaces/mlscript/Debug1.mlsi | 5 + .../.interfaces/mlscript/Debug2.mlsi | 96 +++++++ .../.interfaces/mlscript/Debug3.mlsi | 95 +++++++ .../.interfaces/mlscript/Debug4.mlsi | 3 + .../.interfaces/mlscript/TyperDebug.mlsi | 250 +++++++++--------- .../src/test/esprojects/js/mlscript/Debug1.js | 15 ++ .../src/test/esprojects/js/mlscript/Debug2.js | 13 + .../src/test/esprojects/js/mlscript/Debug3.js | 11 + .../src/test/esprojects/js/mlscript/Debug4.js | 11 + .../src/test/esprojects/mlscript/Debug1.mls | 4 + .../src/test/esprojects/mlscript/Debug2.mls | 5 + .../src/test/esprojects/mlscript/Debug3.mls | 1 + .../src/test/esprojects/mlscript/Debug4.mls | 1 + .../test/scala/driver/DriverDiffTests.scala | 1 + .../main/scala/mlscript/TyperHelpers.scala | 2 +- .../js/src/main/scala/ts2mls/JSWriter.scala | 2 +- 17 files changed, 402 insertions(+), 133 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/Debug1.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Debug2.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Debug3.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Debug4.js create mode 100644 driver/js/src/test/esprojects/mlscript/Debug1.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Debug2.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Debug3.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Debug4.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 01e753058..d147b2539 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -16,7 +16,7 @@ class Driver(options: DriverOptions) { private var dbgWriter: Option[JSWriter] = None private def printDbg(msg: String) = - dbgWriter.fold(println(msg))(writer => writer.writeDbg(msg)) + dbgWriter.fold(())(writer => writer.writeDbg(msg.replace("\t", " "))) private val typer = new mlscript.Typer( @@ -40,6 +40,7 @@ class Driver(options: DriverOptions) { private val noRedundantOutput = (s: String) => () private val importedModule = MutSet[String]() + private val dbdFiles = MutSet[String]() private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) import TSPathResolver.{normalize, isLocal, isMLScirpt, dirname} @@ -100,8 +101,10 @@ class Driver(options: DriverOptions) { val lines = content.splitSane('\n').toIndexedSeq lines.headOption match { - case S(head) => typer.dbg = head.startsWith("//") && head.endsWith(":d") - case _ => typer.dbg = false + case S(head) if (head.startsWith("//") && head.endsWith(":d")) => + dbdFiles.add(filename) + typer.dbg = true + case _ => () } val fph = new mlscript.FastParseHelpers(content, lines) val origin = Origin(filename, 1, fph) @@ -271,9 +274,8 @@ class Driver(options: DriverOptions) { if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false, mlsiWriter.writeErr).show}") + { - dbgWriter = Some(mlsiWriter); - val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false, mlsiWriter.writeErr).show); - dbgWriter = None + dbgWriter = Some(mlsiWriter) + val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false, mlsiWriter.writeErr).show) res } val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") @@ -289,6 +291,12 @@ class Driver(options: DriverOptions) { } else `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // for ts/mlsi files, we only check interface files + + if (dbdFiles.contains(file.filename)) { + typer.dbg = false + dbdFiles.remove(file.filename) + () + } } }) } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi new file mode 100644 index 000000000..6ceeefcd4 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi @@ -0,0 +1,5 @@ +import "./Debug2.mlsi" +import "./Debug4.mlsi" +export declare module Debug1() { + let x: 42 +} diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi new file mode 100644 index 000000000..4d1bdd6e6 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi @@ -0,0 +1,96 @@ +import "./Debug3.mlsi" +export declare module Debug2() { + let y: 42 +} +//| 0. Typing TypingUnit(List(let y = 42)) +//| | 0. Created lazy type info for let y = 42 +//| | Completing let y = 42 +//| | | UNSTASHING... (out) +//| | | Type params +//| | | UNSTASHING... (out) +//| | | Params +//| | | 0. Typing term 42 +//| | | 0. : #42 +//| | | CONSTRAIN #42 ) where +//| | Typing unit statements +//| | : None +//| ⬤ Initial: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| ⬤ Cleaned up: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| consed: Map() +//| ⬤ Unskid: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| analyze1[+] #42 +//| [inv] +//| [nums] +//| analyze2[+] #42 +//| [occs] +//| [vars] TreeSet() +//| [rec] Set() +//| [sub] +//| [bounds] +//| [rec] Set() +//| transform[+] #42 () + None +//| ~> #42 +//| ⬤ Type after simplification: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| normLike[+] TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| | norm[+] #42 +//| | | DNF: DNF(0, #42{}) +//| | ~> #42 +//| ⬤ Normalized: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| ⬤ Cleaned up: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| consed: Map() +//| ⬤ Unskid: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| analyze1[+] #42 +//| [inv] +//| [nums] +//| analyze2[+] #42 +//| [occs] +//| [vars] TreeSet() +//| [rec] Set() +//| [sub] +//| [bounds] +//| [rec] Set() +//| transform[+] #42 () + None +//| ~> #42 +//| ⬤ Resim: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: +//| allVarPols: +//| [subs] HashMap() +//| ⬤ Factored: TypedTypingUnit( +//| TypedNuFun(0,let y = 42,#42) +//| None) +//| where: diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi new file mode 100644 index 000000000..3fbd4c733 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi @@ -0,0 +1,95 @@ +export declare module Debug3() { + let z: 1 +} +//| 0. Typing TypingUnit(List(let z = 1)) +//| | 0. Created lazy type info for let z = 1 +//| | Completing let z = 1 +//| | | UNSTASHING... (out) +//| | | Type params +//| | | UNSTASHING... (out) +//| | | Params +//| | | 0. Typing term 1 +//| | | 0. : #1 +//| | | CONSTRAIN #1 ) where +//| | Typing unit statements +//| | : None +//| ⬤ Initial: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| ⬤ Cleaned up: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| consed: Map() +//| ⬤ Unskid: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| analyze1[+] #1 +//| [inv] +//| [nums] +//| analyze2[+] #1 +//| [occs] +//| [vars] TreeSet() +//| [rec] Set() +//| [sub] +//| [bounds] +//| [rec] Set() +//| transform[+] #1 () + None +//| ~> #1 +//| ⬤ Type after simplification: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| normLike[+] TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| | norm[+] #1 +//| | | DNF: DNF(0, #1{}) +//| | ~> #1 +//| ⬤ Normalized: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| ⬤ Cleaned up: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| consed: Map() +//| ⬤ Unskid: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| analyze1[+] #1 +//| [inv] +//| [nums] +//| analyze2[+] #1 +//| [occs] +//| [vars] TreeSet() +//| [rec] Set() +//| [sub] +//| [bounds] +//| [rec] Set() +//| transform[+] #1 () + None +//| ~> #1 +//| ⬤ Resim: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: +//| allVarPols: +//| [subs] HashMap() +//| ⬤ Factored: TypedTypingUnit( +//| TypedNuFun(0,let z = 1,#1) +//| None) +//| where: diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi new file mode 100644 index 000000000..6fac89d9a --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi @@ -0,0 +1,3 @@ +export declare module Debug4() { + let w: "wuwuwu" +} diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi index 8dd016639..88ddaeaf1 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi @@ -61,7 +61,7 @@ export declare module TyperDebug() { //| | | | | | | 2. : Int //| | | | | | | CONSTRAIN α830'' α831'') //| | | | | | | where - α830'' :> (Int -> Int) +//| α830'' :> (Int -> Int) //| | | | | | | 2. C α830'' α831'') (0) //| | | | | | | | 2. C α830'' α831'') (0) //| | | | | | | | | NEW α830'' UB (2) @@ -75,13 +75,13 @@ export declare module TyperDebug() { //| | | | | UNSTASHING... (out) //| | | | | CONSTRAIN ((y: Int,) -> α831'') Int +//| α831'' :> Int //| | | | | 2. C ((y: Int,) -> α831'') α831'') + (x,) (y,),((y: Int,) -> α831'')) where - α831'' :> Int +//| α831'' :> Int //| | | | Typing unit statements //| | | | : None //| | | Checking base class implementations... @@ -104,13 +104,13 @@ export declare module TyperDebug() { //| | | = HashMap() //| | | UNSTASHING... (out) //| | Completed TypedNuCls(0, TypeName(A), - List(), - List((x,Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831''))) - (x,NuParam(x,Int)), - : ⊤, Set(), Map()) where - α831'' :> Int +//| List(), +//| List((x,Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831''))) +//| (x,NuParam(x,Int)), +//| : ⊤, Set(), Map()) where +//| α831'' :> Int //| | Completing let aa = A (42,) //| | | UNSTASHING... (out) //| | | Type params @@ -132,12 +132,12 @@ export declare module TyperDebug() { //| | | 0. : α833 //| | | CONSTRAIN α833 #A +//| α833 :> #A //| | | 1. C α833 #A +//| α833 :> #A //| | Typing unit statements //| | | 0. Typing term (console).log ((aa).add (6,),) //| | | | 0. Typing term (console).log @@ -169,7 +169,7 @@ export declare module TyperDebug() { //| | | | | | 0. : α833 //| | | | | | CONSTRAIN α833 #A +//| α833 :> #A //| | | | | | 0. C α833 α831'')›) where - α831'' :> Int +//| α831'' :> Int //| | | | | | | | | | | | Fresh[0] A.add : Some(‹∀ 1. ((y: Int,) -> α831'')›) where Some( - α831'' :> Int) +//| α831'' :> Int) //| | | | | | | | | | | | & None (from refinement) //| | | | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› //| | | | | CONSTRAIN add836 ,) -> α837) //| | | | | where - α831'' :> Int - add836 :> ‹∀ 1. ((y: Int,) -> α831'')› +//| α831'' :> Int +//| add836 :> ‹∀ 1. ((y: Int,) -> α831'')› //| | | | | 0. C add836 ,) -> α837) (0) //| | | | | | 0. C add836 ,) -> α837) (0) //| | | | | | | NEW add836 UB (0) @@ -199,10 +199,10 @@ export declare module TyperDebug() { //| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α831'')› ,) -> α837) (2) //| | | | | | | | | | INST [1] ‹∀ 1. ((y: Int,) -> α831'')› //| | | | | | | | | | where - α831'' :> Int +//| α831'' :> Int //| | | | | | | | | | TO [0] ~> ((y: Int,) -> α831_838) //| | | | | | | | | | where - α831_838 :> Int +//| α831_838 :> Int //| | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) //| | | | | | | | | | | 0. C ((y: Int,) -> α831_838) ,) -> α837) (4) //| | | | | | | | | | | | 0. C (#6,) α839) //| | | | where - log835 :> ((args0: (Anything | MutArray[Anything]),) -> Unit) - α837 :> Int +//| log835 :> ((args0: (Anything | MutArray[Anything]),) -> Unit) +//| α837 :> Int //| | | | 0. C log835 α839) (0) //| | | | | 0. C log835 α839) (0) //| | | | | | NEW log835 UB (0) @@ -234,39 +234,39 @@ export declare module TyperDebug() { //| | | 0. : α839 //| | : Some(α839) //| ⬤ Initial: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831''))) - (x,NuParam(x,Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),α833) - Some(α839)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831''))) +//| (x,NuParam(x,Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),α833) +//| Some(α839)) //| where: - α831'' :> Int - α833 :> #A <: {add: add836} - add836 :> ‹∀ 1. ((y: Int,) -> α831'')› <: ((#6,) -> α837) - α837 :> Int <: (Anything | MutArray[Anything]) - α839 :> Unit +//| α831'' :> Int +//| α833 :> #A <: {add: add836} +//| add836 :> ‹∀ 1. ((y: Int,) -> α831'')› <: ((#6,) -> α837) +//| α837 :> Int <: (Anything | MutArray[Anything]) +//| α839 :> Unit //| allVarPols: +α831'', +α833, +α839 //| Renewed α831'' ~> α831_840'' //| Renewed α833 ~> α833_841 //| Renewed α839 ~> α839_842 //| ⬤ Cleaned up: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) - (x,NuParam(x,Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),α833_841) - Some(α839_842)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) +//| (x,NuParam(x,Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),α833_841) +//| Some(α839_842)) //| where: - α831_840'' :> Int - α833_841 :> #A - α839_842 :> Unit +//| α831_840'' :> Int +//| α833_841 :> #A +//| α839_842 :> Unit //| allVarPols: +α831_840'', +α833_841, +α839_842 //| consed: Map((true,Int) -> α831_840'', (true,#A) -> α833_841, (true,Unit) -> α839_842) //| !unskid-1! Int -> α831_840'' @@ -274,19 +274,19 @@ export declare module TyperDebug() { //| !unskid-1! Int -> α831_840'' //| !unskid-1! #A -> α833_841 //| ⬤ Unskid: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,α831_840'')), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) - (x,NuParam(x,α831_840'')), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),α833_841) - Some(α839_842)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,α831_840'')), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> α831_840''))) +//| (x,NuParam(x,α831_840'')), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),α833_841) +//| Some(α839_842)) //| where: - α831_840'' :> Int - α833_841 :> #A - α839_842 :> Unit +//| α831_840'' :> Int +//| α833_841 :> #A +//| α839_842 :> Unit //| analyze1[+] α831_840'' //| | analyze1[+;@[+](0)] Int //| analyze1[+] ((y: Int,) -> α831_840'') @@ -340,9 +340,9 @@ export declare module TyperDebug() { //| 1[!] α839_842 //| [sub] α831_840'' -> None, α833_841 -> None, α839_842 -> None //| [bounds] - α831_840'' :> Int - α833_841 :> #A - α839_842 :> Unit +//| α831_840'' :> Int +//| α833_841 :> #A +//| α839_842 :> Unit //| [rec] Set() //| transform[+] α831_840'' () + None //| | -> bound Some(true) @@ -396,27 +396,27 @@ export declare module TyperDebug() { //| | ~> Unit //| ~> Unit //| ⬤ Type after simplification: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),#A) - Some(Unit)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) +//| (x,NuParam(x,Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),#A) +//| Some(Unit)) //| where: //| allVarPols: //| normLike[+] TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) - (x,NuParam(x,Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),#A) - Some(Unit)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: Int,) -> Int))) +//| (x,NuParam(x,Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),#A) +//| Some(Unit)) //| | norm[+] Int //| | | DNF: DNF(0, #Int{}) //| | ~> #Int @@ -460,40 +460,40 @@ export declare module TyperDebug() { //| | | DNF: DNF(0, #unit<>{}) //| | ~> #unit<> //| ⬤ Normalized: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,#Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) - (x,NuParam(x,#Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) - Some(#unit<>)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,#Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) +//| (x,NuParam(x,#Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),A) +//| Some(#unit<>)) //| where: //| allVarPols: //| ⬤ Cleaned up: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,#Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) - (x,NuParam(x,#Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) - Some(#unit<>)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,#Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) +//| (x,NuParam(x,#Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),A) +//| Some(#unit<>)) //| where: //| allVarPols: //| consed: Map() //| ⬤ Unskid: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,#Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) - (x,NuParam(x,#Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) - Some(#unit<>)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,#Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) +//| (x,NuParam(x,#Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),A) +//| Some(#unit<>)) //| where: //| analyze1[+] #Int //| analyze1[+] ((y: #Int,) -> #Int) @@ -552,26 +552,26 @@ export declare module TyperDebug() { //| transform[+] #unit<> () + None //| ~> #unit<> //| ⬤ Resim: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,#Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) - (x,NuParam(x,#Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) - Some(#unit<>)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,#Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) +//| (x,NuParam(x,#Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),A) +//| Some(#unit<>)) //| where: //| allVarPols: //| [subs] HashMap() //| ⬤ Factored: TypedTypingUnit( - TypedNuCls(0, TypeName(A), - List(), - List((x,#Int)), - this: ⊤, - (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) - (x,NuParam(x,#Int)), - : ⊤, Set(), Map()) - TypedNuFun(0,let aa = A (42,),A) - Some(#unit<>)) +//| TypedNuCls(0, TypeName(A), +//| List(), +//| List((x,#Int)), +//| this: ⊤, +//| (add,TypedNuFun(1,fun add = (y: Int,) => + (x,) (y,),((y: #Int,) -> #Int))) +//| (x,NuParam(x,#Int)), +//| : ⊤, Set(), Map()) +//| TypedNuFun(0,let aa = A (42,),A) +//| Some(#unit<>)) //| where: diff --git a/driver/js/src/test/esprojects/js/mlscript/Debug1.js b/driver/js/src/test/esprojects/js/mlscript/Debug1.js new file mode 100644 index 000000000..e2c2c1d38 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Debug1.js @@ -0,0 +1,15 @@ +import { Debug2 } from "./Debug2.js" + +import { Debug4 } from "./Debug4.js" + +const Debug1 = new class Debug1 { + #x; + get x() { return this.#x; } + constructor() { + } + $init() { + this.#x = 42; + const x = this.#x; + } +}; +Debug1.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Debug2.js b/driver/js/src/test/esprojects/js/mlscript/Debug2.js new file mode 100644 index 000000000..83b4a5d10 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Debug2.js @@ -0,0 +1,13 @@ +import { Debug3 } from "./Debug3.js" + +export const Debug2 = new class Debug2 { + #y; + get y() { return this.#y; } + constructor() { + } + $init() { + this.#y = 42; + const y = this.#y; + } +}; +Debug2.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Debug3.js b/driver/js/src/test/esprojects/js/mlscript/Debug3.js new file mode 100644 index 000000000..2186c08ac --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Debug3.js @@ -0,0 +1,11 @@ +export const Debug3 = new class Debug3 { + #z; + get z() { return this.#z; } + constructor() { + } + $init() { + this.#z = 1; + const z = this.#z; + } +}; +Debug3.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Debug4.js b/driver/js/src/test/esprojects/js/mlscript/Debug4.js new file mode 100644 index 000000000..822e413cb --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Debug4.js @@ -0,0 +1,11 @@ +export const Debug4 = new class Debug4 { + #w; + get w() { return this.#w; } + constructor() { + } + $init() { + this.#w = "wuwuwu"; + const w = this.#w; + } +}; +Debug4.$init(); diff --git a/driver/js/src/test/esprojects/mlscript/Debug1.mls b/driver/js/src/test/esprojects/mlscript/Debug1.mls new file mode 100644 index 000000000..070909968 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Debug1.mls @@ -0,0 +1,4 @@ +import "./Debug2.mls" +import "./Debug4.mls" + +let x = 42 diff --git a/driver/js/src/test/esprojects/mlscript/Debug2.mls b/driver/js/src/test/esprojects/mlscript/Debug2.mls new file mode 100644 index 000000000..45248da6b --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Debug2.mls @@ -0,0 +1,5 @@ +//:d + +import "./Debug3.mls" + +let y = 42 diff --git a/driver/js/src/test/esprojects/mlscript/Debug3.mls b/driver/js/src/test/esprojects/mlscript/Debug3.mls new file mode 100644 index 000000000..0e6ac214b --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Debug3.mls @@ -0,0 +1 @@ +let z = 1 diff --git a/driver/js/src/test/esprojects/mlscript/Debug4.mls b/driver/js/src/test/esprojects/mlscript/Debug4.mls new file mode 100644 index 000000000..c5193957c --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Debug4.mls @@ -0,0 +1 @@ +let w = "wuwuwu" diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index f80fc7b8e..203163780 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -133,6 +133,7 @@ object DriverDiffTests { esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules esEntry("Builtin"), esEntry("TyperDebug"), + esEntry("Debug1"), esEntry("Child", expectTypeError = true), esEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true) ) diff --git a/shared/src/main/scala/mlscript/TyperHelpers.scala b/shared/src/main/scala/mlscript/TyperHelpers.scala index 87e2873d4..71e0a6ef7 100644 --- a/shared/src/main/scala/mlscript/TyperHelpers.scala +++ b/shared/src/main/scala/mlscript/TyperHelpers.scala @@ -862,7 +862,7 @@ abstract class TyperHelpers { Typer: Typer => case NuParam(nme, ty) => ty.lb.toList ::: ty.ub :: Nil case TypedNuFun(level, fd, ty) => ty :: Nil case TypedNuDummy(d) => Nil - case _ => ??? // TODO + case _ => Nil // TODO } def children(includeBounds: Bool): List[SimpleType] = this match { case tv @ AssignedVariable(ty) => if (includeBounds) ty :: Nil else Nil diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 0bc45ef08..100792d20 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -15,7 +15,7 @@ class JSWriter(filename: String) { def writeln(str: String): Unit = write(str + "\n") def write(str: String): Unit = buffer ++= str def writeErr(str: String): Unit = err ++= s"//| $str\n" - def writeDbg(str: String): Unit = dbg ++= s"//| $str\n" + def writeDbg(str: String): Unit = str.split("\n").foreach(s => dbg ++= s"//| $s\n") def close(): Unit = { val str = buffer.toString() + dbg.toString() + err.toString() From ad42dd89d93421fe3576e19ea31cce5b796041ec Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 12:00:56 +0800 Subject: [PATCH 173/202] WIP: Ignore tsc-generated files --- .github/workflows/scala.yml | 10 ++----- .gitignore | 2 ++ driver/js/src/test/cjsprojects/js/ts/Baz.js | 28 ------------------- driver/js/src/test/cjsprojects/js/ts/Foo.js | 7 ----- driver/js/src/test/cjsprojects/js/ts/Funs.js | 11 -------- .../esprojects/js/my_ts_path/ConfigGen.js | 9 ------ .../test/esprojects/js/my_ts_path/MyClass.js | 5 ---- .../test/esprojects/js/my_ts_path/MyPrint.js | 9 ------ .../test/esprojects/js/my_ts_path/ReadLine.js | 7 ----- scripts/ts-prepare.sh | 17 +++++++++++ 10 files changed, 21 insertions(+), 84 deletions(-) delete mode 100644 driver/js/src/test/cjsprojects/js/ts/Baz.js delete mode 100644 driver/js/src/test/cjsprojects/js/ts/Foo.js delete mode 100644 driver/js/src/test/cjsprojects/js/ts/Funs.js delete mode 100644 driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js delete mode 100644 driver/js/src/test/esprojects/js/my_ts_path/MyClass.js delete mode 100644 driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js delete mode 100644 driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js create mode 100755 scripts/ts-prepare.sh diff --git a/.github/workflows/scala.yml b/.github/workflows/scala.yml index 7c6e9453c..1bf5d02d4 100644 --- a/.github/workflows/scala.yml +++ b/.github/workflows/scala.yml @@ -19,14 +19,8 @@ jobs: - uses: actions/setup-node@v3 with: node-version: '17.x' - - name: Install TypeScript - run: npm ci - - name: Install test libraries for es projects - working-directory: ./driver/js/src/test/esprojects - run: npm ci - - name: Install test libraries for cjs projects - working-directory: ./driver/js/src/test/cjsprojects - run: npm ci + - name: Prepare TypeScript + run: ./scripts/ts-prepare.sh - name: Run tests run: sbt test -J-XX:+UseG1GC - name: Check no changes diff --git a/.gitignore b/.gitignore index 4a989b4c7..7157a2c7a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ metals.sbt project/Dependencies.scala project/metals.sbt **.worksheet.sc +driver/js/src/test/cjsprojects/js/ts/ +driver/js/src/test/esprojects/js/my_ts_path/ .DS_Store diff --git a/driver/js/src/test/cjsprojects/js/ts/Baz.js b/driver/js/src/test/cjsprojects/js/ts/Baz.js deleted file mode 100644 index 7ffc30d13..000000000 --- a/driver/js/src/test/cjsprojects/js/ts/Baz.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -}; -var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -}; -var _Baz_times; -class Baz { - constructor(t) { - _Baz_times.set(this, void 0); - __classPrivateFieldSet(this, _Baz_times, t, "f"); - } - baz() { - for (let i = 0; i < __classPrivateFieldGet(this, _Baz_times, "f"); ++i) { - console.log("baz"); - } - } -} -_Baz_times = new WeakMap(); -module.exports = { - Baz: Baz -}; diff --git a/driver/js/src/test/cjsprojects/js/ts/Foo.js b/driver/js/src/test/cjsprojects/js/ts/Foo.js deleted file mode 100644 index d6f4f2210..000000000 --- a/driver/js/src/test/cjsprojects/js/ts/Foo.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -class Foo { - foo() { - return "foo"; - } -} -module.exports = Foo; diff --git a/driver/js/src/test/cjsprojects/js/ts/Funs.js b/driver/js/src/test/cjsprojects/js/ts/Funs.js deleted file mode 100644 index f639e9fa1..000000000 --- a/driver/js/src/test/cjsprojects/js/ts/Funs.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -function f(x, y) { - return x + y; -} -function g(x) { - return f(x, x); -} -function h() { - return g(42); -} -module.exports = h; diff --git a/driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js b/driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js deleted file mode 100644 index d971405b0..000000000 --- a/driver/js/src/test/esprojects/js/my_ts_path/ConfigGen.js +++ /dev/null @@ -1,9 +0,0 @@ -import json5 from "json5"; -export function generate(outDir) { - const json = { - "compilerOptions": { - "outDir": outDir - } - }; - return json5.stringify(json); -} diff --git a/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js b/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js deleted file mode 100644 index 0aadeb152..000000000 --- a/driver/js/src/test/esprojects/js/my_ts_path/MyClass.js +++ /dev/null @@ -1,5 +0,0 @@ -export class FooClass { - foo() { - console.log("foo"); - } -} diff --git a/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js b/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js deleted file mode 100644 index a80a68b32..000000000 --- a/driver/js/src/test/esprojects/js/my_ts_path/MyPrint.js +++ /dev/null @@ -1,9 +0,0 @@ -export class DatePrint { - constructor(p) { - this.prefix = p; - } - print(msg) { - let date = new Date(1145141919810); - console.log(`[${this.prefix}] ${msg}. (${date.toLocaleString("en-US", { timeZone: "America/New_York" })})`); - } -} diff --git a/driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js b/driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js deleted file mode 100644 index 4f6afd07c..000000000 --- a/driver/js/src/test/esprojects/js/my_ts_path/ReadLine.js +++ /dev/null @@ -1,7 +0,0 @@ -const lines = [ - "Admin", "1", "y", "foo", "y", "4", "n" -]; -let i = 0; -export function getStrLn() { - return lines[i++]; -} diff --git a/scripts/ts-prepare.sh b/scripts/ts-prepare.sh new file mode 100755 index 000000000..88816657d --- /dev/null +++ b/scripts/ts-prepare.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +echo "install typescript and json5 for mlscript..." +npm ci +chmod 777 ./node_modules/typescript/bin/tsc + +cd driver/js/src/test/cjsprojects +echo "install ts libraries for driver cjsprojects test..." +npm ci +echo "compile ts files for driver cjsprojects test..." +../../../../../node_modules/typescript/bin/tsc + +cd ../esprojects +echo "install ts libraries for driver esprojects test..." +npm ci +echo "compile ts files for driver esprojects test..." +../../../../../node_modules/typescript/bin/tsc From c5f532a95baa776c62c982d9efc4ac9e497dfdd1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 14:45:27 +0800 Subject: [PATCH 174/202] WIP: Get members' name from identifiers rather than symbols --- .../main/scala/ts2mls/TSCompilerInfo.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 28 +++++++++++-------- .../main/scala/ts2mls/types/Converter.scala | 2 +- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 2f9516dc0..f830cddfb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -253,7 +253,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val idExpression = TSIdentifierObject(node.expression) lazy val nodeExpression = TSNodeObject(node.expression) lazy val isVarParam = !js.isUndefined(node.dotDotDotToken) - lazy val hasmoduleReference = !js.isUndefined(node.moduleReference) + lazy val hasModuleReference = !js.isUndefined(node.moduleReference) lazy val moduleAugmentation = if (js.isUndefined(node.moduleAugmentations)) TSTokenObject(g.undefined) else TSTokenObject(node.moduleAugmentations.selectDynamic("0")) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index c764c019d..c7916cfa4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -79,7 +79,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici val fullname = TypeScript.resolveModuleName(localName, resolvedPath, config) val moduleName = TSPathResolver.basename(fullname) val varName = req.name.escapedText - if (req.hasmoduleReference) { + if (req.hasModuleReference) { val imp = TSFullImport(localName, varName) importList.add(fullname, imp) global.put(varName, TSRenamedType(varName, TSReferenceType(s"$moduleName")), false, false) @@ -287,12 +287,18 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici }) }) - private def addMember(mem: TSType, node: TSNodeObject, name: String, others: Map[String, TSMemberType])(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { + private def addMember( + mem: TSType, + node: TSNodeObject, + name: String, + mod: Option[TSAccessModifier], + others: Map[String, TSMemberType] + )(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { case func: TSFunctionType => { - if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, node.modifier)) + if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, mod.getOrElse(node.modifier))) else { // TODO: handle functions' overloading val res = TSIgnoredOverload(func, name) // the implementation is always after declarations - others.removed(name) ++ Map(name -> TSMemberType(res, node.modifier)) + others.removed(name) ++ Map(name -> TSMemberType(res, mod.getOrElse(node.modifier))) } } case _ => mem match { @@ -300,21 +306,21 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici case TSReferenceType(ref) if name === ref => others ++ Map(name -> TSMemberType( markUnsupported(node), - node.modifier + mod.getOrElse(node.modifier) )) - case _ => others ++ Map(name -> TSMemberType(mem, node.modifier)) + case _ => others ++ Map(name -> TSMemberType(mem, mod.getOrElse(node.modifier))) } } private def getClassMembersType(list: TSNodeArray, requireStatic: Boolean)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => { - val name = p.symbol.escapedName - - if (name =/= "__constructor" && p.isStatic == requireStatic) { + // The constructors have no name identifier. + if (!p.name.isUndefined && p.isStatic == requireStatic) { + val name = p.name.escapedText val mem = if (!p.isStatic) getMemberType(p) else parseMembers(name, p.initializer, true) - addMember(mem, p, name, mp) + addMember(mem, p, name, Option.when[TSAccessModifier](name.startsWith("#"))(Private), mp) } else mp }) @@ -330,7 +336,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici private def getInterfacePropertiesType(list: TSNodeArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => - if (p.isCallSignature) mp else addMember(getMemberType(p), p, p.symbol.escapedName, mp)) + if (p.isCallSignature) mp else addMember(getMemberType(p), p, p.symbol.escapedName, None, mp)) private def getAnonymousPropertiesType(list: TSSymbolArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index 44e81c3a6..fcef8754f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -114,7 +114,7 @@ object Converter { private def convertRecord(members: Map[String, TSMemberType], typeVars: List[TSTypeParameter], parents: List[TSType], statics: Map[String, TSMemberType], constructorList: List[TSType], anonymous: Boolean)(implicit indent: String) = { val allRecs = members.toList.map((m) => m._2.modifier match { - case Public if !m._1.contains("#") => + case Public => if (anonymous) s"${escapeIdent(m._1)}: ${convert(m._2)}," else m._2.base match { case _: TSFunctionType => s"${generateFunDeclaration(m._2.base, m._1, false)(indent + " ")}\n" From 95f97b70c92a7290f3ae863aa8e17b1578838c6b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 14:58:38 +0800 Subject: [PATCH 175/202] WIP: Improve comments and fix typos --- driver/js/src/main/scala/driver/Driver.scala | 28 ++++---- .../src/main/scala/driver/DriverOptions.scala | 6 +- .../js/src/main/scala/ts2mls/FileInfo.scala | 18 ++--- .../src/main/scala/ts2mls/JSFileSystem.scala | 2 +- .../main/scala/ts2mls/TSCompilerInfo.scala | 26 ++++---- ts2mls/js/src/main/scala/ts2mls/TSData.scala | 2 +- .../src/main/scala/ts2mls/TSNamespace.scala | 20 +++--- .../main/scala/ts2mls/TSPathResolver.scala | 2 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 6 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 66 +++++++++---------- .../main/scala/ts2mls/types/Converter.scala | 4 +- .../src/main/scala/ts2mls/types/TSType.scala | 14 ++-- .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 13 files changed, 98 insertions(+), 98 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index d147b2539..37d09d46a 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -35,7 +35,7 @@ class Driver(options: DriverOptions) { println(msg) } - // errors in imported files should be printed in their own files to avoid redundancy + // Errors in imported files should be printed in their own files to avoid redundancy private val noRedundantRaise = (diag: Diagnostic) => () private val noRedundantOutput = (s: String) => () @@ -50,9 +50,9 @@ class Driver(options: DriverOptions) { private def checkESModule(filename: String, from: String) = if (isMLScirpt(filename)) None - else if (isLocal(filename)) // local files: check tsconfig.json + else if (isLocal(filename)) // Local files: check tsconfig.json Some(TypeScript.isESModule(config, false)) - else { // node_modules: find package.json to get the module type + else { // Files in node_modules: find package.json to get the module type val fullname = TypeScript.resolveModuleName(filename, from, config) def find(path: String): Boolean = { val dir = dirname(path) @@ -61,7 +61,7 @@ class Driver(options: DriverOptions) { val config = TypeScript.parsePackage(pack) TypeScript.isESModule(config, true) } - else if (dir.isEmpty || dir === "." || dir === "/") false // not found: default is commonjs + else if (dir.isEmpty || dir === "." || dir === "/") false // Not found: default is commonjs else find(dir) } Some(find(fullname)) @@ -82,7 +82,7 @@ class Driver(options: DriverOptions) { expected } catch { - case err: Diagnostic => // we can not find a file to store the error message. print on the screen + case err: Diagnostic => // We can not find a file to store the error message. Print on the screen report(err, printErr) options.expectError } @@ -145,7 +145,7 @@ class Driver(options: DriverOptions) { NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations))(S(Loc(0, 1, origin)), N, N) :: Nil) }) - // if the current file is es5.mlsi, we allow overriding builtin type(like String and Object) + // If the current file is es5.mlsi, we allow overriding builtin type(like String and Object) private def `type`(tu: TypingUnit, isES5: Boolean, errOutput: String => Unit)( implicit ctx: Ctx, raise: Raise, @@ -186,14 +186,14 @@ class Driver(options: DriverOptions) { vars: Map[Str, typer.SimpleType] ) = jsBuiltinDecs.foreach(lst => `type`(TypingUnit(lst), true, printErr)) - // translate mlscirpt import paths into js import paths + // Translate mlscirpt import paths into js import paths private def resolveJSPath(file: FileInfo, imp: String) = - if (isLocal(imp) && !isMLScirpt(imp)) { // local ts files: locate by checking tsconfig.json + if (isLocal(imp) && !isMLScirpt(imp)) { // Local ts files: locate by checking tsconfig.json val tsPath = TypeScript.getOutputFileNames(s"${TSPathResolver.dirname(file.filename)}/$imp", config) val outputBase = TSPathResolver.dirname(TSPathResolver.normalize(s"${options.outputDir}${file.jsFilename}")) TSPathResolver.relative(outputBase, tsPath) } - else imp // mlscript & node_module: use the original name + else imp // Otherwise(mlscript & node_module): use the original name private def importModule(file: FileInfo)( implicit ctx: Ctx, @@ -250,9 +250,9 @@ class Driver(options: DriverOptions) { sigs :+ extractSig(file.filename, file.moduleName) }) otherList.foreach(dp => { - // We need to create another new context when compiling other files - // e.g. A -> B, A -> C, B -> D, C -> D, -> means "depends on" - // If we forget to add `import "D.mls"` in C, we need to raise an error + // We need to create another new context when compiling other files. + // e.g. A -> B, A -> C, B -> D, C -> D, where `->` means "depends on". + // If we forget to add `import "D.mls"` in C, we need to raise an error. // Keeping using the same environment would not. var newCtx: Ctx = Ctx.init val newExtrCtx: Opt[typer.ExtrCtx] = N @@ -271,7 +271,7 @@ class Driver(options: DriverOptions) { mlsiWriter.writeErr(t.toString()) Nil }) ++ cycleSigs.map(tu => tu.entities) - if (file.filename.endsWith(".mls")) { // only generate js/mlsi files for mls files + if (file.filename.endsWith(".mls")) { // Only generate js/mlsi files for mls files val expStr = cycleSigs.foldLeft("")((s, tu) => s"$s${`type`(tu, false, mlsiWriter.writeErr).show}") + { dbgWriter = Some(mlsiWriter) @@ -290,7 +290,7 @@ class Driver(options: DriverOptions) { ), jsBuiltinDecs ++ importedSym, exported || importedModule(file.filename)) } else - `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // for ts/mlsi files, we only check interface files + `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // For ts/mlsi files, we only check interface files if (dbdFiles.contains(file.filename)) { typer.dbg = false diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index e94aa5f0f..d149984a5 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -11,7 +11,7 @@ final case class DriverOptions( outputDir: String, tsconfig: Option[String], interfaceDir: String, - commonJS: Boolean, // generate common js or es5 - expectTypeError: Boolean, // ignore type errors for test - expectError: Boolean, // the test should raise errors + commonJS: Boolean, // Generate common js or es5 + expectTypeError: Boolean, // Type errors are expected + expectError: Boolean, // Other errors(e.g., code generation errors) are expected ) diff --git a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala index 43268d33b..6a499887d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/FileInfo.scala @@ -5,11 +5,11 @@ import ts2mls.{TypeScript, TSImport} import ts2mls.TSPathResolver final case class FileInfo( - workDir: String, // work directory (related to compiler path) - localFilename: String, // filename (related to work dir, or in node_modules) - interfaceDir: String, // .mlsi file directory (related to output dir) - parent: Option[String] = None, // file that imports this (related to work dir) - nodeModulesNested: Boolean = false // if it is a local file in node_modules + workDir: String, // Work directory (related to compiler path) + localFilename: String, // Filename (related to work dir, or in node_modules) + interfaceDir: String, // `.mlsi` file directory (related to output dir) + parent: Option[String] = None, // File that imports this (related to work dir) + nodeModulesNested: Boolean = false // If it is a local file in node_modules ) { import TSPathResolver.{normalize, isLocal, dirname, basename, extname} @@ -19,10 +19,10 @@ final case class FileInfo( val isNodeModule: Boolean = nodeModulesNested || relatedPath.isEmpty - // module name in ts/mls + // Module name in ts/mls val moduleName = basename(localFilename) - // full filename (related to compiler path, or module name in node_modules) + // Full filename (related to compiler path, or module name in node_modules) lazy val filename: String = if (!isNodeModule) normalize(s"./$workDir/$localFilename") else if (nodeModulesNested) localFilename @@ -34,7 +34,7 @@ final case class FileInfo( val rel = normalize(TSPathResolver.relative(dirname(localFilename), file.localFilename)) if (isLocal(rel)) rel else s"./$rel" } - else if (file.nodeModulesNested) { // node_modules, but relatoive path + else if (file.nodeModulesNested) { // `node_modules`, but relative path val p = dirname(TSImport.createInterfaceForNode(resolve)) val rel = normalize(TSPathResolver.relative(p, file.localFilename)) if (isLocal(rel)) rel else s"./$rel" @@ -57,7 +57,7 @@ final case class FileInfo( else if (nodeModulesNested) TypeScript.resolveModuleName(s"./$moduleName", parent.getOrElse(""), config) else TSPathResolver.resolve(filename) - def interfaceFilename(implicit config: js.Dynamic): String = // interface filename (related to work directory) + def interfaceFilename(implicit config: js.Dynamic): String = // Interface filename (related to work directory) relatedPath.fold( s"$interfaceDir/${dirname(TSImport.createInterfaceForNode(resolve))}/${moduleName}.mlsi" )(path => s"${normalize(s"$interfaceDir/$path/$moduleName.mlsi")}") diff --git a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala index 9c1bf0f82..0e03704fb 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSFileSystem.scala @@ -7,7 +7,7 @@ import js.JSConverters._ import ts2mls.TSPathResolver object JSFileSystem { - private val fs = g.require("fs") // must use fs module to manipulate files in JS + private val fs = g.require("fs") // Must use fs module to manipulate files in JS def exists(filename: String): Boolean = fs.existsSync(filename) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index f830cddfb..a43b6c5c8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -60,10 +60,10 @@ object TypeScript { val syntaxKindExport = ts.SyntaxKind.ExportKeyword val objectFlagsAnonymous = ts.ObjectFlags.Anonymous val objectFlagsMapped = ts.ObjectFlags.Mapped - val symbolFlagsOptional = ts.SymbolFlags.Optional // this flag is only for checking optional members of interfaces - val typeFlagsConditional = ts.TypeFlags.Conditional // T extends U ? X : Y - val typeFlagsIndex = ts.TypeFlags.Index // keyof T - val typeFlagsIndexedAccess = ts.TypeFlags.IndexedAccess // T[K] + val symbolFlagsOptional = ts.SymbolFlags.Optional // This flag is only for checking optional members of interfaces + val typeFlagsConditional = ts.TypeFlags.Conditional // `T extends U ? X : Y` + val typeFlagsIndex = ts.TypeFlags.Index // `keyof T` + val typeFlagsIndexedAccess = ts.TypeFlags.IndexedAccess // `T[K]` def isToken(node: js.Dynamic) = ts.isToken(node) def isClassDeclaration(node: js.Dynamic) = ts.isClassDeclaration(node) @@ -141,8 +141,8 @@ class TSSymbolObject(sym: js.Dynamic)(implicit checker: TSTypeChecker) extends T private lazy val flags = sym.flags lazy val parent = TSSymbolObject(sym.parent) - // the first declaration of this symbol - // if there is no overloading, there is only one declaration + // The first declaration of this symbol/ + // If there is no overloading, there is only one declaration lazy val declaration = if (declarations.isUndefined) TSNodeObject(g.undefined) else declarations.get(0) @@ -176,8 +176,8 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isObjectLiteral = !initializer.isUndefined && !initializer.isToken && TypeScript.isObjectLiteralExpression(node.initializer) - // `TypeScript.isModuleDeclaration` works on both namespaces and modules - // but namespaces are more recommended, so we merely use `isNamespace` here + // `TypeScript.isModuleDeclaration` works on both namespaces and modules. + // But namespaces are more recommended, so we merely use `isNamespace` here lazy val isNamespace = TypeScript.isModuleDeclaration(node) lazy val isArrayTypeNode = TypeScript.isArrayTypeNode(node) lazy val isTupleTypeNode = TypeScript.isTupleTypeNode(node) @@ -189,11 +189,11 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val isExportAssignment = TypeScript.isExportAssignment(node) lazy val exportedAsNamespace = TypeScript.isNamespaceExportDeclaration(node) - // if a node has an initializer or is marked by a question notation it is optional + // If a node has an initializer or is marked by a question notation it is optional // e.g. `function f(x?: int) {}`, we can use it directly: `f()`. - // in this case, there would be a question token. + // In this case, there would be a question token. // e.g. `function f(x: int = 42) {}`, we can use it directly: `f()`. - // in this case, the initializer would store the default value and be non-empty. + // In this case, the initializer would store the default value and be non-empty. lazy val isOptionalParameter = checker.isOptionalParameter(node) lazy val isStatic = if (modifiers.isUndefined) false else modifiers.foldLeft(false)((s, t) => t.isStatic) @@ -211,7 +211,7 @@ class TSNodeObject(node: js.Dynamic)(implicit checker: TSTypeChecker) extends TS lazy val types = TSNodeArray(node.types) lazy val heritageClauses = TSNodeArray(node.heritageClauses) lazy val initializer = TSNodeObject(node.initializer) - lazy val initToken = TSTokenObject(node.initializer) // for object literal, the initializer is a token. + lazy val initToken = TSTokenObject(node.initializer) // For object literal, the initializer is a token. lazy val initID = TSIdentifierObject(node.initializer) lazy val modifier = if (modifiers.isUndefined) Public @@ -305,7 +305,7 @@ class TSTypeObject(obj: js.Dynamic)(implicit checker: TSTypeChecker) extends TSA lazy val isIntersectionType = obj.isIntersection() lazy val isFunctionLike = node.isFunctionLike lazy val isAnonymous = (objectFlags & TypeScript.objectFlagsAnonymous) > 0 - lazy val isMapped = (objectFlags & TypeScript.objectFlagsMapped) > 0 // mapping a type to another by using `keyof` and so on + lazy val isMapped = (objectFlags & TypeScript.objectFlagsMapped) > 0 // Mapping a type to another by using `keyof` and so on lazy val isTypeParameter = flags == TypeScript.typeFlagsTypeParameter lazy val isObject = flags == TypeScript.typeFlagsObject lazy val isTypeParameterSubstitution = isObject && typeArguments.length > 0 diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index 0b8163a86..a08bcce8c 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -8,7 +8,7 @@ abstract class TSAny(v: js.Dynamic) { val isUndefined: Boolean = js.isUndefined(v) } -// array for information object in tsc +// Array for information object in tsc abstract class TSArray[T <: TSAny](arr: js.Dynamic) extends TSAny(arr) { def get(index: Int): T = ??? lazy val length = arr.length diff --git a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala index 862a64259..d48b0722f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSNamespace.scala @@ -10,8 +10,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: private val members = HashMap[String, (TSType, Boolean)]() private val cjsExport = HashMap[String, String]() - // write down the order of members - // easier to check the output one by one + // Write down the order of members. + // Easier to check the output one by one. private val order = ListBuffer.empty[Either[String, String]] def isCommonJS = !cjsExport.isEmpty @@ -22,9 +22,9 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: } def derive(name: String, exported: Boolean): TSNamespace = - if (subSpace.contains(name)) subSpace(name)._1 // if the namespace has appeared in another file, just return it + if (subSpace.contains(name)) subSpace(name)._1 // If the namespace has appeared in another file, just return it else { - val sub = new TSNamespace(name, Some(this), allowReservedTypes) // not a top level module! + val sub = new TSNamespace(name, Some(this), allowReservedTypes) // Not a top level module! subSpace.put(name, (sub, exported)) order += Left(name) sub @@ -77,7 +77,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: def get(name: String): TSType = if (members.contains(name)) members(name)._1 - else parent.fold[TSType](TSReferenceType(name))(p => p.get(name)) // default in es5 + else parent.fold[TSType](TSReferenceType(name))(p => p.get(name)) // Default in es5 def get(names: List[String]): TSType = names match { case head :: Nil => get(head) @@ -96,8 +96,8 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: if (members.contains(name)) members(name)._1 match { case _: TSClassType => put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) case _: TSInterfaceType => put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) - case _: TSTypeAlias => None // type alias in ts would be erased. - case tp => put(alias, TSRenamedType(alias, tp), true, false) // variables & functions + case _: TSTypeAlias => None // Type alias in ts would be erased. + case tp => put(alias, TSRenamedType(alias, tp), true, false) // Variables & functions } else if (subSpace.contains(name)) put(alias, TSRenamedType(alias, TSReferenceType(name)), true, false) @@ -136,10 +136,10 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: ns.put(name, tp, true, true) } case _ => - writer.writeln(s"$indent// WARNING: duplicate $name") // if merging is not supported, do nothing + writer.writeln(s"$indent// WARNING: duplicate $name") // If merging is not supported, do nothing } case _ => - writer.writeln(s"$indent// WARNING: duplicate $name") // if merging is not supported, do nothing + writer.writeln(s"$indent// WARNING: duplicate $name") // If merging is not supported, do nothing } generateNS(name, writer, indent) } @@ -157,7 +157,7 @@ class TSNamespace(name: String, parent: Option[TSNamespace], allowReservedTypes: val (mem, exp) = members(name) val realName = cjsExport.getOrElse(name, name) mem match { - case inter: TSIntersectionType => // overloaded functions + case inter: TSIntersectionType => // Overloaded functions writer.writeln(Converter.generateFunDeclaration(inter, realName, exp)(indent)) case f: TSFunctionType => writer.writeln(Converter.generateFunDeclaration(f, realName, exp)(indent)) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala index 8b4bb849d..d8a1b509d 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSPathResolver.scala @@ -6,7 +6,7 @@ import js.DynamicImplicits._ import js.JSConverters._ object TSPathResolver { - private val np: js.Dynamic = g.require("path") // built-in node module + private val np: js.Dynamic = g.require("path") // Built-in node module def resolve(path: String): String = np.resolve(path).toString() def dirname(filename: String): String = np.dirname(filename).toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 8e6787621..ea72b1196 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -5,10 +5,10 @@ import js.DynamicImplicits._ import ts2mls.types._ import scala.collection.mutable.{HashSet, HashMap} -// for general ts, we still consider that there is a top-level module +// For general ts, we still consider that there is a top-level module // and in mls we will import ts file like this: -// import * as TopLevelModuleName from "filename" -// for es5.d.ts, we only need to translate everything +// `import * as TopLevelModuleName from "filename"`. +// For es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String], typer: (FileInfo, JSWriter) => Unit) { private implicit val configContent = TypeScript.parseOption(file.workDir, tsconfig) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index c7916cfa4..eec56e0d8 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -17,7 +17,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici def getUMDModule: Option[TSNamespace] = umdModuleName.fold[Option[TSNamespace]](Some(global))(name => Some(global.derive(name, false))) - // parse import + // Parse import TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isRequire) @@ -26,33 +26,33 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) }) - // parse main body + // Parse main body TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) { // for functions + if (!nodeObject.symbol.isUndefined) { // For functions if (nodeObject.isFunctionLike) addFunctionIntoNamespace(nodeObject.symbol, nodeObject, nodeObject.symbol.escapedName)(global) - else // for classes/interfaces/namespace + else // For classes/interfaces/namespace addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) } - else if (!nodeObject.declarationList.isUndefined) { // for variables + else if (!nodeObject.declarationList.isUndefined) { // For variables val decNode = nodeObject.declarationList.declaration addNodeIntoNamespace(decNode, decNode.symbol.escapedName, decNode.isExported)(global) } } }) - // parse export + // Parse export TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isExportDeclaration) { - if (!nodeObject.moduleSpecifier.isUndefined) // re-export + if (!nodeObject.moduleSpecifier.isUndefined) // Re-export parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) else // ES modules parseExportDeclaration(nodeObject.exportClause.elements) } - else if (nodeObject.isExportAssignment) { // commonJS + else if (nodeObject.isExportAssignment) { // CommonJS val name = nodeObject.idExpression.escapedText if (name === "undefined") { // For exports = { ... }. In this case we still need the top-level module val props = nodeObject.nodeExpression.properties @@ -100,7 +100,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } private def parseImportDeclaration(clause: TSNodeObject, moduleSpecifier: TSTokenObject, exported: Boolean): Unit = { - // ignore `import "filename.ts"` + // Ignore `import "filename.ts"` if (!clause.isUndefined) { val bindings = clause.namedBindings val importName = moduleSpecifier.text @@ -114,12 +114,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici (ele.propertyName.escapedText, Some(ele.symbol.escapedName)) ) val imp = TSSingleImport(importName, list) - if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export + if (exported) imp.createAlias.foreach(re => reExportList += re) // Re-export importList.add(fullPath, imp) } else if (!node.name.isUndefined) { val imp = TSFullImport(importName, node.name.escapedText) - if (exported) imp.createAlias.foreach(re => reExportList += re) // re-export + if (exported) imp.createAlias.foreach(re => reExportList += re) // Re-export importList.add(fullPath, imp) } @@ -135,13 +135,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici }) private def getSymbolFullname(sym: TSSymbolObject)(implicit ns: TSNamespace): String = { - def simplify(symName: String, nsName: String): String = // remove unnecessary namespaces prefixes + def simplify(symName: String, nsName: String): String = // Remove unnecessary namespaces prefixes if (symName.startsWith(nsName + ".")) symName.substring(nsName.length() + 1) else if (nsName.lastIndexOf('.') > -1) simplify(symName, nsName.substring(0, nsName.lastIndexOf('.'))) else symName - if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) // imported from another file + if (!sym.parent.isUndefined && sym.parent.declaration.isSourceFile) // Imported from another file importList.resolveTypeAlias(sym.parent.declaration.resolvedPath, sym.escapedName) - else if (!sym.parent.isUndefined && sym.parent.isMerged) { // merged with other declarations + else if (!sym.parent.isUndefined && sym.parent.isMerged) { // Merged with other declarations def findDecFile(node: TSNodeObject): String = if (node.parent.isUndefined) "" else if (node.parent.isSourceFile) { @@ -161,13 +161,13 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici val res = findDecFile(dec) Option.when((res === resolvedPath) || importList.contains(res))(res) }) - filename.fold(sym.escapedName)(filename => // not found: this file is referenced by `///`. directly use the name is safe - if (filename === resolvedPath) // in the same file + filename.fold(sym.escapedName)(filename => // Not found: this file is referenced by `///`. directly use the name is safe + if (filename === resolvedPath) // In the same file simplify(s"${getSymbolFullname(sym.parent)}.${sym.escapedName}", ns.toString()) - else importList.resolveTypeAlias(filename, sym.escapedName) // in an imported file + else importList.resolveTypeAlias(filename, sym.escapedName) // In an imported file ) } - else if (sym.parent.isUndefined) { // already top-level symbol + else if (sym.parent.isUndefined) { // Already top-level symbol val name = sym.escapedName if (name.contains("\"")) TSPathResolver.basename(name.substring(1, name.length() - 1)) else name @@ -198,7 +198,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (obj.isObject) if (obj.isAnonymous) { val props = getAnonymousPropertiesType(obj.properties) - // upper case field names are not supported in records in mlscript so far + // Upper case field names are not supported in records in mlscript so far if (!props.exists{ case (name, _) if (!name.isEmpty()) => Character.isUpperCase(name(0)); case _ => false}) TSInterfaceType("", props, List(), List(), None) else TSNoInfoUnsupported @@ -208,7 +208,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici else if (obj.isConditionalType || obj.isIndexType || obj.isIndexedAccessType) TSNoInfoUnsupported else TSPrimitiveType(obj.intrinsicName) - // the function `getMemberType` can't process function/tuple type alias correctly + // The function `getMemberType` can't process function/tuple type alias correctly private def getTypeAlias(tn: TSNodeObject)(implicit ns: TSNamespace): TSType = if (tn.isFunctionLike) getFunctionType(tn, true) @@ -218,23 +218,23 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici case t => t } - // parse string/numeric literal types. we need to add quotes if it is a string literal + // Parse string/numeric literal types. We need to add quotes if it is a string literal private def getLiteralType(tp: TSNodeObject)(implicit ns: TSNamespace) = TSLiteralType(tp.literal.text, tp.literal.isStringLiteral) - // parse object literal types + // Parse object literal types private def getObjectLiteralMembers(props: TSNodeArray)(implicit ns: TSNamespace) = props.foldLeft(Map[String, TSMemberType]())((mp, p) => { mp ++ Map(p.name.escapedText -> TSMemberType(TSLiteralType(p.initToken.text, p.initToken.isStringLiteral))) }) - // get the type of variables in classes/named interfaces/anonymous interfaces + // Get the type of variables in classes/named interfaces/anonymous interfaces private def getMemberType(node: TSNodeObject)(implicit ns: TSNamespace): TSType = if (node.isIndexSignature || node.isConstructSignature) markUnsupported(node) else { val res = - if (node.isFunctionLike) getFunctionType(node, false) // erase name to avoid name clash when overriding methods in ts + if (node.isFunctionLike) getFunctionType(node, false) // Erase name to avoid name clash when overriding methods in ts else if (node.`type`.isUndefined) getObjectType(node.typeAtLocation) else if (node.`type`.isLiteralTypeNode) getLiteralType(node.`type`) else getObjectType(node.`type`.typeNode) @@ -256,12 +256,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici } val pList = node.parameters.foldLeft(List[TSParameterType]())((lst, p) => { - // erase name to avoid name clash when overriding methods in ts + // Erase name to avoid name clash when overriding methods in ts val name = if (keepNames) p.symbol.escapedName else s"args${lst.length}" - // in typescript, you can use `this` to explicitly specifies the callee - // but it never appears in the final javascript file + // In typescript, you can use `this` to explicitly specifies the callee. + // But it never appears in the final javascript file if (p.symbol.escapedName === "this") lst - else if (p.isOptionalParameter) // TODO: support optinal and default value soon + else if (p.isOptionalParameter) // TODO: support optional and default value soon lst :+ TSParameterType(name, TSUnionType(getObjectType(p.symbolType), TSPrimitiveType("undefined"))) else lst :+ TSParameterType(name, eraseVarParam(getObjectType(p.symbolType), p.isVarParam)) }) @@ -297,12 +297,12 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici case func: TSFunctionType => { if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, mod.getOrElse(node.modifier))) else { // TODO: handle functions' overloading - val res = TSIgnoredOverload(func, name) // the implementation is always after declarations + val res = TSIgnoredOverload(func, name) // The implementation is always after declarations others.removed(name) ++ Map(name -> TSMemberType(res, mod.getOrElse(node.modifier))) } } case _ => mem match { - // if the member's name is the same as the type name, we need to mark it unsupported + // If the member's name is the same as the type name, we need to mark it unsupported case TSReferenceType(ref) if name === ref => others ++ Map(name -> TSMemberType( markUnsupported(node), @@ -343,7 +343,7 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici mp ++ Map(p.escapedName -> TSMemberType(if (p.`type`.isUndefined) getMemberType(p.declaration) else getObjectType(p.`type`)))) private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean)(implicit ns: TSNamespace): TSType = { - val res = // do not handle parents here. we have not had enough information so far. + val res = // Do not handle parents here. we have not had enough information so far. if (isClass) TSClassType(name, getClassMembersType(node.members, false), getClassMembersType(node.members, true), getTypeParameters(node), getHeritageList(node), getConstructorList(node.members)) @@ -376,10 +376,10 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici if (fun.unsupported) ns.put(name, markUnsupported(node), node.isExported, false) else if (!ns.containsMember(name, false)) ns.put(name, fun, node.isExported, false) else - ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // the implementation is always after declarations + ns.put(name, TSIgnoredOverload(fun, name), node.isExported || ns.exported(name), true) // The implementation is always after declarations }) - // overload functions in a sub-namespace need to provide an overload array + // Overload functions in a sub-namespace need to provide an overload array // because the namespace merely exports symbols rather than node objects themselves private def addNodeIntoNamespace(node: TSNodeObject, name: String, exported: Boolean)(implicit ns: TSNamespace) = if (node.isClassDeclaration) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index fcef8754f..d9f60f754 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -57,13 +57,13 @@ object Converter { s"$tpList($pList) => ${convert(res)}" case TSUnionType(lhs, rhs) => s"(${convert(lhs)}) | (${convert(rhs)})" case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" - case TSTypeParameter(name, _) => s"'$name" // constraints should be translated where the type parameters were created rather than be used + case TSTypeParameter(name, _) => s"'$name" // Constraints should be translated where the type parameters were created rather than be used case TSTupleType(lst) => s"(${lst.foldLeft("")((p, t) => s"$p${convert(t)}, ")})" case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members case itf: TSInterfaceType => - if (itf.name.isEmpty()) convertRecord(itf.members, Nil, Nil, Map(), Nil, true) // anonymous interfaces + if (itf.name.isEmpty()) convertRecord(itf.members, Nil, Nil, Map(), Nil, true) // Anonymous interfaces else convertClassOrInterface(Right(itf), exported) case cls: TSClassType => convertClassOrInterface(Left(cls), exported) diff --git a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala index b6cafe6ea..5dddaac5f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/TSType.scala @@ -9,7 +9,7 @@ sealed abstract class TSType { val unsupported = false } -// record both parameter's name and parameter's type +// Record both parameter's name and parameter's type case class TSParameterType(name: String, tp: TSType) extends TSType { override val unsupported: Boolean = tp.unsupported } @@ -81,20 +81,20 @@ sealed abstract class TSStructuralType(lhs: TSType, rhs: TSType, notion: String) case class TSUnionType(lhs: TSType, rhs: TSType) extends TSStructuralType(lhs, rhs, "|") case class TSIntersectionType(lhs: TSType, rhs: TSType) extends TSStructuralType(lhs, rhs, "&") -// ts2mls doesn't support overloading functions with type parameters -// TSIgnoredOverload is used to store these functions and raise a warning later -// only the most general overloading form would be stored +// `ts2mls` doesn't support overloading functions with type parameters. +// TSIgnoredOverload is used to store these functions and raise a warning later. +// Only the most general overloading form would be stored case class TSIgnoredOverload(base: TSFunctionType, name: String) extends TSType { val warning = s"/* warning: the overload of function $name is not supported yet. */" override val unsupported: Boolean = base.unsupported } -// generate type name = ... in mlscript +// Generate type name = ... in mlscript case class TSTypeAlias(name: String, original: TSType, tp: List[TSType]) extends TSType { override val unsupported: Boolean = original.unsupported || tp.foldLeft(false)((r, t) => r || t.unsupported) } -// generate val name = ... in mlscript +// Generate val name = ... in mlscript case class TSRenamedType(name: String, original: TSType) extends TSType { override val unsupported: Boolean = original.unsupported } @@ -102,6 +102,6 @@ case class TSLiteralType(value: String, isString: Boolean) extends TSType case class TSUnsupportedType(code: String, filename: String, line: String, column: String) extends TSType { override val unsupported: Boolean = true } -object TSNoInfoUnsupported extends TSType { // unsupported type without code and location information +object TSNoInfoUnsupported extends TSType { // Unsupported type without code and location information override val unsupported: Boolean = true } diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index f3d075e7a..e38b5a08b 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -8,7 +8,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), - false, None, (file: FileInfo, writer: JSWriter) => ()) // no need for builtin + false, None, (file: FileInfo, writer: JSWriter) => ()) // No need for builtin program.generate }) } From a8b7aff8df44ef4bb4430decc9beb073436363d0 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 15:16:13 +0800 Subject: [PATCH 176/202] WIP: Improve error messages --- driver/js/src/main/scala/driver/Driver.scala | 16 +++++++++------- .../js/src/main/scala/driver/DriverOptions.scala | 5 +++++ .../src/test/scala/driver/DriverDiffTests.scala | 13 ++++++++++--- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 37d09d46a..ce4d87f31 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -45,9 +45,6 @@ class Driver(options: DriverOptions) { import TSPathResolver.{normalize, isLocal, isMLScirpt, dirname} - private def expected = - ((Driver.totalErrors > 0) == options.expectError) && ((Driver.totalTypeErrors > 0) == options.expectTypeError) - private def checkESModule(filename: String, from: String) = if (isMLScirpt(filename)) None else if (isLocal(filename)) // Local files: check tsconfig.json @@ -67,8 +64,9 @@ class Driver(options: DriverOptions) { Some(find(fullname)) } - // Return true if success - def execute: Boolean = + import DriverResult._ + + def execute: DriverResult = try { Driver.totalErrors = 0 Driver.totalTypeErrors = 0 @@ -79,12 +77,16 @@ class Driver(options: DriverOptions) { implicit val stack = List[String]() initTyper compile(FileInfo(options.path, options.filename, options.interfaceDir), false) - expected + if (Driver.totalErrors > 0 && !options.expectError) Error + else if (Driver.totalErrors == 0 && options.expectError) ExpectError + else if (Driver.totalTypeErrors > 0 && !options.expectTypeError) TypeError + else if (Driver.totalErrors > 0 && !options.expectError) ExpectTypeError + else OK } catch { case err: Diagnostic => // We can not find a file to store the error message. Print on the screen report(err, printErr) - options.expectError + if (options.expectError) OK else Error } def genPackageJson(): Unit = { diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index d149984a5..b2de2f7dc 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -15,3 +15,8 @@ final case class DriverOptions( expectTypeError: Boolean, // Type errors are expected expectError: Boolean, // Other errors(e.g., code generation errors) are expected ) + +object DriverResult extends Enumeration { + type DriverResult = Value + val OK, Error, TypeError, ExpectError, ExpectTypeError = Value +} diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 203163780..1e41cf24d 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -18,9 +18,16 @@ class DriverDiffTests extends AnyFunSuite { DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() - val success = driver.execute - - assert(success, s"failed when compiling $filename.") + val res = driver.execute + + import DriverResult._ + res match { + case Error => fail(s"Compiling error(s) found in $filename.") + case TypeError => fail(s"Type error(s) found in $filename") + case ExpectError => fail(s"Expect compiling error(s) in $filename") + case ExpectTypeError => fail(s"Expect type error(s) in $filename") + case OK => () + } if (!expectError) execution match { case Some((executionFile, outputFile)) => From da5f3f197ffff632a55a395566f7d0d65f159f61 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Wed, 12 Jul 2023 15:29:23 +0800 Subject: [PATCH 177/202] WIP: Update README --- README.md | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f0eeec956..d13b73ff3 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,18 @@ MLscript supports union, intersection, and complement (or negation) connectives, - The `ts2mls/js/src/test/diff` directory contains the declarations generated by ts2mls. +- The `driver/js/src/main` directory contains the sources of the driver module. + +- The `driver/js/src/test/scala/driver` directory contains the sources of the test infrastructure for the driver. + +- The `driver/js/src/test/cjsprojects` directory contains the tests using CommonJS module solution. + +- The `driver/js/src/test/esprojects` directory contains the tests using ES module solution. + +- The `driver/js/src/test/output` directory contains the test execution outputs. + +- The `driver/js/src/test/predefs` directory contains the MLscript type definitions that override those in `es5.d.ts`. + ### Prerequisites You need [JDK supported by Scala][supported-jdk-versions], [sbt][sbt], [Node.js][node.js], and TypeScript to compile the project and run the tests. @@ -49,8 +61,14 @@ We recommend you to install JDK and sbt via [coursier][coursier]. The versions o Running the main MLscript tests only requires the Scala Build Tool installed. In the terminal, run `sbt mlscriptJVM/test`. -Running the ts2mls MLscript tests requires NodeJS, and TypeScript in addition. -In the terminal, run `sbt ts2mlsTest/test`. +Running the driver MLscript tests(including ts2mls) requires NodeJS, TypeScript, and TypeScript libraries below: +- [json5](https://json5.org/) +- [lodash](https://lodash.com/) +- [fp-ts](https://gcanti.github.io/fp-ts/) + +To install these libraries and compile TypeScript codes automatically, run `./scripts/ts-prepare.sh`. + +In the terminal, run `sbt driverTest/test`. You can also run all tests simultaneously. In the terminal, run `sbt test`. @@ -70,15 +88,22 @@ You can also indicate the test you want in `shared/src/test/scala/mlscript/DiffT ).map(os.RelPath(_)) ``` -To run the tests in ts2mls sub-project individually, -you can indicate the test you want in `ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala`: +To run the tests in the driver sub-project individually, +you can indicate the test you want in `driver/js/src/test/scala/driver/DriverDiffTests.scala`: ```scala -private val testsData = List( - // Put all input files in the `Seq` - // Then indicate the output file's name - (Seq("Array.ts"), "Array.d.mls") - ) +private val ts2mlsCases = List( + ts2mlsEntry(/* ... */), + // ... +) +private val esCases = List( + esEntry(/* ... */), + // ... +) +private val cjsCases = List( + cjsEntry(/* ... */), + // ... +) ``` ### Running the web demo locally From 3334cf6d75c4c2ba5611a0ad78ef6b26799b4ba9 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 14 Jul 2023 09:19:40 +0800 Subject: [PATCH 178/202] WIP: Move files --- .../scala/driver/JSGitHelper.scala | 2 +- .../main/scala/mlscript/utils/GitHelper.scala | 27 +++++++++++++++++++ .../{GitHelper.scala => JVMGitHelper.scala} | 22 +-------------- 3 files changed, 29 insertions(+), 22 deletions(-) rename driver/js/src/{test => main}/scala/driver/JSGitHelper.scala (96%) create mode 100644 shared/src/main/scala/mlscript/utils/GitHelper.scala rename shared/src/test/scala/mlscript/{GitHelper.scala => JVMGitHelper.scala} (60%) diff --git a/driver/js/src/test/scala/driver/JSGitHelper.scala b/driver/js/src/main/scala/driver/JSGitHelper.scala similarity index 96% rename from driver/js/src/test/scala/driver/JSGitHelper.scala rename to driver/js/src/main/scala/driver/JSGitHelper.scala index c54770802..67a0561e4 100644 --- a/driver/js/src/test/scala/driver/JSGitHelper.scala +++ b/driver/js/src/main/scala/driver/JSGitHelper.scala @@ -1,6 +1,6 @@ package driver -import mlscript.GitHelper +import mlscript.utils.GitHelper import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ diff --git a/shared/src/main/scala/mlscript/utils/GitHelper.scala b/shared/src/main/scala/mlscript/utils/GitHelper.scala new file mode 100644 index 000000000..412ce042b --- /dev/null +++ b/shared/src/main/scala/mlscript/utils/GitHelper.scala @@ -0,0 +1,27 @@ +package mlscript.utils + +import shorthands._ +import os.FilePath +import os.Path +import scala.collection.Iterator + +abstract class GitHelper[PathType, RelPathType](rootDir: PathType, workDir: PathType) { + protected def diff: Iterator[Str] + protected def str2RelPath(s: Str): RelPathType + protected def filter(file: PathType): Bool + + // Aggregate unstaged modified files to only run the tests on them, if there are any + final protected lazy val modified: Set[RelPathType] = try diff.flatMap { gitStr => + println(" [git] " + gitStr) + val prefix = gitStr.take(2) + val filePath = str2RelPath(gitStr.drop(3)) + if (prefix =:= "A " || prefix =:= "M " || prefix =:= "R " || prefix =:= "D ") + N // * Disregard modified files that are staged + else S(filePath) + }.toSet catch { + case err: Throwable => System.err.println("/!\\ git command failed with: " + err) + Set.empty + } + + final def getFiles(allFiles: IndexedSeq[PathType]): IndexedSeq[PathType] = allFiles.filter(filter(_)) +} diff --git a/shared/src/test/scala/mlscript/GitHelper.scala b/shared/src/test/scala/mlscript/JVMGitHelper.scala similarity index 60% rename from shared/src/test/scala/mlscript/GitHelper.scala rename to shared/src/test/scala/mlscript/JVMGitHelper.scala index 56a0ef79f..f42997df1 100644 --- a/shared/src/test/scala/mlscript/GitHelper.scala +++ b/shared/src/test/scala/mlscript/JVMGitHelper.scala @@ -1,31 +1,11 @@ package mlscript +import mlscript.utils.GitHelper import mlscript.utils._, shorthands._ import os.FilePath import os.Path import scala.collection.Iterator -abstract class GitHelper[PathType, RelPathType](rootDir: PathType, workDir: PathType) { - protected def diff: Iterator[Str] - protected def str2RelPath(s: Str): RelPathType - protected def filter(file: PathType): Bool - - // Aggregate unstaged modified files to only run the tests on them, if there are any - final protected lazy val modified: Set[RelPathType] = try diff.flatMap { gitStr => - println(" [git] " + gitStr) - val prefix = gitStr.take(2) - val filePath = str2RelPath(gitStr.drop(3)) - if (prefix =:= "A " || prefix =:= "M " || prefix =:= "R " || prefix =:= "D ") - N // * Disregard modified files that are staged - else S(filePath) - }.toSet catch { - case err: Throwable => System.err.println("/!\\ git command failed with: " + err) - Set.empty - } - - final def getFiles(allFiles: IndexedSeq[PathType]): IndexedSeq[PathType] = allFiles.filter(filter(_)) -} - class JVMGitHelper(rootDir: os.Path, workDir: os.Path) extends GitHelper[os.Path, os.RelPath](rootDir, workDir) { override protected def str2RelPath(s: Str): os.RelPath = os.RelPath(s) override protected def diff: Iterator[Str] = From 76c58e4ab6e3bfed371f9e86853e23d00b09c940 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 14 Jul 2023 10:03:44 +0800 Subject: [PATCH 179/202] WIP: Refactor driver diff test --- .../test/scala/driver/DriverDiffTests.scala | 109 ++++++------------ 1 file changed, 35 insertions(+), 74 deletions(-) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 1e41cf24d..e99e071ea 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -10,10 +10,9 @@ class DriverDiffTests extends AnyFunSuite { import DriverDiffTests._ import ts2mls.JSFileSystem._ - private def run(cases: List[TestOption], helper: JSGitHelper) = { - val diffFiles = helper.getFiles(cases.map(_.toString()).toIndexedSeq).toSet - cases.filter(opt => diffFiles(opt.toString())).foreach { - case TestOption(filename, workDir, outputDir, interfaceDir, cjs, execution, tsconfig, expectTypeError, expectError) => test(filename) { + private def run(cases: List[TestOption], workDir: Str, outputDir: Str, interfaceDir: Str, cjs: Bool) = { + cases.foreach { + case TestOption(filename, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError) val driver = Driver(options) @@ -29,79 +28,44 @@ class DriverDiffTests extends AnyFunSuite { case OK => () } - if (!expectError) execution match { - case Some((executionFile, outputFile)) => - val output = cp.execSync(s"node $executionFile").toString() + if (!expectError) execution.fold(()){ + case (executionFile, checkFile) => + val output = cp.execSync(s"node $outputDir/$executionFile").toString() + val outputFile = s"$checkPath/$checkFile" val original = readFile(outputFile).getOrElse("") if (original =/= output) fs.writeFileSync(outputFile, output) - case None => () } } } } - run(ts2mlsCases, ts2mlsHelper) - run(esCases, esHelper) - run(cjsCases, cjsHelper) + run(ts2mlsCases, "ts2mls/js/src/test/typescript", "", "../diff", false) + run(esCases, esPath, s"${esPath}/js/", ".interfaces", false) + run(cjsCases, cjsPath, s"${cjsPath}/js/", ".interfaces", true) } object DriverDiffTests { private val diffPath = "driver/js/src/test/" - private val outputPath = s"${diffPath}output/" + private val checkPath = s"${diffPath}output/" private val ts2mlsPath = "ts2mls/js/src/test/diff" private val esPath = s"${diffPath}esprojects/" private val cjsPath = s"${diffPath}cjsprojects/" private case class TestOption( filename: String, - workDir: String, - outputDir: String, - interfaceDir: String, - commonJS: Boolean, execution: Option[(String, String)], tsconfig: Option[String], expectTypeError: Boolean, expectError: Boolean - ) { - override def toString() = ts2mls.TSPathResolver.normalize(s"$workDir/$filename") - } + ) private def driverEntry( - entryModule: String, - tsconfig: Option[String], - workDir: String, - jsPath: String, - expectTypeError: Boolean, - expectError: Boolean, - commonJS: Boolean - ) = TestOption( - s"./mlscript/${entryModule}.mls", - workDir, - jsPath, - ".interfaces", - commonJS, - Some((s"${jsPath}mlscript/${entryModule}.js", s"${outputPath}${entryModule}.check")), - tsconfig, - expectTypeError, - expectError - ) - - private def cjsEntry( - entryModule: String, - tsconfig: Option[String] = None, - expectTypeError: Boolean = false, - expectError: Boolean = false - ) = driverEntry(entryModule, tsconfig, cjsPath, s"${cjsPath}/js/", expectTypeError, expectError, true) - - private def esEntry( - entryModule: String, - tsconfig: Option[String] = None, - expectTypeError: Boolean = false, - expectError: Boolean = false - ) = driverEntry(entryModule, tsconfig, esPath, s"${esPath}/js/", expectTypeError, expectError, false) + entryModule: String, tsconfig: Option[String] = None, expectTypeError: Boolean = false, expectError: Boolean = false, + ) = TestOption(s"./mlscript/${entryModule}.mls", S((s"mlscript/${entryModule}.js", s"${entryModule}.check")), + tsconfig, expectTypeError, expectError) private def ts2mlsEntry(entryFile: String, expectTypeError: Boolean = false, expectError: Boolean = false) = - TestOption(s"./${entryFile}", "ts2mls/js/src/test/typescript", "", "../diff", false, None, None, expectTypeError, expectError) + TestOption(s"./${entryFile}", None, None, expectTypeError, expectError) private val ts2mlsCases = List( ts2mlsEntry("BasicFunctions.ts", expectTypeError = true), @@ -129,33 +93,30 @@ object DriverDiffTests { ) private val esCases = List( - esEntry("Simple"), - esEntry("Cycle2"), - esEntry("Self", expectError = true), - esEntry("C", expectError = true, expectTypeError = true), - esEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members - esEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position - esEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position - esEntry("MLS2TheMax", Some("./tsconfig.json")), - esEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules - esEntry("Builtin"), - esEntry("TyperDebug"), - esEntry("Debug1"), - esEntry("Child", expectTypeError = true), - esEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true) + driverEntry("Simple"), + driverEntry("Cycle2"), + driverEntry("Self", expectError = true), + driverEntry("C", expectError = true, expectTypeError = true), + driverEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members + driverEntry("Output", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position + driverEntry("Output2", Some("./tsconfig.json"), expectTypeError = true), // TODO: type parameter position + driverEntry("MLS2TheMax", Some("./tsconfig.json")), + driverEntry("MyPartialOrder", Some("./tsconfig.json"), expectError = true, expectTypeError = true), // TODO: type traits in modules + driverEntry("Builtin"), + driverEntry("TyperDebug"), + driverEntry("Debug1"), + driverEntry("Child", expectTypeError = true), + driverEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true) ) private val cjsCases = List( - cjsEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types - cjsEntry("CJS1"), - cjsEntry("Bar", Some("./tsconfig.json")), - cjsEntry("BazBaz", Some("./tsconfig.json"), expectTypeError = true), - cjsEntry("Call", Some("./tsconfig.json"), expectError = true) + driverEntry("Lodash", Some("./tsconfig.json"), expectTypeError = true), // TODO: module member selection/trait types + driverEntry("CJS1"), + driverEntry("Bar", Some("./tsconfig.json")), + driverEntry("BazBaz", Some("./tsconfig.json"), expectTypeError = true), + driverEntry("Call", Some("./tsconfig.json"), expectError = true) ) private val cp = g.require("child_process") private val fs = g.require("fs") - private val ts2mlsHelper = JSGitHelper(".", ts2mlsPath) - private val esHelper = JSGitHelper(".", s"${esPath}/mlscript") - private val cjsHelper = JSGitHelper(".", s"${cjsPath}/mlscript") } From 2bcf4e75501be59d2ce1d755e91e239172a57d43 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 14 Jul 2023 12:23:24 +0800 Subject: [PATCH 180/202] WIP: Optimize driver diff test --- driver/js/src/main/scala/driver/Driver.scala | 25 ++++-- .../src/main/scala/driver/DriverOptions.scala | 12 +-- .../test/scala/driver/DriverDiffTests.scala | 6 +- .../main/scala/mlscript/utils/GitHelper.scala | 2 +- .../test/scala/mlscript/JVMGitHelper.scala | 2 +- .../src/main/scala/ts2mls}/JSGitHelper.scala | 13 ++- .../js/src/main/scala/ts2mls/TSProgram.scala | 70 +++++++++++---- .../src/main/scala/ts2mls/TSSourceFile.scala | 90 ++++++++++--------- .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 9 files changed, 136 insertions(+), 86 deletions(-) rename {driver/js/src/main/scala/driver => ts2mls/js/src/main/scala/ts2mls}/JSGitHelper.scala (52%) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index ce4d87f31..b97e14727 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -7,13 +7,15 @@ import mlscript.utils.shorthands._ import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} -import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo} +import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo, JSGitHelper} class Driver(options: DriverOptions) { import Driver._ import JSFileSystem._ import JSDriverBackend.ModuleType + private val gitHelper = JSGitHelper(".", options.watchDir, options.forceIfNoChange) + private var dbgWriter: Option[JSWriter] = None private def printDbg(msg: String) = dbgWriter.fold(())(writer => writer.writeDbg(msg.replace("\t", " "))) @@ -76,8 +78,9 @@ class Driver(options: DriverOptions) { implicit val vars: Map[Str, typer.SimpleType] = Map.empty implicit val stack = List[String]() initTyper - compile(FileInfo(options.path, options.filename, options.interfaceDir), false) - if (Driver.totalErrors > 0 && !options.expectError) Error + val res = compile(FileInfo(options.path, options.filename, options.interfaceDir), false) + if (!res) OK // Not changed. + else if (Driver.totalErrors > 0 && !options.expectError) Error else if (Driver.totalErrors == 0 && options.expectError) ExpectError else if (Driver.totalTypeErrors > 0 && !options.expectTypeError) TypeError else if (Driver.totalErrors > 0 && !options.expectError) ExpectTypeError @@ -217,13 +220,12 @@ class Driver(options: DriverOptions) { extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType], stack: List[String] - ): Unit = { + ): Bool = { if (!isMLScirpt(file.filename)) { // TypeScript System.out.println(s"generating interface for ${file.filename}...") val tsprog = - TSProgram(file, true, options.tsconfig, checkTSInterface) - tsprog.generate - return + TSProgram(file, true, options.tsconfig, checkTSInterface, S(gitHelper)) + return tsprog.generate } val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") @@ -251,7 +253,8 @@ class Driver(options: DriverOptions) { importedModule += file.filename sigs :+ extractSig(file.filename, file.moduleName) }) - otherList.foreach(dp => { + val cycleRecompile = cycleList.foldLeft(false)((r, f) => r || gitHelper.filter(f.filename)) + val dependentRecompile = otherList.foldLeft(cycleRecompile)((r, dp) => { // We need to create another new context when compiling other files. // e.g. A -> B, A -> C, B -> D, C -> D, where `->` means "depends on". // If we forget to add `import "D.mls"` in C, we need to raise an error. @@ -262,9 +265,11 @@ class Driver(options: DriverOptions) { initTyper val newFilename = file.`import`(dp) importedModule += newFilename.filename - compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) + compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) || r }) + if (!dependentRecompile && !gitHelper.filter(file.filename)) return false + System.out.println(s"compiling ${file.filename}...") val importedSym = (try { otherList.map(d => importModule(file.`import`(d))) } catch { @@ -301,6 +306,8 @@ class Driver(options: DriverOptions) { } } }) + + true } private def generate( diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index b2de2f7dc..06cc2c1a2 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -6,14 +6,16 @@ import js.DynamicImplicits._ import js.JSConverters._ final case class DriverOptions( - filename: String, - path: String, - outputDir: String, - tsconfig: Option[String], - interfaceDir: String, + filename: String, // The entry file's name + path: String, // Work path + watchDir: String, // Watch mlscript files and recompile automatically + outputDir: String, // JS output path + tsconfig: Option[String], // TS configuration filename (if applicable) + interfaceDir: String, // Interface file output path commonJS: Boolean, // Generate common js or es5 expectTypeError: Boolean, // Type errors are expected expectError: Boolean, // Other errors(e.g., code generation errors) are expected + forceIfNoChange: Boolean // If it is true, recompile everything when there is no change ) object DriverResult extends Enumeration { diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index e99e071ea..9e986bff4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -14,7 +14,7 @@ class DriverDiffTests extends AnyFunSuite { cases.foreach { case TestOption(filename, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError) + DriverOptions(filename, workDir, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val res = driver.execute @@ -39,7 +39,7 @@ class DriverDiffTests extends AnyFunSuite { } } - run(ts2mlsCases, "ts2mls/js/src/test/typescript", "", "../diff", false) + run(ts2mlsCases, ts2mlsPath, "", "../diff", false) run(esCases, esPath, s"${esPath}/js/", ".interfaces", false) run(cjsCases, cjsPath, s"${cjsPath}/js/", ".interfaces", true) } @@ -47,7 +47,7 @@ class DriverDiffTests extends AnyFunSuite { object DriverDiffTests { private val diffPath = "driver/js/src/test/" private val checkPath = s"${diffPath}output/" - private val ts2mlsPath = "ts2mls/js/src/test/diff" + private val ts2mlsPath = "ts2mls/js/src/test/typescript/" private val esPath = s"${diffPath}esprojects/" private val cjsPath = s"${diffPath}cjsprojects/" diff --git a/shared/src/main/scala/mlscript/utils/GitHelper.scala b/shared/src/main/scala/mlscript/utils/GitHelper.scala index 412ce042b..d3eb8ab95 100644 --- a/shared/src/main/scala/mlscript/utils/GitHelper.scala +++ b/shared/src/main/scala/mlscript/utils/GitHelper.scala @@ -8,7 +8,7 @@ import scala.collection.Iterator abstract class GitHelper[PathType, RelPathType](rootDir: PathType, workDir: PathType) { protected def diff: Iterator[Str] protected def str2RelPath(s: Str): RelPathType - protected def filter(file: PathType): Bool + def filter(file: PathType): Bool // Aggregate unstaged modified files to only run the tests on them, if there are any final protected lazy val modified: Set[RelPathType] = try diff.flatMap { gitStr => diff --git a/shared/src/test/scala/mlscript/JVMGitHelper.scala b/shared/src/test/scala/mlscript/JVMGitHelper.scala index f42997df1..969bf7d5f 100644 --- a/shared/src/test/scala/mlscript/JVMGitHelper.scala +++ b/shared/src/test/scala/mlscript/JVMGitHelper.scala @@ -10,7 +10,7 @@ class JVMGitHelper(rootDir: os.Path, workDir: os.Path) extends GitHelper[os.Path override protected def str2RelPath(s: Str): os.RelPath = os.RelPath(s) override protected def diff: Iterator[Str] = os.proc("git", "status", "--porcelain", workDir).call().out.lines().iterator - override protected def filter(file: Path): Bool = { + override def filter(file: Path): Bool = { JVMGitHelper.validExt(file.ext) && filter(file.relativeTo(rootDir)) } diff --git a/driver/js/src/main/scala/driver/JSGitHelper.scala b/ts2mls/js/src/main/scala/ts2mls/JSGitHelper.scala similarity index 52% rename from driver/js/src/main/scala/driver/JSGitHelper.scala rename to ts2mls/js/src/main/scala/ts2mls/JSGitHelper.scala index 67a0561e4..e11229b4b 100644 --- a/driver/js/src/main/scala/driver/JSGitHelper.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSGitHelper.scala @@ -1,12 +1,11 @@ -package driver +package ts2mls import mlscript.utils.GitHelper import scala.scalajs.js import js.Dynamic.{global => g} import js.DynamicImplicits._ -import ts2mls.TSPathResolver -class JSGitHelper(rootDir: String, workDir: String) extends GitHelper[String, String](rootDir, workDir) { +class JSGitHelper(rootDir: String, workDir: String, val forceIfNoChange: Boolean) extends GitHelper[String, String](rootDir, workDir) { override protected def str2RelPath(s: String): String = s override protected def diff: Iterator[String] = { val res = JSGitHelper.cp.execSync(s"git status --porcelain $workDir").toString() @@ -14,13 +13,13 @@ class JSGitHelper(rootDir: String, workDir: String) extends GitHelper[String, St else res.split("\n").iterator } - override protected def filter(file: String): Boolean = - modified(TSPathResolver.normalize(file)) || modified.isEmpty + override def filter(file: String): Boolean = + modified(TSPathResolver.normalize(file)) || (forceIfNoChange && modified.isEmpty) } object JSGitHelper { - def apply(rootDir: String, workDir: String): JSGitHelper = - new JSGitHelper(rootDir, workDir) + def apply(rootDir: String, workDir: String, forceIfNoChange: Boolean): JSGitHelper = + new JSGitHelper(rootDir, workDir, forceIfNoChange) private val cp = g.require("child_process") } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index ea72b1196..d966f149b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -10,21 +10,33 @@ import scala.collection.mutable.{HashSet, HashMap} // `import * as TopLevelModuleName from "filename"`. // For es5.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files -class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String], typer: (FileInfo, JSWriter) => Unit) { +class TSProgram( + file: FileInfo, + uesTopLevelModule: Boolean, + tsconfig: Option[String], + typer: (FileInfo, JSWriter) => Unit, + gitHelper: Option[JSGitHelper] +) { private implicit val configContent = TypeScript.parseOption(file.workDir, tsconfig) private val program = TypeScript.createProgram(Seq( if (file.isNodeModule) file.resolve else file.filename )) - private val cache = new HashMap[String, TSNamespace]() + private val cache = new HashMap[String, TSSourceFile]() private implicit val checker = TSTypeChecker(program.getTypeChecker()) import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} - def generate: Unit = generate(file, None)(Nil) + def generate: Boolean = generate(file, None)(Nil) - private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Unit = { - val filename = if (TypeScript.isLinux) file.resolve else file.resolve.toLowerCase() + private def generate(file: FileInfo, ambientNS: Option[TSNamespace])(implicit stack: List[String]): Boolean = { + def resolve(file: FileInfo) = if (TypeScript.isLinux) file.resolve else file.resolve.toLowerCase() + // We prefer to not tract node_modules in git, so we need to check if the interface file exists + def shouldRecompile(filename: String, interface: String) = gitHelper.fold(true)( + helper => helper.forceIfNoChange || helper.filter(relative(filename, file.workDir)) || !JSFileSystem.exists(interface) + ) + + val filename = resolve(file) val moduleName = file.moduleName val globalNamespace = ambientNS.getOrElse(TSNamespace(!uesTopLevelModule)) val sfObj = program.getSourceFileByPath(filename) @@ -33,23 +45,39 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str else TSSourceFile(sfObj, globalNamespace, moduleName) val importList = sourceFile.getImportList val reExportList = sourceFile.getReExportList - cache.addOne(filename, globalNamespace) + cache.addOne(filename, sourceFile) val relatedPath = relative(file.workDir, dirname(filename)) + val interfaceFilename = s"${file.workDir}/${file.interfaceFilename}" val (cycleList, otherList) = importList.partitionMap(imp => { val newFile = file.`import`(imp.filename) - if (stack.contains(newFile.resolve)) Left(newFile) + if (stack.contains(resolve(newFile))) Left(newFile) else Right(newFile) }) - otherList.foreach(imp => { - generate(imp, None)(filename :: stack) + val cycleRecompile = cycleList.foldLeft(false)((r, f) => + r || shouldRecompile(resolve(f), s"${f.workDir}/${f.interfaceFilename}")) + val reExportRecompile = reExportList.foldLeft(false)((r, e) => + r || { + val f = file.`import`(e.filename) + shouldRecompile(resolve(f), s"${f.workDir}/${f.interfaceFilename}") + }) + val referencedRecompile: Boolean = sourceFile.referencedFiles.reduce((r: Boolean, s: js.Dynamic) => { + val f = file.`import`(s.toString()) + r || shouldRecompile(resolve(f), interfaceFilename) + }, false) + + val dependentRecompile = otherList.foldLeft(cycleRecompile || reExportRecompile || referencedRecompile)((r, imp) => { + generate(imp, None)(filename :: stack) || r }) - var writer = JSWriter(s"${file.workDir}/${file.interfaceFilename}") - val imported = new HashSet[String]() + if (!dependentRecompile && !shouldRecompile(filename, interfaceFilename)) return false + sourceFile.parse + val writer = JSWriter(interfaceFilename) + val imported = new HashSet[String]() + otherList.foreach(imp => { val name = file.translateImportToInterface(imp) if (!imported(name)) { @@ -60,18 +88,20 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str cycleList.foreach(imp => { if (ambientNS.isEmpty || stack.indexOf(filename) > 0) { writer.writeln(s"declare module ${Converter.escapeIdent(imp.moduleName)} {") - cache(imp.resolve).generate(writer, " ") + val sf = cache(resolve(imp)) + sf.parse + sf.global.generate(writer, " ") writer.writeln("}") } }) reExportList.foreach { case TSReExport(alias, imp, memberName) => - val absName = file.`import`(imp).resolve + val absName = resolve(file.`import`(imp)) if (!cache.contains(absName)) throw new AssertionError(s"unexpected re-export from ${imp}") else { - val ns = cache(absName) + val ns = cache(absName).global val moduleName = basename(absName) memberName.fold( globalNamespace.put(alias, TSRenamedType(alias, TSReferenceType(moduleName)), true, false) @@ -88,6 +118,8 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str typer(file, writer) writer.close() } + + true } private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String, commonJS: Boolean): Unit = @@ -100,6 +132,12 @@ class TSProgram(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[Str } object TSProgram { - def apply(file: FileInfo, uesTopLevelModule: Boolean, tsconfig: Option[String], typer: (FileInfo, JSWriter) => Unit) = - new TSProgram(file, uesTopLevelModule, tsconfig, typer) + def apply( + file: FileInfo, + uesTopLevelModule: Boolean, + tsconfig: Option[String], + typer: (FileInfo, JSWriter) => Unit, + gitHelper: Option[JSGitHelper] + ) = + new TSProgram(file, uesTopLevelModule, tsconfig, typer, gitHelper) } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index eec56e0d8..12ccdff1f 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -6,7 +6,7 @@ import types._ import mlscript.utils._ import scala.collection.mutable.ListBuffer -class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) { +class TSSourceFile(sf: js.Dynamic, val global: TSNamespace, topName: String)(implicit checker: TSTypeChecker, config: js.Dynamic) { private val lineHelper = new TSLineStartsHelper(sf.getLineStarts()) private val importList = TSImportList() private val reExportList = new ListBuffer[TSReExport]() @@ -17,59 +17,63 @@ class TSSourceFile(sf: js.Dynamic, global: TSNamespace, topName: String)(implici def getUMDModule: Option[TSNamespace] = umdModuleName.fold[Option[TSNamespace]](Some(global))(name => Some(global.derive(name, false))) - // Parse import + // Parse import & re-export first TypeScript.forEachChild(sf, (node: js.Dynamic) => { val nodeObject = TSNodeObject(node) if (nodeObject.isRequire) parseRequire(nodeObject) else if (nodeObject.isImportDeclaration) parseImportDeclaration(nodeObject.importClause, nodeObject.moduleSpecifier, false) + else if (nodeObject.isExportDeclaration && !nodeObject.moduleSpecifier.isUndefined) // Re-export + parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) }) - // Parse main body - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (!nodeObject.isToken) { - if (!nodeObject.symbol.isUndefined) { // For functions - if (nodeObject.isFunctionLike) - addFunctionIntoNamespace(nodeObject.symbol, nodeObject, nodeObject.symbol.escapedName)(global) - else // For classes/interfaces/namespace - addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) - } - else if (!nodeObject.declarationList.isUndefined) { // For variables - val decNode = nodeObject.declarationList.declaration - addNodeIntoNamespace(decNode, decNode.symbol.escapedName, decNode.isExported)(global) + private var parsed = false + def parse = if (!parsed) { + parsed = true + // Parse main body + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (!nodeObject.isToken) { + if (!nodeObject.symbol.isUndefined) { // For functions + if (nodeObject.isFunctionLike) + addFunctionIntoNamespace(nodeObject.symbol, nodeObject, nodeObject.symbol.escapedName)(global) + else // For classes/interfaces/namespace + addNodeIntoNamespace(nodeObject, nodeObject.symbol.escapedName, nodeObject.isExported)(global) + } + else if (!nodeObject.declarationList.isUndefined) { // For variables + val decNode = nodeObject.declarationList.declaration + addNodeIntoNamespace(decNode, decNode.symbol.escapedName, decNode.isExported)(global) + } } - } - }) + }) - // Parse export - TypeScript.forEachChild(sf, (node: js.Dynamic) => { - val nodeObject = TSNodeObject(node) - if (nodeObject.isExportDeclaration) { - if (!nodeObject.moduleSpecifier.isUndefined) // Re-export - parseImportDeclaration(nodeObject.exportClause, nodeObject.moduleSpecifier, true) - else // ES modules - parseExportDeclaration(nodeObject.exportClause.elements) - } - else if (nodeObject.isExportAssignment) { // CommonJS - val name = nodeObject.idExpression.escapedText - if (name === "undefined") { // For exports = { ... }. In this case we still need the top-level module - val props = nodeObject.nodeExpression.properties - props.foreach(node => { - val name = node.initID.escapedText - if (name === "undefined") - addNodeIntoNamespace(node.initializer, node.name.escapedText, true)(global) - else if (node.name.escapedText === name) - global.`export`(name) - else global.put(node.name.escapedText, TSRenamedType(node.name.escapedText, TSReferenceType(name)), true, false) - }) + // Parse export + TypeScript.forEachChild(sf, (node: js.Dynamic) => { + val nodeObject = TSNodeObject(node) + if (nodeObject.isExportDeclaration) { + if (nodeObject.moduleSpecifier.isUndefined) // ES modules + parseExportDeclaration(nodeObject.exportClause.elements) } - else global.renameExport(name, topName) // Export the member directly - } - else if (nodeObject.exportedAsNamespace) // UMD - umdModuleName = Some(nodeObject.symbol.escapedName) - }) + else if (nodeObject.isExportAssignment) { // CommonJS + val name = nodeObject.idExpression.escapedText + if (name === "undefined") { // For exports = { ... }. In this case we still need the top-level module + val props = nodeObject.nodeExpression.properties + props.foreach(node => { + val name = node.initID.escapedText + if (name === "undefined") + addNodeIntoNamespace(node.initializer, node.name.escapedText, true)(global) + else if (node.name.escapedText === name) + global.`export`(name) + else global.put(node.name.escapedText, TSRenamedType(node.name.escapedText, TSReferenceType(name)), true, false) + }) + } + else global.renameExport(name, topName) // Export the member directly + } + else if (nodeObject.exportedAsNamespace) // UMD + umdModuleName = Some(nodeObject.symbol.escapedName) + }) + } def getImportList: List[TSImport] = importList.getFilelist def getReExportList: List[TSReExport] = reExportList.toList diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index e38b5a08b..78eeb8ac9 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -8,7 +8,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), - false, None, (file: FileInfo, writer: JSWriter) => ()) // No need for builtin + false, None, (file: FileInfo, writer: JSWriter) => (), None) // No need for builtin check program.generate }) } From 906526a8e2ff65ff23e6aea7a33889cc832bc749 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 14 Jul 2023 13:14:06 +0800 Subject: [PATCH 181/202] WIP: Add watch method --- driver/js/src/main/scala/driver/Driver.scala | 2 +- .../src/main/scala/driver/DriverHelper.scala | 39 +++++++++++++++++++ .../src/main/scala/driver/DriverOptions.scala | 1 - .../test/scala/driver/DriverDiffTests.scala | 2 +- 4 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 driver/js/src/main/scala/driver/DriverHelper.scala diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index b97e14727..cf5a4d563 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -14,7 +14,7 @@ class Driver(options: DriverOptions) { import JSFileSystem._ import JSDriverBackend.ModuleType - private val gitHelper = JSGitHelper(".", options.watchDir, options.forceIfNoChange) + private val gitHelper = JSGitHelper(".", options.path, options.forceIfNoChange) private var dbgWriter: Option[JSWriter] = None private def printDbg(msg: String) = diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala new file mode 100644 index 000000000..544f768e8 --- /dev/null +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -0,0 +1,39 @@ +package driver + +import scala.scalajs.js +import js.Dynamic.{global => g} +import js.DynamicImplicits._ +import js.JSConverters._ +import scala.scalajs.js.annotation._ +import mlscript.utils._ + +@JSExportTopLevel("MLscriptDriver") +object DriverHelper { + private val fs = g.require("fs") + + @JSExport + def watch( + filename: String, + workDir: String, + outputDir: String, + tsconfig: Option[String], + commonJS: Boolean, + expectTypeError: Boolean + ): Unit = { + val options = DriverOptions(filename, workDir, outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) + fs.watch(workDir, (event: js.Dynamic) => { + if (event.toString() === "change") { + val res = Driver(options).execute + + import DriverResult._ + res match { + case Error => System.err.println(s"Compiling error(s) found in $filename.") + case TypeError => System.err.println(s"Type error(s) found in $filename") + case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") + case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") + case OK => () + } + } + }) + } +} diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index 06cc2c1a2..0d895aa54 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -8,7 +8,6 @@ import js.JSConverters._ final case class DriverOptions( filename: String, // The entry file's name path: String, // Work path - watchDir: String, // Watch mlscript files and recompile automatically outputDir: String, // JS output path tsconfig: Option[String], // TS configuration filename (if applicable) interfaceDir: String, // Interface file output path diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 9e986bff4..ca3bf9397 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -14,7 +14,7 @@ class DriverDiffTests extends AnyFunSuite { cases.foreach { case TestOption(filename, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) + DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val res = driver.execute From d5b517292577a8acb396c003ad9b3cb977ac48e4 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 11:58:05 +0800 Subject: [PATCH 182/202] WIP: Fix several problems --- .gitignore | 2 + build.sbt | 4 +- driver/js/src/main/scala/driver/Driver.scala | 8 +- .../src/main/scala/driver/DriverHelper.scala | 51 +++- .../src/main/scala/driver/DriverOptions.scala | 1 + .../test/scala/driver/DriverDiffTests.scala | 2 +- driver/npm/package.json | 26 ++ .../test/diff => driver/npm/predefs}/Dom.mlsi | 0 .../test/diff => driver/npm/predefs}/ES5.mlsi | 0 .../{js/src/test => npm}/predefs/Predef.mlsi | 0 package-lock.json | 283 ++++++++++++++++++ package.json | 1 + .../main/scala/ts2mls/TSCompilerInfo.scala | 2 +- .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 14 files changed, 358 insertions(+), 24 deletions(-) create mode 100644 driver/npm/package.json rename {ts2mls/js/src/test/diff => driver/npm/predefs}/Dom.mlsi (100%) rename {ts2mls/js/src/test/diff => driver/npm/predefs}/ES5.mlsi (100%) rename driver/{js/src/test => npm}/predefs/Predef.mlsi (100%) diff --git a/.gitignore b/.gitignore index 7157a2c7a..d107505c8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,6 @@ project/metals.sbt **.worksheet.sc driver/js/src/test/cjsprojects/js/ts/ driver/js/src/test/esprojects/js/my_ts_path/ +driver/npm/index.js +driver/npm/index.js.map .DS_Store diff --git a/build.sbt b/build.sbt index 23ab61d1b..3bfba554f 100644 --- a/build.sbt +++ b/build.sbt @@ -98,7 +98,9 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) .jvmSettings() .jsSettings( libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", - libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test" + libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", + Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "driver" / "npm" / "index.js", + scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) } ) .dependsOn(mlscript % "compile->compile;test->test") .dependsOn(ts2mls % "compile->compile;test->test") diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index cf5a4d563..431a040d7 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -167,7 +167,7 @@ class Driver(options: DriverOptions) { mlscript.Bot } - private lazy val jsBuiltinDecs = Driver.jsBuiltinPaths.map(path => parseAndRun(path, { + private lazy val jsBuiltinDecs = Driver.jsBuiltinPaths.map(path => parseAndRun(s"${options.includePath}/$path", { case (_, declarations, _, _) => declarations })) @@ -337,9 +337,9 @@ object Driver { def apply(options: DriverOptions) = new Driver(options) private val jsBuiltinPaths = List( - "./ts2mls/js/src/test/diff/ES5.mlsi", - "./ts2mls/js/src/test/diff/Dom.mlsi", - "./driver/js/src/test/predefs/Predef.mlsi" + "./ES5.mlsi", + "./Dom.mlsi", + "./Predef.mlsi" ) private def printErr(msg: String): Unit = diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala index 544f768e8..d8eee4d52 100644 --- a/driver/js/src/main/scala/driver/DriverHelper.scala +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -6,13 +6,14 @@ import js.DynamicImplicits._ import js.JSConverters._ import scala.scalajs.js.annotation._ import mlscript.utils._ +import ts2mls.TypeScript -@JSExportTopLevel("MLscriptDriver") object DriverHelper { - private val fs = g.require("fs") + // Do not use fs.watch + // See https://github.com/paulmillr/chokidar + private val watcher = TypeScript.load("chokidar") - @JSExport - def watch( + private def run( filename: String, workDir: String, outputDir: String, @@ -20,20 +21,38 @@ object DriverHelper { commonJS: Boolean, expectTypeError: Boolean ): Unit = { - val options = DriverOptions(filename, workDir, outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) - fs.watch(workDir, (event: js.Dynamic) => { - if (event.toString() === "change") { - val res = Driver(options).execute + System.out.println(s"start watching $workDir") + val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) + watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { + val res = Driver(options).execute - import DriverResult._ - res match { - case Error => System.err.println(s"Compiling error(s) found in $filename.") - case TypeError => System.err.println(s"Type error(s) found in $filename") - case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") - case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") - case OK => () - } + import DriverResult._ + res match { + case Error => System.err.println(s"Compiling error(s) found in $filename.") + case TypeError => System.err.println(s"Type error(s) found in $filename") + case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") + case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") + case OK => () } }) } + + @JSExportTopLevel("watch") + def watch( + filename: String, + workDir: String, + outputDir: String, + tsconfig: String, + commonJS: Boolean, + expectTypeError: Boolean + ): Unit = run(filename, workDir, outputDir, Some(tsconfig), commonJS, expectTypeError) + + @JSExportTopLevel("watch") + def watch( + filename: String, + workDir: String, + outputDir: String, + commonJS: Boolean, + expectTypeError: Boolean + ): Unit = run(filename, workDir, outputDir, None, commonJS, expectTypeError) } diff --git a/driver/js/src/main/scala/driver/DriverOptions.scala b/driver/js/src/main/scala/driver/DriverOptions.scala index 0d895aa54..5cfdd8d4e 100644 --- a/driver/js/src/main/scala/driver/DriverOptions.scala +++ b/driver/js/src/main/scala/driver/DriverOptions.scala @@ -8,6 +8,7 @@ import js.JSConverters._ final case class DriverOptions( filename: String, // The entry file's name path: String, // Work path + includePath: String, // Where the predef is outputDir: String, // JS output path tsconfig: Option[String], // TS configuration filename (if applicable) interfaceDir: String, // Interface file output path diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index ca3bf9397..ef9e3dbee 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -14,7 +14,7 @@ class DriverDiffTests extends AnyFunSuite { cases.foreach { case TestOption(filename, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) + DriverOptions(filename, workDir, "./driver/npm/predefs/", outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val res = driver.execute diff --git a/driver/npm/package.json b/driver/npm/package.json new file mode 100644 index 000000000..534deeddd --- /dev/null +++ b/driver/npm/package.json @@ -0,0 +1,26 @@ +{ + "name": "mlscript-driver", + "version": "0.0.1", + "description": "mlscript driver", + "scripts": { + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hkust-taco/mlscript.git" + }, + "keywords": [ + "functional-programming", + "type-inference" + ], + "author": "hkust-taco-lab", + "license": "MIT", + "bugs": { + "url": "https://github.com/hkust-taco/mlscript/issues" + }, + "homepage": "https://github.com/hkust-taco/mlscript#readme", + "dependencies": { + "json5": "^2.2.3", + "typescript": "^4.7.4", + "chokidar": "^3.5.3" + } +} diff --git a/ts2mls/js/src/test/diff/Dom.mlsi b/driver/npm/predefs/Dom.mlsi similarity index 100% rename from ts2mls/js/src/test/diff/Dom.mlsi rename to driver/npm/predefs/Dom.mlsi diff --git a/ts2mls/js/src/test/diff/ES5.mlsi b/driver/npm/predefs/ES5.mlsi similarity index 100% rename from ts2mls/js/src/test/diff/ES5.mlsi rename to driver/npm/predefs/ES5.mlsi diff --git a/driver/js/src/test/predefs/Predef.mlsi b/driver/npm/predefs/Predef.mlsi similarity index 100% rename from driver/js/src/test/predefs/Predef.mlsi rename to driver/npm/predefs/Predef.mlsi diff --git a/package-lock.json b/package-lock.json index 44596f1b5..bbc51e65f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,10 +5,141 @@ "packages": { "": { "dependencies": { + "chokidar": "^3.5.3", "json5": "^2.2.3", "typescript": "^4.7.4" } }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "engines": { + "node": ">=8" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -20,6 +151,47 @@ "node": ">=6" } }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/typescript": { "version": "4.7.4", "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", @@ -34,11 +206,122 @@ } }, "dependencies": { + "anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "requires": { + "fill-range": "^7.0.1" + } + }, + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "optional": true + }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "requires": { + "is-glob": "^4.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + }, + "picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "requires": { + "picomatch": "^2.2.1" + } + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "requires": { + "is-number": "^7.0.0" + } + }, "typescript": { "version": "4.7.4", "resolved": "https://registry.npmmirror.com/typescript/-/typescript-4.7.4.tgz", diff --git a/package.json b/package.json index f33b6f03f..33eb144b3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "dependencies": { + "chokidar": "^3.5.3", "json5": "^2.2.3", "typescript": "^4.7.4" } diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index a43b6c5c8..998ee5551 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -9,7 +9,7 @@ import mlscript.utils._ import js.isUndefined object TypeScript { - private def load(moduleName: String) = try g.require(moduleName) catch { + def load(moduleName: String) = try g.require(moduleName) catch { case _ : Throwable => { System.err.println(s"Cannot find $moduleName in the current directory. Please install by running \"npm install\".") val process = g.require("process") diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index 78eeb8ac9..ef70dae16 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -7,7 +7,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( - FileInfo("./ts2mls/js/src/test/typescript", filename, "../diff/"), + FileInfo("./ts2mls/js/src/test/typescript", filename, "../../../../../driver/npm/predefs"), false, None, (file: FileInfo, writer: JSWriter) => (), None) // No need for builtin check program.generate }) From de5c30ea956817e2b0b35731f7dae4f1cbe32f99 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 12:16:15 +0800 Subject: [PATCH 183/202] WIP: Update package.json --- driver/js/src/test/esprojects/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/driver/js/src/test/esprojects/package.json b/driver/js/src/test/esprojects/package.json index 80cb02650..52643d6b6 100644 --- a/driver/js/src/test/esprojects/package.json +++ b/driver/js/src/test/esprojects/package.json @@ -3,5 +3,6 @@ "fp-ts": "^2.16.0", "json5": "^2.2.3" }, - "module": "es2015" + "module": "es2015", + "type": "module" } From b9f95dbcee1038765d3a5ecb68f1ae4572a68c29 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 13:40:41 +0800 Subject: [PATCH 184/202] WIP: Fix several problems --- .gitignore | 4 ++-- .../test/scala/driver/DriverDiffTests.scala | 2 +- driver/npm/README.md | 1 + driver/npm/lib/index.d.ts | 21 +++++++++++++++++++ driver/npm/{ => lib}/predefs/Dom.mlsi | 0 driver/npm/{ => lib}/predefs/ES5.mlsi | 0 driver/npm/{ => lib}/predefs/Predef.mlsi | 0 driver/npm/package.json | 4 +++- .../scala/ts2mls/TSTypeGenerationTests.scala | 2 +- 9 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 driver/npm/README.md create mode 100644 driver/npm/lib/index.d.ts rename driver/npm/{ => lib}/predefs/Dom.mlsi (100%) rename driver/npm/{ => lib}/predefs/ES5.mlsi (100%) rename driver/npm/{ => lib}/predefs/Predef.mlsi (100%) diff --git a/.gitignore b/.gitignore index d107505c8..a9def9946 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,6 @@ project/metals.sbt **.worksheet.sc driver/js/src/test/cjsprojects/js/ts/ driver/js/src/test/esprojects/js/my_ts_path/ -driver/npm/index.js -driver/npm/index.js.map +driver/npm/lib/index.js +driver/npm/lib/index.js.map .DS_Store diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index ef9e3dbee..ba963ded2 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -14,7 +14,7 @@ class DriverDiffTests extends AnyFunSuite { cases.foreach { case TestOption(filename, execution, tsconfig, expectTypeError, expectError) => test(filename) { val options = - DriverOptions(filename, workDir, "./driver/npm/predefs/", outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) + DriverOptions(filename, workDir, "./driver/npm/lib/predefs/", outputDir, tsconfig, interfaceDir, cjs, expectTypeError, expectError, true) val driver = Driver(options) if (!outputDir.isEmpty()) driver.genPackageJson() val res = driver.execute diff --git a/driver/npm/README.md b/driver/npm/README.md new file mode 100644 index 000000000..2529f3cbd --- /dev/null +++ b/driver/npm/README.md @@ -0,0 +1 @@ +# MLscript Driver diff --git a/driver/npm/lib/index.d.ts b/driver/npm/lib/index.d.ts new file mode 100644 index 000000000..7a722af9d --- /dev/null +++ b/driver/npm/lib/index.d.ts @@ -0,0 +1,21 @@ +declare interface Driver { + watch( + filename: string, + workDir: string, + outputDir: string, + tsconfig: string, + commonJS: boolean, + expectTypeError: boolean + ); + + watch( + filename: string, + workDir: string, + outputDir: string, + commonJS: boolean, + expectTypeError: boolean + ); +} + +declare const driver: Driver +export = driver; diff --git a/driver/npm/predefs/Dom.mlsi b/driver/npm/lib/predefs/Dom.mlsi similarity index 100% rename from driver/npm/predefs/Dom.mlsi rename to driver/npm/lib/predefs/Dom.mlsi diff --git a/driver/npm/predefs/ES5.mlsi b/driver/npm/lib/predefs/ES5.mlsi similarity index 100% rename from driver/npm/predefs/ES5.mlsi rename to driver/npm/lib/predefs/ES5.mlsi diff --git a/driver/npm/predefs/Predef.mlsi b/driver/npm/lib/predefs/Predef.mlsi similarity index 100% rename from driver/npm/predefs/Predef.mlsi rename to driver/npm/lib/predefs/Predef.mlsi diff --git a/driver/npm/package.json b/driver/npm/package.json index 534deeddd..d40699bf5 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -2,6 +2,8 @@ "name": "mlscript-driver", "version": "0.0.1", "description": "mlscript driver", + "types": "lib/index.d.ts", + "main": "lib/index.js", "scripts": { }, "repository": { @@ -12,7 +14,7 @@ "functional-programming", "type-inference" ], - "author": "hkust-taco-lab", + "author": "hkust-taco", "license": "MIT", "bugs": { "url": "https://github.com/hkust-taco/mlscript/issues" diff --git a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala index ef70dae16..4b1af6d5b 100644 --- a/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala +++ b/ts2mls/js/src/test/scala/ts2mls/TSTypeGenerationTests.scala @@ -7,7 +7,7 @@ class TSTypeGenerationTest extends AnyFunSuite { testsData.foreach((filename) => test(filename) { val program = TSProgram( - FileInfo("./ts2mls/js/src/test/typescript", filename, "../../../../../driver/npm/predefs"), + FileInfo("./ts2mls/js/src/test/typescript", filename, "../../../../../driver/npm/lib/predefs"), false, None, (file: FileInfo, writer: JSWriter) => (), None) // No need for builtin check program.generate }) From 12db97914cd7770bac65f82e3b1a10c8864eab7c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 14:28:29 +0800 Subject: [PATCH 185/202] WIP: Add js check --- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index d966f149b..cc9e14778 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -50,10 +50,11 @@ class TSProgram( val interfaceFilename = s"${file.workDir}/${file.interfaceFilename}" val (cycleList, otherList) = - importList.partitionMap(imp => { - val newFile = file.`import`(imp.filename) - if (stack.contains(resolve(newFile))) Left(newFile) - else Right(newFile) + importList.map(imp => file.`import`(imp.filename)).filter( + imp => !resolve(imp).endsWith(".js") // If it is not a ts lib, we ignore it and require users to provide full type annotations + ).partitionMap(imp => { + if (stack.contains(resolve(imp))) Left(imp) + else Right(imp) }) val cycleRecompile = cycleList.foldLeft(false)((r, f) => From a701892764077f41c0e56324ffd59705f14ad60b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 15:26:27 +0800 Subject: [PATCH 186/202] WIP: Update build.sbt and version --- build.sbt | 2 +- driver/npm/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index 3bfba554f..718ef7c9b 100644 --- a/build.sbt +++ b/build.sbt @@ -99,7 +99,7 @@ lazy val driver = crossProject(JSPlatform, JVMPlatform).in(file("driver")) .jsSettings( libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0", libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.12" % "test", - Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "driver" / "npm" / "index.js", + Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "driver" / "npm" / "lib" / "index.js", scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.CommonJSModule) } ) .dependsOn(mlscript % "compile->compile;test->test") diff --git a/driver/npm/package.json b/driver/npm/package.json index d40699bf5..871a2f9b1 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,6 +1,6 @@ { "name": "mlscript-driver", - "version": "0.0.1", + "version": "0.0.2", "description": "mlscript driver", "types": "lib/index.d.ts", "main": "lib/index.js", From e125e7d3ee0663de7e8487599023ae8c8c9d465a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 17:17:40 +0800 Subject: [PATCH 187/202] WIP: Fix several problems --- driver/js/src/main/scala/driver/DriverHelper.scala | 4 +++- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala index d8eee4d52..f5226f281 100644 --- a/driver/js/src/main/scala/driver/DriverHelper.scala +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -24,7 +24,9 @@ object DriverHelper { System.out.println(s"start watching $workDir") val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { - val res = Driver(options).execute + val driver = Driver(options) + driver.genPackageJson() + val res = driver.execute import DriverResult._ res match { diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index cc9e14778..add14a8e3 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -33,7 +33,7 @@ class TSProgram( def resolve(file: FileInfo) = if (TypeScript.isLinux) file.resolve else file.resolve.toLowerCase() // We prefer to not tract node_modules in git, so we need to check if the interface file exists def shouldRecompile(filename: String, interface: String) = gitHelper.fold(true)( - helper => helper.forceIfNoChange || helper.filter(relative(filename, file.workDir)) || !JSFileSystem.exists(interface) + helper => helper.forceIfNoChange || helper.filter(relative(TSPathResolver.resolve(file.workDir), filename)) || !JSFileSystem.exists(interface) ) val filename = resolve(file) From d010e8d8aa1545e6b88c844de97f37de052b3c9a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Mon, 17 Jul 2023 18:46:15 +0800 Subject: [PATCH 188/202] WIP: Add fallback for unsupported type notations and fix mixin parents --- driver/js/src/main/scala/driver/Driver.scala | 15 ++++- .../.interfaces/mlscript/Mixin1.mlsi | 40 +++++++++++ .../.interfaces/mlscript/Mixin2.mlsi | 11 +++ .../src/test/esprojects/js/mlscript/Mixin1.js | 62 +++++++++++++++++ .../src/test/esprojects/js/mlscript/Mixin2.js | 67 +++++++++++++++++++ .../src/test/esprojects/mlscript/Mixin1.mls | 17 +++++ .../src/test/esprojects/mlscript/Mixin2.mls | 14 ++++ driver/js/src/test/output/Mixin1.check | 1 + .../test/scala/driver/DriverDiffTests.scala | 3 +- .../src/main/scala/mlscript/JSBackend.scala | 8 ++- 10 files changed, 234 insertions(+), 4 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/Mixin1.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Mixin2.js create mode 100644 driver/js/src/test/esprojects/mlscript/Mixin1.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Mixin2.mls create mode 100644 driver/js/src/test/output/Mixin1.check diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 431a040d7..e667b07ee 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -205,12 +205,23 @@ class Driver(options: DriverOptions) { extrCtx: Opt[typer.ExtrCtx], vars: Map[Str, typer.SimpleType] ): List[NuDecl] = - parseAndRun(s"${options.path}/${file.interfaceFilename}", { + try parseAndRun(s"${options.path}/${file.interfaceFilename}", { case (_, declarations, imports, _) => imports.foreach(d => importModule(file.`import`(d.path))) `type`(TypingUnit(declarations), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) declarations.filter(_.isExported) - }) + }) + catch { // The generated interface code is not supported yet + case _: Throwable if JSFileSystem.exists(file.filename) => // Use the original file + parseAndRun(file.filename, { + case (definitions, declarations, imports, _) => + imports.foreach(d => importModule(file.`import`(d.path))) + val mod = + NuTypeDef(Mod, TypeName(file.moduleName), Nil, N, N, N, Nil, N, N, TypingUnit(definitions ++ declarations))(N, N, N) + `type`(TypingUnit(mod :: Nil), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) + mod :: Nil + }) + } private def compile( file: FileInfo, diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi new file mode 100644 index 000000000..683fc9911 --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi @@ -0,0 +1,40 @@ +import "./Mixin2.mlsi" +export declare module Mixin1() { + class Neg[A](expr: A) + mixin EvalNeg() { + super: {eval: 'a -> 'b} + this: {eval: 'expr -> Int} + fun eval: (Neg['expr] | Object & 'a & ~#Neg) -> (Int | 'b) + } + module MyLang { + fun eval: (Neg['A] | Object & ~#Neg) -> Int + } + fun show: unit + unit + where + 'A <: Neg['A] | Object & ~#Neg +} +//| ╔══[ERROR] Unsupported parent specification +//| ║ l.11: module MyLang extends Mixin2.EvalBase, EvalNeg +//| ╙── ^^^^^^^^^^^^^^^ +//| ╔══[ERROR] Type mismatch in type declaration: +//| ║ l.11: module MyLang extends Mixin2.EvalBase, EvalNeg +//| ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//| ╟── Object of type `anything` does not have field 'eval' +//| ║ l.11: module MyLang extends Mixin2.EvalBase, EvalNeg +//| ║ ^ +//| ╟── Note: constraint arises from field selection: +//| ║ l.8: else super.eval(e) +//| ║ ^^^^^^^^^^ +//| ╟── from reference: +//| ║ l.8: else super.eval(e) +//| ╙── ^^^^^ +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) +//| ╙── ^^^^ +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) +//| ╙── ^^^^ +//| ╔══[ERROR] access to class member not yet supported +//| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) +//| ╙── ^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi new file mode 100644 index 000000000..32183b6de --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi @@ -0,0 +1,11 @@ +export declare module Mixin2() { + class Add[E](lhs: E, rhs: E) + class Lit(n: Int) + fun eval: forall 'a. 'a -> Int + mixin EvalBase() { + this: {eval: 'lhs -> Int} + fun eval: (Add['lhs] | Lit) -> Int + } + where + 'a <: Add['a] | Lit +} diff --git a/driver/js/src/test/esprojects/js/mlscript/Mixin1.js b/driver/js/src/test/esprojects/js/mlscript/Mixin1.js new file mode 100644 index 000000000..d704b4287 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Mixin1.js @@ -0,0 +1,62 @@ +import { Mixin2 } from "./Mixin2.js" + +const Mixin1 = new class Mixin1 { + #Neg; + #MyLang; + constructor() { + } + get show() { + const self = this; + return ((() => { + let program = Mixin2.Add(Mixin2.Lit(48), self.Neg(Mixin2.Lit(6))); + return console.log(self.MyLang.eval(program)); + })()); + } + EvalNeg(base) { + const outer = this; + return (class EvalNeg extends base { + constructor(...rest) { + super(...rest); + } + eval(e) { + const self = this; + return ((() => { + return e instanceof outer.Neg.class ? ((d) => 0 - self.eval(d))(e.expr) : super.eval(e); + })()); + } + }); + } + get MyLang() { + const outer = this; + if (this.#MyLang === undefined) { + class MyLang extends outer.EvalNeg(Mixin2.EvalBase(Object)) { + constructor() { + super(); + } + } + this.#MyLang = new MyLang(); + this.#MyLang.class = MyLang; + } + return this.#MyLang; + } + get Neg() { + const outer = this; + if (this.#Neg === undefined) { + class Neg { + #expr; + get expr() { return this.#expr; } + constructor(expr) { + this.#expr = expr; + } + }; + this.#Neg = ((expr) => Object.freeze(new Neg(expr))); + this.#Neg.class = Neg; + } + return this.#Neg; + } + $init() { + const self = this; + self.show; + } +}; +Mixin1.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Mixin2.js b/driver/js/src/test/esprojects/js/mlscript/Mixin2.js new file mode 100644 index 000000000..a919d7a5a --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Mixin2.js @@ -0,0 +1,67 @@ +export const Mixin2 = new class Mixin2 { + #Add; + #Lit; + constructor() { + } + eval(e) { + const self = this; + return ((() => { + let a; + return (a = e, a instanceof self.Lit.class ? ((n) => n)(e.n) : a instanceof self.Add.class ? ((l) => ((r) => self.eval(l) + self.eval(r))(e.rhs))(e.lhs) : (() => { + throw new Error("non-exhaustive case expression"); + })()); + })()); + } + EvalBase(base) { + const outer = this; + return (class EvalBase extends base { + constructor(...rest) { + super(...rest); + } + eval(e) { + const self = this; + return ((() => { + let a; + return (a = e, a instanceof outer.Lit.class ? ((n) => n)(e.n) : a instanceof outer.Add.class ? ((l) => ((r) => self.eval(l) + self.eval(r))(e.rhs))(e.lhs) : (() => { + throw new Error("non-exhaustive case expression"); + })()); + })()); + } + }); + } + get Add() { + const outer = this; + if (this.#Add === undefined) { + class Add { + #lhs; + get lhs() { return this.#lhs; } + #rhs; + get rhs() { return this.#rhs; } + constructor(lhs, rhs) { + this.#lhs = lhs; + this.#rhs = rhs; + } + }; + this.#Add = ((lhs, rhs) => Object.freeze(new Add(lhs, rhs))); + this.#Add.class = Add; + } + return this.#Add; + } + get Lit() { + const outer = this; + if (this.#Lit === undefined) { + class Lit { + #n; + get n() { return this.#n; } + constructor(n) { + this.#n = n; + } + }; + this.#Lit = ((n) => Object.freeze(new Lit(n))); + this.#Lit.class = Lit; + } + return this.#Lit; + } + $init() {} +}; +Mixin2.$init(); diff --git a/driver/js/src/test/esprojects/mlscript/Mixin1.mls b/driver/js/src/test/esprojects/mlscript/Mixin1.mls new file mode 100644 index 000000000..52d636559 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Mixin1.mls @@ -0,0 +1,17 @@ +import "./Mixin2.mls" + +class Neg(expr: A) + +mixin EvalNeg { + fun eval(e) = + if e is Neg(d) then 0 - this.eval(d) + else super.eval(e) +} + +module MyLang extends Mixin2.EvalBase, EvalNeg + +fun show = + let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) + console.log(MyLang.eval(program)) + +show diff --git a/driver/js/src/test/esprojects/mlscript/Mixin2.mls b/driver/js/src/test/esprojects/mlscript/Mixin2.mls new file mode 100644 index 000000000..d860a3b4b --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Mixin2.mls @@ -0,0 +1,14 @@ +export class Add(lhs: E, rhs: E) +export class Lit(n: Int) + +fun eval(e) = + if e is + Lit(n) then n + Add(l, r) then eval(l) + eval(r) + +export mixin EvalBase { + fun eval(e) = + if e is + Lit(n) then n: Int + Add(l, r) then this.eval(l) + this.eval(r) +} diff --git a/driver/js/src/test/output/Mixin1.check b/driver/js/src/test/output/Mixin1.check new file mode 100644 index 000000000..d81cc0710 --- /dev/null +++ b/driver/js/src/test/output/Mixin1.check @@ -0,0 +1 @@ +42 diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index ba963ded2..39c704da4 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -106,7 +106,8 @@ object DriverDiffTests { driverEntry("TyperDebug"), driverEntry("Debug1"), driverEntry("Child", expectTypeError = true), - driverEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true) + driverEntry("NewTSClass", Some("./tsconfig.json"), expectTypeError = true), + driverEntry("Mixin1", expectTypeError = true) ) private val cjsCases = List( diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 3c05a7c8d..4c04ecc49 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -632,7 +632,11 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { def resolveSelection(restNames: Ls[Str], nested: Ls[NuTypeDef], res: JSExpr): JSExpr = restNames match { case name :: Nil => nested.find(_.nme.name === name).fold( throw CodeGenError(s"parent $name not found.") - )(p => if (p.isPlainJSClass) res.member(name) else res.member(name).member("class")) + )(p => + if (p.kind === Mxn) JSInvoke(res.member(name), Ls(base)) + else if (p.isPlainJSClass) res.member(name) + else res.member(name).member("class") + ) case cur :: rest => (nested.find { case nd: NuTypeDef => nd.kind === Mod && nd.nme.name === cur case _ => false @@ -643,6 +647,8 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { } scope.resolveValue(top) match { case Some(sym: ModuleSymbol) => resolveSelection(rest, sym.nested, JSIdent(sym.lexicalName)) + case Some(CapturedSymbol(out, sym: MixinSymbol)) => + JSInvoke(resolveSelection(rest, sym.nested, JSIdent(out.runtimeName).member(sym.lexicalName)), Ls(base)) case Some(CapturedSymbol(out, sym: ModuleSymbol)) => resolveSelection(rest, sym.nested, JSIdent(out.runtimeName).member(sym.lexicalName)) case _ => throw CodeGenError(s"type selection ${fullname.mkString(".")} is not supported in inheritance now.") From a28fde49c4eca93e682165e5e315a4e2afb8aa9c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Jul 2023 10:09:21 +0800 Subject: [PATCH 189/202] WIP: Fix several problem --- driver/js/src/main/scala/driver/Driver.scala | 6 +++-- .../src/main/scala/driver/DriverHelper.scala | 26 +++++++++++-------- driver/npm/package.json | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index e667b07ee..3b0cc981f 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -240,6 +240,7 @@ class Driver(options: DriverOptions) { } val mlsiFile = normalize(s"${file.workDir}/${file.interfaceFilename}") + val jsFile = s"${options.outputDir}/${file.jsFilename}" val mlsiWriter = JSWriter(mlsiFile) implicit val raise: Raise = (diag: Diagnostic) => report(diag, mlsiWriter.writeErr) parseAndRun(file.filename, { @@ -279,7 +280,8 @@ class Driver(options: DriverOptions) { compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) || r }) - if (!dependentRecompile && !gitHelper.filter(file.filename)) return false + if (!dependentRecompile && !gitHelper.filter(file.filename) && JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile)) + return false System.out.println(s"compiling ${file.filename}...") val importedSym = (try { otherList.map(d => importModule(file.`import`(d))) } @@ -301,7 +303,7 @@ class Driver(options: DriverOptions) { mlsiWriter.write(interfaces) mlsiWriter.close() if (Driver.totalErrors == 0) - generate(Pgrm(definitions), s"${options.outputDir}/${file.jsFilename}", file.moduleName, imports.map( + generate(Pgrm(definitions), jsFile, file.moduleName, imports.map( imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala index f5226f281..77c359ebf 100644 --- a/driver/js/src/main/scala/driver/DriverHelper.scala +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -23,18 +23,22 @@ object DriverHelper { ): Unit = { System.out.println(s"start watching $workDir") val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) - watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { - val driver = Driver(options) - driver.genPackageJson() - val res = driver.execute + watcher.watch(workDir, + js.Dictionary("ignoreInitial" -> true, "ignored" -> "(.*\\.mlsi) | (.*\\.js)") + ).on("all", (event: js.Dynamic, file: js.Dynamic) => { + if (event.toString() === "change" || event.toString() === "add") { + val driver = Driver(options) + driver.genPackageJson() + val res = driver.execute - import DriverResult._ - res match { - case Error => System.err.println(s"Compiling error(s) found in $filename.") - case TypeError => System.err.println(s"Type error(s) found in $filename") - case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") - case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") - case OK => () + import DriverResult._ + res match { + case Error => System.err.println(s"Compiling error(s) found in $filename.") + case TypeError => System.err.println(s"Type error(s) found in $filename") + case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") + case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") + case OK => () + } } }) } diff --git a/driver/npm/package.json b/driver/npm/package.json index 871a2f9b1..20bcf98b5 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,6 +1,6 @@ { "name": "mlscript-driver", - "version": "0.0.2", + "version": "0.0.3", "description": "mlscript driver", "types": "lib/index.d.ts", "main": "lib/index.js", From 1ed0827a36619bf292a988f619ca57c79035cc9e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Tue, 18 Jul 2023 14:01:24 +0800 Subject: [PATCH 190/202] WIP: Add README --- driver/npm/README.md | 42 +++++++++++++++++++++++++++++++++++++++++ driver/npm/package.json | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/driver/npm/README.md b/driver/npm/README.md index 2529f3cbd..10d7076d6 100644 --- a/driver/npm/README.md +++ b/driver/npm/README.md @@ -1 +1,43 @@ # MLscript Driver + +**This is a pre-release of MLscript driver.** + +## Quick Start +To install MLscript driver, you can use `npm`: +```shell +npm i mlscript-driver +``` + +The newest version is recommended: there may be lots of bugs in the previous versions. + +To watch the project directory, you can use TypeScript(recommended)/JavaScript: +```ts +import driver from "mlscript-driver" + +// filename: string, workDir: string, outputDir: string, tsconfig: string, commonJS: boolean, expectTypeError: boolean +driver.watch("./mlscript/Main.mls", "./", "./js/", "./tsconfig.json", false, true) +``` + +The path must start with `./`, or it will be treated as `node_modules` paths. + +If you need to interoperate with TypeScript, you must provide the path of `tsconfig.json` file. +Otherwise, it is optional. + +You can choose to use CommonJS or ES modules(recommended). + +Since Mlscript is still under development, type inferences are not fully supported. +If there is a type error but it is correct, please set the `expectTypeError` flag to `true`. +To get the type error messages, please check the corresponding `.mlsi` files in `.interfaces`. + +For more details, you can check the demo [here](https://github.com/NeilKleistGao/mlscript-driver-demo). + +## Project Structure +The MLscript driver uses `git` to track the file changes. +Please make sure your project locates in a git repo. + +Though not necessary, we still recommend you organize the project in this structure: +- `.interfaces`: temporary interface files generated by MLscript driver. +- `mlscript`: directory for MLscript files. +- `node_modules`: third-party libraries in TypeScript. +- `ts`: directory for TypeScript files. +- configuration files: `package.json` and `tsconfig.json` should locate in the root directory. diff --git a/driver/npm/package.json b/driver/npm/package.json index 20bcf98b5..61265cb13 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,6 +1,6 @@ { "name": "mlscript-driver", - "version": "0.0.3", + "version": "0.0.4", "description": "mlscript driver", "types": "lib/index.d.ts", "main": "lib/index.js", From 18c9ecf2f9a3f58c5e07bc7b1e10d1d02cbc258f Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 20 Jul 2023 10:10:35 +0800 Subject: [PATCH 191/202] Fix watch file type and rename package --- .../js/src/main/scala/driver/DriverHelper.scala | 7 +++---- driver/npm/README.md | 16 ++++++++-------- driver/npm/lib/index.d.ts | 6 +++--- driver/npm/package.json | 8 ++++---- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala index 77c359ebf..5e35328aa 100644 --- a/driver/js/src/main/scala/driver/DriverHelper.scala +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -23,10 +23,9 @@ object DriverHelper { ): Unit = { System.out.println(s"start watching $workDir") val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) - watcher.watch(workDir, - js.Dictionary("ignoreInitial" -> true, "ignored" -> "(.*\\.mlsi) | (.*\\.js)") - ).on("all", (event: js.Dynamic, file: js.Dynamic) => { - if (event.toString() === "change" || event.toString() === "add") { + watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { + val filename = file.toString() + if ((event.toString() === "change" || event.toString() === "add") && (filename.endsWith("ts") || filename.endsWith("mls"))) { val driver = Driver(options) driver.genPackageJson() val res = driver.execute diff --git a/driver/npm/README.md b/driver/npm/README.md index 10d7076d6..bd53f8107 100644 --- a/driver/npm/README.md +++ b/driver/npm/README.md @@ -1,21 +1,21 @@ -# MLscript Driver +# MLscript -**This is a pre-release of MLscript driver.** +**This is a pre-release of MLscript.** ## Quick Start -To install MLscript driver, you can use `npm`: +To install MLscript, you can use `npm`: ```shell -npm i mlscript-driver +npm i mlscript ``` The newest version is recommended: there may be lots of bugs in the previous versions. To watch the project directory, you can use TypeScript(recommended)/JavaScript: ```ts -import driver from "mlscript-driver" +import mlscript from "mlscript" // filename: string, workDir: string, outputDir: string, tsconfig: string, commonJS: boolean, expectTypeError: boolean -driver.watch("./mlscript/Main.mls", "./", "./js/", "./tsconfig.json", false, true) +mlscript.watch("./mlscript/Main.mls", "./", "./js/", "./tsconfig.json", false, true) ``` The path must start with `./`, or it will be treated as `node_modules` paths. @@ -32,11 +32,11 @@ To get the type error messages, please check the corresponding `.mlsi` files in For more details, you can check the demo [here](https://github.com/NeilKleistGao/mlscript-driver-demo). ## Project Structure -The MLscript driver uses `git` to track the file changes. +The MLscript uses `git` to track the file changes. Please make sure your project locates in a git repo. Though not necessary, we still recommend you organize the project in this structure: -- `.interfaces`: temporary interface files generated by MLscript driver. +- `.interfaces`: temporary interface files generated by MLscript. - `mlscript`: directory for MLscript files. - `node_modules`: third-party libraries in TypeScript. - `ts`: directory for TypeScript files. diff --git a/driver/npm/lib/index.d.ts b/driver/npm/lib/index.d.ts index 7a722af9d..358a69f4b 100644 --- a/driver/npm/lib/index.d.ts +++ b/driver/npm/lib/index.d.ts @@ -1,4 +1,4 @@ -declare interface Driver { +declare interface MLscript { watch( filename: string, workDir: string, @@ -17,5 +17,5 @@ declare interface Driver { ); } -declare const driver: Driver -export = driver; +declare const mlscript: MLscript +export = mlscript; diff --git a/driver/npm/package.json b/driver/npm/package.json index 61265cb13..9597264a2 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,7 +1,7 @@ { - "name": "mlscript-driver", - "version": "0.0.4", - "description": "mlscript driver", + "name": "mlscript", + "version": "0.0.1-beta.3", + "description": "mlscript", "types": "lib/index.d.ts", "main": "lib/index.js", "scripts": { @@ -14,7 +14,7 @@ "functional-programming", "type-inference" ], - "author": "hkust-taco", + "author": "HKUST TACO Lab", "license": "MIT", "bugs": { "url": "https://github.com/hkust-taco/mlscript/issues" From 2a107bfc3bf8d4035d89c6db36d7a2a9c48638ae Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 27 Jul 2023 16:19:47 +0800 Subject: [PATCH 192/202] Fix several problems --- .../src/main/scala/driver/DriverHelper.scala | 32 +++++++++++-------- driver/npm/package.json | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/driver/js/src/main/scala/driver/DriverHelper.scala b/driver/js/src/main/scala/driver/DriverHelper.scala index 5e35328aa..cb53f80a1 100644 --- a/driver/js/src/main/scala/driver/DriverHelper.scala +++ b/driver/js/src/main/scala/driver/DriverHelper.scala @@ -23,22 +23,26 @@ object DriverHelper { ): Unit = { System.out.println(s"start watching $workDir") val options = DriverOptions(filename, workDir, s"${g.__dirname}/predefs/", outputDir, tsconfig, ".interfaces", commonJS, expectTypeError, false, false) - watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { - val filename = file.toString() - if ((event.toString() === "change" || event.toString() === "add") && (filename.endsWith("ts") || filename.endsWith("mls"))) { - val driver = Driver(options) - driver.genPackageJson() - val res = driver.execute + def compile() = { + val driver = Driver(options) + driver.genPackageJson() + val res = driver.execute - import DriverResult._ - res match { - case Error => System.err.println(s"Compiling error(s) found in $filename.") - case TypeError => System.err.println(s"Type error(s) found in $filename") - case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") - case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") - case OK => () - } + import DriverResult._ + res match { + case Error => System.err.println(s"Compiling error(s) found in $filename.") + case TypeError => System.err.println(s"Type error(s) found in $filename") + case ExpectError => System.err.println(s"Expect compiling error(s) in $filename") + case ExpectTypeError => System.err.println(s"Expect type error(s) in $filename") + case OK => System.out.println("Finished") } + } + + compile() + watcher.watch(workDir, js.Dictionary("ignoreInitial" -> true)).on("all", (event: js.Dynamic, file: js.Dynamic) => { + val filename = file.toString() + if ((event.toString() === "change" || event.toString() === "add") && (filename.endsWith("ts") || filename.endsWith("mls"))) + compile() }) } diff --git a/driver/npm/package.json b/driver/npm/package.json index 9597264a2..59c15fba2 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,6 +1,6 @@ { "name": "mlscript", - "version": "0.0.1-beta.3", + "version": "0.0.1-beta.4", "description": "mlscript", "types": "lib/index.d.ts", "main": "lib/index.js", From 1a65bb953af99fee8a08dc420276b570a1912d78 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 14 Sep 2023 17:04:56 +0800 Subject: [PATCH 193/202] Fix inexhaustive match --- shared/src/main/scala/mlscript/TyperDatatypes.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index 6ab5494f2..d353b3b38 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -403,7 +403,8 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => case (_: SkolemTag | _: Extruded, _: ObjectTag) => 1 case (_: SkolemTag, _: Extruded) => -1 case (_: Extruded, _: SkolemTag) => 1 - case (_: UnusableLike, _) => 2 + case (_, _: UnusableLike) => -1 + case (_: UnusableLike, _) => 1 } } From 3a9e6be7caf12e465cd416eb5c0efabc8dd3f65c Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 15 Sep 2023 10:40:31 +0800 Subject: [PATCH 194/202] Improve recompile track --- driver/js/src/main/scala/driver/Driver.scala | 4 ++-- ts2mls/js/src/main/scala/ts2mls/JSWriter.scala | 3 ++- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 45b6ec50e..95a7792ea 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -234,7 +234,6 @@ class Driver(options: DriverOptions) { stack: List[String] ): Bool = { if (!isMLScirpt(file.filename)) { // TypeScript - System.out.println(s"generating interface for ${file.filename}...") val tsprog = TSProgram(file, true, options.tsconfig, checkTSInterface, S(gitHelper)) return tsprog.generate @@ -281,7 +280,8 @@ class Driver(options: DriverOptions) { compile(newFilename, true)(newCtx, newExtrCtx, newVars, stack :+ file.filename) || r }) - if (!dependentRecompile && !gitHelper.filter(file.filename) && JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile)) + if (!dependentRecompile && !gitHelper.filter(file.filename) && !gitHelper.filter(mlsiFile) && + JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile)) return false System.out.println(s"compiling ${file.filename}...") diff --git a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala index 100792d20..890c9fe65 100644 --- a/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/JSWriter.scala @@ -17,11 +17,12 @@ class JSWriter(filename: String) { def writeErr(str: String): Unit = err ++= s"//| $str\n" def writeDbg(str: String): Unit = str.split("\n").foreach(s => dbg ++= s"//| $s\n") - def close(): Unit = { + def close(): Boolean = { val str = buffer.toString() + dbg.toString() + err.toString() val origin = readFile(filename).getOrElse("") val updated = str =/= origin if (updated) writeFile(filename, str) + updated } def getContent: String = buffer.toString() diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index add14a8e3..11e9ec291 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -74,6 +74,7 @@ class TSProgram( }) if (!dependentRecompile && !shouldRecompile(filename, interfaceFilename)) return false + System.out.println(s"generating interface for ${file.filename}...") sourceFile.parse val writer = JSWriter(interfaceFilename) @@ -119,8 +120,7 @@ class TSProgram( typer(file, writer) writer.close() } - - true + else false } private def generate(writer: JSWriter, globalNamespace: TSNamespace, moduleName: String, commonJS: Boolean): Unit = From bf12c7648720aa7b0a83a49025d02ab69ca67bc1 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 15 Sep 2023 10:52:54 +0800 Subject: [PATCH 195/202] Update version --- driver/npm/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driver/npm/package.json b/driver/npm/package.json index 59c15fba2..40e715b89 100644 --- a/driver/npm/package.json +++ b/driver/npm/package.json @@ -1,6 +1,6 @@ { "name": "mlscript", - "version": "0.0.1-beta.4", + "version": "0.0.1-beta.5", "description": "mlscript", "types": "lib/index.d.ts", "main": "lib/index.js", From 04a464a1159cf137ccd74d42104e41100d13331e Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 16 Sep 2023 11:35:09 +0800 Subject: [PATCH 196/202] Refactor code --- driver/js/src/main/scala/driver/Driver.scala | 78 ++++++++++--------- .../src/test/cjsprojects/js/mlscript/Call.js | 2 +- .../js/src/test/esprojects/js/mlscript/C.js | 2 +- .../esprojects/js/mlscript/MyPartialOrder.js | 2 +- .../src/main/scala/mlscript/NewParser.scala | 1 - .../src/main/scala/mlscript/NuTypeDefs.scala | 2 +- shared/src/main/scala/mlscript/syntax.scala | 10 +-- .../main/scala/ts2mls/TSCompilerInfo.scala | 1 + ts2mls/js/src/main/scala/ts2mls/TSData.scala | 3 +- .../js/src/main/scala/ts2mls/TSProgram.scala | 2 +- .../src/main/scala/ts2mls/TSSourceFile.scala | 12 +-- 11 files changed, 59 insertions(+), 56 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 95a7792ea..e6ff761f4 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -4,10 +4,9 @@ import scala.scalajs.js import mlscript.utils._ import mlscript._ import mlscript.utils.shorthands._ -import scala.collection.mutable.{ListBuffer,Map => MutMap, Set => MutSet} +import scala.collection.mutable.{ListBuffer, Map => MutMap, Set => MutSet} import mlscript.codegen._ import mlscript.Message._ -import mlscript.{NewLexer, NewParser, ErrorReport, Origin, Diagnostic} import ts2mls.{TSProgram, TypeScript, TSPathResolver, JSFileSystem, JSWriter, FileInfo, JSGitHelper} class Driver(options: DriverOptions) { @@ -17,9 +16,11 @@ class Driver(options: DriverOptions) { private val gitHelper = JSGitHelper(".", options.path, options.forceIfNoChange) + private var totalErrors = 0 + private var totalTypeErrors = 0 private var dbgWriter: Option[JSWriter] = None private def printDbg(msg: String) = - dbgWriter.fold(())(writer => writer.writeDbg(msg.replace("\t", " "))) + dbgWriter.foreach(writer => writer.writeDbg(msg.replace("\t", " "))) private val typer = new mlscript.Typer( @@ -43,7 +44,7 @@ class Driver(options: DriverOptions) { private val noRedundantOutput = (s: String) => () private val importedModule = MutSet[String]() - private val dbdFiles = MutSet[String]() + private val dbgFiles = MutSet[String]() private implicit val config = TypeScript.parseOption(options.path, options.tsconfig) import TSPathResolver.{normalize, isLocal, isMLScirpt, dirname} @@ -71,8 +72,8 @@ class Driver(options: DriverOptions) { def execute: DriverResult = try { - Driver.totalErrors = 0 - Driver.totalTypeErrors = 0 + totalErrors = 0 + totalTypeErrors = 0 implicit var ctx: Ctx = Ctx.init implicit val raise: Raise = (diag: Diagnostic) => report(diag, printErr) implicit val extrCtx: Opt[typer.ExtrCtx] = N @@ -81,10 +82,10 @@ class Driver(options: DriverOptions) { initTyper val res = compile(FileInfo(options.path, options.filename, options.interfaceDir), false) if (!res) OK // Not changed. - else if (Driver.totalErrors > 0 && !options.expectError) Error - else if (Driver.totalErrors == 0 && options.expectError) ExpectError - else if (Driver.totalTypeErrors > 0 && !options.expectTypeError) TypeError - else if (Driver.totalErrors > 0 && !options.expectError) ExpectTypeError + else if (totalErrors > 0 && !options.expectError) Error + else if (totalErrors == 0 && options.expectError) ExpectError + else if (totalTypeErrors > 0 && !options.expectTypeError) TypeError + else if (totalErrors > 0 && !options.expectError) ExpectTypeError else OK } catch { @@ -95,8 +96,10 @@ class Driver(options: DriverOptions) { def genPackageJson(): Unit = { val content = // TODO: more settings? - if (!options.commonJS) "{ \"type\": \"module\" }\n" - else "{ \"type\": \"commonjs\" }\n" + if (!options.commonJS) + """{ "type": "module" }""" + "\n" + else + """{ "type": "commonjs" }""" + "\n" saveToFile(s"${options.outputDir}/package.json", content) } @@ -108,7 +111,7 @@ class Driver(options: DriverOptions) { val lines = content.splitSane('\n').toIndexedSeq lines.headOption match { case S(head) if (head.startsWith("//") && head.endsWith(":d")) => - dbdFiles.add(filename) + dbgFiles.add(filename) typer.dbg = true case _ => () } @@ -222,6 +225,7 @@ class Driver(options: DriverOptions) { `type`(TypingUnit(mod :: Nil), false, noRedundantOutput)(ctx, noRedundantRaise, extrCtx, vars) mod :: Nil }) + case _: Throwable => throw ErrorReport(msg"Cannot import file ${file.filename}" -> None :: Nil, true, Diagnostic.Compilation) } private def compile( @@ -281,8 +285,7 @@ class Driver(options: DriverOptions) { }) if (!dependentRecompile && !gitHelper.filter(file.filename) && !gitHelper.filter(mlsiFile) && - JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile)) - return false + JSFileSystem.exists(mlsiFile) && JSFileSystem.exists(jsFile)) return false System.out.println(s"compiling ${file.filename}...") val importedSym = (try { otherList.map(d => importModule(file.`import`(d))) } @@ -303,7 +306,7 @@ class Driver(options: DriverOptions) { mlsiWriter.write(interfaces) mlsiWriter.close() - if (Driver.totalErrors == 0) + if (totalErrors == 0) generate(Pgrm(definitions), jsFile, file.moduleName, imports.map( imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) @@ -313,9 +316,9 @@ class Driver(options: DriverOptions) { else `type`(TypingUnit(declarations), false, mlsiWriter.writeErr) // For ts/mlsi files, we only check interface files - if (dbdFiles.contains(file.filename)) { + if (dbgFiles.contains(file.filename)) { typer.dbg = false - dbdFiles.remove(file.filename) + dbgFiles.remove(file.filename) () } } @@ -340,11 +343,27 @@ class Driver(options: DriverOptions) { } catch { case CodeGenError(err) => totalErrors += 1 - saveToFile(filename, s"//| codegen error: $err") + saveToFile(filename, s"//| codegen error: $err\n") case t : Throwable => totalErrors += 1 - saveToFile(filename, s"//| unexpected error: ${t.toString()}") + saveToFile(filename, s"//| unexpected error: ${t.toString()}\n") + } + + private def report(diag: Diagnostic, output: Str => Unit): Unit = { + diag match { + case ErrorReport(msg, loco, src) => + src match { + case Diagnostic.Lexing => + totalErrors += 1 + case Diagnostic.Parsing => + totalErrors += 1 + case _ => + totalTypeErrors += 1 + } + case WarningReport(msg, loco, src) => () } + Diagnostic.report(diag, output, 0, false, true) + } } object Driver { @@ -359,28 +378,11 @@ object Driver { private def printErr(msg: String): Unit = System.err.println(msg) - private var totalErrors = 0 - private var totalTypeErrors = 0 + private def saveToFile(filename: String, content: String) = { val writer = JSWriter(filename) writer.write(content) writer.close() } - - private def report(diag: Diagnostic, output: Str => Unit): Unit = { - diag match { - case ErrorReport(msg, loco, src) => - src match { - case Diagnostic.Lexing => - totalErrors += 1 - case Diagnostic.Parsing => - totalErrors += 1 - case _ => - totalTypeErrors += 1 - } - case WarningReport(msg, loco, src) => () - } - Diagnostic.report(diag, output, 0, false, true) - } } diff --git a/driver/js/src/test/cjsprojects/js/mlscript/Call.js b/driver/js/src/test/cjsprojects/js/mlscript/Call.js index 43237d67e..f03b0168f 100644 --- a/driver/js/src/test/cjsprojects/js/mlscript/Call.js +++ b/driver/js/src/test/cjsprojects/js/mlscript/Call.js @@ -1 +1 @@ -//| codegen error: unresolved symbol g \ No newline at end of file +//| codegen error: unresolved symbol g diff --git a/driver/js/src/test/esprojects/js/mlscript/C.js b/driver/js/src/test/esprojects/js/mlscript/C.js index 978d4e339..d1a6e66e9 100644 --- a/driver/js/src/test/esprojects/js/mlscript/C.js +++ b/driver/js/src/test/esprojects/js/mlscript/C.js @@ -1 +1 @@ -//| codegen error: unresolved symbol A \ No newline at end of file +//| codegen error: unresolved symbol A diff --git a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js index 57f4d1f6a..d0f503cbe 100644 --- a/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js +++ b/driver/js/src/test/esprojects/js/mlscript/MyPartialOrder.js @@ -1 +1 @@ -//| codegen error: parent BoundedMeetSemilattice not found. \ No newline at end of file +//| codegen error: parent BoundedMeetSemilattice not found. diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index e94b3b6ba..58671b647 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -324,7 +324,6 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo S(res, _cur) } } - final def block(prev: Ls[IfBody \/ Statement])(implicit et: ExpectThen, fe: FoundErr): Ls[IfBody \/ Statement] = cur match { case Nil => prev.reverse diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index f38b9ba79..eca901d95 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -1071,7 +1071,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val fd = NuFunDef((a.fd.isLetRec, b.fd.isLetRec) match { case (S(a), S(b)) => S(a || b) case _ => N // if one is fun, then it will be fun - }, a.fd.nme, N, a.fd.tparams, a.fd.rhs)(a.fd.declareLoc, a.fd.exportLoc, N, a.fd.outer orElse b.fd.outer) + }, a.fd.nme, N/*no sym name?*/, a.fd.tparams, a.fd.rhs)(a.fd.declareLoc, a.fd.exportLoc, N, a.fd.outer orElse b.fd.outer) S(TypedNuFun(a.level, fd, a.bodyType & b.bodyType)(a.isImplemented || b.isImplemented)) case (a: NuParam, S(b: NuParam)) => S(NuParam(a.nme, a.ty && b.ty)(a.level)) diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index 80b4a34c2..0a4f11dce 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -122,11 +122,11 @@ trait IdentifiedTerm sealed abstract class SimpleTerm extends Term with IdentifiedTerm with SimpleTermImpl sealed trait Statement extends StatementImpl -final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement -final case class DataDefn(body: Term) extends Statement -final case class DatatypeDefn(head: Term, body: Term) extends Statement -final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } -class Import(val path: Str) extends Statement +final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement +final case class DataDefn(body: Term) extends Statement +final case class DatatypeDefn(head: Term, body: Term) extends Statement +final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } +class Import(val path: Str) extends Statement object Import { def apply(path: Str): Import = new Import(path) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala index 998ee5551..844dfccae 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSCompilerInfo.scala @@ -22,6 +22,7 @@ object TypeScript { private val sys: js.Dynamic = ts.sys private val process: js.Dynamic = g.require("process") + // * For other platforms, we need to invoke `toLowerCase` on the resolved names, or the file would not be found. lazy val isLinux: Boolean = process.platform.toString().toLowerCase === "linux" // tsconfig.json diff --git a/ts2mls/js/src/main/scala/ts2mls/TSData.scala b/ts2mls/js/src/main/scala/ts2mls/TSData.scala index a08bcce8c..4d6ec419b 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSData.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSData.scala @@ -3,6 +3,7 @@ package ts2mls import scala.scalajs.js import js.DynamicImplicits._ import js.JSConverters._ +import mlscript.utils._ abstract class TSAny(v: js.Dynamic) { val isUndefined: Boolean = js.isUndefined(v) @@ -81,7 +82,7 @@ class TSLineStartsHelper(arr: js.Dynamic) extends TSAny(arr) { if (isUndefined) throw new AssertionError("can not read line starts from the source file.") // line, column in string - def getPos(pos: js.Dynamic): (String, String) = if (js.isUndefined(pos)) ("-1", "-1") else { + def getPos(pos: js.Dynamic): (String, String) = if (js.isUndefined(pos)) die else { val len = arr.length def run(index: Int): (String, String) = if (index >= len) throw new AssertionError(s"invalid pos parameter $pos.") diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 11e9ec291..4afe533d4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -8,7 +8,7 @@ import scala.collection.mutable.{HashSet, HashMap} // For general ts, we still consider that there is a top-level module // and in mls we will import ts file like this: // `import * as TopLevelModuleName from "filename"`. -// For es5.d.ts, we only need to translate everything +// For es5.d.ts and dom.d.ts, we only need to translate everything // and it will be imported without top-level module before we compile other files class TSProgram( file: FileInfo, diff --git a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala index 12ccdff1f..983391df1 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSSourceFile.scala @@ -229,7 +229,7 @@ class TSSourceFile(sf: js.Dynamic, val global: TSNamespace, topName: String)(imp // Parse object literal types private def getObjectLiteralMembers(props: TSNodeArray)(implicit ns: TSNamespace) = props.foldLeft(Map[String, TSMemberType]())((mp, p) => { - mp ++ Map(p.name.escapedText -> TSMemberType(TSLiteralType(p.initToken.text, p.initToken.isStringLiteral))) + mp.updated(p.name.escapedText, TSMemberType(TSLiteralType(p.initToken.text, p.initToken.isStringLiteral))) }) // Get the type of variables in classes/named interfaces/anonymous interfaces @@ -299,20 +299,20 @@ class TSSourceFile(sf: js.Dynamic, val global: TSNamespace, topName: String)(imp others: Map[String, TSMemberType] )(implicit ns: TSNamespace): Map[String, TSMemberType] = mem match { case func: TSFunctionType => { - if (!others.contains(name)) others ++ Map(name -> TSMemberType(func, mod.getOrElse(node.modifier))) + if (!others.contains(name)) others.updated(name, TSMemberType(func, mod.getOrElse(node.modifier))) else { // TODO: handle functions' overloading val res = TSIgnoredOverload(func, name) // The implementation is always after declarations - others.removed(name) ++ Map(name -> TSMemberType(res, mod.getOrElse(node.modifier))) + others.updated(name, TSMemberType(res, mod.getOrElse(node.modifier))) } } case _ => mem match { // If the member's name is the same as the type name, we need to mark it unsupported case TSReferenceType(ref) if name === ref => - others ++ Map(name -> TSMemberType( + others.updated(name, TSMemberType( markUnsupported(node), mod.getOrElse(node.modifier) )) - case _ => others ++ Map(name -> TSMemberType(mem, mod.getOrElse(node.modifier))) + case _ => others.updated(name, TSMemberType(mem, mod.getOrElse(node.modifier))) } } @@ -344,7 +344,7 @@ class TSSourceFile(sf: js.Dynamic, val global: TSNamespace, topName: String)(imp private def getAnonymousPropertiesType(list: TSSymbolArray)(implicit ns: TSNamespace): Map[String, TSMemberType] = list.foldLeft(Map[String, TSMemberType]())((mp, p) => - mp ++ Map(p.escapedName -> TSMemberType(if (p.`type`.isUndefined) getMemberType(p.declaration) else getObjectType(p.`type`)))) + mp.updated(p.escapedName, TSMemberType(if (p.`type`.isUndefined) getMemberType(p.declaration) else getObjectType(p.`type`)))) private def parseMembers(name: String, node: TSNodeObject, isClass: Boolean)(implicit ns: TSNamespace): TSType = { val res = // Do not handle parents here. we have not had enough information so far. From 5c5cee1ee3ba2d0b17c3fc36af23a84864471729 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Thu, 26 Oct 2023 10:25:53 +0800 Subject: [PATCH 197/202] WIP: Add weak keyword --- driver/js/src/main/scala/driver/Driver.scala | 4 +-- .../src/test/esprojects/mlscript/Cycle1.mls | 2 +- shared/src/main/scala/mlscript/NewLexer.scala | 1 + .../src/main/scala/mlscript/NewParser.scala | 33 ++++++++++++------- shared/src/main/scala/mlscript/syntax.scala | 4 +-- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index e6ff761f4..ec63b4401 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -302,13 +302,13 @@ class Driver(options: DriverOptions) { val res = packTopModule(Some(file.moduleName), `type`(TypingUnit(definitions), false, mlsiWriter.writeErr).show(true)) res } - val interfaces = otherList.map(s => Import(file.translateImportToInterface(s))).foldRight(expStr)((imp, itf) => s"$imp\n$itf") + val interfaces = otherList.map(s => Import(file.translateImportToInterface(s), false)).foldRight(expStr)((imp, itf) => s"$imp\n$itf") mlsiWriter.write(interfaces) mlsiWriter.close() if (totalErrors == 0) generate(Pgrm(definitions), jsFile, file.moduleName, imports.map( - imp => new Import(resolveJSPath(file, imp.path)) with ModuleType { + imp => new Import(resolveJSPath(file, imp.path), imp.weak) with ModuleType { val isESModule = checkESModule(path, TSPathResolver.resolve(file.filename)) } ), jsBuiltinDecs ++ importedSym, exported || importedModule(file.filename)) diff --git a/driver/js/src/test/esprojects/mlscript/Cycle1.mls b/driver/js/src/test/esprojects/mlscript/Cycle1.mls index ff3eca7cb..bcf63a5f9 100644 --- a/driver/js/src/test/esprojects/mlscript/Cycle1.mls +++ b/driver/js/src/test/esprojects/mlscript/Cycle1.mls @@ -1,4 +1,4 @@ -import "./Cycle2.mls" +weak import "./Cycle2.mls" export fun f(x: Int): Int = if x is 0 then 114 diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 1835c258b..54924fdca 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -328,6 +328,7 @@ object NewLexer { "exists", "in", "out", + "weak", "import", "null", "undefined", diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 183f9a42c..f299c309a 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -328,6 +328,19 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo S(res, _cur) } } + + final def importPath: Str = yeetSpaces match { + case (LITVAL(StrLit(path)), _) :: _ => + consume + path + case c => + val (tkstr, loc) = c.headOption.fold(("end of input", lastLoc))(_.mapFirst(_.describe).mapSecond(some)) + err(( + msg"Expected a module path; found ${tkstr} instead" -> loc :: Nil)) + "" + } + + final def block(prev: Ls[IfBody \/ Statement])(implicit et: ExpectThen, fe: FoundErr): Ls[IfBody \/ Statement] = cur match { case Nil => prev.reverse @@ -352,19 +365,17 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo } case c => val t = c match { + case (KEYWORD("weak"), l0) :: (SPACE, l1) :: (KEYWORD("import"), l2) :: c => + consume + consume + consume + val path = importPath + val res = Import(path, true) + R(res.withLoc(S(l0 ++ l1 ++ l2 ++ res.getLoc))) case (KEYWORD("import"), l0) :: c => consume - val path = yeetSpaces match { - case (LITVAL(StrLit(path)), _) :: _ => - consume - path - case c => - val (tkstr, loc) = c.headOption.fold(("end of input", lastLoc))(_.mapFirst(_.describe).mapSecond(some)) - err(( - msg"Expected a module path; found ${tkstr} instead" -> loc :: Nil)) - "" - } - val res = Import(path) + val path = importPath + val res = Import(path, false) R(res.withLoc(S(l0 ++ res.getLoc))) case ModifierSet(mods, (KEYWORD(k @ ("class" | "infce" | "trait" | "mixin" | "type" | "module")), l0) :: c) => consume diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index f1324e77d..1bcb28752 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -126,10 +126,10 @@ final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement final case class DataDefn(body: Term) extends Statement final case class DatatypeDefn(head: Term, body: Term) extends Statement final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } -class Import(val path: Str) extends Statement +class Import(val path: Str, val weak: Bool) extends Statement object Import { - def apply(path: Str): Import = new Import(path) + def apply(path: Str, weak: Bool): Import = new Import(path, weak) } sealed trait DesugaredStatement extends Statement with DesugaredStatementImpl From 571a982c6808f7cc283ab9afb0b86355e9ebfd0d Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 27 Oct 2023 09:55:53 +0800 Subject: [PATCH 198/202] WIP: Refactor parsing --- shared/src/main/scala/mlscript/NewParser.scala | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index f299c309a..8dd2020ad 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -365,13 +365,19 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo } case c => val t = c match { - case (KEYWORD("weak"), l0) :: (SPACE, l1) :: (KEYWORD("import"), l2) :: c => + case (KEYWORD("weak"), l0) :: c => consume - consume - consume - val path = importPath - val res = Import(path, true) - R(res.withLoc(S(l0 ++ l1 ++ l2 ++ res.getLoc))) + yeetSpaces match { + case (KEYWORD("import"), l1) :: _ => + consume + val path = importPath + val res = Import(path, true) + R(res.withLoc(S(l0 ++ l1 ++ res.getLoc))) + case _ => + err(msg"Unexpected weak" -> S(l0) :: Nil) + R(errExpr) + } + case (KEYWORD("import"), l0) :: c => consume val path = importPath From 20cba24e9effaf263cb027da96456360e1eef22a Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 27 Oct 2023 10:13:42 +0800 Subject: [PATCH 199/202] Check weak import --- driver/js/src/main/scala/driver/Driver.scala | 15 +++++++++------ .../esprojects/.interfaces/mlscript/Cycle3.mlsi | 7 +++++++ .../esprojects/.interfaces/mlscript/Cycle4.mlsi | 5 +++++ .../src/test/esprojects/js/mlscript/Cycle3.js | 11 +++++++++++ .../src/test/esprojects/js/mlscript/Cycle4.js | 17 +++++++++++++++++ .../js/src/test/esprojects/mlscript/Cycle3.mls | 5 +++++ .../js/src/test/esprojects/mlscript/Cycle4.mls | 6 ++++++ .../src/test/scala/driver/DriverDiffTests.scala | 1 + 8 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi create mode 100644 driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi create mode 100644 driver/js/src/test/esprojects/js/mlscript/Cycle3.js create mode 100644 driver/js/src/test/esprojects/js/mlscript/Cycle4.js create mode 100644 driver/js/src/test/esprojects/mlscript/Cycle3.mls create mode 100644 driver/js/src/test/esprojects/mlscript/Cycle4.mls diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index ec63b4401..1843f4ecb 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -249,20 +249,23 @@ class Driver(options: DriverOptions) { implicit val raise: Raise = (diag: Diagnostic) => report(diag, mlsiWriter.writeErr) parseAndRun(file.filename, { case (definitions, declarations, imports, _) => { - val depList = imports.map(_.path) - - val (cycleList, otherList) = depList.filter(dep => { - val depFile = file.`import`(dep) + val (cycleList, otherList) = imports.filter(dep => { + val depFile = file.`import`(dep.path) if (depFile.filename === file.filename) { totalErrors += 1 mlsiWriter.writeErr(s"Cannot import ${file.filename} from itself") false } + else if (stack.contains(depFile.filename) && !dep.weak) { + totalErrors += 1 + mlsiWriter.writeErr(s"Use `weak import` to break the cycle dependency `import \"${dep.path}\"`") + false + } else true }).partitionMap { dep => { - val depFile = file.`import`(dep) + val depFile = file.`import`(dep.path) if (stack.contains(depFile.filename)) L(depFile) - else R(dep) + else R(dep.path) } } val cycleSigs = cycleList.foldLeft(Ls[TypingUnit]())((sigs, file) => { diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi new file mode 100644 index 000000000..b31dad8bb --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi @@ -0,0 +1,7 @@ +export declare module Cycle3() { + fun f: (x: Int) -> Int +} +//| Use `weak import` to break the cycle dependency `import "./Cycle4.mls"` +//| ╔══[ERROR] identifier not found: Cycle4 +//| ║ l.5: _ then Cycle4.g(x - 1) +//| ╙── ^^^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi new file mode 100644 index 000000000..721fa72ce --- /dev/null +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi @@ -0,0 +1,5 @@ +import "./Cycle3.mlsi" +export declare module Cycle4() { + fun g: (x: Int) -> Int + undefined +} diff --git a/driver/js/src/test/esprojects/js/mlscript/Cycle3.js b/driver/js/src/test/esprojects/js/mlscript/Cycle3.js new file mode 100644 index 000000000..4841153f9 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Cycle3.js @@ -0,0 +1,11 @@ +import { Cycle4 } from "./Cycle4.js" + +export const Cycle3 = new class Cycle3 { + constructor() { + } + f(x) { + return x === 0 ? 114 : Cycle4.g(x - 1); + } + $init() {} +}; +Cycle3.$init(); diff --git a/driver/js/src/test/esprojects/js/mlscript/Cycle4.js b/driver/js/src/test/esprojects/js/mlscript/Cycle4.js new file mode 100644 index 000000000..2809242d2 --- /dev/null +++ b/driver/js/src/test/esprojects/js/mlscript/Cycle4.js @@ -0,0 +1,17 @@ +import { Cycle3 } from "./Cycle3.js" + +function log(x) { + return console.info(x); +} +export const Cycle4 = new class Cycle4 { + constructor() { + } + g(x) { + return Cycle3.f(x); + } + $init() { + const qualifier = this; + log(qualifier.g(42)); + } +}; +Cycle4.$init(); diff --git a/driver/js/src/test/esprojects/mlscript/Cycle3.mls b/driver/js/src/test/esprojects/mlscript/Cycle3.mls new file mode 100644 index 000000000..b547c08c1 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Cycle3.mls @@ -0,0 +1,5 @@ +import "./Cycle4.mls" + +export fun f(x: Int): Int = if x is + 0 then 114 + _ then Cycle4.g(x - 1) diff --git a/driver/js/src/test/esprojects/mlscript/Cycle4.mls b/driver/js/src/test/esprojects/mlscript/Cycle4.mls new file mode 100644 index 000000000..d8b32f4b2 --- /dev/null +++ b/driver/js/src/test/esprojects/mlscript/Cycle4.mls @@ -0,0 +1,6 @@ +import "./Cycle3.mls" + +export fun g(x: Int): Int +export fun g(x: Int): Int = Cycle3.f(x) + +log(g(42)) diff --git a/driver/js/src/test/scala/driver/DriverDiffTests.scala b/driver/js/src/test/scala/driver/DriverDiffTests.scala index 39c704da4..aca96e608 100644 --- a/driver/js/src/test/scala/driver/DriverDiffTests.scala +++ b/driver/js/src/test/scala/driver/DriverDiffTests.scala @@ -95,6 +95,7 @@ object DriverDiffTests { private val esCases = List( driverEntry("Simple"), driverEntry("Cycle2"), + driverEntry("Cycle4", expectError = true, expectTypeError = true), driverEntry("Self", expectError = true), driverEntry("C", expectError = true, expectTypeError = true), driverEntry("TS", Some("./tsconfig.json"), expectTypeError = true), // TODO: type members From 33537709f2aa863c98c4562e3cb9771e3ac73427 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 27 Oct 2023 15:50:19 +0800 Subject: [PATCH 200/202] Merge from new-definition-typing and fix some problems --- .vscode/settings.json | 3 +- .../scala/mlscript/compiler/ClassLifter.scala | 256 ++-- .../scala/mlscript/compiler/DataType.scala | 36 + .../mlscript/compiler/DataTypeInferer.scala | 18 + .../scala/mlscript/compiler/Helpers.scala | 197 +++ .../mlscript/compiler/mono/Monomorph.scala | 334 +++++ .../compiler/mono/MonomorphContext.scala | 33 + .../compiler/mono/MonomorphError.scala | 3 + .../mono/specializer/BoundedExpr.scala | 226 ++++ .../compiler/mono/specializer/Builtin.scala | 95 ++ .../compiler/mono/specializer/Context.scala | 21 + .../mono/specializer/Predicates.scala | 6 + .../mono/specializer/Specializer.scala | 228 ++++ .../compiler/printer/ExprPrinter.scala | 73 + .../main/scala/mlscript/compiler/syntax.scala | 271 ++++ compiler/shared/test/diff/LambLift.mls | 87 ++ compiler/shared/test/diff/LiftType.mls | 46 +- compiler/shared/test/diff/Lifter.mls | 161 +-- compiler/shared/test/diff/LifterBlks.mls | 146 +- compiler/shared/test/diff/mono.mls | 1204 +++++++++++++++++ .../test/scala/mlscript/compiler/Test.scala | 30 +- doc/mls-codebase-doc.md | 377 ++++++ driver/js/src/main/scala/driver/Driver.scala | 7 +- .../cjsprojects/.interfaces/mlscript/Bar.mlsi | 2 +- .../.interfaces/mlscript/BazBaz.mlsi | 2 +- .../.interfaces/mlscript/CJS1.mlsi | 2 +- .../.interfaces/mlscript/CJS2.mlsi | 2 +- .../.interfaces/mlscript/Call.mlsi | 2 +- .../.interfaces/mlscript/Lodash.mlsi | 2 +- .../esprojects/.interfaces/mlscript/A.mlsi | 2 +- .../esprojects/.interfaces/mlscript/B.mlsi | 4 +- .../.interfaces/mlscript/Builtin.mlsi | 2 +- .../esprojects/.interfaces/mlscript/C.mlsi | 4 +- .../.interfaces/mlscript/Child.mlsi | 2 +- .../.interfaces/mlscript/Cycle1.mlsi | 4 +- .../.interfaces/mlscript/Cycle2.mlsi | 4 +- .../.interfaces/mlscript/Cycle3.mlsi | 2 +- .../.interfaces/mlscript/Cycle4.mlsi | 4 +- .../.interfaces/mlscript/Debug1.mlsi | 2 +- .../.interfaces/mlscript/Debug2.mlsi | 13 +- .../.interfaces/mlscript/Debug3.mlsi | 13 +- .../.interfaces/mlscript/Debug4.mlsi | 2 +- .../.interfaces/mlscript/MLS2TheMax.mlsi | 39 +- .../.interfaces/mlscript/Mixin1.mlsi | 8 +- .../.interfaces/mlscript/Mixin2.mlsi | 2 +- .../.interfaces/mlscript/MyPartialOrder.mlsi | 6 +- .../.interfaces/mlscript/NewTSClass.mlsi | 2 +- .../.interfaces/mlscript/Opened.mlsi | 6 +- .../.interfaces/mlscript/Output.mlsi | 4 +- .../.interfaces/mlscript/Output2.mlsi | 4 +- .../.interfaces/mlscript/Parent.mlsi | 3 +- .../esprojects/.interfaces/mlscript/Self.mlsi | 2 +- .../.interfaces/mlscript/Simple.mlsi | 4 +- .../esprojects/.interfaces/mlscript/TS.mlsi | 7 +- .../.interfaces/mlscript/TyperDebug.mlsi | 505 ++++--- .../.interfaces/mlscript/tools/Concat.mlsi | 2 +- .../.interfaces/mlscript/tools/Inc.mlsi | 2 +- .../src/test/esprojects/mlscript/Opened.mls | 2 +- driver/npm/lib/predefs/ES5.mlsi | 6 +- .../scala/mlscript/ConstraintSolver.scala | 47 +- .../src/main/scala/mlscript/JSBackend.scala | 21 +- shared/src/main/scala/mlscript/MLParser.scala | 2 +- shared/src/main/scala/mlscript/NewLexer.scala | 31 +- .../src/main/scala/mlscript/NewParser.scala | 208 ++- .../src/main/scala/mlscript/NuTypeDefs.scala | 517 +++++-- shared/src/main/scala/mlscript/Parser.scala | 2 +- .../main/scala/mlscript/TypeSimplifier.scala | 79 +- shared/src/main/scala/mlscript/Typer.scala | 192 ++- .../main/scala/mlscript/TyperDatatypes.scala | 19 +- .../main/scala/mlscript/TyperHelpers.scala | 90 +- .../main/scala/mlscript/codegen/Codegen.scala | 5 + .../main/scala/mlscript/codegen/Helpers.scala | 4 +- .../scala/mlscript/codegen/Polyfill.scala | 3 + .../main/scala/mlscript/codegen/Scope.scala | 1 + shared/src/main/scala/mlscript/helpers.scala | 76 +- shared/src/main/scala/mlscript/syntax.scala | 6 +- .../main/scala/mlscript/ucs/Desugarer.scala | 14 +- .../src/main/scala/mlscript/ucs/helpers.scala | 2 +- .../main/scala/mlscript/utils/Identity.scala | 2 +- .../main/scala/mlscript/utils/package.scala | 2 +- .../scala/mlscript/utils/shorthands.scala | 2 + shared/src/test/diff/basics/Datatypes.fun | 2 +- shared/src/test/diff/basics/Intersections.fun | 112 +- shared/src/test/diff/basics/Simplesub1.fun | 39 +- ...nalParam.mls => AuxiliaryConstructors.mls} | 263 +++- .../src/test/diff/codegen/ConstructorStmt.mls | 134 +- .../src/test/diff/codegen/FieldOverride.mls | 12 +- .../test/diff/codegen/MemberInitShadowing.mls | 2 +- shared/src/test/diff/codegen/Mixin.mls | 268 +--- .../test/diff/codegen/ModuleInheritance.mls | 24 +- shared/src/test/diff/codegen/Modules.mls | 38 + shared/src/test/diff/codegen/Nested.mls | 68 +- shared/src/test/diff/codegen/New.mls | 15 +- shared/src/test/diff/codegen/NewMatching.mls | 13 +- shared/src/test/diff/codegen/NuClasses.mls | 11 +- shared/src/test/diff/codegen/NuFuns.mls | 27 +- .../src/test/diff/codegen/NuParentheses.mls | 61 + shared/src/test/diff/codegen/NuReplHost.mls | 50 + shared/src/test/diff/codegen/ReplHost.mls | 8 +- shared/src/test/diff/codegen/Super.mls | 14 +- shared/src/test/diff/codegen/SymbolicOps.mls | 8 +- shared/src/test/diff/codegen/ValLet.mls | 66 +- .../test/diff/contys/ExplicitConstraints.mls | 6 +- .../test/diff/ecoop23/ComparePointPoly.mls | 90 ++ .../test/diff/ecoop23/ExpressionProblem.mls | 20 +- shared/src/test/diff/ecoop23/Intro.mls | 7 +- .../test/diff/ecoop23/PolymorphicVariants.mls | 120 +- .../diff/ecoop23/SimpleRegionDSL_annot.mls | 475 +++++++ ...eRegionDSL.mls => SimpleRegionDSL_raw.mls} | 60 +- .../test/diff/fcp-lit/variations_PolyML.mls | 6 +- shared/src/test/diff/fcp/Church_CT.mls | 48 +- shared/src/test/diff/fcp/FunnyId.mls | 90 +- shared/src/test/diff/fcp/ListBuild.mls | 21 +- shared/src/test/diff/fcp/NestedDataTypes.mls | 20 +- .../src/test/diff/fcp/NestedDataTypesGADT.mls | 13 +- shared/src/test/diff/fcp/NoRecursiveTypes.mls | 15 + shared/src/test/diff/fcp/OCamlList.mls | 4 +- shared/src/test/diff/fcp/Overloads.mls | 71 +- shared/src/test/diff/fcp/PaperTable.mls | 80 +- .../src/test/diff/fcp/QML_exist_Classes.mls | 169 ++- .../test/diff/fcp/QML_exist_Classes_min.mls | 22 +- .../src/test/diff/fcp/QML_exist_Records_D.mls | 78 +- .../test/diff/fcp/QML_exist_Records_ND.mls | 108 +- .../test/diff/fcp/QML_exist_Records_min_1.mls | 8 +- shared/src/test/diff/fcp/QML_exist_nu.mls | 339 +++++ shared/src/test/diff/fcp/SystemF.mls | 2 +- shared/src/test/diff/fcp/SystemF_2.mls | 150 +- shared/src/test/diff/gadt/Exp1.mls | 17 +- shared/src/test/diff/gadt/Exp2.mls | 30 +- shared/src/test/diff/gadt/ThisMatching.mls | 36 +- .../test/diff/gen/genTests_v1-0.14-15-x2.fun | 8 +- .../diff/mlf-examples/ex_casparticuliers.mls | 4 +- .../test/diff/mlf-examples/ex_concrete.mls | 4 +- shared/src/test/diff/mlf-examples/ex_demo.mls | 194 ++- .../test/diff/mlf-examples/ex_predicative.mls | 130 +- .../src/test/diff/mlf-examples/ex_selfapp.mls | 63 +- .../test/diff/mlf-examples/ex_validate.mls | 26 +- .../mlf-examples/merge_regression_min.mls | 16 +- shared/src/test/diff/mlscript/Addable.mls | 6 +- shared/src/test/diff/mlscript/BadPolym.mls | 30 +- .../src/test/diff/mlscript/ByNameByValue.mls | 8 +- shared/src/test/diff/mlscript/David2.mls | 53 +- shared/src/test/diff/mlscript/DavidB.mls | 34 +- shared/src/test/diff/mlscript/ExprProb.mls | 110 +- shared/src/test/diff/mlscript/ExprProb2.mls | 75 +- .../src/test/diff/mlscript/ExprProb_Inv.mls | 108 +- .../test/diff/mlscript/Group_2022_06_09.mls | 22 +- shared/src/test/diff/mlscript/HeadOption.mls | 26 +- shared/src/test/diff/mlscript/Neg.mls | 4 +- .../test/diff/mlscript/NestedClassArgs.mls | 79 +- .../test/diff/mlscript/NestedClassArgs_Co.mls | 20 +- .../diff/mlscript/NestedRecursiveMatch.mls | 12 +- shared/src/test/diff/mlscript/Paper.mls | 16 +- shared/src/test/diff/mlscript/PolyVariant.mls | 10 +- .../diff/mlscript/PolyVariantCodeReuse.mls | 290 ++-- shared/src/test/diff/mlscript/RecErrors.mls | 2 +- .../src/test/diff/mlscript/RecursiveTypes.mls | 129 +- shared/src/test/diff/mlscript/Repro.mls | 3 + .../src/test/diff/mlscript/RigidVariables.mls | 71 + shared/src/test/diff/mlscript/Sequence.mls | 26 + shared/src/test/diff/mlscript/Yicong.mls | 158 +-- shared/src/test/diff/mlscript/Yuheng.mls | 18 +- shared/src/test/diff/nu/AbstractClasses.mls | 34 +- shared/src/test/diff/nu/ArrayProg.mls | 33 +- shared/src/test/diff/nu/Ascription.mls | 2 +- shared/src/test/diff/nu/AuxCtors.mls | 180 +++ shared/src/test/diff/nu/BadAliases.mls | 30 +- shared/src/test/diff/nu/BadBlocks.mls | 178 +++ shared/src/test/diff/nu/BadClassInherit.mls | 112 +- shared/src/test/diff/nu/BadClasses.mls | 89 +- shared/src/test/diff/nu/BadFieldInit.mls | 132 ++ shared/src/test/diff/nu/BadMixins.mls | 1 + shared/src/test/diff/nu/BadScopes.mls | 8 +- shared/src/test/diff/nu/BadSignatures.mls | 23 +- shared/src/test/diff/nu/BadSuper.mls | 1 + shared/src/test/diff/nu/BadUCS.mls | 22 +- .../test/diff/nu/BasicClassInheritance.mls | 123 +- shared/src/test/diff/nu/BasicClasses.mls | 20 +- shared/src/test/diff/nu/BasicMixins.mls | 62 +- shared/src/test/diff/nu/CallByName.mls | 39 + shared/src/test/diff/nu/CaseExpr.mls | 168 +++ .../src/test/diff/nu/ClassInstantiation.mls | 61 + shared/src/test/diff/nu/ClassesInMixins.mls | 20 +- shared/src/test/diff/nu/CtorStatements.mls | 24 - shared/src/test/diff/nu/CtorSubtraction.mls | 37 + shared/src/test/diff/nu/Dates.mls | 13 +- shared/src/test/diff/nu/Declarations.mls | 13 +- shared/src/test/diff/nu/DeclaredMembers.mls | 2 + shared/src/test/diff/nu/DiamondInherit.mls | 16 +- shared/src/test/diff/nu/DidierNu.mls | 4 +- shared/src/test/diff/nu/EncodedLists.mls | 5 +- shared/src/test/diff/nu/EqlClasses.mls | 81 +- shared/src/test/diff/nu/Eval.mls | 256 ++++ shared/src/test/diff/nu/EvalNegNeg.mls | 12 +- .../test/diff/nu/ExpressionProblem_repro.mls | 2 +- shared/src/test/diff/nu/Extrusion.mls | 43 + shared/src/test/diff/nu/FieldRefinement.mls | 2 +- shared/src/test/diff/nu/FlatMonads.mls | 347 +++-- shared/src/test/diff/nu/FlatMonads_repro.mls | 219 +++ shared/src/test/diff/nu/FunPatterns.mls | 17 +- shared/src/test/diff/nu/FunPoly.mls | 2 +- shared/src/test/diff/nu/FunSigs.mls | 4 +- shared/src/test/diff/nu/GADTMono.mls | 80 +- .../test/diff/nu/GenericClassInheritance.mls | 61 +- shared/src/test/diff/nu/GenericClasses.mls | 65 +- shared/src/test/diff/nu/GenericMethods.mls | 48 +- shared/src/test/diff/nu/GenericMixins.mls | 27 +- shared/src/test/diff/nu/GenericModules.mls | 20 +- shared/src/test/diff/nu/HeungTung.mls | 316 +++++ shared/src/test/diff/nu/Huawei1.mls | 10 +- shared/src/test/diff/nu/IdentEscape.mls | 12 +- .../src/test/diff/nu/ImplicitMethodPolym.mls | 58 +- .../diff/nu/InferredInheritanceTypeArgs.mls | 66 +- .../diff/nu/InheritanceLevelMismatches.mls | 3 +- shared/src/test/diff/nu/InterfaceGeneric.mls | 6 +- shared/src/test/diff/nu/InterfaceMono.mls | 130 +- shared/src/test/diff/nu/Interfaces.mls | 290 ++-- .../test/diff/nu/IntraBlockPolymorphism.mls | 6 +- shared/src/test/diff/nu/Jonathan.mls | 38 +- shared/src/test/diff/nu/LetRec.mls | 43 +- shared/src/test/diff/nu/LocalLets.mls | 16 +- shared/src/test/diff/nu/MIscPoly.mls | 78 ++ shared/src/test/diff/nu/MemberConfusion.mls | 10 +- .../src/test/diff/nu/MemberIntersections.mls | 68 +- shared/src/test/diff/nu/MetaWrap.mls | 50 +- shared/src/test/diff/nu/Metaprog.mls | 65 + shared/src/test/diff/nu/MethodSignatures.mls | 20 +- shared/src/test/diff/nu/Misc.mls | 95 +- shared/src/test/diff/nu/MissingImplBug.mls | 2 +- shared/src/test/diff/nu/MissingTypeArg.mls | 94 ++ shared/src/test/diff/nu/Mixin42.mls | 24 +- shared/src/test/diff/nu/MixinParameters.mls | 36 +- shared/src/test/diff/nu/ModuleParameters.mls | 46 +- shared/src/test/diff/nu/Mut.mls | 63 + shared/src/test/diff/nu/MutualRec.mls | 66 +- shared/src/test/diff/nu/NamedArgs.mls | 432 +++++- shared/src/test/diff/nu/NestedClasses.mls | 14 +- shared/src/test/diff/nu/NestedRecords.mls | 45 + shared/src/test/diff/nu/New.mls | 2 + shared/src/test/diff/nu/NewNew.mls | 43 +- shared/src/test/diff/nu/NoThisCtor.mls | 64 +- shared/src/test/diff/nu/NuAlexJ.mls | 2 +- shared/src/test/diff/nu/NuForallTerms.mls | 4 +- .../test/diff/nu/NuPolymorphicTypeAliases.mls | 93 ++ shared/src/test/diff/nu/Object.mls | 46 +- shared/src/test/diff/nu/OpLam.mls | 2 +- shared/src/test/diff/nu/ParamImplementing.mls | 49 +- shared/src/test/diff/nu/ParamPassing.mls | 215 +++ shared/src/test/diff/nu/Parens.mls | 30 +- shared/src/test/diff/nu/PartialApp.mls | 2 +- .../test/diff/nu/PolymorphicVariants_Alt.mls | 87 +- .../test/diff/nu/PostHocMixinSignature.mls | 73 + .../test/diff/nu/PrivateMemberOverriding.mls | 57 + .../test/diff/nu/RawUnionTraitSignatures.mls | 20 +- shared/src/test/diff/nu/Refinements.mls | 2 +- shared/src/test/diff/nu/RightAssocOps.mls | 75 + shared/src/test/diff/nu/RigidVariables.mls | 44 + shared/src/test/diff/nu/SelfAppMethods.mls | 3 +- shared/src/test/diff/nu/SelfRec.mls | 133 +- shared/src/test/diff/nu/SimpleSymbolicOps.mls | 20 + shared/src/test/diff/nu/SimpleTraitImpl.mls | 130 +- shared/src/test/diff/nu/Subscripts.mls | 2 +- shared/src/test/diff/nu/TODO_Classes.mls | 187 +-- .../src/test/diff/nu/ThisRefinedClasses.mls | 44 +- shared/src/test/diff/nu/TraitSignatures.mls | 4 +- .../test/diff/nu/TrickyGenericInheritance.mls | 126 +- shared/src/test/diff/nu/TypeAliases.mls | 6 +- shared/src/test/diff/nu/TypeVariables.mls | 10 +- shared/src/test/diff/nu/TypreMembers.mls | 3 +- shared/src/test/diff/nu/Unapply.mls | 108 ++ shared/src/test/diff/nu/UnaryMinus.mls | 93 ++ shared/src/test/diff/nu/UndefMatching.mls | 22 +- shared/src/test/diff/nu/Uninstantiable.mls | 21 +- shared/src/test/diff/nu/Unit.mls | 356 ++++- shared/src/test/diff/nu/Unsupported.mls | 4 +- shared/src/test/diff/nu/ValSigs.mls | 36 +- shared/src/test/diff/nu/Vals.mls | 14 +- shared/src/test/diff/nu/Virtual.mls | 20 +- shared/src/test/diff/nu/WeirdUnions.mls | 40 +- shared/src/test/diff/nu/i180.mls | 79 ++ shared/src/test/diff/nu/repro0.mls | 9 +- shared/src/test/diff/nu/repro1.mls | 2 +- shared/src/test/diff/nu/repro_EvalNegNeg.mls | 4 +- .../diff/nu/repro_PolymorphicVariants.mls | 8 +- shared/src/test/diff/parser/Arrays.mls | 39 +- shared/src/test/diff/parser/BasicSyntax.mls | 71 +- shared/src/test/diff/parser/Blocks.mls | 25 + shared/src/test/diff/parser/Brackets.mls | 12 +- .../diff/parser/ControversialIfSplits.mls | 16 +- shared/src/test/diff/parser/Forall.mls | 20 +- shared/src/test/diff/parser/Fun.mls | 16 +- shared/src/test/diff/parser/IfThenElse.mls | 47 +- shared/src/test/diff/parser/Lambdas.mls | 40 +- shared/src/test/diff/parser/Lets.mls | 6 +- shared/src/test/diff/parser/Misc.mls | 18 +- shared/src/test/diff/parser/NamedArrays.mls | 72 +- shared/src/test/diff/parser/NegativeLits.mls | 4 +- shared/src/test/diff/parser/Subscripts.mls | 12 +- shared/src/test/diff/parser/WeirdIfs.mls | 8 +- shared/src/test/diff/parser/Where.mls | 8 +- shared/src/test/diff/scalac/i13162.mls | 131 ++ shared/src/test/diff/tapl/NuUntyped.mls | 2 +- shared/src/test/diff/tapl/SimplyTyped.mls | 323 +++-- shared/src/test/diff/tapl/Untyped.mls | 352 +++-- shared/src/test/diff/tricky/Pottier.fun | 10 +- shared/src/test/diff/ucs/AppSplits.mls | 76 ++ shared/src/test/diff/ucs/Humiliation.mls | 8 +- shared/src/test/diff/ucs/HygienicBindings.mls | 8 +- shared/src/test/diff/ucs/InterleavedLet.mls | 72 +- shared/src/test/diff/ucs/JSON.mls | 6 +- shared/src/test/diff/ucs/LitUCS.mls | 17 +- shared/src/test/diff/ucs/NestedBranches.mls | 75 +- shared/src/test/diff/ucs/NestedPattern.mls | 12 +- shared/src/test/diff/ucs/SimpleUCS.mls | 6 +- shared/src/test/diff/ucs/SplitAfterOp.mls | 4 +- shared/src/test/diff/ucs/ThenIndent.mls | 31 + shared/src/test/diff/ucs/TrivialIf.mls | 4 +- shared/src/test/diff/ucs/WeirdIf.mls | 4 +- shared/src/test/diff/ucs/zipWith.mls | 6 +- .../src/test/scala/mlscript/DiffTests.scala | 71 +- shared/src/test/scala/mlscript/NodeTest.scala | 1 + .../main/scala/ts2mls/types/Converter.scala | 4 +- ts2mls/js/src/test/diff/Cycle2.mlsi | 3 - ts2mls/js/src/test/diff/Export.mlsi | 5 +- ts2mls/js/src/test/diff/Intersection.mlsi | 2 +- ts2mls/js/src/test/diff/Optional.mlsi | 2 +- ts2mls/js/src/test/diff/TSArray.mlsi | 2 +- ts2mls/js/src/test/diff/Tuple.mlsi | 32 +- ts2mls/js/src/test/diff/Type.mlsi | 4 +- ts2mls/js/src/test/diff/TypeParameter.mlsi | 4 +- ts2mls/js/src/test/diff/Union.mlsi | 2 +- 331 files changed, 15059 insertions(+), 4920 deletions(-) create mode 100644 compiler/shared/main/scala/mlscript/compiler/DataType.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/DataTypeInferer.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/Helpers.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/Monomorph.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/MonomorphContext.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/MonomorphError.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/specializer/BoundedExpr.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/specializer/Builtin.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/specializer/Context.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/specializer/Predicates.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/mono/specializer/Specializer.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/printer/ExprPrinter.scala create mode 100644 compiler/shared/main/scala/mlscript/compiler/syntax.scala create mode 100644 compiler/shared/test/diff/LambLift.mls create mode 100644 compiler/shared/test/diff/mono.mls create mode 100644 doc/mls-codebase-doc.md rename shared/src/test/diff/codegen/{OptionalParam.mls => AuxiliaryConstructors.mls} (63%) create mode 100644 shared/src/test/diff/codegen/Modules.mls create mode 100644 shared/src/test/diff/codegen/NuParentheses.mls create mode 100644 shared/src/test/diff/codegen/NuReplHost.mls create mode 100644 shared/src/test/diff/ecoop23/ComparePointPoly.mls create mode 100644 shared/src/test/diff/ecoop23/SimpleRegionDSL_annot.mls rename shared/src/test/diff/ecoop23/{SimpleRegionDSL.mls => SimpleRegionDSL_raw.mls} (86%) create mode 100644 shared/src/test/diff/fcp/NoRecursiveTypes.mls create mode 100644 shared/src/test/diff/fcp/QML_exist_nu.mls create mode 100644 shared/src/test/diff/mlscript/RigidVariables.mls create mode 100644 shared/src/test/diff/mlscript/Sequence.mls create mode 100644 shared/src/test/diff/nu/AuxCtors.mls create mode 100644 shared/src/test/diff/nu/BadBlocks.mls create mode 100644 shared/src/test/diff/nu/BadFieldInit.mls create mode 100644 shared/src/test/diff/nu/CallByName.mls create mode 100644 shared/src/test/diff/nu/CaseExpr.mls create mode 100644 shared/src/test/diff/nu/ClassInstantiation.mls delete mode 100644 shared/src/test/diff/nu/CtorStatements.mls create mode 100644 shared/src/test/diff/nu/CtorSubtraction.mls create mode 100644 shared/src/test/diff/nu/Eval.mls create mode 100644 shared/src/test/diff/nu/Extrusion.mls create mode 100644 shared/src/test/diff/nu/FlatMonads_repro.mls create mode 100644 shared/src/test/diff/nu/HeungTung.mls create mode 100644 shared/src/test/diff/nu/MIscPoly.mls create mode 100644 shared/src/test/diff/nu/Metaprog.mls create mode 100644 shared/src/test/diff/nu/MissingTypeArg.mls create mode 100644 shared/src/test/diff/nu/NestedRecords.mls create mode 100644 shared/src/test/diff/nu/NuPolymorphicTypeAliases.mls create mode 100644 shared/src/test/diff/nu/PostHocMixinSignature.mls create mode 100644 shared/src/test/diff/nu/PrivateMemberOverriding.mls create mode 100644 shared/src/test/diff/nu/RightAssocOps.mls create mode 100644 shared/src/test/diff/nu/RigidVariables.mls create mode 100644 shared/src/test/diff/nu/SimpleSymbolicOps.mls create mode 100644 shared/src/test/diff/nu/Unapply.mls create mode 100644 shared/src/test/diff/nu/UnaryMinus.mls create mode 100644 shared/src/test/diff/nu/i180.mls create mode 100644 shared/src/test/diff/scalac/i13162.mls create mode 100644 shared/src/test/diff/ucs/AppSplits.mls create mode 100644 shared/src/test/diff/ucs/ThenIndent.mls diff --git a/.vscode/settings.json b/.vscode/settings.json index ed59a9aa7..90f301979 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,5 +13,6 @@ "other": "off", "strings": "off" } - } + }, + "files.autoSave": "off" } diff --git a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala index 30947a749..563fe2757 100644 --- a/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala +++ b/compiler/shared/main/scala/mlscript/compiler/ClassLifter.scala @@ -6,8 +6,10 @@ import mlscript.utils.shorthands.* import scala.collection.mutable.StringBuilder as StringBuilder import scala.collection.mutable.Map as MutMap import scala.collection.mutable.Set as MutSet +import scala.collection.mutable.ArrayBuffer as ArrayBuffer import mlscript.codegen.Helpers.inspect as showStructure import mlscript.codegen.CodeGenError +import mlscript.compiler.mono.MonomorphError class ClassLifter(logDebugMsg: Boolean = false) { type ClassName = String @@ -28,6 +30,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { LocalContext(vSet ++ inters.map(x => Var(x.name)), tSet -- inters) } def intersect(rst: LocalContext) = LocalContext(vSet intersect rst.vSet, tSet intersect rst.tSet) + def intersectV(rst: Set[Var]) = LocalContext(vSet.intersect(rst), tSet) def contains(v: Var) = vSet.contains(v) || tSet.contains(TypeName(v.name)) def contains(tv: TypeName) = vSet.contains(Var(tv.name)) || tSet.contains(tv) override def toString(): String = "(" ++ vSet.mkString(", ") ++ "; " ++ tSet.mkString(", ") ++ ")" @@ -37,6 +40,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { private def asContext(t: TypeName) = LocalContext(Set(), Set(t)) private def asContextT(tS: IterableOnce[TypeName]) = LocalContext(Set(), tS.iterator.toSet) private def emptyCtx = LocalContext(Set(), Set()) + private def emptyCtxObj = LocalContext(Set(Var("this")), Set()) case class ClassInfoCache( originNm: TypeName, @@ -55,6 +59,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { type NamePath = List[String] var retSeq: List[NuTypeDef] = Nil + val globalFunctions: ArrayBuffer[NuFunDef] = ArrayBuffer() var anonymCnt: Int = 0 var clsCnt: Int = 0 val logOutput: StringBuilder = new StringBuilder @@ -144,7 +149,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { (tmp._1.flatten, tmp._2.flatten, tmp._3.flatten) } - private def genClassNm(orgNm: String)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): TypeName = { + private def genClassNm(orgNm: String)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): TypeName = { TypeName(outer match{ case None => clsCnt = clsCnt+1 @@ -153,11 +158,15 @@ class ClassLifter(logDebugMsg: Boolean = false) { }) } - private def getFreeVars(stmt: Located)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): LocalContext = stmt match{ - case v:Var => - log(s"get free var find $v: ${ctx.vSet.contains(v)}/${buildPathToVar(v).isDefined}/${cache.contains(TypeName(v.name))}/${v.name.equals("this")}") - if(ctx.vSet.contains(v) || buildPathToVar(v).isDefined || cache.contains(TypeName(v.name)) || v.name.equals("this") || primiTypes.contains(v.name)) then emptyCtx else asContext(v) - case t: NamedType => + private def getFreeVars(stmt: Located)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): LocalContext = stmt match{ + case v:Var => + val caseEmpty = ctx.vSet.contains(v) || cache.contains(TypeName(v.name)) || globFuncs.contains(v) || primiTypes.contains(v.name) + val caseThis = buildPathToVar(v).isDefined && !ctx.vSet.contains(Var("this")) + log(s"get free var find $v: $caseEmpty/$caseThis") + if(caseEmpty) then emptyCtx + else if(caseThis) asContext(Var("this")) + else asContext(v) + case t: NamedType => log(s"get type $t under $ctx, $cache, $outer") asContextT(t.collectTypeNames.map(TypeName(_)).filterNot(x => ctx.contains(x) || cache.contains(x) || primiTypes.contains(x.name))) case Lam(lhs, rhs) => @@ -181,7 +190,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { case TyApp(trm, tpLst) => getFreeVars(trm).addT(tpLst.flatMap(_.collectTypeNames.map(TypeName(_)))) case NuTypeDef(_, nm, tps, param, _, _, pars, _, _, body) => - val prmVs = getFreeVars(param.getOrElse(Tup(Nil)))(using emptyCtx, Map(), None) + val prmVs = getFreeVars(param.getOrElse(Tup(Nil)))(using emptyCtx, Map(), globFuncs, None) val newVs = prmVs.vSet ++ getFields(body.entities) + Var(nm.name) val nCtx = ctx.addV(newVs).addT(nm).addT(tps.map(_._2)) val parVs = pars.map(getFreeVars(_)(using nCtx)).fold(emptyCtx)(_ ++ _) @@ -196,20 +205,20 @@ class ClassLifter(logDebugMsg: Boolean = false) { others.children.map(getFreeVars).fold(emptyCtx)(_ ++ _) } - private def collectClassInfo(cls: NuTypeDef, preClss: Set[TypeName])(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): ClassInfoCache = { + private def collectClassInfo(cls: NuTypeDef, preClss: Set[TypeName])(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): ClassInfoCache = { val NuTypeDef(_, nm, tps, param, _, _, pars, _, _, body) = cls - log(s"grep context of ${cls.nme.name} under {\n$ctx\n$cache\n$outer\n}\n") + log(s"grep context of ${cls.nme.name} under $ctx # $cache # $globFuncs # $outer ") val (clses, funcs, trms) = splitEntities(cls.body.entities) val (supNms, rcdFlds) = pars.map(getSupClsInfoByTerm).unzip val flds = rcdFlds.flatten.map{ - case (v, Fld(_, trm)) => - val tmp = getFreeVars(trm)(using emptyCtx) + case (v, Fld(_, trm)) => + val tmp = getFreeVars(trm)(using emptyCtxObj) val ret = tmp.tSet ++ tmp.vSet.map(x => TypeName(x.name)) (v, ret) }.unzip log(s"par record: ${flds._2.flatten}") val fields = (param.fold(Nil)(t => t.fields).flatMap(tupleEntityToVar) ++ funcs.map(_.nme) ++ clses.map(x => Var(x.nme.name)) ++ trms.flatMap(grepFieldsInTrm) ++ flds._1).toSet - val nCtx = ctx.addV(fields).addV(flds._1).extT(tps.map(_._2)) + val nCtx = ctx.addV(fields).addV(flds._1).extT(tps.map(_._2)).addV(Var("this")) val tmpCtx = ((body.entities.map(getFreeVars(_)(using nCtx)) ++ pars.map(getFreeVars(_)(using nCtx))).fold(emptyCtx)(_ ++ _).moveT2V(preClss) ).addT(flds._2.flatten.toSet).extV(supNms.flatten.map(x => Var(x.name))) @@ -218,8 +227,8 @@ class ClassLifter(logDebugMsg: Boolean = false) { ret } - private def liftCaseBranch(brn: CaseBranches)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (CaseBranches, LocalContext) = brn match{ - case Case(v: Var, body, rest) => + private def liftCaseBranch(brn: CaseBranches)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (CaseBranches, LocalContext) = brn match{ + case Case(v: Var, body, rest) => val nTrm = liftTerm(body)(using ctx.addV(v)) val nRest = liftCaseBranch(rest) (Case(v, nTrm._1, nRest._1), nTrm._2 ++ nRest._2) @@ -233,18 +242,18 @@ class ClassLifter(logDebugMsg: Boolean = false) { case NoCases => (brn, emptyCtx) } - private def liftIf(body: IfBody)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (IfBody, LocalContext) = body match{ - case IfElse(expr) => + private def liftIf(body: IfBody)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (IfBody, LocalContext) = body match{ + case IfElse(expr) => val ret = liftTerm(expr) (IfElse(ret._1), ret._2) case IfThen(expr, rhs) => val nE = liftTerm(expr) val nR = liftTerm(rhs) (IfThen(nE._1, nR._1), nE._2 ++ nR._2) - case _ => ??? + case _ => throw MonomorphError(s"Unknown IfBody: ${body}") } - private def liftTuple(tup: Tup)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (Tup, LocalContext) = { + private def liftTuple(tup: Tup)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (Tup, LocalContext) = { val ret = tup.fields.map{ case (None, Fld(flags, trm)) => val tmp = liftTerm(trm) @@ -256,7 +265,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { (Tup(ret._1), ret._2.fold(emptyCtx)(_ ++ _)) } - private def liftConstr(tp: TypeName, prm: Tup)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (TypeName, Tup, LocalContext) = { + private def liftConstr(tp: TypeName, prm: Tup)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (TypeName, Tup, LocalContext) = { def findAncestor(crt: ClassInfoCache, target: Option[ClassInfoCache]): Option[(List[String], Option[String])] = { (crt.outerCls, target) match{ case (None, None) => None @@ -290,8 +299,13 @@ class ClassLifter(logDebugMsg: Boolean = false) { } } - private def liftTerm(target: Term)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (Term, LocalContext) = target match { - case v: Var => + private def newLambObj(lhs: Term, rhs: Term) = + New(None, TypingUnit(List(NuFunDef(None, Var("apply"), None, Nil, Left(Lam(lhs, rhs)))(N, N, N, N, N, false)))) //TODO: Use Proper Arguments + + private def liftTerm(target: Term)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (Term, LocalContext) = + log(s"liftTermNew $target in $ctx, $cache, $globFuncs, $outer") + target match{ + case v: Var => if(ctx.contains(v) || v.name.equals("this") || primiTypes.contains(v.name)) (v, emptyCtx) else if(cache.contains(TypeName(v.name))){ val ret = liftConstr(TypeName(v.name), Tup(Nil)) @@ -303,12 +317,16 @@ class ClassLifter(logDebugMsg: Boolean = false) { case None => (v, asContext(v)) } } - case Lam(lhs, rhs) => - val lctx = getFreeVars(lhs)(using emptyCtx, cache, None) - val (ltrm, _) = liftTerm(lhs)(using ctx.addV(lctx.vSet)) - val (rtrm, rctx) = liftTerm(rhs)(using ctx.addV(lctx.vSet)) - (Lam(ltrm, rtrm), rctx -+ lctx) - case t: Tup => + case Lam(lhs, rhs) => + val prmCnt = getFreeVars(lhs)(using emptyCtx, cache, globFuncs, None).vSet.size + val nTpNm = TypeName(genAnoName("Lambda"+prmCnt)) + val anoCls = NuTypeDef( + Cls, nTpNm, Nil, S(Tup(Nil)), N, N, Nil, N, N, + TypingUnit(List(NuFunDef(None, Var("apply"), N, Nil, Left(Lam(lhs, rhs)))(N, N, N, N, N, false))))(N, N, N) //TODO: Use Proper Arguments + val nSta = New(Some((nTpNm, Tup(Nil))), TypingUnit(Nil)) + val ret = liftEntities(List(anoCls, nSta)) + (Blk(ret._1), ret._2) + case t: Tup => liftTuple(t) case Rcd(fields) => val ret = fields.map{ @@ -324,7 +342,12 @@ class ClassLifter(logDebugMsg: Boolean = false) { case App(v: Var, prm: Tup) if cache.contains(TypeName(v.name)) => val ret = liftConstr(TypeName(v.name), prm) (App(Var(ret._1.name), ret._2), ret._3) - case App(lhs, rhs) => + case App(v: Var, prm: Tup) if globFuncs.contains(v) => + val (nFuncName, nCtxs) = globFuncs.get(v).get + val addiArgs = nCtxs.vSet.toList.map(toFldsEle(_)) + val nPrm = liftTuple(prm) + (App(nFuncName, Tup(nPrm._1.fields ++ addiArgs)), nPrm._2) + case App(lhs, rhs) => val (ltrm, lctx) = liftTerm(lhs) val (rtrm, rctx) = liftTerm(rhs) (App(ltrm, rtrm), lctx ++ rctx) @@ -357,7 +380,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { case Sel(receiver, fieldName) => val nRec = liftTerm(receiver) (Sel(nRec._1, fieldName), nRec._2) - case Splc(fields) => ??? + case Splc(fields) => throw MonomorphError(s"Unimplemented liftTerm: ${target}") case Subs(arr, idx) => val (ltrm, lctx) = liftTerm(arr) val (rtrm, rctx) = liftTerm(idx) @@ -370,7 +393,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { val ret = liftTerm(lhs) val nTs = targs.map(liftType).unzip (TyApp(ret._1, nTs._1), nTs._2.fold(ret._2)(_ ++ _)) - case With(trm, fields) => ??? + case With(trm, fields) => throw MonomorphError(s"Unimplemented liftTerm: ${target}") case New(Some((t: TypeName, prm: Tup)), TypingUnit(Nil)) => val ret = liftConstr(t, prm) (New(Some((ret._1, ret._2)), TypingUnit(Nil)), ret._3) @@ -390,7 +413,7 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nSta = New(Some((nTpNm, Tup(Nil))), TypingUnit(Nil)) val ret = liftEntities(List(anoCls, nSta)) (Blk(ret._1), ret._2) - case New(head, body) => ??? + case New(head, body) => throw MonomorphError(s"Unimplemented liftTerm: ${target}") case Blk(stmts) => val ret = liftEntities(stmts) (Blk(ret._1), ret._2) @@ -405,12 +428,12 @@ class ClassLifter(logDebugMsg: Boolean = false) { val (bod2, ctx) = liftTerm(bod) val (sts2, ctx2) = liftEntities(sts) (Where(bod2, sts2), ctx2) - case _: Eqn | _: Super => ??? // TODO - case patmat: AdtMatchWith => lastWords(s"Cannot liftTerm ${patmat}") + case _: Eqn | _: Super => throw MonomorphError(s"Unimplemented liftTerm: ${target}") // TODO + case patmat: AdtMatchWith => lastWords(s"Cannot liftTermNew ${patmat}") } //serves for lifting Tup(Some(_), Fld(_, _, trm)), where trm refers to a type - private def liftTermAsType(target: Term)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (Term, LocalContext) = + private def liftTermAsType(target: Term)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (Term, LocalContext) = log(s"liftTermAsType $target in $ctx, $cache") target match{ case v: Var => @@ -442,24 +465,24 @@ class ClassLifter(logDebugMsg: Boolean = false) { ((v, Fld(flags, tmp._1)), tmp._2) }.unzip (Rcd(ret._1), ret._2.fold(emptyCtx)(_ ++ _)) - case _ => ??? + case _ => throw MonomorphError(s"Unimplemented liftTermAsType: ${target}") } - private def liftTypeName(target: TypeName)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (TypeName, LocalContext) = { + private def liftTypeName(target: TypeName)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (TypeName, LocalContext) = { if(ctx.contains(target) || primiTypes.contains(target.name)) { target -> emptyCtx } else { cache.get(target).map(x => (x.liftedNm -> emptyCtx)).getOrElse(target -> asContext(target)) } } - private def liftTypeField(target: Field)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (Field, LocalContext) = { + private def liftTypeField(target: Field)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (Field, LocalContext) = { val (inT, iCtx) = target.in.map(liftType).unzip val (outT, oCtx) = liftType(target.out) Field(inT, outT) -> (iCtx.getOrElse(emptyCtx) ++ oCtx) } - private def liftType(target: Type)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (Type, LocalContext) = target match{ - case AppliedType(base, targs) => + private def liftType(target: Type)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (Type, LocalContext) = target match{ + case AppliedType(base, targs) => val (nTargs, nCtx) = targs.map(liftType).unzip val (nBase, bCtx) = liftTypeName(base) AppliedType(nBase, nTargs) -> (nCtx.fold(emptyCtx)(_ ++ _) ++ bCtx) @@ -536,18 +559,24 @@ class ClassLifter(logDebugMsg: Boolean = false) { val (body2, ctx) = liftType(body) PolyType(targs, body2) -> ctx case Top | Bot | _: Literal | _: TypeTag | _: TypeVar => target.asInstanceOf[Type] -> emptyCtx - case _: Selection => ??? // TODO + case _: Selection => throw MonomorphError(s"Unimplemented liftType: ${target}") // TODO } - private def liftFunc(func: NuFunDef)(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (NuFunDef, LocalContext) = { - log(s"liftFunc $func under $ctx # $cache # $outer") + private def liftMemberFunc(func: NuFunDef)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (NuFunDef, LocalContext) = { + log(s"liftMemberFunc $func under $ctx # $cache # $globFuncs # $outer") val NuFunDef(rec, nm, sn, tpVs, body) = func - body match { - case Left(value) => - val ret = liftTerm(value)(using ctx.addV(nm).addT(tpVs)) - (func.copy(rhs = Left(ret._1))(func.declareLoc, func.exportLoc, func.virtualLoc, func.signature, func.outer, func.genField), ret._2) - case Right(PolyType(targs, body)) => + body match{ + case Left(Lam(lhs@Tup(etts), rhs)) => + val lctx = getFreeVars(lhs)(using emptyCtx, cache, globFuncs, None) + val lret = liftTuple(lhs)(using ctx.addV(lctx.vSet)) + val ret = liftTerm(rhs)(using ctx.addV(lctx.vSet).addT(tpVs)) + (func.copy(rhs = Left(Lam(lret._1, ret._1)))(func.declareLoc, func.exportLoc, func.virtualLoc, func.signature, func.outer, func.genField), ret._2 -+ lret._2) //TODO: Check correctness + case Left(value) => + // will be treated as Lam(Tup(Nil), rhs) + val ret = liftTerm(value)(using ctx.addT(tpVs)) + (func.copy(rhs = Left(Lam(Tup(Nil), ret._1)))(func.declareLoc, func.exportLoc, func.virtualLoc, func.signature, func.outer, func.genField), ret._2) //TODO: Check correctness + case Right(PolyType(targs, body)) => val nBody = liftType(body)(using ctx.addT(tpVs)) val nTargs = targs.map { case L(tp) => liftTypeName(tp)(using ctx.addT(tpVs)).mapFirst(Left.apply) @@ -555,9 +584,39 @@ class ClassLifter(logDebugMsg: Boolean = false) { }.unzip (func.copy(rhs = Right(PolyType(nTargs._1, nBody._1)))(func.declareLoc, func.exportLoc, func.virtualLoc, func.signature, func.outer, func.genField), nTargs._2.fold(nBody._2)(_ ++ _)) - case _ => ??? // TODO + case _ => throw MonomorphError(s"Unimplemented liftMemberFunc: ${func}") // TODO } } + + private def liftGlobalFunc(func: NuFunDef)(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): Unit = { + log(s"liftGlobalFunc $func under $ctx # $cache # $globFuncs # $outer") + val NuFunDef(rec, nm, _, tpVs, body) = func + val nTpVs = tpVs ++ globFuncs.get(nm).get._2.tSet.toList + globalFunctions.addOne(body match{ + case Left(Lam(lhs@Tup(etts), rhs)) => + val tmp = globFuncs.get(nm).get._2.vSet.toList.map(toFldsEle) + val lctx = getFreeVars(lhs)(using emptyCtx, cache, globFuncs, None) + val lret = liftTuple(lhs)(using ctx.addV(lctx.vSet) ++ globFuncs.get(nm).get._2, cache, globFuncs) + val ret = liftTerm(rhs)(using ctx.addV(lctx.vSet) ++ globFuncs.get(nm).get._2, cache, globFuncs) + NuFunDef(rec, globFuncs.get(nm).get._1, N, nTpVs, Left(Lam(Tup(lret._1.fields ++ tmp), ret._1)))(N, N, N, N, N, true) //TODO: Use proper arguments + case Left(rhs) => + // will be treated as Lam(Tup(Nil), rhs) + val tmp = globFuncs.get(nm).get._2.vSet.toList.map(toFldsEle) + val ret = liftTerm(rhs)(using ctx ++ globFuncs.get(nm).get._2, cache, globFuncs) + NuFunDef(rec, globFuncs.get(nm).get._1, N, nTpVs, Left(Lam(Tup(tmp), ret._1)))(N, N, N, N, N, true) //TODO: Use proper arguments + // val ret = liftTermNew(value)(using ctx.addV(nm) ++ globFuncs.get(nm).get._2, cache, globFuncs) + // NuFunDef(rec, globFuncs.get(nm).get._1, nTpVs, Left(ret._1)) + case Right(PolyType(targs, body)) => + val nBody = liftType(body)(using ctx ++ globFuncs.get(nm).get._2, cache, globFuncs, None) + val nTargs = targs.map({ + case L(tn) => + liftTypeName(tn)(using ctx.addT(nTpVs), cache, globFuncs, None) match + case (tn, ctx) => (L(tn), ctx) + case R(tv) => R(tv) -> emptyCtx}).unzip + NuFunDef(rec, globFuncs.get(nm).get._1, N, nTpVs, Right(PolyType(nTargs._1, nBody._1)))(N, N, N, N, N, true) //TODO: Use proper arguments + case _ => throw MonomorphError(s"Unimplemented liftGlobalFunc: ${func}") + }) + } private def grepFieldsInTrm(trm: Term): Option[Var] = trm match{ @@ -565,35 +624,48 @@ class ClassLifter(logDebugMsg: Boolean = false) { case _ => None } - private def mixClsInfos(clsInfos: Map[TypeName, ClassInfoCache], newClsNms: Set[Var])(using cache: ClassCache): Map[TypeName, ClassInfoCache] = { - val nameInfoMap: MutMap[TypeName, ClassInfoCache] = MutMap(clsInfos.toSeq: _*) - log(s"mix cls infos $nameInfoMap") + private def mixClsInfos(clsInfos: Map[String, ClassInfoCache], funcInfos: Map[String, LocalContext])(using cache: ClassCache): (Map[String, ClassInfoCache], Map[String, LocalContext]) = { + val nameInfoMap: MutMap[String, ClassInfoCache] = MutMap(clsInfos.toSeq: _*) + val nameFuncMap: MutMap[String, LocalContext] = MutMap(funcInfos.toSeq: _*) + log(s"mix cls infos $nameInfoMap, $nameFuncMap") // val fullMp = cache ++ nameInfoMap - val clsNmsAsTypeNm = newClsNms.map(x => TypeName(x.name)) - val len = clsInfos.size - for(_ <- 1 to len){ - val tmp = nameInfoMap.toList - tmp.foreach{case (nmOfCls, infoOfCls@ClassInfoCache(_, _, ctx, flds, inners, sups, _, _, _)) => { - val usedClsNmList = ctx.vSet.map(x => TypeName(x.name)).intersect(clsNmsAsTypeNm) - val newCtxForCls = usedClsNmList.foldLeft(ctx)((c1, c2) => c1 ++ nameInfoMap.get(c2).get.capturedParams) + val clsNmsAsTypeNm = clsInfos.keySet.map(x => TypeName(x)) + val len = clsInfos.size + nameFuncMap.size + for(_ <- 0 to len){ + nameInfoMap.toList.foreach{case (nmOfCls, infoOfCls@ClassInfoCache(_, _, ctx, flds, inners, sups, _, _, _)) => { + val usedClsNmList = ctx.vSet.map(_.name).intersect(clsInfos.keySet) + val newCtxForCls_tmp = usedClsNmList.foldLeft(ctx)((c1, c2) => c1 ++ nameInfoMap.get(c2).get.capturedParams) + + val usedFuncNmList = ctx.vSet.map(_.name).intersect(funcInfos.keySet) + val newCtxForCls = usedFuncNmList.foldLeft(newCtxForCls_tmp)((c, x) => c ++ nameFuncMap.get(x).get) + val supClsNmList = infoOfCls.supClses - val newFields = supClsNmList.foreach(c2 => flds.addAll( - nameInfoMap.get(c2).map(_.fields).getOrElse(cache.get(c2).map(_.fields).getOrElse(Nil)) + supClsNmList.foreach(c2 => flds.addAll( + nameInfoMap.get(c2.name).map(_.fields).getOrElse(cache.get(c2).map(_.fields).getOrElse(Nil)) )) - val newInners = supClsNmList.foreach(c2 => inners.addAll( - nameInfoMap.get(c2).map(_.innerClses).getOrElse(cache.get(c2).map(_.innerClses).getOrElse(Nil)) + supClsNmList.foreach(c2 => inners.addAll( + nameInfoMap.get(c2.name).map(_.innerClses).getOrElse(cache.get(c2).map(_.innerClses).getOrElse(Nil)) )) - val newCtxFromSup = supClsNmList.map(c2 => - nameInfoMap.get(c2).map(_.capturedParams).getOrElse(cache.get(c2).map(_.capturedParams).getOrElse(emptyCtx)) + val newCtxFromSup = supClsNmList.map(c2 => + nameInfoMap.get(c2.name).map(_.capturedParams).getOrElse(cache.get(c2).map(_.capturedParams).getOrElse(emptyCtx)) ).fold(emptyCtx)(_ ++ _) infoOfCls.capturedParams = newCtxForCls ++ newCtxFromSup }} + nameFuncMap.toList.foreach((nm, ctx) => { + val usedClsNmList = ctx.vSet.map(_.name).intersect(clsInfos.keySet) + val usedFuncNmList = ctx.vSet.map(_.name).intersect(funcInfos.keySet) + val nCtx = (usedClsNmList.map(x => nameInfoMap.get(x).get.capturedParams) ++ usedFuncNmList.map(x => nameFuncMap.get(x).get)).foldLeft(ctx)(_ ++ _) + nameFuncMap.update(nm, nCtx) + }) } - nameInfoMap.foreach((x1, x2) => x2.capturedParams = (x2.capturedParams extV newClsNms).extT(x2.innerClses.keySet)) - nameInfoMap.toMap + nameInfoMap.foreach((x1, x2) => x2.capturedParams = (x2.capturedParams.extV(clsInfos.keySet.map(Var(_)))).extV(funcInfos.keySet.map(Var(_))).extT(x2.innerClses.keySet)) + nameFuncMap.toList.foreach((x, c) => nameFuncMap.update(x, c.extV(clsInfos.keySet.map(Var(_))).extV(funcInfos.keySet.map(Var(_))))) + log(s"mix result: $nameInfoMap, $nameFuncMap") + nameInfoMap.toMap -> nameFuncMap.toMap } + - private def liftEntities(etts: List[Statement])(using ctx: LocalContext, cache: ClassCache, outer: Option[ClassInfoCache]): (List[Statement], LocalContext) = { + private def liftEntities(etts: List[Statement])(using ctx: LocalContext, cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): (List[Statement], LocalContext) = { log("liftEntities: " ++ etts.headOption.map(_.toString()).getOrElse("")) val (newCls, newFuncs, rstTrms) = splitEntities(etts) val newClsNms = newCls.map(x => Var(x.nme.name)).toSet @@ -601,30 +673,39 @@ class ClassLifter(logDebugMsg: Boolean = false) { val nmsInTrm = rstTrms.flatMap(grepFieldsInTrm) val clsInfos = newCls.map(x => { val infos = collectClassInfo(x, newCls.map(_.nme).toSet)(using emptyCtx) - infos.capturedParams = infos.capturedParams.copy(vSet = infos.capturedParams.vSet.intersect(ctx.vSet ++ newClsNms ++ newFuncNms ++ nmsInTrm)) - x.nme -> infos}).toMap + infos.capturedParams = infos.capturedParams.intersect(ctx.addT(infos.capturedParams.tSet).addV(newClsNms ++ newFuncNms ++ nmsInTrm -- globFuncs.keySet ++ outer.map(_ => Var("this")))) + x.nme.name -> infos}).toMap + val funcInfos = + newFuncs.map(x => x.nme.name -> (x.rhs match { + case Left(trm) => getFreeVars(trm)(using emptyCtx) + .intersect(ctx.addV(newClsNms ++ newFuncNms ++ nmsInTrm -- globFuncs.keySet ++ outer.map(_ => Var("this")))) + .extT(x.tparams) + case _ => emptyCtx}) + ).toMap log("captured cls infos: \n" ++ clsInfos.toString()) - val refinedInfo = mixClsInfos(clsInfos, newClsNms) - val newCache = cache ++ refinedInfo - refinedInfo.foreach((_, clsi) => completeClsInfo(clsi)(using newCache)) - - newCls.foreach(x => liftTypeDefNew(x)(using newCache)) - val (liftedFuns, funVs) = newFuncs.map(liftFunc(_)(using ctx.addV(newFuncNms), newCache)).unzip - val (liftedTerms, termVs) = rstTrms.map(liftTerm(_)(using ctx.addV(newFuncNms), newCache)).unzip - (liftedFuns ++ liftedTerms, (funVs ++ termVs).fold(emptyCtx)(_ ++ _)) + log("captured func infos: \n" ++ funcInfos.toString()) + val (refinedClsInfo, refinedFuncInfo) = mixClsInfos(clsInfos, funcInfos) + val newCache = cache ++ refinedClsInfo.map(x => (TypeName(x._1) -> x._2)) + refinedClsInfo.foreach((_, clsi) => completeClsInfo(clsi)(using newCache)) + val newGlobalFuncs = refinedFuncInfo.map((nm, vs) => (Var(nm) -> (Var(genAnoName(nm)), vs))) + + newCls.foreach(x => liftTypeDef(x)(using newCache, globFuncs ++ newGlobalFuncs)) + (newFuncs zip refinedFuncInfo).foreach((f, c) => liftGlobalFunc(f)(using ctx, newCache, globFuncs ++ newGlobalFuncs)) + val (liftedTerms, termVs) = rstTrms.map(liftTerm(_)(using ctx.addV(newFuncNms), newCache, globFuncs ++ newGlobalFuncs)).unzip + (liftedTerms, (termVs).fold(emptyCtx)(_ ++ _)) } - private def completeClsInfo(clsInfo: ClassInfoCache)(using cache: ClassCache): Unit = { + private def completeClsInfo(clsInfo: ClassInfoCache)(using cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)]): Unit = { val ClassInfoCache(_, nName, freeVs, flds, inners, _, _, cls, _) = clsInfo val (clsList, _, _) = splitEntities(cls.body.entities) val innerClsNmSet = clsList.map(_.nme).toSet - val innerClsInfos = clsList.map(x => x.nme -> collectClassInfo(x, innerClsNmSet)(using asContextV(freeVs.vSet ++ flds), cache, Some(clsInfo))).toMap - val refinedInfos = mixClsInfos(innerClsInfos, innerClsNmSet.map(x => Var(x.name))) + val innerClsInfos = clsList.map(x => x.nme.name -> collectClassInfo(x, innerClsNmSet)(using asContextV(freeVs.vSet ++ flds), cache, globFuncs, Some(clsInfo))).toMap + val refinedInfos = mixClsInfos(innerClsInfos, Map())._1.map(x => (TypeName(x._1) -> x._2)) refinedInfos.foreach((_, info) => completeClsInfo(info)(using cache ++ refinedInfos)) inners.addAll(refinedInfos) } - private def liftTypeDefNew(target: NuTypeDef)(using cache: ClassCache, outer: Option[ClassInfoCache]): Unit = { + private def liftTypeDef(target: NuTypeDef)(using cache: ClassCache, globFuncs: Map[Var, (Var, LocalContext)], outer: Option[ClassInfoCache]): Unit = { def getAllInners(sups: Set[TypeName]): ClassCache = { sups.flatMap( t => cache.get(t).map(x => getAllInners(x.supClses) ++ x.innerClses) @@ -644,10 +725,10 @@ class ClassLifter(logDebugMsg: Boolean = false) { outer.map(x => List(toFldsEle(Var(genParName(x.liftedNm.name))))).getOrElse(Nil) ++ params.fold(Nil)(t => t.fields) ++ freeVs.vSet.map(toFldsEle) - val nPars = pars.map(liftTerm(_)(using emptyCtx, nCache, nOuter)).unzip - val nFuncs = funcList.map(liftFunc(_)(using emptyCtx, nCache, nOuter)).unzip - val nTerms = termList.map(liftTerm(_)(using emptyCtx, nCache, nOuter)).unzip - clsList.foreach(x => liftTypeDefNew(x)(using nCache, nOuter)) + val nPars = pars.map(liftTerm(_)(using emptyCtx, nCache, globFuncs, nOuter)).unzip + val nFuncs = funcList.map(liftMemberFunc(_)(using emptyCtx, nCache, globFuncs, nOuter)).unzip + val nTerms = termList.map(liftTerm(_)(using emptyCtx, nCache, globFuncs, nOuter)).unzip + clsList.foreach(x => liftTypeDef(x)(using nCache, globFuncs, nOuter)) retSeq = retSeq.appended(NuTypeDef( kind, nName, nTps.map((None, _)), S(Tup(nParams)), None, None, nPars._1, None, None, TypingUnit(nFuncs._1 ++ nTerms._1))(None, None, None)) @@ -657,9 +738,10 @@ class ClassLifter(logDebugMsg: Boolean = false) { log("=========================\n") log(s"lifting: \n${showStructure(rawUnit)}\n") retSeq = Nil - val re = liftEntities(rawUnit.entities)(using emptyCtx, Map(), None) + globalFunctions.clear() + val re = liftEntities(rawUnit.entities)(using emptyCtx, Map(), Map(), None) log(s"freeVars: ${re._2}") // println(logOutput.toString()) - TypingUnit(retSeq.toList++re._1) + TypingUnit(retSeq.toList ++ globalFunctions.toList ++ re._1) } } diff --git a/compiler/shared/main/scala/mlscript/compiler/DataType.scala b/compiler/shared/main/scala/mlscript/compiler/DataType.scala new file mode 100644 index 000000000..ca3ba27b0 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/DataType.scala @@ -0,0 +1,36 @@ +package mlscript.compiler + +abstract class DataType + +object DataType: + sealed class Singleton(value: Expr.Literal, dataType: DataType) extends DataType: + override def toString(): String = value.toString() + + enum Primitive(name: String) extends DataType: + case Integer extends Primitive("int") + case Decimal extends Primitive("real") + case Boolean extends Primitive("bool") + case String extends Primitive("str") + override def toString(): String = this.name + end Primitive + + sealed case class Tuple(elementTypes: List[DataType]) extends DataType: + override def toString(): String = elementTypes.mkString("(", ", ", ")") + + sealed case class Class(declaration: Item.TypeDecl) extends DataType: + override def toString(): String = s"class ${declaration.name.name}" + + sealed case class Function(parameterTypes: List[DataType], returnType: DataType) extends DataType: + def this(returnType: DataType, parameterTypes: DataType*) = + this(parameterTypes.toList, returnType) + override def toString(): String = + val parameterList = parameterTypes.mkString("(", ", ", ")") + s"$parameterList -> $returnType" + + sealed case class Record(fields: Map[String, DataType]) extends DataType: + def this(fields: (String, DataType)*) = this(Map.from(fields)) + override def toString(): String = + fields.iterator.map { (name, ty) => s"$name: $ty" }.mkString("{", ", ", "}") + + case object Unknown extends DataType: + override def toString(): String = "unknown" diff --git a/compiler/shared/main/scala/mlscript/compiler/DataTypeInferer.scala b/compiler/shared/main/scala/mlscript/compiler/DataTypeInferer.scala new file mode 100644 index 000000000..117a8a3b7 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/DataTypeInferer.scala @@ -0,0 +1,18 @@ +package mlscript.compiler +import mlscript.compiler.mono.MonomorphError + +trait DataTypeInferer: + import DataType._ + + def findClassByName(name: String): Option[Item.TypeDecl] + + def infer(expr: Expr, compatiableType: Option[DataType]): DataType = + expr match + case Expr.Tuple(elements) => DataType.Tuple(elements.map(infer(_, None))) + case lit @ Expr.Literal(value: BigInt) => Singleton(lit, Primitive.Integer) + case lit @ Expr.Literal(value: BigDecimal) => Singleton(lit, Primitive.Decimal) + case lit @ Expr.Literal(value: String) => Singleton(lit, Primitive.String) + case lit @ Expr.Literal(value: Boolean) => Singleton(lit, Primitive.Boolean) + case Expr.Apply(Expr.Ref(name), args) => + findClassByName(name).fold(DataType.Unknown)(DataType.Class(_)) + case _ => throw MonomorphError(s"I can't infer the type of $expr now") \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/Helpers.scala b/compiler/shared/main/scala/mlscript/compiler/Helpers.scala new file mode 100644 index 000000000..d9e6a7784 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/Helpers.scala @@ -0,0 +1,197 @@ +package mlscript.compiler + +import mlscript.{App, Asc, Assign, Bind, Blk, Bra, CaseOf, Lam, Let, Lit, + New, Rcd, Sel, Subs, Term, Test, Tup, With, Var, Fld, FldFlags, If, PolyType} +import mlscript.{IfBody, IfThen, IfElse, IfLet, IfOpApp, IfOpsApp, IfBlock} +import mlscript.UnitLit +import mlscript.codegen.Helpers.inspect as showStructure +import mlscript.compiler.mono.MonomorphError +import mlscript.NuTypeDef +import mlscript.NuFunDef +import scala.collection.mutable.ArrayBuffer +import mlscript.CaseBranches +import mlscript.Case +import mlscript.NoCases +import mlscript.Wildcard +import mlscript.DecLit +import mlscript.IntLit +import mlscript.StrLit +import mlscript.AppliedType +import mlscript.TypeName +import mlscript.TypeDefKind +import mlscript.compiler.mono.Monomorph + +object Helpers: + /** + * Extract parameters for monomorphization from a `Tup`. + */ + def toFuncParams(term: Term): Iterator[Parameter] = term match + case Tup(fields) => fields.iterator.flatMap { + // The new parser emits `Tup(_: UnitLit(true))` from `fun f() = x`. + case (_, Fld(FldFlags(_, _, _), UnitLit(true))) => None + case (None, Fld(FldFlags(_, spec, _), Var(name))) => Some((spec, Expr.Ref(name))) + case (Some(Var(name)), Fld(FldFlags(_, spec, _), _)) => Some((spec, Expr.Ref(name))) + case _ => throw new MonomorphError( + s"only `Var` can be parameters but we meet ${showStructure(term)}" + ) + } + case _ => throw MonomorphError("expect the list of parameters to be a `Tup`") + + def toFuncArgs(term: Term): IterableOnce[Term] = term match + // The new parser generates `(undefined, )` when no arguments. + // Let's do this temporary fix. + case Tup((_, Fld(FldFlags(_, _, _), UnitLit(true))) :: Nil) => Iterable.empty + case Tup(fields) => fields.iterator.map(_._2.value) + case _ => Some(term) + + def term2Expr(term: Term): Expr = { + term match + case Var(name) => Expr.Ref(name) + case Lam(lhs, rhs) => + val params = toFuncParams(lhs).toList + Expr.Lambda(params, term2Expr(rhs)) + case App(App(Var("=>"), Bra(false, args: Tup)), body) => + val params = toFuncParams(args).toList + Expr.Lambda(params, term2Expr(body)) + case App(App(Var("."), self), App(Var(method), args: Tup)) => + Expr.Apply(Expr.Select(term2Expr(self), Expr.Ref(method)), List.from(toFuncArgs(args).map(term2Expr))) + case App(lhs, rhs) => + val callee = term2Expr(lhs) + val arguments = toFuncArgs(rhs).map(term2Expr).toList + Expr.Apply(callee, arguments) + case Tup(fields) => + Expr.Tuple(fields.map { + case (_, Fld(FldFlags(mut, spec, genGetter), value)) => term2Expr(value) + }) + case Rcd(fields) => + Expr.Record(fields.map { + case (name, Fld(FldFlags(mut, spec, genGetter), value)) => (Expr.Ref(name.name), term2Expr(value)) + }) + case Sel(receiver, fieldName) => + Expr.Select(term2Expr(receiver), Expr.Ref(fieldName.name)) + case Let(rec, Var(name), rhs, body) => + val exprRhs = term2Expr(rhs) + val exprBody = term2Expr(body) + Expr.LetIn(rec, Expr.Ref(name), exprRhs, exprBody) + case Blk(stmts) => Expr.Block(stmts.flatMap[Expr | Item.FuncDecl | Item.FuncDefn] { + case term: Term => Some(term2Expr(term)) + case tyDef: NuTypeDef => throw MonomorphError(s"Unimplemented term2Expr ${term}") + case funDef: NuFunDef => + val NuFunDef(_, nme, sn, targs, rhs) = funDef + val ret: Item.FuncDecl | Item.FuncDefn = rhs match + case Left(Lam(params, body)) => + Item.FuncDecl(Expr.Ref(nme.name), toFuncParams(params).toList, term2Expr(body)) + case Left(body: Term) => Item.FuncDecl(Expr.Ref(nme.name), Nil, term2Expr(body)) + case Right(tp) => Item.FuncDefn(Expr.Ref(nme.name), targs, PolyType(Nil, tp)) //TODO: Check correctness in Type -> Polytype conversion + Some(ret) + case mlscript.DataDefn(_) => throw MonomorphError("unsupported DataDefn") + case mlscript.DatatypeDefn(_, _) => throw MonomorphError("unsupported DatatypeDefn") + case mlscript.TypeDef(_, _, _, _, _, _, _, _) => throw MonomorphError("unsupported TypeDef") + case mlscript.Def(_, _, _, _) => throw MonomorphError("unsupported Def") + case mlscript.LetS(_, _, _) => throw MonomorphError("unsupported LetS") + case mlscript.Constructor(_, _) => throw MonomorphError("unsupported Constructor") + case _: mlscript.Import => throw MonomorphError("unsupported import") + }) + case Bra(rcd, term) => term2Expr(term) + case Asc(term, ty) => Expr.As(term2Expr(term), ty) + case _: Bind => throw MonomorphError("cannot monomorphize `Bind`") + case _: Test => throw MonomorphError("cannot monomorphize `Test`") + case With(term, Rcd(fields)) => + Expr.With(term2Expr(term), Expr.Record(fields.map { + case (name, Fld(FldFlags(mut, spec, getGetter), value)) => (Expr.Ref(name.name), term2Expr(term)) + })) + case CaseOf(term, cases) => + def rec(bra: CaseBranches)(using buffer: ArrayBuffer[CaseBranch]): Unit = bra match + case Case(pat, body, rest) => + val newCase = pat match + case Var(name) => CaseBranch.Instance(Expr.Ref(name), Expr.Ref("_"), term2Expr(body)) + case DecLit(value) => CaseBranch.Constant(Expr.Literal(value), term2Expr(body)) + case IntLit(value) => CaseBranch.Constant(Expr.Literal(value), term2Expr(body)) + case StrLit(value) => CaseBranch.Constant(Expr.Literal(value), term2Expr(body)) + case UnitLit(undefinedOrNull) => CaseBranch.Constant(Expr.Literal(UnitValue.Undefined), term2Expr(body)) + buffer.addOne(newCase) + rec(rest) + case NoCases => () + case Wildcard(body) => + buffer.addOne(CaseBranch.Wildcard(term2Expr(body))) + val branchBuffer = ArrayBuffer[CaseBranch]() + rec(cases)(using branchBuffer) + Expr.Match(term2Expr(term), branchBuffer) + + case Subs(array, index) => + Expr.Subscript(term2Expr(array), term2Expr(index)) + case Assign(lhs, rhs) => + Expr.Assign(term2Expr(lhs), term2Expr(rhs)) + case New(None, body) => + throw MonomorphError(s"Unimplemented term2Expr ${term}") + case New(Some((constructor, args)), body) => + val typeName = constructor match + case AppliedType(TypeName(name), _) => name + case TypeName(name) => name + Expr.New(TypeName(typeName), toFuncArgs(args).map(term2Expr).toList) + // case Blk(unit) => Expr.Isolated(trans2Expr(TypingUnit(unit))) + case If(body, alternate) => body match + case IfThen(condition, consequent) => + Expr.IfThenElse( + term2Expr(condition), + term2Expr(consequent), + alternate.map(term2Expr) + ) + case term: IfElse => throw MonomorphError("unsupported IfElse") + case term: IfLet => throw MonomorphError("unsupported IfLet") + case term: IfOpApp => throw MonomorphError("unsupported IfOpApp") + case term: IfOpsApp => throw MonomorphError("unsupported IfOpsApp") + case term: IfBlock => throw MonomorphError("unsupported IfBlock") + case IntLit(value) => Expr.Literal(value) + case DecLit(value) => Expr.Literal(value) + case StrLit(value) => Expr.Literal(value) + case UnitLit(undefinedOrNull) => + Expr.Literal(if undefinedOrNull + then UnitValue.Undefined + else UnitValue.Null) + case _ => throw MonomorphError("unsupported term"+ term.toString) + } + + def func2Item(funDef: NuFunDef): Item.FuncDecl | Item.FuncDefn = + val NuFunDef(_, nme, sn, targs, rhs) = funDef + rhs match + case Left(Lam(params, body)) => + Item.FuncDecl(Expr.Ref(nme.name), toFuncParams(params).toList, term2Expr(body)) + case Left(body: Term) => Item.FuncDecl(Expr.Ref(nme.name), Nil, term2Expr(body)) + case Right(tp) => Item.FuncDefn(Expr.Ref(nme.name), targs, PolyType(Nil, tp)) //TODO: Check correctness in Type -> Polytype conversion + + def type2Item(tyDef: NuTypeDef): Item.TypeDecl = + val NuTypeDef(kind, className, tparams, params, _, _, parents, _, _, body) = tyDef + val isolation = Isolation(body.entities.flatMap { + // Question: Will there be pure terms in class body? + case term: Term => + Some(term2Expr(term)) + case subTypeDef: NuTypeDef => throw MonomorphError(s"Unimplemented func2Item ${tyDef}") + case subFunDef: NuFunDef => + Some(func2Item(subFunDef)) + case term => throw MonomorphError(term.toString) + }) + val typeDecl: Item.TypeDecl = Item.TypeDecl( + Expr.Ref(className.name), // name + kind, // kind + tparams.map(_._2), // typeParams + toFuncParams(params.getOrElse(Tup(Nil))).toList, // params + parents.map { + case Var(name) => (TypeName(name), Nil) + case App(Var(name), args) => (TypeName(name), term2Expr(args) match{ + case Expr.Tuple(fields) => fields + case _ => Nil + }) + case _ => throw MonomorphError("unsupported parent term") + }, // parents + isolation // body + ) + typeDecl + + private given Conversion[TypeDefKind, TypeDeclKind] with + import mlscript.{Als, Cls, Trt} + def apply(kind: TypeDefKind): TypeDeclKind = kind match + case Als => TypeDeclKind.Alias + case Cls => TypeDeclKind.Class + case Trt => TypeDeclKind.Trait + case _ => throw MonomorphError(s"Unsupported TypeDefKind conversion ${kind}") diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/Monomorph.scala b/compiler/shared/main/scala/mlscript/compiler/mono/Monomorph.scala new file mode 100644 index 000000000..fde9c93ed --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/Monomorph.scala @@ -0,0 +1,334 @@ +package mlscript.compiler.mono + +import mlscript.compiler.debug.{Debug, DummyDebug} +import mlscript.{TypingUnit, NuTypeDef, NuFunDef} +import mlscript.{AppliedType, TypeName} +import mlscript.{App, Asc, Assign, Bind, Blk, Bra, CaseOf, Lam, Let, Lit, + New, Rcd, Sel, Subs, Term, Test, Tup, With, Var, Fld, If} +import mlscript.{IfThen, IfElse, IfLet, IfOpApp, IfOpsApp, IfBlock} +import mlscript.{IntLit, DecLit, StrLit, UnitLit} +import scala.collection.immutable.{HashMap} +import scala.collection.mutable.{Map as MutMap, Set as MutSet} +import scala.collection.mutable.ListBuffer +import mlscript.Cls +import mlscript.CaseBranches +import mlscript.TypeDefKind +import mlscript.AppliedType.apply +import mlscript.compiler.mono.specializer.Builtin +import mlscript.compiler.mono.specializer.Context +import mlscript.compiler.* + +import mlscript.compiler.printer.ExprPrinter +import mlscript.compiler.mono.specializer.BoundedExpr +import mlscript.compiler.mono.specializer.{MonoValue, ObjectValue, UnknownValue, FunctionValue, VariableValue} + +class Monomorph(debug: Debug = DummyDebug) extends DataTypeInferer: + import Helpers._ + import Monomorph._ + + /** + * Specialized implementations of function declarations. + */ + private val funImpls = MutMap[String, (Item.FuncDecl, MutMap[String, Item.FuncDecl], List[BoundedExpr], VariableValue)]() + + private def getfunInfo(nm: String): String = + val info = funImpls.get(nm).get + s"$nm: (${info._3.mkString(" X ")}) -> ${info._4} @${funDependence.get(nm).get.mkString("{", ", ", "}")}" + + private val funDependence = MutMap[String, Set[String]]() + + val evalQueue = MutSet[String]() + val evalCnt = MutMap[String, Int]() + + /** + * Specialized implementations of each type declarations. + */ + private val tyImpls = MutMap[String, SpecializationMap[Item.TypeDecl]]() + private val allTypeImpls = MutMap[String, Item.TypeDecl]() + /** + * Add a prototype type declaration. + */ + private def addPrototypeTypeDecl(typeDecl: Item.TypeDecl) = + tyImpls.addOne(typeDecl.name.name, SpecializationMap(typeDecl)) + allTypeImpls.addOne(typeDecl.name.name, typeDecl) + /** + * An iterator going through all type declarations. + */ + private def allTypeDecls: IterableOnce[Item.TypeDecl] = + tyImpls.values.flatMap { _.iterator } + + /** + * A global store of monomorphized lambda classes. + */ + private val lamTyDefs = MutMap[String, Item.TypeDecl]() + /** + * A global store of anonymous classes. For example, `new { ... }`. + */ + private val anonymTyDefs = MutMap[String, Item.TypeDecl]() + + def findClassByName(name: String): Option[mlscript.compiler.Item.TypeDecl] = + allTypeImpls.get(name) + + val specializer = mono.specializer.Specializer(this)(using debug) + + private def addNewFunction(func: Item.FuncDecl): Unit = { + funImpls.addOne(func.name.name, (func, MutMap(), func.params.map(_ => BoundedExpr()), VariableValue.refresh())) + funDependence.addOne(func.name.name, Set()) + } + + private def getResult(exps: List[Expr]) = mlscript.compiler.ModuleUnit(exps.concat[Expr | Item](funImpls.map(x => x._2._1)) + .concat(allTypeImpls.values.map(x => x.copy(body = Isolation(Nil)))) + .concat(lamTyDefs.values) + .concat(anonymTyDefs.values) + .toList) + + /** + * This function defunctionalizes the top-level `TypingUnit` into a `Module`. + */ + def defunctionalize(tu: TypingUnit): ModuleUnit = + // debug.trace("MONO MODL", PrettyPrinter.show(tu)) { + val exps = tu.entities.zipWithIndex.flatMap[Expr] { + case (term: Term, i) => + val exp = term2Expr(term) + val funcName = s"main$$$$$i" + val asFunc: Item.FuncDecl = Item.FuncDecl(Expr.Ref(funcName), Nil, exp) + addNewFunction(asFunc) + evalQueue.addOne(funcName) + Some(Expr.Apply(Expr.Ref(funcName), Nil)) + case (tyDef: NuTypeDef, _) => + val ret = type2Item(tyDef) + addPrototypeTypeDecl(ret) + None + case (funDef: NuFunDef, _) => + val funcItem = func2Item(funDef) + funcItem match + case funcDecl: Item.FuncDecl => + addNewFunction(funcDecl) + case _ => () + None + case (other, _) => throw MonomorphError(s"Unknown Statement in TypingUnit: ${other}") + }; + debug.log(getResult(exps).getDebugOutput.toLines(using false).mkString("\n")) + while(!evalQueue.isEmpty){ + val crt = evalQueue.head + evalQueue.remove(crt) + updateFunction(crt) + } + funImpls.mapValuesInPlace{ + case (_, (Item.FuncDecl(nm, as, body), mp, la, lr)) => + (Item.FuncDecl(nm, as, specializer.defunctionalize(body)), mp, la, lr) + } + val ret = getResult(exps) + debug.log("") + debug.log("==============final function signatures==================") + funImpls.foreach( + (nm, info) => { + debug.log(s"$nm: (${info._3.mkString(" X ")}) -> ${info._4}") + } + ) + + ret + // }() + + private def updateFunction(crt: String): Unit = { + debug.log(s"evaluating $crt, rests: ${evalQueue}") + val cnt = evalCnt.get(crt).getOrElse(0) + if(cnt <= 10){ + evalCnt.update(crt, cnt+1) + debug.log("=" * 10 + s" updating $crt " + "=" * 10) + debug.log(getfunInfo(crt)) + updateFunc(crt) + debug.log(getfunInfo(crt)) + } + else{ + throw new MonomorphError("stack overflow!!!") + } + } + + /** + * This function monomorphizes the nested `TypingUnit` into a `Isolation`. + */ + private def trans2Expr(body: TypingUnit): Isolation = + debug.trace("MONO BODY", PrettyPrinter.show(body)) { + Isolation(body.entities.flatMap[Expr | Item.FuncDecl | Item.FuncDefn] { + case term: Term => + Some(term2Expr(term)) + case tyDef: NuTypeDef => + val ret = type2Item(tyDef) + addPrototypeTypeDecl(ret) + None + case funDef: NuFunDef => + Some(func2Item(funDef)) + case other => throw MonomorphError(s"Unknown Statement in TypingUnit: ${other}") + }) + }(identity) + + def getFuncRetVal(name: String, args: List[BoundedExpr])(using evalCtx: Context, callingStack: List[String]): BoundedExpr = { + debug.trace[BoundedExpr]("SPEC CALL", name + args.mkString(" with (", ", ", ")")) { + if(funImpls.contains(name)){ + val (funcdecl, mps, oldArgs, oldVs) = funImpls.get(name).get + val old = funDependence.get(name).get + funDependence.update(name, old ++ callingStack.headOption) + // debug.log(s"adding dependence ${callingStack.headOption}") + val nArgs = (oldArgs zip (args.map(_.unfoldVars))).map(_ ++ _).zip(funcdecl.params).map( + (x,y) => if(y._1) then x else x.literals2Prims + ) + + debug.log(s"comparing ${oldArgs.mkString("(", ", ", ")")} with ${nArgs.map(_.getDebugOutput).mkString("(", ", ", ")")}") + if(evalCnt.get(name).isEmpty || (oldArgs zip nArgs).find(x => x._1.compare(x._2)).isDefined){ + funImpls.update(name, (funcdecl, mps, nArgs, oldVs)) + if(!evalQueue.contains(name)){ + if(evalCnt.get(name).isEmpty){ + debug.log(s"first time encounter $name") + updateFunction(name) + } + else{ + debug.log(s"find finer args") + evalQueue.add(name) + } + } + } + BoundedExpr(funImpls.get(name).get._4) + } + else { + debug.log(s"calling unknown function $name(${args.mkString(",")})") + debug.log(funImpls.keySet.toString()) + BoundedExpr(UnknownValue()) + } + }(identity) + } + + private def updateFunc(name: String): Unit = { + val (funcdecl, mps, args, _) = funImpls.get(name).get + val ctx = (funcdecl.params.map(_._2.name) zip args).toMap + val nBody = specializer.evaluate(funcdecl.body)(using Context()++ctx, List(funcdecl.name.name)) + val nVs = nBody.expValue + val oldVs = VariableValue.get(funImpls.get(name).get._4) + debug.log(s"comparing ${oldVs} with ${nVs}") + if(oldVs.compare(nVs)){ + debug.log(s"adding these funcs to queue: ${funDependence.get(name).get}") + funDependence.get(name).get.foreach(x => if !evalQueue.contains(x) then evalQueue.add(x)) + } + funImpls.updateWith(name)(_.map(x => { + val nFuncDecl: Item.FuncDecl = x._1.copy(body = nBody) + VariableValue.update(x._4, nVs) + (nFuncDecl, x._2, x._3, x._4) + })) + } + + def findVar(name: String)(using evalCtx: Context, callingStack: List[String]): MonoValue = { + if(funImpls.contains(name)){ + val funcBody = funImpls.get(name).get + funDependence.update(name, funDependence.get(name).get ++ callingStack.headOption) + FunctionValue(name, funcBody._1.params.map(_._2.name), Nil) + } + else{ + UnknownValue() + } + } + + private def partitationArguments(name: String, params: List[Parameter], args: List[Expr]): (List[Expr], List[Expr]) = + if (args.length != params.length) { + debug.log("") + throw MonomorphError(s"$name expect ${params.length} arguments but ${args.length} were given") + } + val staticArguments = params.iterator.zip(args).flatMap({ + case ((true, _), value) => Some(value) + case _ => None + }).toList + val dynamicArguments = params.iterator.zip(args).flatMap({ + case ((false, _), value) => Some(value) + case _ => None + }).toList + (staticArguments, dynamicArguments) + + private def generateSignature(staticArguments: List[Expr])(using MonomorphContext): String = + staticArguments.iterator.map(infer(_, None)).mkString("__", "_", "") + + private def specializeClassCall(name: String, args: List[Expr])(using MonomorphContext): Option[Expr] = + debug.trace("SPEC CALL", "class " + name + args.mkString(" with (", ", ", ")")) { + ??? + }(_.fold(Debug.noPostTrace)(identity)) + + def createObjValue(tpName: String, args: List[BoundedExpr]): MonoValue = + debug.trace("SPEC NEW", s"$tpName($args)"){ + if(allTypeImpls.contains(tpName)){ + val tp = allTypeImpls.get(tpName).get + val ags = (tp.params.map(_._2.name) zip args) + val ret = ObjectValue(tpName, MutMap(ags: _*)) + val pars = tp.parents.map((supTp, prms) => { + val evArgs = prms.map(specializer.evaluate(_)(using Context() ++ (("this"->BoundedExpr(ret)) :: ags), List(tpName)).expValue) + BoundedExpr(createObjValue(supTp.base.name, evArgs)) + }) + val parObjs = pars.zipWithIndex.map((e, i) => s"sup$$$i" -> e) + debug.log(s"par objs: $parObjs") + ret.fields.addAll(parObjs) + ret + } + else throw MonomorphError(s"tpName ${tpName} not found in implementations ${allTypeImpls}") + }(identity) + + def getFieldVal(obj: ObjectValue, field: String): BoundedExpr = + debug.trace("SPEC SEL", s"$obj :: $field"){ + if(allTypeImpls.contains(obj.name)){ + val tpDef = allTypeImpls.get(obj.name).get + val func = tpDef.body.items.flatMap{ + case funcDecl@Item.FuncDecl(Expr.Ref(nm), prms, bd) if nm.equals(field) => + Some(funcDecl) + case _ => None + }.headOption + if(func.isDefined){ + debug.log("defined") + val Item.FuncDecl(nm, prms, bd) = func.get + val nFuncName = s"${nm.name}$$${obj.name}" + if(!funImpls.contains(nFuncName)){ + val nFunc: Item.FuncDecl = Item.FuncDecl(Expr.Ref(nFuncName), (false, Expr.Ref("this")) :: prms, bd) + addNewFunction(nFunc) + } + BoundedExpr(FunctionValue(nFuncName, prms.map(_._2.name), List("this" -> BoundedExpr(obj)))) + } + else if(obj.fields.contains(field)) + debug.log("contains") + obj.fields.get(field).get + else{ + debug.log("else") + obj.fields.flatMap(x => { + if (x._1.matches("sup\\$[0-9]+")) { + x._2.asValue match{ + case Some(o: ObjectValue) => + Some(getFieldVal(o, field)) + case _ => None + } + } + else None + }).headOption.getOrElse( + throw MonomorphError(s"Field ${field} not Found in"+obj.toString()) + ) + } + } + else { + throw MonomorphError(s"ObjectValue ${obj} not found in implementations ${allTypeImpls}") + } + }(identity) + +object Monomorph: + class SpecializationMap[T <: Item](val prototype: T): + private var basePrototype: Option[T] = None + private val implementations = MutMap[String, T]() + + inline def getOrInsert(signature: String, op: => T): T = + implementations.getOrElseUpdate(signature, op) + inline def size: Int = implementations.size + // signature + item + inline def +=(entry: (String, T)): T = + implementations.addOne(entry) + entry._2 + inline def base: Option[T] = basePrototype + inline def base_=(op: => T): Unit = + basePrototype match + case None => basePrototype = Some(op) + case Some(_) => () + inline def isEmpty: Boolean = implementations.isEmpty + inline def iterator: Iterator[T] = + if implementations.isEmpty then Iterator.empty else + basePrototype.iterator.concat(implementations.values) \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphContext.scala b/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphContext.scala new file mode 100644 index 000000000..b3eef1342 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphContext.scala @@ -0,0 +1,33 @@ +package mlscript.compiler.mono + +import mlscript.compiler.debug.DebugOutput +import scala.collection.immutable.SeqMap +import mlscript.compiler.debug.Printable +import mlscript.compiler.* + +class MonomorphContext(context: List[Map[String, DataType]]) extends Printable: + def +(entry: (String, DataType)): MonomorphContext = + MonomorphContext(context match { + case Nil => Nil + case head :: tail => (head + entry) :: tail + }) + + def :+(entry: (String, DataType)): MonomorphContext = + MonomorphContext((Map.empty + entry) :: context) + + def unary_+ : MonomorphContext = + MonomorphContext(Map.empty :: context) + + def get(key: String): Option[DataType] = + context.iterator.flatMap(_.get(key)).nextOption() + + def getDebugOutput: DebugOutput = + DebugOutput.Map(context.foldRight(SeqMap.empty[String, String]) { (entries, map) => + entries.foldLeft(map) { (map, entry) => + map + (entry._1 -> entry._2.toString) + } + }.toList) + + +object MonomorphContext: + def empty: MonomorphContext = MonomorphContext(Nil) \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphError.scala b/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphError.scala new file mode 100644 index 000000000..e7ef0305e --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/MonomorphError.scala @@ -0,0 +1,3 @@ +package mlscript.compiler.mono + +class MonomorphError(message: String) extends Error(message) diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/specializer/BoundedExpr.scala b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/BoundedExpr.scala new file mode 100644 index 000000000..fc60c04da --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/BoundedExpr.scala @@ -0,0 +1,226 @@ +package mlscript.compiler.mono.specializer + +import mlscript.compiler.{Expr, UnitValue} +import mlscript.compiler.debug.Printable +import mlscript.compiler.debug.DebugOutput +import scala.collection.mutable.Map as MutMap +import scala.collection.mutable.Set as MutSet +import mlscript.Var +import scala.collection.immutable +import mlscript.compiler.mono.MonomorphError + +abstract class MonoValue { + def toBoundedExpr = BoundedExpr(this) + def toStringSafe(using Set[Int]) = this.toString() +} +case class ObjectValue(name: String, fields: MutMap[String, BoundedExpr]) extends MonoValue{ + override def toString(): String = fields.map(x => (s"${x._1}: ${x._2.toStringSafe}")).mkString(s"$name@{", ", ", "}") + override def toStringSafe(using Set[Int]): String = fields.map(x => (s"${x._1}: ${x._2.toStringSafe}")).mkString(s"$name@{", ", ", "}") + def merge(other: ObjectValue)(using inStackExps: Set[Int]): ObjectValue = { + val allKeys = fields.keySet + val nFlds = allKeys.map(k => { + val s1 = fields.get(k).get + val s2 = other.fields.get(k).get + if(inStackExps.contains(s1.hashCode()) && inStackExps.contains(s2.hashCode())) + (k -> s1) + else (k -> (s1 ++ s2)) + }) + ObjectValue(name, MutMap(nFlds.toSeq: _*)) + } + override def equals(x: Any): Boolean = { + x match { + case ObjectValue(xName, _) => name.equals(xName) + case _ => false + } + } +} +case class FunctionValue(name: String, prm: List[String], ctx: List[(String, BoundedExpr)]) extends MonoValue{ + override def toString(): String = prm.mkString(s"$name(", ", ", ")") + ctx.map(x => (s"${x._1}: ${x._2.toStringSafe}")).mkString(" given {", ", ", "}") + override def toStringSafe(using Set[Int]): String = prm.mkString(s"$name(", ", ", ")") + ctx.map(x => (s"${x._1}: ${x._2.toStringSafe}")).mkString(" given {", ", ", "}") + override def equals(x: Any): Boolean = x match{ + case FunctionValue(xName, _, _) => name.equals(xName) + case _ => false + } +} +case class UnknownValue() extends MonoValue{ + val idValue = UnknownValue.refresh() + override def toString(): String = s"?$idValue?" +} +object UnknownValue{ + var unknownCnt: Int = 0 + def refresh() = { + unknownCnt += 1 + unknownCnt + } +} +case class VariableValue(vx: Int, version: Int) extends MonoValue{ + override def toStringSafe(using Set[Int]): String = s"*$vx*=${VariableValue.get(this).toStringSafe}" + override def toString(): String = toStringSafe(using Set()) + def refresh() = VariableValue(vx, version+1) +} +object VariableValue{ + var vxCnt = 0 + val vMap = MutMap[Int, BoundedExpr]() + def refresh(): VariableValue = { + vxCnt += 1 + val ret = VariableValue(vxCnt, 0) + vMap.addOne(vxCnt -> BoundedExpr(ret)) + ret + } + def get(v: VariableValue): BoundedExpr = vMap.get(v.vx).get + def update(v: VariableValue, s: BoundedExpr): Unit = { + vMap.update(v.vx, s) + } +} + +case class LiteralValue(i: BigInt | BigDecimal | Boolean | String | UnitValue) extends MonoValue{ + def asBoolean(): Option[Boolean] = i match{ + case x: Boolean => Some(x) + case _ => None + } + override def toString(): String = i.toString() +} +case class PrimitiveValue() extends MonoValue{ + override def toString(): String = "*LIT*" +} + +class BoundedExpr(private val values: Set[MonoValue]) extends Printable { + def this(singleVal: MonoValue) = this(Set(singleVal)) + def this() = this(Set()) + def getDebugOutput: DebugOutput = DebugOutput.Plain(toStringSafe) + def getObjNames() = values.flatMap{ + // case FunctionValue(name, body, prm, ctx) => Some(name) + case ObjectValue(name, _) => Some(name) + case _ => None + }.toSet + // override def hashCode(): Int = values.hashCode() + override def toString(): String = toStringSafe + var updateCnt: Int = 0 + def toStringSafe(using printed: Set[Int] = Set()): String = { + if(printed.contains(this.hashCode())) s"..." + else values.map(_.toStringSafe(using printed + this.hashCode())).mkString("[", " | ", s"]") + } + def asValue: Option[MonoValue] = { + val tmp = this.unfoldVars + if(tmp.values.size == 1) { + Some(tmp.values.head) + } + else None + } + def getValue: Set[MonoValue] = { + unfoldVars.values.toSet.filterNot(_.isInstanceOf[VariableValue]) + } + + private def splitSpecifiedObjects(vs: Set[MonoValue], nms: Set[String]): (Set[MonoValue], Map[String, ObjectValue]) = { + val ret = vs.map{ + case o@ObjectValue(name, fields) => + if nms.contains(name) then { + (None, Some(name -> o)) + } else { + (Some(o), None) + } + case x => (Some(x), None) + }.unzip + val ret1 = ret._1.flatten + val ret2 = ret._2.flatten.toMap + (ret1, ret2) + } + + def unfoldVars(using instackExps: Set[Int] = Set()): BoundedExpr = { + val vars = values.toList.map{ + case vx: VariableValue => (Some(vx), None) + case others => (None, Some(others)) + }.unzip + val varSets: List[BoundedExpr] = vars._1.flatten.map(x => { + val vSet = VariableValue.get(x) + if(!instackExps.contains(vSet.hashCode())){ + vSet.unfoldVars(using instackExps + vSet.hashCode()) + } + else BoundedExpr(x) + }) + varSets.foldLeft(BoundedExpr(vars._2.flatten.toSet))((x, y) => (x ++ y)(using instackExps + y.hashCode())) + } + + def literals2Prims: BoundedExpr = { + val hasPrim = values.find(x => x.isInstanceOf[PrimitiveValue] || x.isInstanceOf[LiteralValue]).isDefined + if(hasPrim) + BoundedExpr(values.filterNot(x => x.isInstanceOf[PrimitiveValue] || x.isInstanceOf[LiteralValue]) + PrimitiveValue()) + else this + } + + def ++(other: BoundedExpr)(using instackExps: Set[Int] = Set()): BoundedExpr = { + if(this == other) this + else { + // unfoldVars + // other.unfoldVars + val mergingValNms = getObjNames().intersect(other.getObjNames()) + val (restVals1, mergingVals1) = splitSpecifiedObjects(values.toSet, mergingValNms) + val (restVals2, mergingVals2) = splitSpecifiedObjects(other.values.toSet, mergingValNms) + // val map2 = other.values.flatMap(x => if(values.fin(x)) then None else Some(x)) + val ret = mergingValNms.map(nm => (mergingVals1.get(nm), mergingVals2.get(nm)) match + case (Some(x1: ObjectValue), Some(x2: ObjectValue)) => x1.merge(x2)(using instackExps ++ Set(this.hashCode(), other.hashCode())) + case _ => throw MonomorphError(s"Name ${nm} not found in BoundedExpr merging") + ) + // println(s"get ${BoundedExpr(restVals1 ++ restVals2 ++ ret)}") + var ret2 = restVals1 ++ restVals2 + if(ret2.count(x => (x.isInstanceOf[LiteralValue] || x.isInstanceOf[PrimitiveValue])) > 1){ + ret2 = ret2.filterNot(_.isInstanceOf[LiteralValue]) + PrimitiveValue() + } + val retVals = BoundedExpr(ret2 ++ ret) + retVals.updateCnt = this.updateCnt + if(this.compare(retVals)) retVals.updateCnt += 1 + retVals + } + } + + def size = values.size + // lazy val eleCnt: Int = countEles + def eleCnt(using instackExps: Set[Int] = Set()): Int = { + if(values.size == 0) { + 0 + } + else { + val seperated = values.map{ + case o: ObjectValue => (None, Some(o)) + case f: FunctionValue => (Some(1), None) + case _: LiteralValue => (Some(1), None) + case _: PrimitiveValue => (Some(100000), None) + case UnknownValue() => (Some(1), None) + case vx: VariableValue => (Some(VariableValue.get(vx).eleCnt(using instackExps + VariableValue.get(vx).hashCode())), None) + }.unzip + val (lits, objs) = (seperated._1.flatten, seperated._2.flatten) + val objn = objs.map{ + case ObjectValue(name, fields) => + fields.map(x => { + if(instackExps.contains(x._2.hashCode())) 1 + else x._2.eleCnt(using instackExps + x._2.hashCode()) + }).fold(0)(_ + _) + 1 + }.fold(0)(_ + _) + lits.fold(0)(_ + _) + objn + } + } + def compare(other: BoundedExpr)(using instackExps: Set[Int] = Set()): Boolean = { + if(instackExps.contains(this.hashCode()) && instackExps.contains(other.hashCode())) + false + else { + if(values.find(_.isInstanceOf[PrimitiveValue]).isEmpty && other.values.find(_.isInstanceOf[PrimitiveValue]).isDefined) + true + else if(this.size != other.size) + this.size < other.size + else{ + val nms1 = this.getObjNames() + val nms2 = other.getObjNames() + if(nms1.equals(nms2)){ + val (rests1, objs1) = splitSpecifiedObjects(this.values.toSet, nms1) + val (rests2, objs2) = splitSpecifiedObjects(other.values.toSet, nms1) + nms1.find(nm => { + val v1s = objs1.get(nm).get.fields + val v2s = objs2.get(nm).get.fields + v1s.keySet.find(k => v1s.get(k).get.compare(v2s.get(k).get)(using instackExps + this.hashCode() + other.hashCode())).isDefined + }).isDefined + } + else true + } + } + } +} \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Builtin.scala b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Builtin.scala new file mode 100644 index 000000000..a1a7b12c1 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Builtin.scala @@ -0,0 +1,95 @@ +package mlscript.compiler.mono.specializer + +import mlscript.compiler.Expr +import mlscript.compiler.mono.MonomorphError + +object Builtin: + val builtinRefs = Set(">", "-", "+", "*", "&&", "||", "==", "true", "false") + + private val builtinBinaryOperations = Map[String, (Expr, Expr) => Option[Expr]]( + (">", { + case (Expr.Literal(lhs: BigInt), Expr.Literal(rhs: BigInt)) => + Some(Expr.Literal(lhs > rhs)) + case (Expr.Literal(lhs: BigDecimal), Expr.Literal(rhs: BigDecimal)) => + Some(Expr.Literal(lhs > rhs)) + case (_, _) => None + }), + ("-", { + case (Expr.Literal(lhs: BigInt), Expr.Literal(rhs: BigInt)) => + Some(Expr.Literal(lhs - rhs)) + case (Expr.Literal(lhs: BigDecimal), Expr.Literal(rhs: BigDecimal)) => + Some(Expr.Literal(lhs - rhs)) + case (_, _) => None + }), + ("+", { + case (Expr.Literal(lhs: BigInt), Expr.Literal(rhs: BigInt)) => + Some(Expr.Literal(lhs + rhs)) + case (Expr.Literal(lhs: BigDecimal), Expr.Literal(rhs: BigDecimal)) => + Some(Expr.Literal(lhs + rhs)) + case (_, _) => None + }), + ("*", { + case (Expr.Literal(lhs: BigInt), Expr.Literal(rhs: BigInt)) => + Some(Expr.Literal(lhs * rhs)) + case (Expr.Literal(lhs: BigDecimal), Expr.Literal(rhs: BigDecimal)) => + Some(Expr.Literal(lhs * rhs)) + case (_, _) => None + }) + ) + + private val builtinBinaryOperationsValue = Map[String, (MonoValue, MonoValue) => Option[MonoValue]]( + (">", { + case (LiteralValue(lhs: BigInt), LiteralValue(rhs: BigInt)) => + Some(LiteralValue(lhs > rhs)) + case (LiteralValue(lhs: BigDecimal), LiteralValue(rhs: BigDecimal)) => + Some(LiteralValue(lhs > rhs)) + case (_, _) => None + }), + ("-", { + case (LiteralValue(lhs: BigInt), LiteralValue(rhs: BigInt)) => + Some(LiteralValue(lhs - rhs)) + case (LiteralValue(lhs: BigDecimal), LiteralValue(rhs: BigDecimal)) => + Some(LiteralValue(lhs - rhs)) + case (_, _) => None + }), + ("+", { + case (LiteralValue(lhs: BigInt), LiteralValue(rhs: BigInt)) => + Some(LiteralValue(lhs + rhs)) + case (LiteralValue(lhs: BigDecimal), LiteralValue(rhs: BigDecimal)) => + Some(LiteralValue(lhs + rhs)) + case (_, _) => None + }), + ("*", { + case (LiteralValue(lhs: BigInt), LiteralValue(rhs: BigInt)) => + Some(LiteralValue(lhs * rhs)) + case (LiteralValue(lhs: BigDecimal), LiteralValue(rhs: BigDecimal)) => + Some(LiteralValue(lhs * rhs)) + case (_, _) => None + }), + ("&&", { + case (LiteralValue(lhs: Boolean), LiteralValue(rhs: Boolean)) => + Some(LiteralValue(lhs && rhs)) + case (_, _) => None + }), + ("||", { + case (LiteralValue(lhs: Boolean), LiteralValue(rhs: Boolean)) => + Some(LiteralValue(lhs || rhs)) + case (_, _) => None + }), + ("==", { + case (LiteralValue(lhs: BigInt), LiteralValue(rhs: BigInt)) => + Some(LiteralValue(lhs == rhs)) + case (LiteralValue(lhs: Boolean), LiteralValue(rhs: Boolean)) => + Some(LiteralValue(lhs == rhs)) + case (_, _) => None + }) + ) + + def isBinaryOperator(name: String): Boolean = + builtinBinaryOperations.contains(name) + + def evalulateBinaryOperation(name: String, lhs: Expr, rhs: Expr): Option[Expr] = + builtinBinaryOperations(name)(lhs, rhs) + + def evaluateBinaryOpValue(name: String, lhs: MonoValue, rhs: MonoValue): Option[MonoValue] = + builtinBinaryOperationsValue(name)(lhs, rhs) diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Context.scala b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Context.scala new file mode 100644 index 000000000..bd1d8faec --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Context.scala @@ -0,0 +1,21 @@ +package mlscript.compiler.mono.specializer + +import mlscript.compiler.Expr +import mlscript.compiler.debug.{DebugOutput, Printable} +import mlscript.compiler.mono.specializer.BoundedExpr + +class Context(private val entries: Map[String, BoundedExpr]) extends Printable: + def this() = this(Map("true" -> BoundedExpr(LiteralValue(true)), "false" -> BoundedExpr(LiteralValue(false)))) + inline def get(name: String): BoundedExpr = entries.get(name).getOrElse(BoundedExpr(UnknownValue())) + inline def +(entry: (String, BoundedExpr)): Context = Context(entries + entry) + inline def ++(other: Context): Context = Context(entries ++ other.entries) + inline def ++(other: IterableOnce[(String, BoundedExpr)]) = Context(entries ++ other) + inline def isEmpty: Boolean = entries.isEmpty + inline def contains(name: String): Boolean = entries.contains(name) + def getDebugOutput: DebugOutput = + DebugOutput.Map(entries.iterator.map { + (key, value) => (key, value.toString) + }.toList) +object Context{ + def toCtx(entries: IterableOnce[(String, BoundedExpr)]) = Context(Map.from(entries)) +} \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Predicates.scala b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Predicates.scala new file mode 100644 index 000000000..80a75fa1a --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Predicates.scala @@ -0,0 +1,6 @@ +package mlscript.compiler.mono.specializer + +import mlscript.compiler.Expr + +object Predicates: + \ No newline at end of file diff --git a/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Specializer.scala b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Specializer.scala new file mode 100644 index 000000000..6a8adea77 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/mono/specializer/Specializer.scala @@ -0,0 +1,228 @@ +package mlscript.compiler.mono.specializer + +import scala.collection.mutable.ArrayBuffer +import scala.collection.mutable.Map as MutMap +import mlscript.compiler.debug.Debug +import mlscript.compiler.mono.MonomorphError +import mlscript.compiler.mono.Monomorph +import mlscript.compiler.UnitValue +import mlscript.TypeName +import mlscript.compiler.Item +import mlscript.compiler.CaseBranch +import mlscript.compiler.Expr + +class Specializer(monoer: Monomorph)(using debug: Debug){ + + def evaluate(rawExpr: Expr)(using evalCtx: Context, callingStack: List[String]): Expr = + // debug.trace[Expr]("EVAL ", rawExpr.toString()) { + rawExpr match{ + case Expr.Ref(name) => + rawExpr.expValue = + if evalCtx.contains(name) then evalCtx.get(name) else BoundedExpr(monoer.findVar(name)) + rawExpr + case Expr.Apply(Expr.Apply(opE@Expr.Ref(op), a1), a2) if Builtin.isBinaryOperator(op) => + if(a1.length == 1 && a2.length == 1) + { + val a1E = evaluate(a1.head) + val a2E = evaluate(a2.head) + val pairedAV = (a1E.expValue.asValue, a2E.expValue.asValue) match { + case (Some(i1: LiteralValue), Some(i2: LiteralValue)) => + Builtin.evaluateBinaryOpValue(op, i1, i2) match{ + case Some(value) => value + case None => PrimitiveValue() + } + case _ => PrimitiveValue() + } + val retExp = Expr.Apply(Expr.Apply(opE, List(a1E)), List(a2E)) + retExp.expValue = BoundedExpr(pairedAV) + retExp + } + else throw MonomorphError(s"Malformed Expr: ${rawExpr}") + + case other@Expr.Apply(callee, arguments) => + val calE = evaluate(callee) + val cal = calE.expValue + val nArgs = arguments.map(evaluate) + val args = nArgs.map(_.expValue) + val retV = cal.getValue.map{ + case FunctionValue(name, prm, ctxArg) => + val callResult = monoer.getFuncRetVal(name, ctxArg.unzip._2 ++ args) + // debug.log(s"call result: $callResult") + callResult + case o: ObjectValue => + val sel = monoer.getFieldVal(o, "apply") + sel.asValue match + case Some(FunctionValue(name, prm, ctx)) => + val callResult = monoer.getFuncRetVal(name, ctx.unzip._2 ++ args) + // debug.log(s"call result: $callResult") + callResult + case _ => BoundedExpr(UnknownValue()) + case _ => BoundedExpr(UnknownValue()) + }.fold(BoundedExpr())((x, y) => { + // debug.log(s"merging $x with $y") + val xy = x ++ y + // debug.log(s"result $xy") + xy + }) + val retExp = Expr.Apply(calE, nArgs) + retExp.expValue = retV + retExp + + case Expr.Select(receiver, field) => + val rec = evaluate(receiver) + val retV = rec.expValue.getValue.map{ + case ObjectValue(_, flds) if flds.contains(field.name) => + flds.get(field.name).get + case obj: ObjectValue => + monoer.getFieldVal(obj, field.name) + case _ => + BoundedExpr(UnknownValue()) + }.fold(BoundedExpr())(_ ++ _) + val retExp = Expr.Select(rec, field) + retExp.expValue = retV + retExp + + case Expr.LetIn(false, name, rhs, body) => + val nRhs = evaluate(rhs) + val nCtx = evalCtx + (name.name -> nRhs.expValue) + val nBody = evaluate(body)(using nCtx) + val retExp = Expr.LetIn(false, name, nRhs, nBody) + retExp.expValue = body.expValue + retExp + + case l@Expr.Literal(value) => + l.expValue = BoundedExpr(LiteralValue(value)) + l + + case Expr.New(apply, arguments) => + val nArgs = arguments.map(evaluate(_)) + val args = nArgs.map(_.expValue) + val retV = BoundedExpr(monoer.createObjValue(apply.name, args)) + val retExp = Expr.New(apply, nArgs) + retExp.expValue = retV + retExp + + case Expr.IfThenElse(condition, consequent, Some(alternate)) => + val nCond = evaluate(condition) + val nCons = evaluate(consequent) + val nAlter = evaluate(alternate) + val retV = nCond.expValue.asValue match { + case Some(x: LiteralValue) if x.asBoolean().isDefined => + if(x.asBoolean().get){ + nCons.expValue + } + else { + nAlter.expValue + } + case _ => + nCons.expValue ++ nAlter.expValue + } + val retExp = Expr.IfThenElse(nCond, nCons, Some(nAlter)) + retExp.expValue = retV + retExp + case Expr.IfThenElse(condition, consequent, None) => + val nCond = evaluate(condition) + val nCons = evaluate(consequent) + val retExp = Expr.IfThenElse(nCond, nCons, None) + retExp.expValue = BoundedExpr(LiteralValue(UnitValue.Undefined)) + retExp + + case self@Expr.Lambda(prm, body) => + throw MonomorphError(s"Unhandled case: ${rawExpr}") + + case Expr.Isolated(isolation) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + + case Expr.Tuple(fields) => + if(fields.length == 1){ + evaluate(fields.head) + } + else + throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.Record(fields) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.LetIn(true, name, rhs, body) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.Block(items) => + val exps = items.flatMap{ + case e: Expr => Some(evaluate(e)) + case _ => None + } + if(exps.length == 0){ + val retE = Expr.Literal(UnitValue.Undefined) + val retV = BoundedExpr(LiteralValue(UnitValue.Undefined)) + retE.expValue = retV + retE + } + else if(exps.length == 1){ + exps.head + } + else { + val retV = exps.reverse.head.expValue + val retE = Expr.Block(exps) + retE.expValue = retV + retE + } + + case Expr.As(value, toType) => + val retV = evaluate(value) + rawExpr.expValue = retV.expValue + rawExpr + case Expr.Assign(assignee, value) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.With(value, fields) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.Subscript(receiver, index) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + case Expr.Match(scrutinee, branches) => throw MonomorphError(s"Unhandled case: ${rawExpr}") + } + // }(_.expValue) + + def defunctionalize(rawExpr: Expr): Expr = { + val ret: Expr = rawExpr match { + case _: (Expr.Ref | Expr.Literal) => rawExpr + case Expr.Apply(sel@Expr.Select(receiver, field), args) => + val nRec = defunctionalize(receiver) + val nArgs = args.map(defunctionalize) + val branches = ArrayBuffer[CaseBranch]() + receiver.expValue.getValue.foreach{ + case o@ObjectValue(name, _) => + val selValue = monoer.getFieldVal(o, field.name) + val branchExp = selValue.asValue match{ + // foo.f is a member function + case Some(f: FunctionValue) => + Expr.Apply(Expr.Ref(f.name), Expr.Ref("obj") :: nArgs) + // foo.f is (many candidate) lambda(Object) + case _ if selValue.getValue.forall(_.isInstanceOf[ObjectValue]) => + // foo.f match ... + val scrut = Expr.Select(Expr.Ref("obj"), field) + val brchs = selValue.getValue.toList.map(_.asInstanceOf[ObjectValue]) + .map(o => { + val lambdaMemFunc = monoer.getFieldVal(o, "apply").asValue.get.asInstanceOf[FunctionValue] + val caseVarNm: Expr.Ref = Expr.Ref(s"obj$$${o.name}") + CaseBranch.Instance(Expr.Ref(o.name), caseVarNm, + Expr.Apply(Expr.Ref(lambdaMemFunc.name), caseVarNm :: nArgs)) + }) + Expr.Match(scrut, ArrayBuffer(brchs: _*)) + case _ => throw MonomorphError(s"Unhandled case: ${rawExpr}") + + } + branches.addOne(CaseBranch.Instance(Expr.Ref(name), Expr.Ref("obj"), branchExp)) + case _ => () + } + Expr.Match(nRec, branches) + case Expr.Apply(callee, arguments) => + if(callee.expValue.getValue.find(_.isInstanceOf[ObjectValue]).isDefined) + defunctionalize(Expr.Apply(Expr.Select(callee, Expr.Ref("apply")), arguments)) + else + Expr.Apply(defunctionalize(callee), arguments.map(defunctionalize)) + case Expr.New(typeName, args) => Expr.New(typeName, args.map(defunctionalize)) + case Expr.Tuple(fields) => Expr.Tuple(fields.map(defunctionalize)) + case Expr.LetIn(isRec, name, rhs, body) => Expr.LetIn(isRec, name, defunctionalize(rhs), defunctionalize(body)) + case Expr.IfThenElse(condition, consequent, alternate) => Expr.IfThenElse(defunctionalize(condition), defunctionalize(consequent), alternate.map(defunctionalize)) + case Expr.Block(items) => Expr.Block(items.map{ + case e: Expr => defunctionalize(e) + case other => other + }) + case Expr.Select(receiver, field) => Expr.Select(defunctionalize(receiver), field) + case Expr.As(value, toType) => Expr.As(defunctionalize(value), toType) + case _ => throw MonomorphError(s"Unhandled case: ${rawExpr}") + } + ret.expValue = rawExpr.expValue + ret + } +} diff --git a/compiler/shared/main/scala/mlscript/compiler/printer/ExprPrinter.scala b/compiler/shared/main/scala/mlscript/compiler/printer/ExprPrinter.scala new file mode 100644 index 000000000..6026a9ea0 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/printer/ExprPrinter.scala @@ -0,0 +1,73 @@ +package mlscript.compiler.printer + +import mlscript.compiler.{Expr, Isolation, Item, ModuleUnit, Parameter} + +class ExprPrinter: + private val printer = BlockPrinter() + + import printer.{endLine, enter, leave, print} + + private def show(module: ModuleUnit): Unit = module.items.foreach { + case expr: Expr => show(expr) + case item: Item => show(item) + } + + private def show(params: List[Parameter]): String = + params.iterator.map { + case (spec, Expr.Ref(name)) => (if spec then "#" else "") + name + }.mkString("(", ", ", ")") + + private def show(item: Item): Unit = item match + case Item.TypeDecl(Expr.Ref(name), kind, typeParams, params, parents, body) => + val typeParamsStr = if typeParams.isEmpty then "" + else typeParams.iterator.map(_.name).mkString("[", ", ", "]") + val reprParents = if parents.isEmpty then "" + else parents.iterator.map { case (parent, args) => + parent.show(true) + args.iterator.mkString("(", ", ", ")") + }.mkString(": ", ", ", "") + print(s"$kind $name$typeParamsStr${show(params)}$reprParents ") + show(body) + case Item.FuncDecl(Expr.Ref(name), params, body) => + print(s"fun $name${show(params)} =") + enter() + show(body) + leave() + case Item.FuncDefn(Expr.Ref(name), typeParams, polyType) => + val reprTypeParams = if typeParams.isEmpty then "" else + s"${typeParams.mkString("[", ", ", "]")} => " + print(s"fun $name: $reprTypeParams${polyType.show}") + + private def show(isolation: Isolation): Unit = + enter("{", "}") + isolation.items.foreach { + case expr: Expr => show(expr) + case item: Item => show(item) + } + leave() + + private def show(expr: Expr) = + print(expr.toString) + endLine() + + def toLines: List[String] = printer.toLines + + override def toString(): String = printer.toString + +object ExprPrinter: + def print(node: ModuleUnit | Item | Isolation | Expr): String = + val printer = ExprPrinter() + node match + case module: ModuleUnit => printer.show(module) + case item: Item => printer.show(item) + case isolation: Isolation => printer.show(isolation) + case expr: Expr => printer.show(expr) + printer.toString + + def printLines(node: ModuleUnit | Item | Isolation | Expr): List[String] = + val printer = ExprPrinter() + node match + case module: ModuleUnit => printer.show(module) + case item: Item => printer.show(item) + case isolation: Isolation => printer.show(isolation) + case expr: Expr => printer.show(expr) + printer.toLines diff --git a/compiler/shared/main/scala/mlscript/compiler/syntax.scala b/compiler/shared/main/scala/mlscript/compiler/syntax.scala new file mode 100644 index 000000000..b7e205112 --- /dev/null +++ b/compiler/shared/main/scala/mlscript/compiler/syntax.scala @@ -0,0 +1,271 @@ +package mlscript.compiler + +import mlscript.compiler.debug.{DebugOutput, Printable} +import mlscript.compiler.printer.ExprPrinter +import scala.collection.mutable.ArrayBuffer +import mlscript.{Type, Union, Inter, Function, Record, Tuple, Recursive, AppliedType, + Neg, Rem, Bounds, WithExtension, Constrained, Top, Bot, Literal, + TypeName, TypeVar, PolyType, NamedType} +import scala.collection.immutable.HashMap +import mlscript.compiler.mono.specializer.BoundedExpr +import mlscript.compiler.mono.specializer.Builtin + +trait ASTNode: + var parent: ASTNode = null + def setNodeFields(): Unit + var expValue: BoundedExpr = BoundedExpr() + var freeVars: Set[String] = null + var isStatic: Boolean = false + +enum Expr extends Printable, ASTNode: + case Ref(name: String) + case Lambda(params: List[Parameter], body: Expr) + case Apply(callee: Expr, arguments: List[Expr]) + case Tuple(fields: List[Expr]) + case Record(fields: List[(Ref, Expr)]) + case Select(receiver: Expr, field: Ref) + case LetIn(isRec: Boolean, name: Ref, rhs: Expr, body: Expr) + case Block(items: List[Expr | Item.FuncDecl | Item.FuncDefn]) + case As(value: Expr, toType: Type) + case Assign(assignee: Expr, value: Expr) + case With(value: Expr, fields: Expr.Record) + case Subscript(receiver: Expr, index: Expr) + case Match(scrutinee: Expr, branches: ArrayBuffer[CaseBranch]) + case Literal(value: BigInt | BigDecimal | Boolean | String | UnitValue) + case New(typeName: TypeName, args: List[Expr]) + case IfThenElse(condition: Expr, consequent: Expr, alternate: Option[Expr]) + case Isolated(isolation: Isolation) + + val workaround = setNodeFields() + + def setNodeFields(): Unit = this match + case Expr.Ref(name) => + freeVars = if Builtin.builtinRefs.contains(name) then Set() else Set(name) + case Expr.Lambda(params, body) => + body.parent = this; freeVars = body.freeVars -- params.map(_._2.name) + case Expr.Apply(callee, arguments) => + callee.parent = this; arguments.foreach(x => x.parent = this); freeVars = callee.freeVars ++ arguments.flatMap(_.freeVars); isStatic = arguments.map(_.isStatic).fold(callee.isStatic)(_ && _) + case Expr.Tuple(fields) => + fields.foreach(x => x.parent = this); freeVars = fields.flatMap(_.freeVars).toSet; isStatic = fields.map(_.isStatic).fold(true)(_ && _) + case Expr.Record(fields) => + fields.foreach(x => x._2.parent = this); freeVars = fields.flatMap(_._2.freeVars).toSet -- fields.map(_._1.name); isStatic = fields.map(_._2.isStatic).fold(true)(_ && _) + case Expr.Select(receiver, field) => + receiver.parent = this; field.parent = this; freeVars = receiver.freeVars; isStatic = receiver.isStatic + case Expr.LetIn(isRec, name, rhs, body) => + rhs.parent = this; body.parent = this; freeVars = rhs.freeVars ++ body.freeVars - name.name; isStatic = rhs.isStatic && body.isStatic + case Expr.Block(items) => + val expItems = items.flatMap{ + case x: Expr => Some(x) + case _ => None + } + freeVars = expItems.flatMap(_.freeVars).toSet + expItems.foreach(x => {x.parent = this}) + isStatic = expItems.map(_.isStatic).fold(true)(_ && _) + case Expr.As(value, toType) => + value.parent = this; freeVars = value.freeVars; isStatic = value.isStatic + case Expr.Assign(assignee, value) => + assignee.parent = this; value.parent = this; freeVars = assignee.freeVars ++ value.freeVars; isStatic = true + case Expr.With(value, fields) => + value.parent = this; fields.parent = this; freeVars = value.freeVars ++ fields.freeVars; isStatic = value.isStatic && fields.isStatic + case Expr.Subscript(receiver, index) => + receiver.parent = this; index.parent = this; freeVars = receiver.freeVars ++ index.freeVars; isStatic = receiver.isStatic && index.isStatic + case Expr.Match(scrutinee, branches) => + scrutinee.parent = this + isStatic = scrutinee.isStatic + freeVars = scrutinee.freeVars ++ branches.flatMap{ + case CaseBranch.Instance(className, alias, body) => + isStatic &&= body.isStatic + body.freeVars - alias.name + case CaseBranch.Constant(literal, body) => + isStatic &&= body.isStatic + body.freeVars + case CaseBranch.Wildcard(body) => + isStatic &&= body.isStatic + body.freeVars + } + branches.foreach(x => x.body.parent = this) + case Expr.Literal(value) => + freeVars = Set() + isStatic = true + case Expr.New(typeName, args) => + args.foreach(x => x.parent = this) + isStatic = args.map(_.isStatic).fold(true)(_ && _) + freeVars = args.flatMap(_.freeVars).toSet + typeName.name + case Expr.IfThenElse(condition, consequent, alternate) => + condition.parent = this + consequent.parent = this + alternate.foreach(x => x.parent = this) + freeVars = condition.freeVars ++ consequent.freeVars ++ alternate.map(_.freeVars).getOrElse(Set()) + isStatic = alternate.map(_.isStatic && condition.isStatic && consequent.isStatic).getOrElse(true) + case Expr.Isolated(isolation) => + val exps = isolation.items.flatMap{ + case x: Expr => Some(x) + case _ => None + } + exps.foreach{x => x.parent = this} + freeVars = exps.flatMap(_.freeVars).toSet + isStatic = exps.map(_.isStatic).fold(true)(_ && _) + + def asBoolean(): Boolean = this match + case Literal(value: BigInt) => value != 0 + case Literal(value: BigDecimal) => value != 0 + case Literal(value: Boolean) => value + case Literal(value: String) => !value.isEmpty() + case Literal(_) => false + case _ => false + + def getDebugOutput: DebugOutput = + DebugOutput.Code(ExprPrinter.printLines(this)) + + override def toString(): String = + // val header = if this.parent == null then this.freeVars.mkString("[", ", ", "]~") else "" + val body = this match { + case Ref(name) => name + case Lambda(params, body) => + val head = params.mkString("(", ", ", ")") + s"(fun $head -> $body)" + case Apply(Apply(Ref(op), lhs :: Nil), rhs :: Nil) + if !op.headOption.forall(_.isLetter) => + s"($lhs $op $rhs)" + case Apply(callee, arguments) => + callee.toString + arguments.mkString("(", ", ", ")") + case Tuple(fields) => + val inner = fields.mkString(", ") + "(" + (if fields.length == 1 then inner + ", " else inner) + ")" + case Record(fields) => + "{" + fields.iterator.map { (name, value) => s"$name = $value" } + "}" + case Select(receiver, field) => s"$receiver.$field" + case LetIn(isRec, name, rhs, body) => s"let $name = $rhs in $body" + case Block(items) => items.mkString(";") + case As(value, toType) => s"$value as $toType" + case Assign(assignee, value) => s"$assignee = $value" + case With(value, fields) => s"$value with $fields" + case Subscript(receiver, index) => s"$receiver[$index]" + case Match(scrutinee, branches) => + s"$scrutinee match " + branches.iterator.mkString("{", "; ", "}") + case Literal(value) => "#" + value.toString + case New(callee, args) => + s"new ${callee.name}" + args.mkString(" (", ", ", ") ") + case IfThenElse(condition, consequent, None) => + s"if $condition then $consequent" + case IfThenElse(condition, consequent, Some(alternate)) => + s"if $condition then $consequent else $alternate" + case Isolated(isolation) => s"{\n$isolation\n}" + } + // header + + body +end Expr + +// This corresponds to `mlscript.UnitLit`. +enum UnitValue: + case Null, Undefined + + override def toString(): String = + this match + case Null => "null" + case Undefined => "()" // `()` is shorter than `undefined` + +enum CaseBranch: + val body: Expr + + case Instance(className: Expr.Ref, alias: Expr.Ref, body: Expr) + case Constant(literal: Expr.Literal, body: Expr) + case Wildcard(body: Expr) + + override def toString(): String = + this match + case Instance(Expr.Ref(className), Expr.Ref(alias), body) => + s"case $alias: $className => $body" + case Constant(literal, body) => s"case $literal => $body" + case Wildcard(body) => s"_ => $body" + +enum TypeDeclKind: + case Alias, Class, Trait + + override def toString(): String = this match + case Alias => "alias" + case Class => "class" + case Trait => "trait" + + +/** + * Function parameters: `(specializable, name)`. + */ +type Parameter = (Boolean, Expr.Ref) + +enum Item extends Printable: + val name: Expr.Ref + + /** + * Type declarations: aliases, classes and traits. + */ + case TypeDecl(name: Expr.Ref, kind: TypeDeclKind, typeParams: List[TypeName], + params: List[Parameter], parents: List[(NamedType, List[Expr])], body: Isolation) + /** + * Function declaration (with implementation). + */ + case FuncDecl(name: Expr.Ref, params: List[Parameter], body: Expr) + /** + * Function definition (with definition) + */ + case FuncDefn(name: Expr.Ref, typeParams: List[TypeName], body: PolyType) + + override def toString(): String = this match + case TypeDecl(Expr.Ref(name), kind, typeParams, params, parents, body) => + val typeParamsStr = if typeParams.isEmpty then "" + else typeParams.iterator.map(_.name).mkString("[", ", ", "]") + val parentsStr = if parents.isEmpty then "" + else parents.mkString(" extends ", " with ", " ") + s"$kind $name$typeParamsStr$parentsStr { $body }" + case FuncDecl(Expr.Ref(name), params, body) => + val parameters = params.iterator.map { + case (spec, Expr.Ref(name)) => + (if spec then "#" else "") + name + }.mkString("(", ", ", ")") + s"fun $name$parameters = $body" + case FuncDefn(Expr.Ref(name), Nil, polyType) => + s"fun $name: $polyType" + case FuncDefn(Expr.Ref(name), typeParams, polyType) => + s"fun $name: ${typeParams.mkString("[", ", ", "]")} => $polyType" + + def getDebugOutput: DebugOutput = + DebugOutput.Code(ExprPrinter.printLines(this)) + +object Item: + /** + * A shorthand constructor for classes without type parameters and parents. + */ + def classDecl(name: String, params: List[Parameter], body: Isolation): Item.TypeDecl = + Item.TypeDecl(Expr.Ref(name), TypeDeclKind.Class, Nil, params, Nil, body) + +/** + * An `Isolation` is like a `TypingUnit` but without nested classes. + */ +class Isolation(val items: List[Expr | Item.FuncDecl | Item.FuncDefn]) extends Printable: + private val namedItemMap = HashMap.from(items.iterator.flatMap { + case _: Expr => None: Option[(String, Item.FuncDecl | Item.FuncDefn)] + case item: Item.FuncDecl => Some((item.name.name, item)) + case item: Item.FuncDefn => Some((item.name.name, item)) + }) + + def get(name: String): Option[Item.FuncDecl | Item.FuncDefn] = + namedItemMap.get(name) + + def getDebugOutput: DebugOutput = + DebugOutput.Code(ExprPrinter.printLines(this)) + + override def toString(): String = items.mkString("\n") + +object Isolation: + def empty = Isolation(Nil) + +/** + * A `Module` is like a `TypingUnit`. + * This name conflicts with `java.lang.Module`. + * TODO: Find a better name. + */ +class ModuleUnit(val items: List[Expr | Item]) extends Printable: + def getDebugOutput: DebugOutput = + DebugOutput.Code(ExprPrinter.printLines(this)) + + override def toString(): String = items.mkString("\n") diff --git a/compiler/shared/test/diff/LambLift.mls b/compiler/shared/test/diff/LambLift.mls new file mode 100644 index 000000000..5e5054efe --- /dev/null +++ b/compiler/shared/test/diff/LambLift.mls @@ -0,0 +1,87 @@ +:NewDefs + +:AllowRuntimeErrors +fun foo() = + let local(x) = + class Foo { + fun bar = x + foo() + } + (new Foo()).bar + local(1) +foo() +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(), Blk(...))), App(Var(foo), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class Foo$1([x,]) {fun bar = () => +((this).x, foo$1(),)} +//│ let local$2 = (x,) => {('(' new Foo$1([x,]) {} ')').bar} +//│ fun foo$1 = () => {local$2(1,)} +//│ Code(List(foo$1())) +//│ } +//│ fun foo: () -> Int +//│ Int +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +fun foo(f) = + f(1) +foo(x => x+1) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(f)), Blk(...))), App(Var(foo), Tup(_: Lam(Tup(_: Var(x)), App(Var(+), Tup(_: Var(x), _: IntLit(1))))))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda1$2$1([]) {fun apply = (x,) => +(x, 1,)} +//│ fun foo$1 = (f,) => {f(1,)} +//│ Code(List(foo$1({new Lambda1$2$1([]) {}},))) +//│ } +//│ fun foo: forall 'a. (1 -> 'a) -> 'a +//│ Int +//│ res +//│ = 2 + +fun foo(x) = + let bar(f) = + f(x) + bar(y => y+x) +foo(1) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(foo), Tup(_: IntLit(1)))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda1$3$1([x,]) {fun apply = (y,) => +(y, (this).x,)} +//│ let bar$2 = (f, x,) => {f(x,)} +//│ fun foo$1 = (x,) => {bar$2({new Lambda1$3$1([x,]) {}}, x,)} +//│ Code(List(foo$1(1,))) +//│ } +//│ fun foo: Int -> Int +//│ Int +//│ res +//│ = 2 + +fun foo(f) = + f(1) +class A(y: Int){ + fun bar(z) = y+z +} +fun app(a) = + foo(z => a.bar(z)) +app(new A(1)) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(f)), Blk(...))), NuTypeDef(class, A, (), Tup(y: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, bar, None, [], Lam(Tup(_: Var(z)), App(Var(+), Tup(_: Var(y), _: Var(z))))))), NuFunDef(None, app, None, [], Lam(Tup(_: Var(a)), Blk(...))), App(Var(app), Tup(_: New(Some((TypeName(A),[1,])), TypingUnit())))) +//│ Lifted: +//│ TypingUnit { +//│ class A$1([y: Int,]) {fun bar = (z,) => +((this).y, z,)} +//│ class Lambda1$3$2([a,]) {fun apply = (z,) => ((this).a).bar(z,)} +//│ fun foo$2 = (f,) => {f(1,)} +//│ fun app$1 = (a,) => {foo$2({new Lambda1$3$2([a,]) {}},)} +//│ Code(List(app$1(new A$1([1,]) {},))) +//│ } +//│ fun foo: forall 'a. (1 -> 'a) -> 'a +//│ class A(y: Int) { +//│ fun bar: Int -> Int +//│ } +//│ fun app: forall 'b. {bar: 1 -> 'b} -> 'b +//│ Int +//│ res +//│ = 2 diff --git a/compiler/shared/test/diff/LiftType.mls b/compiler/shared/test/diff/LiftType.mls index f56e9fdd1..2b4ccc4f0 100644 --- a/compiler/shared/test/diff/LiftType.mls +++ b/compiler/shared/test/diff/LiftType.mls @@ -5,10 +5,10 @@ class CTX{ class A {} fun foo(f: A => A): (A => A) => A = f(new A) } -//│ |#class| |CTX|{|→|#class| |A| |{||}|↵|#fun| |foo|(|f|#:| |A| |=>| |A|)|#:| |(|A| |=>| |A|)| |=>| |A| |#=| |f|(|#new| |A|)|←|↵|}| +//│ |#class| |CTX|{|→|#class| |A| |{||}|↵|#fun| |foo|(|f|#:| |A| |#=>| |A|)|#:| |(|A| |#=>| |A|)| |#=>| |A| |#=| |f|(|#new| |A|)|←|↵|}| //│ Parsed: {class CTX {class A {}; fun foo = (f: (A,) => A,) => f(new A([]) {},) : (A -> A) -> A}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, None, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),[])), TypingUnit(List())))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, None, [], Lam(Tup(f: Lam(Tup(_: Var(A)), Var(A))), Asc(App(Var(f), Tup(_: New(Some((TypeName(A),[])), TypingUnit()))), Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(A))))),TypeName(A)))))),TypeName(A)))))))) //│ Lifted: //│ TypingUnit { //│ class CTX$1_A$2([par$CTX$1,]) {} @@ -21,18 +21,18 @@ class CTX{ class CTX(x, y){ class A{ fun foo = x} class B: A { fun foo = y} - fun foo(any: (A, B)): (B, A) = (any._2, any._1) + fun foo(any: [A, B]): [B, A] = [any._2, any._1] } -//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |(|A|,| |B|)|)|#:| |(|B|,| |A|)| |#=| |(|any|._2|,| |any|._1|)|←|↵|}| -//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: '(' [A, B,] ')',) => '(' [(any)._2, (any)._1,] ')' : [B, A]}} +//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |[|A|,| |B|]|)|#:| |[|B|,| |A|]| |#=| |[|any|._2|,| |any|._1|]|←|↵|}| +//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: [A, B,],) => [(any)._2, (any)._1,] : [B, A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), _2), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Tup(_: Var(A), _: Var(B))), Asc(Tup(_: Sel(Var(any), _2), _: Sel(Var(any), _1)), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { -//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = ((this).par$CTX$1).x} -//│ class CTX$1_B$3([par$CTX$1,]) {fun foo = ((this).par$CTX$1).y} +//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} +//│ class CTX$1_B$3([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).y} //│ class CTX$1([x, y,]) { -//│ fun foo = (any: '(' [CTX$1_A$2, CTX$1_B$3,] ')',) => '(' [(any)._2, (any)._1,] ')' : [CTX$1_B$3, CTX$1_A$2] +//│ fun foo = (any: [CTX$1_A$2, CTX$1_B$3,],) => [(any)._2, (any)._1,] : [CTX$1_B$3, CTX$1_A$2] //│ } //│ } //│ @@ -40,18 +40,18 @@ class CTX(x, y){ class CTX(x, y){ class A{ fun foo = x} class B: A { fun foo = y} - fun foo(any: {p1: A, p2: B}): (B, A) = (any.p2, any.p1) + fun foo(any: {p1: A, p2: B}): [B, A] = [any.p2, any.p1] } -//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |{|p1|#:| |A|,| |p2|#:| |B|}|)|#:| |(|B|,| |A|)| |#=| |(|any|.p2|,| |any|.p1|)|←|↵|}| -//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: '{' {p1: A, p2: B} '}',) => '(' [(any).p2, (any).p1,] ')' : [B, A]}} +//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|#:| |A| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |{|p1|#:| |A|,| |p2|#:| |B|}|)|#:| |[|B|,| |A|]| |#=| |[|any|.p2|,| |any|.p1|]|←|↵|}| +//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B: A {fun foo = y}; fun foo = (any: '{' {p1: A, p2: B} '}',) => [(any).p2, (any).p1,] : [B, A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Bra(rcd = true, Rcd(Var(p1) = Var(A), Var(p2) = Var(B)))), Asc(Bra(rcd = false, Tup(_: Sel(Var(any), p2), _: Sel(Var(any), p1))), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Bra(rcd = true, Rcd(Var(p1) = Var(A), Var(p2) = Var(B)))), Asc(Tup(_: Sel(Var(any), p2), _: Sel(Var(any), p1)), Tuple(List((None,Field(None,TypeName(B))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { -//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = ((this).par$CTX$1).x} -//│ class CTX$1_B$3([par$CTX$1,]) {fun foo = ((this).par$CTX$1).y} +//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} +//│ class CTX$1_B$3([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).y} //│ class CTX$1([x, y,]) { -//│ fun foo = (any: '{' {p1: CTX$1_A$2, p2: CTX$1_B$3} '}',) => '(' [(any).p2, (any).p1,] ')' : [CTX$1_B$3, CTX$1_A$2] +//│ fun foo = (any: '{' {p1: CTX$1_A$2, p2: CTX$1_B$3} '}',) => [(any).p2, (any).p1,] : [CTX$1_B$3, CTX$1_A$2] //│ } //│ } //│ @@ -59,18 +59,18 @@ class CTX(x, y){ class CTX(x, y){ class A{ fun foo = x} class B { fun foo = y} - fun foo(any: (A, B)): ((B, A), A) = (any, any._1) + fun foo(any: [A, B]): [[B, A], A] = [any, any._1] } -//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|‹|T|›| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |(|A|,| |B|‹|A|›|)|)|#:| |(|(|B|‹|A|›|,| |A|)|,| |A|)| |#=| |(|any|,| |any|._1|)|←|↵|}| -//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B‹T› {fun foo = y}; fun foo = (any: '(' [A, B‹A›,] ')',) => '(' [any, (any)._1,] ')' : [[B[A], A], A]}} +//│ |#class| |CTX|(|x|,| |y|)|{|→|#class| |A|{| |#fun| |foo| |#=| |x|}|↵|#class| |B|‹|T|›| |{| |#fun| |foo| |#=| |y|}|↵|#fun| |foo|(|any|#:| |[|A|,| |B|‹|A|›|]|)|#:| |[|[|B|‹|A|›|,| |A|]|,| |A|]| |#=| |[|any|,| |any|._1|]|←|↵|}| +//│ Parsed: {class CTX(x, y,) {class A {fun foo = x}; class B‹T› {fun foo = y}; fun foo = (any: [A, B‹A›,],) => [any, (any)._1,] : [[B[A], A], A]}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Bra(rcd = false, Tup(_: Var(A), _: TyApp(Var(B), List(TypeName(A)))))), Asc(Bra(rcd = false, Tup(_: Var(any), _: Sel(Var(any), _1))), Tuple(List((None,Field(None,Tuple(List((None,Field(None,AppliedType(TypeName(B),List(TypeName(A))))), (None,Field(None,TypeName(A))))))), (None,Field(None,TypeName(A))))))))))) +//│ TypingUnit(NuTypeDef(class, CTX, (), Tup(_: Var(x), _: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(x)))), NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(y)))), NuFunDef(None, foo, None, [], Lam(Tup(any: Tup(_: Var(A), _: TyApp(Var(B), List(TypeName(A))))), Asc(Tup(_: Var(any), _: Sel(Var(any), _1)), Tuple(List((None,Field(None,Tuple(List((None,Field(None,AppliedType(TypeName(B),List(TypeName(A))))), (None,Field(None,TypeName(A))))))), (None,Field(None,TypeName(A))))))))))) //│ Lifted: //│ TypingUnit { -//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = ((this).par$CTX$1).x} -//│ class CTX$1_B$3[T]([par$CTX$1,]) {fun foo = ((this).par$CTX$1).y} +//│ class CTX$1_A$2([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).x} +//│ class CTX$1_B$3[T]([par$CTX$1,]) {fun foo = () => ((this).par$CTX$1).y} //│ class CTX$1([x, y,]) { -//│ fun foo = (any: '(' [CTX$1_A$2, CTX$1_B$3‹CTX$1_A$2›,] ')',) => '(' [any, (any)._1,] ')' : [[CTX$1_B$3[CTX$1_A$2], CTX$1_A$2], CTX$1_A$2] +//│ fun foo = (any: [CTX$1_A$2, CTX$1_B$3‹CTX$1_A$2›,],) => [any, (any)._1,] : [[CTX$1_B$3[CTX$1_A$2], CTX$1_A$2], CTX$1_A$2] //│ } //│ } //│ diff --git a/compiler/shared/test/diff/Lifter.mls b/compiler/shared/test/diff/Lifter.mls index be5fc34a1..bf77d3a62 100644 --- a/compiler/shared/test/diff/Lifter.mls +++ b/compiler/shared/test/diff/Lifter.mls @@ -28,32 +28,32 @@ class A(x) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getB1| |#=| |B1|(|y|)|↵|#class| |C|(|z|)| |{|→|#fun| |inc|(||)| |#=| |x| |+| |1|↵|#fun| |getY| |#=| |y|↵|#fun| |getA| |#=| |A|(|z|)|↵|#fun| |getB|(|w|)| |#=| |B|(|w|)|↵|#fun| |getC| |#=| |#new| |C|(|inc|(||)|)|↵|#fun| |getSelf| |#=| |this|←|↵|}|←|↵|}|↵|#class| |B1|(|y|)| |{|→|#fun| |getX| |#=| |x|↵|#fun| |getY| |#=| |y|↵|#fun| |getB| |#=| |#new| |B|(|y|)|↵|#fun| |getB1| |#=| |#new| |B1|(|y|)|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|(|x|)|↵|#fun| |getB2|(|y|)| |#=| |B1|(|y|)|↵|#fun| |getB3|(|z|)| |#=| |getB2|(|z|)|↵|#fun| |getA| |#=| |A|(|x|)|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {fun getX = x; fun getB1 = B1(y,); class C(z,) {fun inc = () => +(x, 1,); fun getY = y; fun getA = A(z,); fun getB = (w,) => B(w,); fun getC = new C([inc(),]) {}; fun getSelf = this}}; class B1(y,) {fun getX = x; fun getY = y; fun getB = new B([y,]) {}; fun getB1 = new B1([y,]) {}}; fun getB = new B([x,]) {}; fun getB2 = (y,) => B1(y,); fun getB3 = (z,) => getB2(z,); fun getA = A(x,)}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, None, [], Var(x)), NuFunDef(None, getB1, None, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, inc, None, [], Lam(Tup(), App(Var(+), Tup(_: Var(x), _: IntLit(1))))), NuFunDef(None, getY, None, [], Var(y)), NuFunDef(None, getA, None, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, None, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, None, [], New(Some((TypeName(C),[inc(),])), TypingUnit(List()))), NuFunDef(None, getSelf, None, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, None, [], Var(x)), NuFunDef(None, getY, None, [], Var(y)), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[y,])), TypingUnit(List()))), NuFunDef(None, getB1, None, [], New(Some((TypeName(B1),[y,])), TypingUnit(List()))))), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[x,])), TypingUnit(List()))), NuFunDef(None, getB2, None, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, None, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, None, [], App(Var(A), Tup(_: Var(x))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, None, [], Var(x)), NuFunDef(None, getB1, None, [], App(Var(B1), Tup(_: Var(y)))), NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, inc, None, [], Lam(Tup(), App(Var(+), Tup(_: Var(x), _: IntLit(1))))), NuFunDef(None, getY, None, [], Var(y)), NuFunDef(None, getA, None, [], App(Var(A), Tup(_: Var(z)))), NuFunDef(None, getB, None, [], Lam(Tup(_: Var(w)), App(Var(B), Tup(_: Var(w))))), NuFunDef(None, getC, None, [], New(Some((TypeName(C),[inc(),])), TypingUnit())), NuFunDef(None, getSelf, None, [], Var(this)))))), NuTypeDef(class, B1, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuFunDef(None, getX, None, [], Var(x)), NuFunDef(None, getY, None, [], Var(y)), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[y,])), TypingUnit())), NuFunDef(None, getB1, None, [], New(Some((TypeName(B1),[y,])), TypingUnit())))), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[x,])), TypingUnit())), NuFunDef(None, getB2, None, [], Lam(Tup(_: Var(y)), App(Var(B1), Tup(_: Var(y))))), NuFunDef(None, getB3, None, [], Lam(Tup(_: Var(z)), App(Var(getB2), Tup(_: Var(z))))), NuFunDef(None, getA, None, [], App(Var(A), Tup(_: Var(x))))))) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2_C$4([par$A$1_B$2, z,]) { -//│ fun inc = () => +((((this).par$A$1_B$2).par$A$1).x, 1,) -//│ fun getY = ((this).par$A$1_B$2).y -//│ fun getA = A$1((this).z,) +//│ class A$1_B$2_C$4([par$A$1_B$2, z, x,]) { +//│ fun inc = () => +((this).x, 1,) +//│ fun getY = () => ((this).par$A$1_B$2).y +//│ fun getA = () => A$1((this).z,) //│ fun getB = (w,) => A$1_B$2(((this).par$A$1_B$2).par$A$1, w,) -//│ fun getC = new A$1_B$2_C$4([(this).par$A$1_B$2, (this).inc(),]) {} -//│ fun getSelf = this +//│ fun getC = () => new A$1_B$2_C$4([(this).par$A$1_B$2, (this).inc(), (this).x,]) {} +//│ fun getSelf = () => this //│ } //│ class A$1_B$2([par$A$1, y,]) { -//│ fun getX = ((this).par$A$1).x -//│ fun getB1 = A$1_B1$3((this).par$A$1, (this).y,) +//│ fun getX = () => ((this).par$A$1).x +//│ fun getB1 = () => A$1_B1$3((this).par$A$1, (this).y,) //│ } //│ class A$1_B1$3([par$A$1, y,]) { -//│ fun getX = ((this).par$A$1).x -//│ fun getY = (this).y -//│ fun getB = new A$1_B$2([(this).par$A$1, (this).y,]) {} -//│ fun getB1 = new A$1_B1$3([(this).par$A$1, (this).y,]) {} +//│ fun getX = () => ((this).par$A$1).x +//│ fun getY = () => (this).y +//│ fun getB = () => new A$1_B$2([(this).par$A$1, (this).y,]) {} +//│ fun getB1 = () => new A$1_B1$3([(this).par$A$1, (this).y,]) {} //│ } //│ class A$1([x,]) { -//│ fun getB = new A$1_B$2([this, (this).x,]) {} +//│ fun getB = () => new A$1_B$2([this, (this).x,]) {} //│ fun getB2 = (y,) => A$1_B1$3(this, y,) //│ fun getB3 = (z,) => (this).getB2(z,) -//│ fun getA = A$1((this).x,) +//│ fun getA = () => A$1((this).x,) //│ } //│ } //│ @@ -71,8 +71,8 @@ class A(x) { //│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit(NuTypeDef(class, C, (), Tup(_: Var(z)), (), None, None, TypingUnit(NuFunDef(None, sum, None, [], App(Var(+), Tup(_: App(Var(+), Tup(_: Var(x), _: Var(y))), _: Var(z))))))))))) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2_C$3([par$A$1_B$2, z,]) { -//│ fun sum = +(+((((this).par$A$1_B$2).par$A$1).x, ((this).par$A$1_B$2).y,), (this).z,) +//│ class A$1_B$2_C$3([par$A$1_B$2, z, x,]) { +//│ fun sum = () => +(+((this).x, ((this).par$A$1_B$2).y,), (this).z,) //│ } //│ class A$1_B$2([par$A$1, y,]) {} //│ class A$1([x,]) {} @@ -108,7 +108,7 @@ new C{ //│ |#class| |A|(|x|)| |{|→|#class| |B|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |11|←|↵|}|↵|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |2|↵|#fun| |bar| |#=| |12|←|↵|}|↵|#fun| |bar| |#=| |13|←|↵|}|↵|#class| |C|#:| |A|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |3|↵|#fun| |bar| |#=| |14|←|↵|}|↵|#fun| |bar| |#=| |15|←|↵|}|↵|#new| |C|{|→|#fun| |getB| |#=| |#new| |B|{|→|#fun| |foo| |#=| |4|↵|#fun| |bar| |#=| |16|←|↵|}|↵|#fun| |bar| |#=| |17|←|↵|}| //│ Parsed: {class A(x,) {class B {fun foo = 1; fun bar = 11}; fun getB = new B([]) {fun foo = 2; fun bar = 12}; fun bar = 13}; class C: A {fun getB = new B([]) {fun foo = 3; fun bar = 14}; fun bar = 15}; new C([]) {fun getB = new B([]) {fun foo = 4; fun bar = 16}; fun bar = 17}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)), NuFunDef(None, bar, None, [], IntLit(11)))), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(List(fun foo = 2, fun bar = 12)))), NuFunDef(None, bar, None, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(List(fun foo = 3, fun bar = 14)))), NuFunDef(None, bar, None, [], IntLit(15)))), New(Some((TypeName(C),[])), TypingUnit(List(fun getB = new B([]) {fun foo = 4; fun bar = 16}, fun bar = 17)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)), NuFunDef(None, bar, None, [], IntLit(11)))), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(2)), NuFunDef(None, bar, None, [], IntLit(12))))), NuFunDef(None, bar, None, [], IntLit(13)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(3)), NuFunDef(None, bar, None, [], IntLit(14))))), NuFunDef(None, bar, None, [], IntLit(15)))), New(Some((TypeName(C),[])), TypingUnit(NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(4)), NuFunDef(None, bar, None, [], IntLit(16))))), NuFunDef(None, bar, None, [], IntLit(17))))) //│ Lifted: //│ Lifting failed: java.util.NoSuchElementException: None.get //│ @@ -148,7 +148,7 @@ class A(x: Int): {a1: Int} & B & D(x){ //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)|#:| |{|a1|#:| |Int|}| |&| |B|‹|T|›| |&| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|#:| |T|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T› {}; class C {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): {a1: Int} & B[T] & D[x] {fun getA = () => new C([]) {fun foo = (x: T,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], Lam(Tup(), New(Some((TypeName(C),[])), TypingUnit(List(fun foo = (x: T,) => x)))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], Lam(Tup(), New(Some((TypeName(C),[])), TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(x: Var(T)), Var(x)))))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]([]) {} @@ -171,7 +171,7 @@ class A(x: Int) extends {a1: Int}, B, D(x){ //│ |#class| |B|‹|T|›| |{||}|↵|#class| |C| |{||}|↵|#class| |D|(|y|#:| |Int|)| |{||}|↵|#class| |A|‹|T|,| |U|›|(|x|#:| |Int|)| |#extends| |{|a1|#:| |Int|}|,| |B|‹|T|›|,| |D|(|x|)|{|→|#fun| |getA|(||)| |#=| |#new| |C|{|→|#fun| |foo|(|x|)| |#=| |x|←|↵|}|←|↵|}| //│ Parsed: {class B‹T› {}; class C {}; class D(y: Int,) {}; class A‹T, U›(x: Int,): '{' {a1: Int} '}', B‹T›, D(x,) {fun getA = () => new C([]) {fun foo = (x,) => x}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), None, None, TypingUnit(NuFunDef(None, getA, None, [], Lam(Tup(), New(Some((TypeName(C),[])), TypingUnit(List(fun foo = (x,) => x)))))))) +//│ TypingUnit(NuTypeDef(class, B, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, D, (), Tup(y: Var(Int)), (), None, None, TypingUnit()), NuTypeDef(class, A, ((None,TypeName(T)), (None,TypeName(U))), Tup(x: Var(Int)), (Bra(rcd = true, Rcd(Var(a1) = Var(Int))), TyApp(Var(B), List(TypeName(T))), App(Var(D), Tup(_: Var(x)))), None, None, TypingUnit(NuFunDef(None, getA, None, [], Lam(Tup(), New(Some((TypeName(C),[])), TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Var(x)))))))))) //│ Lifted: //│ TypingUnit { //│ class B$1[T]([]) {} @@ -192,13 +192,13 @@ class Child(x): { age: T } & { name: String} { //│ |#class| |Child|‹|T|,| |U|›|(|x|)|#:| |{| |age|#:| |T| |}| |&| |{| |name|#:| |String|}| |{|→|#class| |Inner|{|→|#fun| |foo| |#=| |age|←|↵|}|↵|#fun| |bar| |#=| |age|↵|#fun| |boo| |#=| |#new| |Inner|←|↵|}| //│ Parsed: {class Child‹T, U›(x,): {age: T} & {name: String} {class Inner {fun foo = age}; fun bar = age; fun boo = new Inner([]) {}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, Child, ((None,TypeName(T)), (None,TypeName(U))), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(age)))), NuFunDef(None, bar, None, [], Var(age)), NuFunDef(None, boo, None, [], New(Some((TypeName(Inner),[])), TypingUnit(List())))))) +//│ TypingUnit(NuTypeDef(class, Child, ((None,TypeName(T)), (None,TypeName(U))), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, Inner, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Var(age)))), NuFunDef(None, bar, None, [], Var(age)), NuFunDef(None, boo, None, [], New(Some((TypeName(Inner),[])), TypingUnit()))))) //│ Lifted: //│ TypingUnit { -//│ class Child$1_Inner$2([par$Child$1, age,]) {fun foo = (this).age} +//│ class Child$1_Inner$2([par$Child$1, age,]) {fun foo = () => (this).age} //│ class Child$1[T,U]([x,]) { -//│ fun bar = age -//│ fun boo = new Child$1_Inner$2([this, age,]) {} +//│ fun bar = () => age +//│ fun boo = () => new Child$1_Inner$2([this, age,]) {} //│ } //│ } //│ @@ -215,11 +215,11 @@ new A(0) { //│ |#class| |A|(|x|#:| |Int|)| |{|→|#fun| |getA|#:| |Int| |#=| |0|↵|#fun| |getA1| |#=| |1|←|↵|}|↵|#new| |A|(|0|)| |{|→|#fun| |getA| |#=| |3|↵|#fun| |getA2| |#=| |2|←|↵|}| //│ Parsed: {class A(x: Int,) {fun getA = 0 : Int; fun getA1 = 1}; new A([0,]) {fun getA = 3; fun getA2 = 2}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, None, [], IntLit(1)))), New(Some((TypeName(A),[0,])), TypingUnit(List(fun getA = 3, fun getA2 = 2)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], Asc(IntLit(0), TypeName(Int))), NuFunDef(None, getA1, None, [], IntLit(1)))), New(Some((TypeName(A),[0,])), TypingUnit(NuFunDef(None, getA, None, [], IntLit(3)), NuFunDef(None, getA2, None, [], IntLit(2))))) //│ Lifted: //│ TypingUnit { -//│ class A$1([x: Int,]) {fun getA = 0 : Int; fun getA1 = 1} -//│ class A$1$2([x: Int,]): A$1((this).x,) {fun getA = 3; fun getA2 = 2} +//│ class A$1([x: Int,]) {fun getA = () => 0 : Int; fun getA1 = () => 1} +//│ class A$1$2([x: Int,]): A$1((this).x,) {fun getA = () => 3; fun getA2 = () => 2} //│ Code(List({new A$1$2([0,]) {}})) //│ } //│ @@ -236,13 +236,13 @@ new A(1) { //│ |#class| |A|(|x|)| |{|→|#class| |B|(|y|)| |{| |}|←|↵|}|↵|#new| |A|(|1|)| |{|→|#fun| |getB| |#=| |#new| |B|(|2|)|{|→|#fun| |getB| |#=| |#new| |B|(|3|)|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {class B(y,) {}}; new A([1,]) {fun getB = new B([2,]) {fun getB = new B([3,]) {}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit()))), New(Some((TypeName(A),[1,])), TypingUnit(List(fun getB = new B([2,]) {fun getB = new B([3,]) {}})))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(_: Var(y)), (), None, None, TypingUnit()))), New(Some((TypeName(A),[1,])), TypingUnit(NuFunDef(None, getB, None, [], New(Some((TypeName(B),[2,])), TypingUnit(NuFunDef(None, getB, None, [], New(Some((TypeName(B),[3,])), TypingUnit())))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1, y,]) {} //│ class A$1([x,]) {} -//│ class A$1$3_B$2$4([par$A$1$3, y,]): A$1_B$2((this).par$A$1$3, (this).y,) {fun getB = new A$1_B$2([(this).par$A$1$3, 3,]) {}} -//│ class A$1$3([x,]): A$1((this).x,) {fun getB = {new A$1$3_B$2$4([this, 2,]) {}}} +//│ class A$1$3_B$2$4([par$A$1$3, y,]): A$1_B$2((this).par$A$1$3, (this).y,) {fun getB = () => new A$1_B$2([(this).par$A$1$3, 3,]) {}} +//│ class A$1$3([x,]): A$1((this).x,) {fun getB = () => {new A$1$3_B$2$4([this, 2,]) {}}} //│ Code(List({new A$1$3([1,]) {}})) //│ } //│ @@ -269,18 +269,18 @@ new B{ //│ |#class| |A| |{|→|#fun| |getA| |#=| |0|↵|#fun| |funcA| |#=| |10|←|↵|}|↵|#class| |B|#:| |A|{|→|#fun| |getA| |#=| |1|↵|#fun| |funcB| |#=| |11|←|↵|}|↵|#new| |A|↵|#new| |B|↵|#fun| |f|(|x|)| |#=| |#if| |x| |is| |A| |#then| |0| |#else| |1|↵|f|(|#new| |A|{|→|#fun| |getA| |#=| |2|←|↵|}|)|↵|#new| |B|{|→|#fun| |getA| |#=| |funcB|←|↵|}| //│ Parsed: {class A {fun getA = 0; fun funcA = 10}; class B: A {fun getA = 1; fun funcB = 11}; new A([]) {}; new B([]) {}; fun f = (x,) => if (is(x, A,)) then 0 else 1; f(new A([]) {fun getA = 2},); new B([]) {fun getA = funcB}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], IntLit(0)), NuFunDef(None, funcA, None, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], IntLit(1)), NuFunDef(None, funcB, None, [], IntLit(11)))), New(Some((TypeName(A),[])), TypingUnit(List())), New(Some((TypeName(B),[])), TypingUnit(List())), NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), If(IfThen(App(Var(is), Tup(_: Var(x), _: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),[])), TypingUnit(List(fun getA = 2))))), New(Some((TypeName(B),[])), TypingUnit(List(fun getA = funcB)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], IntLit(0)), NuFunDef(None, funcA, None, [], IntLit(10)))), NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, getA, None, [], IntLit(1)), NuFunDef(None, funcB, None, [], IntLit(11)))), New(Some((TypeName(A),[])), TypingUnit()), New(Some((TypeName(B),[])), TypingUnit()), NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), If(IfThen(App(Var(is), Tup(_: Var(x), _: Var(A))), IntLit(0), Some(IntLit(1))))), App(Var(f), Tup(_: New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, getA, None, [], IntLit(2)))))), New(Some((TypeName(B),[])), TypingUnit(NuFunDef(None, getA, None, [], Var(funcB))))) //│ Lifted: //│ TypingUnit { -//│ class A$1([]) {fun getA = 0; fun funcA = 10} -//│ class B$2([]) {fun getA = 1; fun funcB = 11} -//│ class A$1$3([]): A$1() {fun getA = 2} -//│ class B$2$4([]): B$2() {fun getA = (this).funcB} -//│ fun f = (x,) => if (is(x, A$1(),)) then 0 else 1 +//│ class A$1([]) {fun getA = () => 0; fun funcA = () => 10} +//│ class B$2([]) {fun getA = () => 1; fun funcB = () => 11} +//│ class A$2$3([]): A$1() {fun getA = () => 2} +//│ class B$3$4([]): B$2() {fun getA = () => (this).funcB} +//│ fun f$1 = (x,) => if (is(x, A$1(),)) then 0 else 1 //│ Code(List(new A$1([]) {})) //│ Code(List(new B$2([]) {})) -//│ Code(List(f({new A$1$3([]) {}},))) -//│ Code(List({new B$2$4([]) {}})) +//│ Code(List(f$1({new A$2$3([]) {}},))) +//│ Code(List({new B$3$4([]) {}})) //│ } //│ @@ -313,11 +313,11 @@ class A{ //│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, None, [], IntLit(1)), NuFunDef(None, foo, None, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, None, [], IntLit(2)), NuFunDef(None, foo, None, [], IntLit(1000)))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, None, [], IntLit(3)), NuFunDef(None, foo, None, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, None, [], IntLit(4)), NuFunDef(None, foo, None, [], IntLit(100000)))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, None, [], IntLit(5)), NuFunDef(None, foo, None, [], IntLit(1000000))))))))) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2([par$A$1,]) {fun funB = 1; fun foo = 100} -//│ class A$1_C$3([par$A$1,]) {fun funC = 2; fun foo = 1000} -//│ class A$1_D$4_E$5([par$A$1_D$4,]) {fun funE = 4; fun foo = 100000} -//│ class A$1_D$4_F$6([par$A$1_D$4,]) {fun funF = 5; fun foo = 1000000} -//│ class A$1_D$4([par$A$1,]) {fun funD = 3; fun foo = 10000} +//│ class A$1_B$2([par$A$1,]) {fun funB = () => 1; fun foo = () => 100} +//│ class A$1_C$3([par$A$1,]) {fun funC = () => 2; fun foo = () => 1000} +//│ class A$1_D$4_E$5([par$A$1_D$4,]) {fun funE = () => 4; fun foo = () => 100000} +//│ class A$1_D$4_F$6([par$A$1_D$4,]) {fun funF = () => 5; fun foo = () => 1000000} +//│ class A$1_D$4([par$A$1,]) {fun funD = () => 3; fun foo = () => 10000} //│ class A$1([]) {} //│ } //│ @@ -353,27 +353,27 @@ class A{ //│ |#class| |A|{|→|#class| |B|{|→|#fun| |funB| |#=| |1|↵|#fun| |foo| |#=| |100|←|↵|}|↵|#class| |C|#:| |B|{|→|#fun| |funC| |#=| |2|↵|#fun| |foo| |#=| |1000|↵|#fun| |getB| |#=| |#new| |B|←|↵|}|↵|#class| |D|{|→|#fun| |funD| |#=| |3|↵|#fun| |foo| |#=| |10000| |↵|#class| |E|#:| |C|{|→|#fun| |funE| |#=| |4|↵|#fun| |foo| |#=| |100000|↵|#fun| |getD| |#=| |#new| |D|←|↵|}|↵|#class| |F|#:| |E|{|→|#fun| |funF| |#=| |5|↵|#fun| |foo| |#=| |1000000|↵|#fun| |getE| |#=| |#new| |E|{|→|#fun| |foo| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A {class B {fun funB = 1; fun foo = 100}; class C: B {fun funC = 2; fun foo = 1000; fun getB = new B([]) {}}; class D {fun funD = 3; fun foo = 10000; class E: C {fun funE = 4; fun foo = 100000; fun getD = new D([]) {}}; class F: E {fun funF = 5; fun foo = 1000000; fun getE = new E([]) {fun foo = 0}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, None, [], IntLit(1)), NuFunDef(None, foo, None, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, None, [], IntLit(2)), NuFunDef(None, foo, None, [], IntLit(1000)), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit(List()))))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, None, [], IntLit(3)), NuFunDef(None, foo, None, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, None, [], IntLit(4)), NuFunDef(None, foo, None, [], IntLit(100000)), NuFunDef(None, getD, None, [], New(Some((TypeName(D),[])), TypingUnit(List()))))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, None, [], IntLit(5)), NuFunDef(None, foo, None, [], IntLit(1000000)), NuFunDef(None, getE, None, [], New(Some((TypeName(E),[])), TypingUnit(List(fun foo = 0))))))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funB, None, [], IntLit(1)), NuFunDef(None, foo, None, [], IntLit(100)))), NuTypeDef(class, C, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funC, None, [], IntLit(2)), NuFunDef(None, foo, None, [], IntLit(1000)), NuFunDef(None, getB, None, [], New(Some((TypeName(B),[])), TypingUnit())))), NuTypeDef(class, D, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funD, None, [], IntLit(3)), NuFunDef(None, foo, None, [], IntLit(10000)), NuTypeDef(class, E, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funE, None, [], IntLit(4)), NuFunDef(None, foo, None, [], IntLit(100000)), NuFunDef(None, getD, None, [], New(Some((TypeName(D),[])), TypingUnit())))), NuTypeDef(class, F, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, funF, None, [], IntLit(5)), NuFunDef(None, foo, None, [], IntLit(1000000)), NuFunDef(None, getE, None, [], New(Some((TypeName(E),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(0)))))))))))) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2([par$A$1,]) {fun funB = 1; fun foo = 100} +//│ class A$1_B$2([par$A$1,]) {fun funB = () => 1; fun foo = () => 100} //│ class A$1_C$3([par$A$1,]) { -//│ fun funC = 2 -//│ fun foo = 1000 -//│ fun getB = new A$1_B$2([(this).par$A$1,]) {} +//│ fun funC = () => 2 +//│ fun foo = () => 1000 +//│ fun getB = () => new A$1_B$2([(this).par$A$1,]) {} //│ } //│ class A$1_D$4_E$5([par$A$1_D$4,]) { -//│ fun funE = 4 -//│ fun foo = 100000 -//│ fun getD = new A$1_D$4([((this).par$A$1_D$4).par$A$1,]) {} +//│ fun funE = () => 4 +//│ fun foo = () => 100000 +//│ fun getD = () => new A$1_D$4([((this).par$A$1_D$4).par$A$1,]) {} //│ } -//│ class A$1_D$4_F$6_E$1$7([par$A$1_D$4_F$6,]): A$1_D$4_E$5(((this).par$A$1_D$4_F$6).par$A$1_D$4,) {fun foo = 0} +//│ class A$1_D$4_F$6_E$1$7([par$A$1_D$4_F$6,]): A$1_D$4_E$5(((this).par$A$1_D$4_F$6).par$A$1_D$4,) {fun foo = () => 0} //│ class A$1_D$4_F$6([par$A$1_D$4,]) { -//│ fun funF = 5 -//│ fun foo = 1000000 -//│ fun getE = {new A$1_D$4_F$6_E$1$7([this,]) {}} +//│ fun funF = () => 5 +//│ fun foo = () => 1000000 +//│ fun getE = () => {new A$1_D$4_F$6_E$1$7([this,]) {}} //│ } -//│ class A$1_D$4([par$A$1,]) {fun funD = 3; fun foo = 10000} +//│ class A$1_D$4([par$A$1,]) {fun funD = () => 3; fun foo = () => 10000} //│ class A$1([]) {} //│ } //│ @@ -389,11 +389,11 @@ new A //│ |#class| |A|{|→|#class| |B|{|→|#fun| |foo| |#=| |1|←|↵|}|↵|#fun| |bar| |#=| |#new| |B|←|↵|}|↵|#new| |A| //│ Parsed: {class A {class B {fun foo = 1}; fun bar = new B([]) {}}; new A([]) {}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)))), NuFunDef(None, bar, None, [], New(Some((TypeName(B),[])), TypingUnit(List()))))), New(Some((TypeName(A),[])), TypingUnit(List()))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)))), NuFunDef(None, bar, None, [], New(Some((TypeName(B),[])), TypingUnit())))), New(Some((TypeName(A),[])), TypingUnit())) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2([par$A$1,]) {fun foo = 1} -//│ class A$1([]) {fun bar = new A$1_B$2([this,]) {}} +//│ class A$1_B$2([par$A$1,]) {fun foo = () => 1} +//│ class A$1([]) {fun bar = () => new A$1_B$2([this,]) {}} //│ Code(List(new A$1([]) {})) //│ } //│ @@ -414,20 +414,20 @@ let x = new A{ //│ |#class| |A|(|x|)| |{|→|#fun| |foo| |#=| |0|↵|#fun| |bar| |#=| |x|←|↵|}|↵|#let| |x| |#=| |#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |newFun| |#=| |2|↵|#fun| |bar| |#=| |#new| |A|(|foo|)|{|→|#fun| |foo| |#=| |bar| |+| |1|↵|#fun| |bar2| |#=| |newFun| |+| |1|←|↵|}|←|↵|}| //│ Parsed: {class A(x,) {fun foo = 0; fun bar = x}; let x = new A([]) {fun foo = 1; fun newFun = 2; fun bar = new A([foo,]) {fun foo = +(bar, 1,); fun bar2 = +(newFun, 1,)}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(0)), NuFunDef(None, bar, None, [], Var(x)))), NuFunDef(Some(false), x, None, [], New(Some((TypeName(A),[])), TypingUnit(List(fun foo = 1, fun newFun = 2, fun bar = new A([foo,]) {fun foo = +(bar, 1,); fun bar2 = +(newFun, 1,)}))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], IntLit(0)), NuFunDef(None, bar, None, [], Var(x)))), NuFunDef(Some(false), x, None, [], New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)), NuFunDef(None, newFun, None, [], IntLit(2)), NuFunDef(None, bar, None, [], New(Some((TypeName(A),[foo,])), TypingUnit(NuFunDef(None, foo, None, [], App(Var(+), Tup(_: Var(bar), _: IntLit(1)))), NuFunDef(None, bar2, None, [], App(Var(+), Tup(_: Var(newFun), _: IntLit(1))))))))))) //│ Lifted: //│ TypingUnit { -//│ class A$1([x,]) {fun foo = 0; fun bar = (this).x} -//│ class A$1$2_A$2$3([par$A$1$2, x,]): A$1((this).x,) { -//│ fun foo = +((this).bar, 1,) -//│ fun bar2 = +(((this).par$A$1$2).newFun, 1,) +//│ class A$1([x,]) {fun foo = () => 0; fun bar = () => (this).x} +//│ class A$2$2_A$3$3([par$A$2$2, x,]): A$1((this).x,) { +//│ fun foo = () => +((this).bar, 1,) +//│ fun bar2 = () => +(((this).par$A$2$2).newFun, 1,) //│ } -//│ class A$1$2([x,]): A$1((this).x,) { -//│ fun foo = 1 -//│ fun newFun = 2 -//│ fun bar = {new A$1$2_A$2$3([this, (this).foo,]) {}} +//│ class A$2$2([x,]): A$1((this).x,) { +//│ fun foo = () => 1 +//│ fun newFun = () => 2 +//│ fun bar = () => {new A$2$2_A$3$3([this, (this).foo,]) {}} //│ } -//│ let x = {new A$1$2([]) {}} +//│ let x$1 = () => {new A$2$2([]) {}} //│ } //│ @@ -451,27 +451,30 @@ new A{ //│ |#class| |A| |{||}|↵|#new| |A|{|→|#fun| |foo| |#=| |1|↵|#fun| |bar| |#=| |#new| |A|{|→|#fun| |foo1| |#=| |foo|↵|#fun| |bar1| |#=| |#new| |A|{|→|#fun| |foo2| |#=| |foo|↵|#fun| |bar2| |#=| |#new| |A|{|→|#fun| |foo3| |#=| |foo|↵|#fun| |bar3| |#=| |#new| |A|{|→|#fun| |foo4| |#=| |foo|↵|#fun| |bar4| |#=| |0|←|↵|}|←|↵|}|←|↵|}|←|↵|}|←|↵|}| //│ Parsed: {class A {}; new A([]) {fun foo = 1; fun bar = new A([]) {fun foo1 = foo; fun bar1 = new A([]) {fun foo2 = foo; fun bar2 = new A([]) {fun foo3 = foo; fun bar3 = new A([]) {fun foo4 = foo; fun bar4 = 0}}}}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), New(Some((TypeName(A),[])), TypingUnit(List(fun foo = 1, fun bar = new A([]) {fun foo1 = foo; fun bar1 = new A([]) {fun foo2 = foo; fun bar2 = new A([]) {fun foo3 = foo; fun bar3 = new A([]) {fun foo4 = foo; fun bar4 = 0}}}})))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit()), New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo, None, [], IntLit(1)), NuFunDef(None, bar, None, [], New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo1, None, [], Var(foo)), NuFunDef(None, bar1, None, [], New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo2, None, [], Var(foo)), NuFunDef(None, bar2, None, [], New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo3, None, [], Var(foo)), NuFunDef(None, bar3, None, [], New(Some((TypeName(A),[])), TypingUnit(NuFunDef(None, foo4, None, [], Var(foo)), NuFunDef(None, bar4, None, [], IntLit(0))))))))))))))))) //│ Lifted: //│ TypingUnit { //│ class A$1([]) {} //│ class A$1$2_A$2$3_A$3$4_A$4$5_A$5$6([par$A$1$2_A$2$3_A$3$4_A$4$5,]): A$1() { -//│ fun foo4 = (((((this).par$A$1$2_A$2$3_A$3$4_A$4$5).par$A$1$2_A$2$3_A$3$4).par$A$1$2_A$2$3).par$A$1$2).foo -//│ fun bar4 = 0 +//│ fun foo4 = () => (((((this).par$A$1$2_A$2$3_A$3$4_A$4$5).par$A$1$2_A$2$3_A$3$4).par$A$1$2_A$2$3).par$A$1$2).foo +//│ fun bar4 = () => 0 //│ } //│ class A$1$2_A$2$3_A$3$4_A$4$5([par$A$1$2_A$2$3_A$3$4,]): A$1() { -//│ fun foo3 = ((((this).par$A$1$2_A$2$3_A$3$4).par$A$1$2_A$2$3).par$A$1$2).foo -//│ fun bar3 = {new A$1$2_A$2$3_A$3$4_A$4$5_A$5$6([this,]) {}} +//│ fun foo3 = () => ((((this).par$A$1$2_A$2$3_A$3$4).par$A$1$2_A$2$3).par$A$1$2).foo +//│ fun bar3 = () => {new A$1$2_A$2$3_A$3$4_A$4$5_A$5$6([this,]) {}} //│ } //│ class A$1$2_A$2$3_A$3$4([par$A$1$2_A$2$3,]): A$1() { -//│ fun foo2 = (((this).par$A$1$2_A$2$3).par$A$1$2).foo -//│ fun bar2 = {new A$1$2_A$2$3_A$3$4_A$4$5([this,]) {}} +//│ fun foo2 = () => (((this).par$A$1$2_A$2$3).par$A$1$2).foo +//│ fun bar2 = () => {new A$1$2_A$2$3_A$3$4_A$4$5([this,]) {}} //│ } //│ class A$1$2_A$2$3([par$A$1$2,]): A$1() { -//│ fun foo1 = ((this).par$A$1$2).foo -//│ fun bar1 = {new A$1$2_A$2$3_A$3$4([this,]) {}} +//│ fun foo1 = () => ((this).par$A$1$2).foo +//│ fun bar1 = () => {new A$1$2_A$2$3_A$3$4([this,]) {}} +//│ } +//│ class A$1$2([]): A$1() { +//│ fun foo = () => 1 +//│ fun bar = () => {new A$1$2_A$2$3([this,]) {}} //│ } -//│ class A$1$2([]): A$1() {fun foo = 1; fun bar = {new A$1$2_A$2$3([this,]) {}}} //│ Code(List({new A$1$2([]) {}})) //│ } //│ diff --git a/compiler/shared/test/diff/LifterBlks.mls b/compiler/shared/test/diff/LifterBlks.mls index b2d692d3b..67d569bd5 100644 --- a/compiler/shared/test/diff/LifterBlks.mls +++ b/compiler/shared/test/diff/LifterBlks.mls @@ -9,26 +9,26 @@ fun foo = //│ Parsed: //│ TypingUnit(NuFunDef(None, foo, None, [], Blk(...))) //│ Lifted: -//│ TypingUnit {fun foo = {print("ok",); print("ko",)}} +//│ TypingUnit {fun foo$1 = () => {print("ok",); print("ko",)}} //│ class A{ class B {} - fun foo(x: B) = (x:B) + fun foo(x: B) = (x : B) } -//│ |#class| |A|{|→|#class| |B| |{||}|↵|#fun| |foo|(|x|#:| |B|)| |#=| |(|x|#:|B|)|←|↵|}| -//│ Parsed: {class A {class B {}; fun foo = (x: B,) => '(' [x: B,] ')'}} +//│ |#class| |A|{|→|#class| |B| |{||}|↵|#fun| |foo|(|x|#:| |B|)| |#=| |(|x| |#:| |B|)|←|↵|}| +//│ Parsed: {class A {class B {}; fun foo = (x: B,) => '(' x : B ')'}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, None, [], Lam(Tup(x: Var(B)), Bra(rcd = false, Tup(x: Var(B)))))))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit()), NuFunDef(None, foo, None, [], Lam(Tup(x: Var(B)), Bra(rcd = false, Asc(Var(x), TypeName(B)))))))) //│ Lifted: //│ TypingUnit { //│ class A$1_B$2([par$A$1,]) {} -//│ class A$1([]) {fun foo = (x: A$1_B$2,) => '(' [x: A$1_B$2,] ')'} +//│ class A$1([]) {fun foo = (x: A$1_B$2,) => '(' x : A$1_B$2 ')'} //│ } //│ fun foo = - fun local(x) = + let local(x) = class Foo { fun bar = x + 1 } @@ -38,30 +38,32 @@ fun foo = fun tmp = 1 print of local of 0 + local of 1 fun tmp = 2 -//│ |#fun| |foo| |#=|→|#fun| |local|(|x|)| |#=|→|#class| |Foo| |{|→|#fun| |bar| |#=| |x| |+| |1|←|↵|}|↵|Foo|(||)|.bar|←|↵|print| |#of| |local|(|0|)| |+| |local|(|1|)|↵|print| |#of| |(|local| |#of| |0|)| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |1|↵|print| |#of| |local| |#of| |0| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |2|←| -//│ Parsed: {fun foo = {fun local = (x,) => {class Foo {fun bar = +(x, 1,)}; (Foo()).bar}; print(+(local(0,), local(1,),),); print(+('(' local(0,) ')', local(1,),),); fun tmp = 1; print(local(+(0, local(1,),),),); fun tmp = 2}} +//│ |#fun| |foo| |#=|→|#let| |local|(|x|)| |#=|→|#class| |Foo| |{|→|#fun| |bar| |#=| |x| |+| |1|←|↵|}|↵|Foo|(||)|.bar|←|↵|print| |#of| |local|(|0|)| |+| |local|(|1|)|↵|print| |#of| |(|local| |#of| |0|)| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |1|↵|print| |#of| |local| |#of| |0| |+| |local| |#of| |1|↵|#fun| |tmp| |#=| |2|←| +//│ Parsed: {fun foo = {let local = (x,) => {class Foo {fun bar = +(x, 1,)}; (Foo()).bar}; print(+(local(0,), local(1,),),); print(+('(' local(0,) ')', local(1,),),); fun tmp = 1; print(local(+(0, local(1,),),),); fun tmp = 2}} //│ Parsed: //│ TypingUnit(NuFunDef(None, foo, None, [], Blk(...))) //│ Lifted: //│ TypingUnit { -//│ class Foo$1([x,]) {fun bar = +((this).x, 1,)} -//│ fun foo = {fun local = (x,) => {(Foo$1(x,)).bar}; fun tmp = 1; fun tmp = 2; print(+(local(0,), local(1,),),); print(+('(' local(0,) ')', local(1,),),); print(local(+(0, local(1,),),),)} +//│ class Foo$1([x,]) {fun bar = () => +((this).x, 1,)} +//│ let local$3 = (x,) => {(Foo$1(x,)).bar} +//│ fun tmp$2 = () => 1 +//│ fun foo$1 = () => {print(+(local$3(0,), local$3(1,),),); print(+('(' local$3(0,) ')', local$3(1,),),); print(local$3(+(0, local$3(1,),),),)} //│ } //│ class A(y){} let f = x => new A(0){fun bar = x+y} f(0) -//│ |#class| |A|(|y|)|{||}|↵|#let| |f| |#=| |x| |=>| |#new| |A|(|0|)|{|#fun| |bar| |#=| |x|+|y|}|↵|f|(|0|)| +//│ |#class| |A|(|y|)|{||}|↵|#let| |f| |#=| |x| |#=>| |#new| |A|(|0|)|{|#fun| |bar| |#=| |x|+|y|}|↵|f|(|0|)| //│ Parsed: {class A(y,) {}; let f = (x,) => new A([0,]) {fun bar = +(x, y,)}; f(0,)} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), None, None, TypingUnit()), NuFunDef(Some(false), f, None, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),[0,])), TypingUnit(List(fun bar = +(x, y,)))))), App(Var(f), Tup(_: IntLit(0)))) +//│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(y)), (), None, None, TypingUnit()), NuFunDef(Some(false), f, None, [], Lam(Tup(_: Var(x)), New(Some((TypeName(A),[0,])), TypingUnit(NuFunDef(None, bar, None, [], App(Var(+), Tup(_: Var(x), _: Var(y)))))))), App(Var(f), Tup(_: IntLit(0)))) //│ Lifted: //│ TypingUnit { //│ class A$1([y,]) {} -//│ class A$1$2([y, x,]): A$1((this).y,) {fun bar = +((this).x, (this).y,)} -//│ let f = (x,) => {new A$1$2([0, x,]) {}} -//│ Code(List(f(0,))) +//│ class A$2$2([y, x,]): A$1((this).y,) {fun bar = () => +((this).x, (this).y,)} +//│ let f$1 = (x,) => {new A$2$2([0, x,]) {}} +//│ Code(List(f$1(0,))) //│ } //│ @@ -81,10 +83,14 @@ class A(x){ //│ TypingUnit(NuTypeDef(class, A, (), Tup(_: Var(x)), (), None, None, TypingUnit(NuFunDef(None, w, None, [], Var(x)), NuFunDef(None, foo, None, [], Lam(Tup(_: Var(y)), Blk(...)))))) //│ Lifted: //│ TypingUnit { -//│ class A$1_B$2([par$A$1, z, y,]) {fun bar = +(+(((this).par$A$1).x, (this).y,), (this).z,)} -//│ class A$1_B$1$3([par$A$1, z, y,]): A$1_B$2((this).par$A$1, (this).z, (this).y,) {fun bar = +(+(((this).par$A$1).w, (this).y,), (this).z,)} +//│ class A$1_B$2([par$A$1, z, y,]) { +//│ fun bar = () => +(+(((this).par$A$1).x, (this).y,), (this).z,) +//│ } +//│ class A$1_B$1$3([par$A$1, z, y,]): A$1_B$2((this).par$A$1, (this).z, (this).y,) { +//│ fun bar = () => +(+(((this).par$A$1).w, (this).y,), (this).z,) +//│ } //│ class A$1([x,]) { -//│ fun w = (this).x +//│ fun w = () => (this).x //│ fun foo = (y,) => {{new A$1_B$1$3([this, 0, y,]) {}}} //│ } //│ } @@ -109,15 +115,15 @@ fun f(x,y,z) = //│ Lifted: //│ TypingUnit { //│ class A$1([x, y,]) { -//│ fun foo = new B$2([(this).y, (this).x,]) {} -//│ fun bar1 = (this).x +//│ fun foo = () => new B$2([(this).y, (this).x,]) {} +//│ fun bar1 = () => (this).x //│ } //│ class B$2([y, x,]) { -//│ fun foo = new A$1([(this).x, (this).y,]) {} -//│ fun bar2 = (this).y +//│ fun foo = () => new A$1([(this).x, (this).y,]) {} +//│ fun bar2 = () => (this).y //│ } -//│ class C$3([x, y,]): A$1((this).x, (this).y,), B$2((this).y, (this).x,) {fun bar = +((this).bar1, (this).bar2,)} -//│ fun f = (x, y, z,) => {} +//│ class C$3([x, y,]): A$1((this).x, (this).y,), B$2((this).y, (this).x,) {fun bar = () => +((this).bar1, (this).bar2,)} +//│ fun f$1 = (x, y, z,) => {} //│ } //│ @@ -140,35 +146,51 @@ fun f(x,y,z) = //│ Lifted: //│ TypingUnit { //│ class C$1_A$2([par$C$1,]) { -//│ fun foo = new C$1_B$3([(this).par$C$1,]) {} -//│ fun bar1 = ((this).par$C$1).x +//│ fun foo = () => new C$1_B$3([(this).par$C$1,]) {} +//│ fun bar1 = () => ((this).par$C$1).x //│ } //│ class C$1_B$3([par$C$1,]) { -//│ fun foo = new C$1_A$2([(this).par$C$1,]) {} -//│ fun bar2 = ((this).par$C$1).y +//│ fun foo = () => new C$1_A$2([(this).par$C$1,]) {} +//│ fun bar2 = () => ((this).par$C$1).y //│ } //│ class C$1([x, y, z,]) { -//│ fun boo = +(+(('(' new C$1_A$2([this,]) {} ')').bar1, (C$1_B$3(this,)).bar2,), (this).z,) +//│ fun boo = () => +(+(('(' new C$1_A$2([this,]) {} ')').bar1, (C$1_B$3(this,)).bar2,), (this).z,) //│ } -//│ fun f = (x, y, z,) => {} +//│ fun f$1 = (x, y, z,) => {} //│ } //│ -fun f(x) = - let g(x) = x + 1 +fun f(y) = + let g(x) = x + y + 1 class Foo(x) { fun h = g(x) } - Foo(x).h -//│ |#fun| |f|(|x|)| |#=|→|#let| |g|(|x|)| |#=| |x| |+| |1|↵|#class| |Foo|(|x|)| |{|→|#fun| |h| |#=| |g|(|x|)|←|↵|}|↵|Foo|(|x|)|.h|←| -//│ Parsed: {fun f = (x,) => {let g = (x,) => +(x, 1,); class Foo(x,) {fun h = g(x,)}; (Foo(x,)).h}} +//│ |#fun| |f|(|y|)| |#=|→|#let| |g|(|x|)| |#=| |x| |+| |y| |+| |1|↵|#class| |Foo|(|x|)| |{|→|#fun| |h| |#=| |g|(|x|)|←|↵|}|←| +//│ Parsed: {fun f = (y,) => {let g = (x,) => +(+(x, y,), 1,); class Foo(x,) {fun h = g(x,)}}} //│ Parsed: -//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Blk(...)))) +//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(y)), Blk(...)))) //│ Lifted: //│ TypingUnit { -//│ class Foo$1([x, g,]) {fun h = (this).g((this).x,)} -//│ fun f = (x,) => {let g = (x,) => +(x, 1,); (Foo$1(x, g,)).h} +//│ class Foo$1([x, y,]) {fun h = () => g$2((this).x, y,)} +//│ let g$2 = (x, y,) => +(+(x, y,), 1,) +//│ fun f$1 = (y,) => {} //│ } +//│ + Foo(1).h +//│ | |Foo|(|1|)|.h| +//│ Parsed: {(Foo(1,)).h} +//│ Parsed: +//│ TypingUnit(Sel(App(Var(Foo), Tup(_: IntLit(1))), h)) +//│ Lifted: +//│ TypingUnit {Code(List((Foo(1,)).h))} +//│ + Foo(x).h +//│ | |Foo|(|x|)|.h| +//│ Parsed: {(Foo(x,)).h} +//│ Parsed: +//│ TypingUnit(Sel(App(Var(Foo), Tup(_: Var(x))), h)) +//│ Lifted: +//│ TypingUnit {Code(List((Foo(x,)).h))} //│ fun f(x) = @@ -185,8 +207,10 @@ fun f(x) = //│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Blk(...)))) //│ Lifted: //│ TypingUnit { -//│ class Foo$1([x, y, g,]) {fun bar = +((this).g((this).x,), (this).y,)} -//│ fun f = (x,) => {let g = (x,) => {let h = (x,) => +(x, 2,); (Foo$1(h(x,), x, g,)).bar}; (Foo$1(x, x, g,)).bar} +//│ class Foo$1([x, y,]) {fun bar = () => +(g$2((this).x,), (this).y,)} +//│ let h$3 = (x,) => +(x, 2,) +//│ let g$2 = (x,) => {(Foo$1(h$3(x,), x,)).bar} +//│ fun f$1 = (x,) => {(Foo$1(x, x,)).bar} //│ } //│ @@ -212,25 +236,26 @@ fun foo(x: T): string = //│ TypingUnit(NuFunDef(None, foo, None, [TypeName(T), TypeName(U)], Lam(Tup(x: Var(T)), Asc(Blk(...), TypeName(string))))) //│ Lifted: //│ TypingUnit { -//│ class A$1[T,U]([y,]): B‹T›, C(y: U,) {fun bar = this} -//│ fun foo[T, U] = (x: T,) => {"rua"} : string +//│ class A$1[T,U]([y,]): B‹T›, C(y: U,) {fun bar = () => this} +//│ fun foo$1[T, U] = (x: T,) => {"rua"} : string //│ } //│ class A{ class B{ - fun f: T => B => T = x => y => x + fun f = x => y => x fun g: T => B => T } } -//│ |#class| |A|‹|T|›|{|→|#class| |B|{|→|#fun| |f|#:| |T| |=>| |B| |=>| |T| |#=| |x| |=>| |y| |=>| |x|↵|#fun| |g|#:| |T| |=>| |B| |=>| |T|←|↵|}|←|↵|}| -//│ Parsed: {class A‹T› {class B {fun f = (x,) => (y,) => x : T -> B -> T; fun g: T -> B -> T}}} +//│ |#class| |A|‹|T|›|{|→|#class| |B|{|→|#fun| |f| |#=| |x| |#=>| |y| |#=>| |x|↵|#fun| |g|#:| |T| |#=>| |B| |#=>| |T|←|↵|}|←|↵|}| +//│ Parsed: {class A‹T› {class B {fun f = (x,) => (y,) => x; fun g: T -> B -> T}}} //│ Parsed: -//│ TypingUnit(NuTypeDef(class, A, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, f, None, [], Asc(Lam(Tup(_: Var(x)), Lam(Tup(_: Var(y)), Var(x))), Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T))))), NuFunDef(None, g, None, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T)))))))))) +//│ TypingUnit(NuTypeDef(class, A, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuTypeDef(class, B, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Lam(Tup(_: Var(y)), Var(x)))), NuFunDef(None, g, None, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),Function(Tuple(List((None,Field(None,TypeName(B))))),TypeName(T)))))))))) //│ Lifted: //│ TypingUnit { +//│ class A$1_B$2_Lambda1$1$3([par$A$1_B$2, x,]) {fun apply = (y,) => (this).x} //│ class A$1_B$2[T]([par$A$1,]) { -//│ fun f = (x,) => (y,) => x : T -> A$1_B$2 -> T +//│ fun f = (x,) => {new A$1_B$2_Lambda1$1$3([this, x,]) {}} //│ fun g = T -> A$1_B$2 -> T //│ } //│ class A$1[T]([]) {} @@ -242,7 +267,7 @@ class Foo{ class StackedRectangleBoxes : RectangleBox & { size: N } class Bar: {any: RectangleBox => StackedRectangleBoxes} } -//│ |#class| |Foo|‹|T|›|{|→|#class| |RectangleBox|#:| |Box|‹|T|›| |&| |{| |breadth|#:| |T| |}|↵|#class| |StackedRectangleBoxes|‹|N|›| |#:| |RectangleBox|‹|T|›| |&| |{| |size|#:| |N| |}|↵|#class| |Bar|#:| |{|any|#:| |RectangleBox| |=>| |StackedRectangleBoxes|}|←|↵|}| +//│ |#class| |Foo|‹|T|›|{|→|#class| |RectangleBox|#:| |Box|‹|T|›| |&| |{| |breadth|#:| |T| |}|↵|#class| |StackedRectangleBoxes|‹|N|›| |#:| |RectangleBox|‹|T|›| |&| |{| |size|#:| |N| |}|↵|#class| |Bar|#:| |{|any|#:| |RectangleBox| |#=>| |StackedRectangleBoxes|}|←|↵|}| //│ Parsed: {class Foo‹T› {class RectangleBox: Box[T] & {breadth: T} {}; class StackedRectangleBoxes‹N›: RectangleBox[T] & {size: N} {}; class Bar: {any: RectangleBox -> StackedRectangleBoxes} {}}} //│ Parsed: //│ TypingUnit(NuTypeDef(class, Foo, ((None,TypeName(T))), Tup(), (), None, None, TypingUnit(NuTypeDef(class, RectangleBox, (), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, StackedRectangleBoxes, ((None,TypeName(N))), Tup(), (), None, None, TypingUnit()), NuTypeDef(class, Bar, (), Tup(), (), None, None, TypingUnit())))) @@ -265,7 +290,7 @@ fun ctx(a,b) = foo(new Lambda{ fun apply(x) = a+x }, b) -//│ |#class| |Func|‹|T|,| |U|›| |{|→|#fun| |apply|#:| |T| |=>| |U|←|↵|}|↵|#class| |Lambda|‹|T|,| |U|›| |#:| |Func|‹|T|,| |U|›| |{||}|↵|#fun| |ctx|(|a|,|b|)| |#=|→|#fun| |foo|(|f|#:| |Func|,| |x|)| |#=| |→|f|.apply|(|x|)|←|↵|foo|(|#new| |Lambda|{|→|#fun| |apply|(|x|)| |#=| |a|+|x|←|↵|}|,| |b|)|←| +//│ |#class| |Func|‹|T|,| |U|›| |{|→|#fun| |apply|#:| |T| |#=>| |U|←|↵|}|↵|#class| |Lambda|‹|T|,| |U|›| |#:| |Func|‹|T|,| |U|›| |{||}|↵|#fun| |ctx|(|a|,|b|)| |#=|→|#fun| |foo|(|f|#:| |Func|,| |x|)| |#=| |→|f|.apply|(|x|)|←|↵|foo|(|#new| |Lambda|{|→|#fun| |apply|(|x|)| |#=| |a|+|x|←|↵|}|,| |b|)|←| //│ Parsed: {class Func‹T, U› {fun apply: T -> U}; class Lambda‹T, U›: Func[T, U] {}; fun ctx = (a, b,) => {fun foo = (f: Func, x,) => {(f).apply(x,)}; foo(new Lambda([]) {fun apply = (x,) => +(a, x,)}, b,)}} //│ Parsed: //│ TypingUnit(NuTypeDef(class, Func, ((None,TypeName(T)), (None,TypeName(U))), Tup(), (), None, None, TypingUnit(NuFunDef(None, apply, None, [], PolyType(List(),Function(Tuple(List((None,Field(None,TypeName(T))))),TypeName(U)))))), NuTypeDef(class, Lambda, ((None,TypeName(T)), (None,TypeName(U))), Tup(), (), None, None, TypingUnit()), NuFunDef(None, ctx, None, [], Lam(Tup(_: Var(a), _: Var(b)), Blk(...)))) @@ -273,8 +298,9 @@ fun ctx(a,b) = //│ TypingUnit { //│ class Func$1[T,U]([]) {fun apply = T -> U} //│ class Lambda$2[T,U]([]) {} -//│ class Lambda$1$3([a,]): Lambda$2() {fun apply = (x,) => +((this).a, x,)} -//│ fun ctx = (a, b,) => {fun foo = (f: Func$1, x,) => {(f).apply(x,)}; foo({new Lambda$1$3([a,]) {}}, b,)} +//│ class Lambda$3$3([a,]): Lambda$2() {fun apply = (x,) => +((this).a, x,)} +//│ fun foo$2 = (f: Func$1, x,) => {(f).apply(x,)} +//│ fun ctx$1 = (a, b,) => {foo$2({new Lambda$3$3([a,]) {}}, b,)} //│ } //│ @@ -288,3 +314,19 @@ f(MyClass) //│ Lifted: //│ Lifting failed: mlscript.codegen.CodeGenError: Cannot find type T. Class values are not supported in lifter. //│ + +class A { + fun foo = + fun bar = foo() + bar() +} +//│ |#class| |A| |{|→|#fun| |foo| |#=| |→|#fun| |bar| |#=| |foo|(||)|↵|bar|(||)|←|←|↵|}| +//│ Parsed: {class A {fun foo = {fun bar = foo(); bar()}}} +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, A, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Blk(...))))) +//│ Lifted: +//│ TypingUnit { +//│ class A$1([]) {fun foo = () => {bar$1(this,)}} +//│ fun bar$1 = (this,) => (this).foo() +//│ } +//│ diff --git a/compiler/shared/test/diff/mono.mls b/compiler/shared/test/diff/mono.mls new file mode 100644 index 000000000..5116e6600 --- /dev/null +++ b/compiler/shared/test/diff/mono.mls @@ -0,0 +1,1204 @@ + +:NewDefs + +:mono +fun f(x: Int) = if x then 42 else 1337 +//│ Parsed: +//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(x: Var(Int)), If(IfThen(Var(x), IntLit(42), Some(IntLit(1337)))))) +//│ Lifted: +//│ TypingUnit { +//│ fun f$1 = (x: Int,) => if (x) then 42 else 1337 +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ fun f$1(x) = +//│ if x then #42 else #1337 +//│ fun f: (x: Int) -> (1337 | 42) + +:mono +fun foo() = 42 +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(), IntLit(42)))) +//│ Lifted: +//│ TypingUnit {fun foo$1 = () => 42} +//│ Mono: +//│ +//│ Defunc result: +//│ fun foo$1() = +//│ #42 +//│ fun foo: () -> 42 + +:mono +fun foo(x, #b) = if b then x else 1337 +let a = foo(42, true) +let b = foo(23, false) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x), _: Var(b)), If(IfThen(Var(b), Var(x), Some(IntLit(1337))))), NuFunDef(Some(false), a, None, [], App(Var(foo), Tup(_: IntLit(42), _: Var(true)))), NuFunDef(Some(false), b, None, [], App(Var(foo), Tup(_: IntLit(23), _: Var(false))))) +//│ Lifted: +//│ TypingUnit { +//│ fun foo$3 = (x, #b,) => if (b) then x else 1337 +//│ let a$1 = () => foo$3(42, true,) +//│ let b$2 = () => foo$3(23, false,) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ fun b$2() = +//│ foo$3(#23, false) +//│ fun foo$3(x, #b) = +//│ if b then x else #1337 +//│ fun a$1() = +//│ foo$3(#42, true) +//│ fun foo: forall 'a. ('a, Object) -> (1337 | 'a) +//│ let a: 1337 | 42 +//│ let b: 1337 | 23 +//│ a +//│ = 42 +//│ b +//│ = 1337 + +:mono +let x = 42 + 1337 +//│ Parsed: +//│ TypingUnit(NuFunDef(Some(false), x, None, [], App(Var(+), Tup(_: IntLit(42), _: IntLit(1337))))) +//│ Lifted: +//│ TypingUnit {let x$1 = () => +(42, 1337,)} +//│ Mono: +//│ +//│ Defunc result: +//│ fun x$1() = +//│ +(#42, #1337) +//│ let x: Int +//│ x +//│ = 1379 + +//:mono +//:e // FIXME: Mutable Parameters +//class Bar(#x) +//fun foo(#b) = b +//let a = foo(new Bar(1)) +//let b = foo(new Bar(2)) + +//:mono +//:w // FIXME: Mutable Parameters +//class OneInt(#a){ +// fun inc() = a+1 +//} +//(new OneInt(1)).inc() + +//:mono +//:e // FIXME: Mutable Parameters +//class OneInt(#a){ +// fun add(x) = +// new OneInt(a+x.a) +//} +//(new OneInt(1)).add(new OneInt(2)) + +:mono +if true then 1 else 0 +if 1+1 > 1 then 1 - 1 else 1*1 +//│ Parsed: +//│ TypingUnit(If(IfThen(Var(true), IntLit(1), Some(IntLit(0))), If(IfThen(App(Var(>), Tup(_: App(Var(+), Tup(_: IntLit(1), _: IntLit(1))), _: IntLit(1))), App(Var(-), Tup(_: IntLit(1), _: IntLit(1))), Some(App(Var(*), Tup(_: IntLit(1), _: IntLit(1)))))) +//│ Lifted: +//│ TypingUnit { +//│ Code(List(if (true) then 1 else 0)) +//│ Code(List(if (>(+(1, 1,), 1,)) then -(1, 1,) else *(1, 1,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$0() +//│ main$$1() +//│ fun main$$0() = +//│ if true then #1 else #0 +//│ fun main$$1() = +//│ if >(+(#1, #1), #1) then -(#1, #1) else *(#1, #1) +//│ Int +//│ res +//│ = 1 +//│ res +//│ = 0 + +:mono +if(b) then 1 else 2 +//│ Parsed: +//│ TypingUnit(If(IfThen(Bra(rcd = false, Var(b)), IntLit(1), Some(IntLit(2)))) +//│ Lifted: +//│ TypingUnit {Code(List(if ('(' b ')') then 1 else 2))} +//│ Mono: +//│ +//│ Defunc result: +//│ main$$0() +//│ fun main$$0() = +//│ if b then #1 else #2 +//│ 1 | 2 +//│ res +//│ = 2 + +:mono +((f, g) => f(g))(f => f, true) +//│ Parsed: +//│ TypingUnit(App(Bra(rcd = false, Lam(Tup(_: Var(f), _: Var(g)), App(Var(f), Tup(_: Var(g))))), Tup(_: Lam(Tup(_: Var(f)), Var(f)), _: Var(true)))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda2$1$1([]) {fun apply = (f, g,) => f(g,)} +//│ class Lambda1$2$2([]) {fun apply = (f,) => f} +//│ Code(List('(' {new Lambda2$1$1([]) {}} ')'({new Lambda1$2$2([]) {}}, true,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$2() +//│ fun apply$Lambda2$1$1(this, f, g) = +//│ f match {case obj: Lambda1$2$2 => apply$Lambda1$2$2(obj, g)} +//│ fun main$$2() = +//│ new Lambda2$1$1 () match {case obj: Lambda2$1$1 => apply$Lambda2$1$1(obj, new Lambda1$2$2 () , true)} +//│ fun apply$Lambda1$2$2(this, f) = +//│ f +//│ class Lambda2$1$1() { +//│ } +//│ class Lambda1$2$2() { +//│ } +//│ true +//│ res +//│ = true + + +:mono +(b => if b then true else false) (true) +//│ Parsed: +//│ TypingUnit(App(Bra(rcd = false, Lam(Tup(_: Var(b)), If(IfThen(Var(b), Var(true), Some(Var(false))))), Tup(_: Var(true)))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda1$1$1([]) {fun apply = (b,) => if (b) then true else false} +//│ Code(List('(' {new Lambda1$1$1([]) {}} ')'(true,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ fun apply$Lambda1$1$1(this, b) = +//│ if b then true else false +//│ fun main$$1() = +//│ new Lambda1$1$1 () match {case obj: Lambda1$1$1 => apply$Lambda1$1$1(obj, true)} +//│ class Lambda1$1$1() { +//│ } +//│ Bool +//│ res +//│ = true + +:mono +fun f(x) = + if(x > 0) then x+1 else x - 1 +f(2)+3 +//│ Parsed: +//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(+), Tup(_: App(Var(f), Tup(_: IntLit(2))), _: IntLit(3)))) +//│ Lifted: +//│ TypingUnit { +//│ fun f$1 = (x,) => {if ('(' >(x, 0,) ')') then +(x, 1,) else -(x, 1,)} +//│ Code(List(+(f$1(2,), 3,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ fun f$1(x) = +//│ if >(x, #0) then +(x, #1) else -(x, #1) +//│ fun main$$1() = +//│ +(f$1(#2), #3) +//│ fun f: Int -> Int +//│ Int +//│ res +//│ = 6 + +:mono +fun fac(n) = + if (n > 1) then fac(n - 1) * n else 1 +fac(2) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, fac, None, [], Lam(Tup(_: Var(n)), Blk(...))), App(Var(fac), Tup(_: IntLit(2)))) +//│ Lifted: +//│ TypingUnit { +//│ fun fac$1 = (n,) => {if ('(' >(n, 1,) ')') then *(fac$1(-(n, 1,),), n,) else 1} +//│ Code(List(fac$1(2,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ fun fac$1(n) = +//│ if >(n, #1) then *(fac$1(-(n, #1)), n) else #1 +//│ fun main$$1() = +//│ fac$1(#2) +//│ fun fac: Int -> Int +//│ Int +//│ res +//│ = 2 + +:mono +class List(val l: List | Nil | undefined, val hasTail: Bool) {} +class Nil(val l: List | Nil | undefined, val hasTail: Bool) {} +fun count(lst) = + if lst.hasTail then + let l = lst.l + if l is undefined then 1 else count(l)+1 + else 0 +count(new List(new List(new Nil(undefined, false), true), true)) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, List, (), Tup(l: App(Var(|), Tup(_: App(Var(|), Tup(_: Var(List), _: Var(Nil))), _: UnitLit(true))), hasTail: Var(Bool)), (), None, None, TypingUnit()), NuTypeDef(class, Nil, (), Tup(l: App(Var(|), Tup(_: App(Var(|), Tup(_: Var(List), _: Var(Nil))), _: UnitLit(true))), hasTail: Var(Bool)), (), None, None, TypingUnit()), NuFunDef(None, count, None, [], Lam(Tup(_: Var(lst)), Blk(...))), App(Var(count), Tup(_: New(Some((TypeName(List),[new List([new Nil([undefined, false,]) {}, true,]) {}, true,])), TypingUnit())))) +//│ Lifted: +//│ TypingUnit { +//│ class List$1([val l: |(|(List, Nil,), undefined,), val hasTail: Bool,]) {} +//│ class Nil$2([val l: |(|(List, Nil,), undefined,), val hasTail: Bool,]) {} +//│ let l$2 = (lst,) => (lst).l +//│ fun count$1 = (lst,) => {if ((lst).hasTail) then {if (is(l, undefined,)) then 1 else +(count$1(l,), 1,)} else 0} +//│ Code(List(count$1(new List$1([new List$1([new Nil$2([undefined, false,]) {}, true,]) {}, true,]) {},))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$4() +//│ fun l$2(lst) = +//│ lst.l +//│ fun count$1(lst) = +//│ if lst.hasTail then if is(l, #()) then #1 else +(count$1(l), #1) else #0 +//│ fun main$$4() = +//│ count$1(new List$1 (new List$1 (new Nil$2 (#(), false) , true) , true) ) +//│ class Nil$2(l, hasTail) { +//│ } +//│ class List$1(l, hasTail) { +//│ } +//│ class List(l: List | Nil | (), hasTail: Bool) +//│ class Nil(l: List | Nil | (), hasTail: Bool) +//│ fun count: forall 'a. 'a -> Int +//│ Int +//│ where +//│ 'a <: {hasTail: Object, l: Object & 'a & ~() | ()} +//│ res +//│ = 2 + +//:mono +//class Cons(e, tail){ +// fun gen() = new Cons(e, tail.gen()) +//} +//class Nil(){ +// fun gen() = new Cons(0, this) +//} +//fun generate(x) = +// if x > 0 then new Cons(x, generate(x+1)) else new Nil() +//generate(10).gen() + +:mono +class List(e: Int, tail: List | Nil) { + fun map: (Int -> Int) -> List + fun map(f)= new List(f(e), tail.map(f)) + fun count(): Int + fun count() = 1 + tail.count() +} +class Nil() { + fun map(f) = this + fun count() = 0 +} +fun add2(x) = x+2 +(new List(1, new List(2, new Nil()))).map(x => x+1).map(x => add2(x)) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, List, (), Tup(e: Var(Int), tail: App(Var(|), Tup(_: Var(List), _: Var(Nil)))), (), None, None, TypingUnit(NuFunDef(None, map, None, [], PolyType(List(),Function(Tuple(List((None,Field(None,Function(Tuple(List((None,Field(None,TypeName(Int))))),TypeName(Int)))))),TypeName(List)))), NuFunDef(None, map, None, [], Lam(Tup(_: Var(f)), New(Some((TypeName(List),[f(e,), (tail).map(f,),])), TypingUnit()))), NuFunDef(None, count, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Int)))), NuFunDef(None, count, None, [], Lam(Tup(), App(Var(+), Tup(_: IntLit(1), _: App(Sel(Var(tail), count), Tup()))))))), NuTypeDef(class, Nil, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, map, None, [], Lam(Tup(_: Var(f)), Var(this))), NuFunDef(None, count, None, [], Lam(Tup(), IntLit(0))))), NuFunDef(None, add2, None, [], Lam(Tup(_: Var(x)), App(Var(+), Tup(_: Var(x), _: IntLit(2))))), App(Sel(App(Sel(Bra(rcd = false, New(Some((TypeName(List),[1, new List([2, new Nil([]) {},]) {},])), TypingUnit())), map), Tup(_: Lam(Tup(_: Var(x)), App(Var(+), Tup(_: Var(x), _: IntLit(1)))))), map), Tup(_: Lam(Tup(_: Var(x)), App(Var(add2), Tup(_: Var(x))))))) +//│ Lifted: +//│ TypingUnit { +//│ class List$1([e: Int, tail: |(List, Nil,),]) { +//│ fun map = (Int -> Int) -> List$1 +//│ fun map = (f,) => new List$1([f((this).e,), ((this).tail).map(f,),]) {} +//│ fun count = () -> Int +//│ fun count = () => +(1, ((this).tail).count(),) +//│ } +//│ class Nil$2([]) {fun map = (f,) => this; fun count = () => 0} +//│ class Lambda1$2$3([]) {fun apply = (x,) => +(x, 1,)} +//│ class Lambda1$3$4([]) {fun apply = (x,) => add2$1(x,)} +//│ fun add2$1 = (x,) => +(x, 2,) +//│ Code(List((('(' new List$1([1, new List$1([2, new Nil$2([]) {},]) {},]) {} ')').map({new Lambda1$2$3([]) {}},)).map({new Lambda1$3$4([]) {}},))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$5() +//│ fun map$List$1(this, f) = +//│ new List$1 (f match {case obj: Lambda1$2$3 => apply$Lambda1$2$3(obj, this.e); case obj: Lambda1$3$4 => apply$Lambda1$3$4(obj, this.e)}, this.tail match {case obj: List$1 => map$List$1(obj, f); case obj: Nil$2 => map$Nil$2(obj, f)}) +//│ fun add2$1(x) = +//│ +(x, #2) +//│ fun main$$5() = +//│ new List$1 (#1, new List$1 (#2, new Nil$2 () ) ) match {case obj: List$1 => map$List$1(obj, new Lambda1$2$3 () )} match {case obj: List$1 => map$List$1(obj, new Lambda1$3$4 () )} +//│ fun apply$Lambda1$3$4(this, x) = +//│ add2$1(x) +//│ fun map$Nil$2(this, f) = +//│ this +//│ fun apply$Lambda1$2$3(this, x) = +//│ +(x, #1) +//│ class Lambda1$3$4() { +//│ } +//│ class Nil$2() { +//│ } +//│ class List$1(e, tail) { +//│ } +//│ class Lambda1$2$3() { +//│ } +//│ class List(e: Int, tail: List | Nil) { +//│ fun count: () -> Int +//│ fun map: (Int -> Int) -> List +//│ } +//│ class Nil() { +//│ fun count: () -> 0 +//│ fun map: anything -> Nil +//│ } +//│ fun add2: Int -> Int +//│ List +//│ res +//│ = List {} + +:mono +:AllowRuntimeErrors +class List(e: Int, tail: List | Nil) { + fun count(): Int + fun count() = 1 + tail.count() +} +class Nil() { + fun count() = 0 +} +fun foo(x) = x.count() +fun generate(x) = + if x > 0 then new List(x, generate(x+1)) else new Nil() +foo(new List(1, new List(2, new Nil()))) +foo(generate(1)) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, List, (), Tup(e: Var(Int), tail: App(Var(|), Tup(_: Var(List), _: Var(Nil)))), (), None, None, TypingUnit(NuFunDef(None, count, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Int)))), NuFunDef(None, count, None, [], Lam(Tup(), App(Var(+), Tup(_: IntLit(1), _: App(Sel(Var(tail), count), Tup()))))))), NuTypeDef(class, Nil, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, count, None, [], Lam(Tup(), IntLit(0))))), NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), App(Sel(Var(x), count), Tup()))), NuFunDef(None, generate, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(foo), Tup(_: New(Some((TypeName(List),[1, new List([2, new Nil([]) {},]) {},])), TypingUnit()))), App(Var(foo), Tup(_: App(Var(generate), Tup(_: IntLit(1)))))) +//│ Lifted: +//│ TypingUnit { +//│ class List$1([e: Int, tail: |(List, Nil,),]) { +//│ fun count = () -> Int +//│ fun count = () => +(1, ((this).tail).count(),) +//│ } +//│ class Nil$2([]) {fun count = () => 0} +//│ fun foo$1 = (x,) => (x).count() +//│ fun generate$2 = (x,) => {if (>(x, 0,)) then new List$1([x, generate$2(+(x, 1,),),]) {} else new Nil$2([]) {}} +//│ Code(List(foo$1(new List$1([1, new List$1([2, new Nil$2([]) {},]) {},]) {},))) +//│ Code(List(foo$1(generate$2(1,),))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$4() +//│ main$$5() +//│ fun foo$1(x) = +//│ x match {case obj: Nil$2 => count$Nil$2(obj); case obj: List$1 => count$List$1(obj)} +//│ fun count$Nil$2(this) = +//│ #0 +//│ fun count$List$1(this) = +//│ +(#1, this.tail match {case obj: List$1 => count$List$1(obj); case obj: Nil$2 => count$Nil$2(obj)}) +//│ fun generate$2(x) = +//│ if >(x, #0) then new List$1 (x, generate$2(+(x, #1))) else new Nil$2 () +//│ fun main$$5() = +//│ foo$1(generate$2(#1)) +//│ fun main$$4() = +//│ foo$1(new List$1 (#1, new List$1 (#2, new Nil$2 () ) ) ) +//│ class Nil$2() { +//│ } +//│ class List$1(e, tail) { +//│ } +//│ class List(e: Int, tail: List | Nil) { +//│ fun count: () -> Int +//│ } +//│ class Nil() { +//│ fun count: () -> 0 +//│ } +//│ fun foo: forall 'a. {count: () -> 'a} -> 'a +//│ fun generate: Int -> (List | Nil) +//│ Int +//│ res +//│ = 2 +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:mono +fun foo(x) = + (f => f(x))(z => z+1) +foo(2) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(foo), Tup(_: IntLit(2)))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda1$2$1([x,]) {fun apply = (f,) => f((this).x,)} +//│ class Lambda1$3$2([]) {fun apply = (z,) => +(z, 1,)} +//│ fun foo$1 = (x,) => {'(' {new Lambda1$2$1([x,]) {}} ')'({new Lambda1$3$2([]) {}},)} +//│ Code(List(foo$1(2,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$3() +//│ fun apply$Lambda1$2$1(this, f) = +//│ f match {case obj: Lambda1$3$2 => apply$Lambda1$3$2(obj, this.x)} +//│ fun foo$1(x) = +//│ new Lambda1$2$1 (x) match {case obj: Lambda1$2$1 => apply$Lambda1$2$1(obj, new Lambda1$3$2 () )} +//│ fun main$$3() = +//│ foo$1(#2) +//│ fun apply$Lambda1$3$2(this, z) = +//│ +(z, #1) +//│ class Lambda1$2$1(x) { +//│ } +//│ class Lambda1$3$2() { +//│ } +//│ fun foo: Int -> Int +//│ Int +//│ res +//│ = 3 + +:mono +fun f(x) = + (y => f(x+y))(x+1) +f(1) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(f), Tup(_: IntLit(1)))) +//│ Lifted: +//│ TypingUnit { +//│ class Lambda1$2$1([x,]) {fun apply = (y,) => f$1(+((this).x, y,),)} +//│ fun f$1 = (x,) => {'(' {new Lambda1$2$1([x,]) {}} ')'(+(x, 1,),)} +//│ Code(List(f$1(1,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$2() +//│ fun apply$Lambda1$2$1(this, y) = +//│ f$1(+(this.x, y)) +//│ fun f$1(x) = +//│ new Lambda1$2$1 (x) match {case obj: Lambda1$2$1 => apply$Lambda1$2$1(obj, +(x, #1))} +//│ fun main$$2() = +//│ f$1(#1) +//│ class Lambda1$2$1(x) { +//│ } +//│ fun f: Int -> nothing +//│ nothing +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + + +:mono +fun f(x) = f(x) +f(0) +f(1) +//│ Parsed: +//│ TypingUnit(NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), App(Var(f), Tup(_: Var(x))))), App(Var(f), Tup(_: IntLit(0))), App(Var(f), Tup(_: IntLit(1)))) +//│ Lifted: +//│ TypingUnit { +//│ fun f$1 = (x,) => f$1(x,) +//│ Code(List(f$1(0,))) +//│ Code(List(f$1(1,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ main$$2() +//│ fun f$1(x) = +//│ f$1(x) +//│ fun main$$2() = +//│ f$1(#1) +//│ fun main$$1() = +//│ f$1(#0) +//│ fun f: anything -> nothing +//│ nothing +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:mono +class Cons(e: 'A, tail: Cons | Nil) { + fun count(): Int + fun count() = 1 + tail.count() +} +class Nil() { + fun count() = 0 +} +class Lambda(){ + fun apply(l) = + l.count() +} +class Lambda2(a: Int){ + fun apply(l) = + (new Cons(a, l)).count() +} +fun foo(x) = + x.apply(new Cons(1, new Nil())) + x.apply(new Nil()) +foo(new Lambda()) +foo(new Lambda2(2)) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Cons, (), Tup(e: Var('A), tail: App(Var(|), Tup(_: Var(Cons), _: Var(Nil)))), (), None, None, TypingUnit(NuFunDef(None, count, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Int)))), NuFunDef(None, count, None, [], Lam(Tup(), App(Var(+), Tup(_: IntLit(1), _: App(Sel(Var(tail), count), Tup()))))))), NuTypeDef(class, Nil, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, count, None, [], Lam(Tup(), IntLit(0))))), NuTypeDef(class, Lambda, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, apply, None, [], Lam(Tup(_: Var(l)), Blk(...))))), NuTypeDef(class, Lambda2, (), Tup(a: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, apply, None, [], Lam(Tup(_: Var(l)), Blk(...))))), NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(foo), Tup(_: New(Some((TypeName(Lambda),[])), TypingUnit()))), App(Var(foo), Tup(_: New(Some((TypeName(Lambda2),[2,])), TypingUnit())))) +//│ Lifted: +//│ TypingUnit { +//│ class Cons$1([e: 'A, tail: |(Cons, Nil,),]) { +//│ fun count = () -> Int +//│ fun count = () => +(1, ((this).tail).count(),) +//│ } +//│ class Nil$2([]) {fun count = () => 0} +//│ class Lambda$3([]) {fun apply = (l,) => {(l).count()}} +//│ class Lambda2$4([a: Int,]) { +//│ fun apply = (l,) => {('(' new Cons$1([(this).a, l,]) {} ')').count()} +//│ } +//│ fun foo$1 = (x,) => {+((x).apply(new Cons$1([1, new Nil$2([]) {},]) {},), (x).apply(new Nil$2([]) {},),)} +//│ Code(List(foo$1(new Lambda$3([]) {},))) +//│ Code(List(foo$1(new Lambda2$4([2,]) {},))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$5() +//│ main$$6() +//│ fun count$Cons$1(this) = +//│ +(#1, this.tail match {case obj: Cons$1 => count$Cons$1(obj); case obj: Nil$2 => count$Nil$2(obj)}) +//│ fun foo$1(x) = +//│ +(x match {case obj: Lambda2$4 => apply$Lambda2$4(obj, new Cons$1 (#1, new Nil$2 () ) ); case obj: Lambda$3 => apply$Lambda$3(obj, new Cons$1 (#1, new Nil$2 () ) )}, x match {case obj: Lambda2$4 => apply$Lambda2$4(obj, new Nil$2 () ); case obj: Lambda$3 => apply$Lambda$3(obj, new Nil$2 () )}) +//│ fun apply$Lambda$3(this, l) = +//│ l match {case obj: Cons$1 => count$Cons$1(obj); case obj: Nil$2 => count$Nil$2(obj)} +//│ fun count$Nil$2(this) = +//│ #0 +//│ fun apply$Lambda2$4(this, l) = +//│ new Cons$1 (this.a, l) match {case obj: Cons$1 => count$Cons$1(obj)} +//│ fun main$$6() = +//│ foo$1(new Lambda2$4 (#2) ) +//│ fun main$$5() = +//│ foo$1(new Lambda$3 () ) +//│ class Nil$2() { +//│ } +//│ class Lambda2$4(a) { +//│ } +//│ class Cons$1(e, tail) { +//│ } +//│ class Lambda$3() { +//│ } +//│ class Cons(e: nothing, tail: Cons | Nil) { +//│ fun count: () -> Int +//│ } +//│ class Nil() { +//│ fun count: () -> 0 +//│ } +//│ class Lambda() { +//│ fun apply: forall 'a. {count: () -> 'a} -> 'a +//│ } +//│ class Lambda2(a: Int) { +//│ fun apply: (Cons | Nil) -> Int +//│ } +//│ fun foo: {apply: (Cons | Nil) -> Int} -> Int +//│ Int +//│ res +//│ = 1 +//│ res +//│ = 3 + +:mono +class Cons(e: Int, tail: Cons | Nil) { + fun count(): Int + fun count() = 1 + tail.count() +} +class Nil() { + fun count() = 0 +} +fun foo(x) = + x(new Cons(1, new Nil())) + x(new Nil()) +foo(l => l.count()) +foo(l => (new Cons(2, l)).count()) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Cons, (), Tup(e: Var(Int), tail: App(Var(|), Tup(_: Var(Cons), _: Var(Nil)))), (), None, None, TypingUnit(NuFunDef(None, count, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Int)))), NuFunDef(None, count, None, [], Lam(Tup(), App(Var(+), Tup(_: IntLit(1), _: App(Sel(Var(tail), count), Tup()))))))), NuTypeDef(class, Nil, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, count, None, [], Lam(Tup(), IntLit(0))))), NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(foo), Tup(_: Lam(Tup(_: Var(l)), App(Sel(Var(l), count), Tup())))), App(Var(foo), Tup(_: Lam(Tup(_: Var(l)), App(Sel(Bra(rcd = false, New(Some((TypeName(Cons),[2, l,])), TypingUnit())), count), Tup()))))) +//│ Lifted: +//│ TypingUnit { +//│ class Cons$1([e: Int, tail: |(Cons, Nil,),]) { +//│ fun count = () -> Int +//│ fun count = () => +(1, ((this).tail).count(),) +//│ } +//│ class Nil$2([]) {fun count = () => 0} +//│ class Lambda1$2$3([]) {fun apply = (l,) => (l).count()} +//│ class Lambda1$3$4([]) { +//│ fun apply = (l,) => ('(' new Cons$1([2, l,]) {} ')').count() +//│ } +//│ fun foo$1 = (x,) => {+(x(new Cons$1([1, new Nil$2([]) {},]) {},), x(new Nil$2([]) {},),)} +//│ Code(List(foo$1({new Lambda1$2$3([]) {}},))) +//│ Code(List(foo$1({new Lambda1$3$4([]) {}},))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$5() +//│ main$$6() +//│ fun count$Cons$1(this) = +//│ +(#1, this.tail match {case obj: Cons$1 => count$Cons$1(obj); case obj: Nil$2 => count$Nil$2(obj)}) +//│ fun foo$1(x) = +//│ +(x match {case obj: Lambda1$3$4 => apply$Lambda1$3$4(obj, new Cons$1 (#1, new Nil$2 () ) ); case obj: Lambda1$2$3 => apply$Lambda1$2$3(obj, new Cons$1 (#1, new Nil$2 () ) )}, x match {case obj: Lambda1$3$4 => apply$Lambda1$3$4(obj, new Nil$2 () ); case obj: Lambda1$2$3 => apply$Lambda1$2$3(obj, new Nil$2 () )}) +//│ fun count$Nil$2(this) = +//│ #0 +//│ fun main$$6() = +//│ foo$1(new Lambda1$3$4 () ) +//│ fun main$$5() = +//│ foo$1(new Lambda1$2$3 () ) +//│ fun apply$Lambda1$3$4(this, l) = +//│ new Cons$1 (#2, l) match {case obj: Cons$1 => count$Cons$1(obj)} +//│ fun apply$Lambda1$2$3(this, l) = +//│ l match {case obj: Cons$1 => count$Cons$1(obj); case obj: Nil$2 => count$Nil$2(obj)} +//│ class Lambda1$3$4() { +//│ } +//│ class Nil$2() { +//│ } +//│ class Cons$1(e, tail) { +//│ } +//│ class Lambda1$2$3() { +//│ } +//│ class Cons(e: Int, tail: Cons | Nil) { +//│ fun count: () -> Int +//│ } +//│ class Nil() { +//│ fun count: () -> 0 +//│ } +//│ fun foo: ((Cons | Nil) -> Int) -> Int +//│ Int +//│ res +//│ = 1 +//│ res +//│ = 3 + +:mono +class Exp() { + virtual fun derive(x: Int): Exp + virtual fun derive(x: Int) = Exp() + virtual fun isEmpty(): Bool + virtual fun isEmpty() = false +} +class E() extends Exp { + fun derive(x) = + new E + fun isEmpty() = + false +} +class Ep() extends Exp { + fun derive(x) = + new E + fun isEmpty() = + true +} +class Ch(i: Int) extends Exp { + fun derive(x) = + if x == i then new Ep else new E + fun isEmpty() = + false +} +class A(e1: Exp, e2: Exp) extends Exp { + fun derive(x) = + new A(e1.derive(x), e2.derive(x)) + fun isEmpty() = + e1.isEmpty() || e2.isEmpty() +} +class C(e1: Exp, e2: Exp) extends Exp { + fun derive(x) = + if e1.isEmpty() then new A(new C(e1.derive(x), e2), e2.derive(x)) else new C(e1.derive(x), e2) + fun isEmpty() = + e1.isEmpty() && e2.isEmpty() +} +(new C(new Ch(1), new A(new Ch(2), new Ch(3)))).derive(0).isEmpty() +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Exp, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, derive, None, [], PolyType(List(),Function(Tuple(List((Some(x),Field(None,TypeName(Int))))),TypeName(Exp)))), NuFunDef(None, derive, None, [], Lam(Tup(x: Var(Int)), App(Var(Exp), Tup()))), NuFunDef(None, isEmpty, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Bool)))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Var(false))))), NuTypeDef(class, E, (), Tup(), (Var(Exp)), None, None, TypingUnit(NuFunDef(None, derive, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Blk(...))))), NuTypeDef(class, Ep, (), Tup(), (Var(Exp)), None, None, TypingUnit(NuFunDef(None, derive, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Blk(...))))), NuTypeDef(class, Ch, (), Tup(i: Var(Int)), (Var(Exp)), None, None, TypingUnit(NuFunDef(None, derive, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Blk(...))))), NuTypeDef(class, A, (), Tup(e1: Var(Exp), e2: Var(Exp)), (Var(Exp)), None, None, TypingUnit(NuFunDef(None, derive, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Blk(...))))), NuTypeDef(class, C, (), Tup(e1: Var(Exp), e2: Var(Exp)), (Var(Exp)), None, None, TypingUnit(NuFunDef(None, derive, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, isEmpty, None, [], Lam(Tup(), Blk(...))))), App(Sel(App(Sel(Bra(rcd = false, New(Some((TypeName(C),[new Ch([1,]) {}, new A([new Ch([2,]) {}, new Ch([3,]) {},]) {},])), TypingUnit())), derive), Tup(_: IntLit(0))), isEmpty), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class Exp$1([]) { +//│ fun derive = (x: Int) -> Exp$1 +//│ fun derive = (x: Int,) => Exp$1() +//│ fun isEmpty = () -> Bool +//│ fun isEmpty = () => false +//│ } +//│ class E$2([]): Exp$1() { +//│ fun derive = (x,) => {new E$2([]) {}} +//│ fun isEmpty = () => {false} +//│ } +//│ class Ep$3([]): Exp$1() { +//│ fun derive = (x,) => {new E$2([]) {}} +//│ fun isEmpty = () => {true} +//│ } +//│ class Ch$4([i: Int,]): Exp$1() { +//│ fun derive = (x,) => {if (==(x, (this).i,)) then new Ep$3([]) {} else new E$2([]) {}} +//│ fun isEmpty = () => {false} +//│ } +//│ class A$5([e1: Exp, e2: Exp,]): Exp$1() { +//│ fun derive = (x,) => {new A$5([((this).e1).derive(x,), ((this).e2).derive(x,),]) {}} +//│ fun isEmpty = () => {||(((this).e1).isEmpty(), ((this).e2).isEmpty(),)} +//│ } +//│ class C$6([e1: Exp, e2: Exp,]): Exp$1() { +//│ fun derive = (x,) => {if (((this).e1).isEmpty()) then new A$5([new C$6([((this).e1).derive(x,), (this).e2,]) {}, ((this).e2).derive(x,),]) {} else new C$6([((this).e1).derive(x,), (this).e2,]) {}} +//│ fun isEmpty = () => {&&(((this).e1).isEmpty(), ((this).e2).isEmpty(),)} +//│ } +//│ Code(List((('(' new C$6([new Ch$4([1,]) {}, new A$5([new Ch$4([2,]) {}, new Ch$4([3,]) {},]) {},]) {} ')').derive(0,)).isEmpty())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$6() +//│ fun isEmpty$E$2(this) = +//│ false +//│ fun isEmpty$A$5(this) = +//│ ||(this.e1 match {case obj: Ch$4 => isEmpty$Ch$4(obj)}, this.e2 match {case obj: Ch$4 => isEmpty$Ch$4(obj)}) +//│ fun isEmpty$Ch$4(this) = +//│ false +//│ fun derive$A$5(this, x) = +//│ new A$5 (this.e1 match {case obj: Ch$4 => derive$Ch$4(obj, x)}, this.e2 match {case obj: Ch$4 => derive$Ch$4(obj, x)}) +//│ fun isEmpty$C$6(this) = +//│ &&(this.e1 match {case obj: Ep$3 => isEmpty$Ep$3(obj); case obj: E$2 => isEmpty$E$2(obj)}, this.e2 match {case obj: A$5 => isEmpty$A$5(obj)}) +//│ fun derive$C$6(this, x) = +//│ if this.e1 match {case obj: Ch$4 => isEmpty$Ch$4(obj)} then new A$5 (new C$6 (this.e1 match {case obj: Ch$4 => derive$Ch$4(obj, x)}, this.e2) , this.e2 match {case obj: A$5 => derive$A$5(obj, x)}) else new C$6 (this.e1 match {case obj: Ch$4 => derive$Ch$4(obj, x)}, this.e2) +//│ fun main$$6() = +//│ new C$6 (new Ch$4 (#1) , new A$5 (new Ch$4 (#2) , new Ch$4 (#3) ) ) match {case obj: C$6 => derive$C$6(obj, #0)} match {case obj: C$6 => isEmpty$C$6(obj)} +//│ fun derive$Ch$4(this, x) = +//│ if ==(x, this.i) then new Ep$3 () else new E$2 () +//│ fun isEmpty$Ep$3(this) = +//│ true +//│ class A$5(e1, e2): Exp$1() { +//│ } +//│ class E$2(): Exp$1() { +//│ } +//│ class C$6(e1, e2): Exp$1() { +//│ } +//│ class Ch$4(i): Exp$1() { +//│ } +//│ class Ep$3(): Exp$1() { +//│ } +//│ class Exp$1() { +//│ } +//│ class Exp() { +//│ fun derive: (x: Int) -> Exp +//│ fun isEmpty: () -> Bool +//│ } +//│ class E() extends Exp { +//│ fun derive: anything -> E +//│ fun isEmpty: () -> false +//│ } +//│ class Ep() extends Exp { +//│ fun derive: anything -> E +//│ fun isEmpty: () -> true +//│ } +//│ class Ch(i: Int) extends Exp { +//│ fun derive: Num -> (E | Ep) +//│ fun isEmpty: () -> false +//│ } +//│ class A(e1: Exp, e2: Exp) extends Exp { +//│ fun derive: Int -> A +//│ fun isEmpty: () -> Bool +//│ } +//│ class C(e1: Exp, e2: Exp) extends Exp { +//│ fun derive: Int -> (A | C) +//│ fun isEmpty: () -> Bool +//│ } +//│ Bool +//│ res +//│ = false + + +:mono +val anyUnknown = false +class List(l: List | Nil, hasTail: Bool) {} +class Nil(hasTail: Bool) {} +fun gen() = + if anyUnknown then new List(gen(), true) else new Nil(false) +gen() +//│ Parsed: +//│ TypingUnit(NuFunDef(Some(false), anyUnknown, None, [], Var(false)), NuTypeDef(class, List, (), Tup(l: App(Var(|), Tup(_: Var(List), _: Var(Nil))), hasTail: Var(Bool)), (), None, None, TypingUnit()), NuTypeDef(class, Nil, (), Tup(hasTail: Var(Bool)), (), None, None, TypingUnit()), NuFunDef(None, gen, None, [], Lam(Tup(), Blk(...))), App(Var(gen), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class List$1([l: |(List, Nil,), hasTail: Bool,]) {} +//│ class Nil$2([hasTail: Bool,]) {} +//│ let anyUnknown$2 = () => false +//│ fun gen$1 = () => {if (anyUnknown) then new List$1([gen$1(), true,]) {} else new Nil$2([false,]) {}} +//│ Code(List(gen$1())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$4() +//│ fun anyUnknown$2() = +//│ false +//│ fun gen$1() = +//│ if anyUnknown then new List$1 (gen$1(), true) else new Nil$2 (false) +//│ fun main$$4() = +//│ gen$1() +//│ class Nil$2(hasTail) { +//│ } +//│ class List$1(l, hasTail) { +//│ } +//│ val anyUnknown: false +//│ class List(l: List | Nil, hasTail: Bool) +//│ class Nil(hasTail: Bool) +//│ fun gen: () -> (List | Nil) +//│ List | Nil +//│ anyUnknown +//│ = false +//│ res +//│ = Nil {} + + + +:mono +class Foo(x: Int){ + fun bar(y) = x+y + fun boo(z) = bar(z)+x +} +(new Foo(1)).boo(2) +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Foo, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, bar, None, [], Lam(Tup(_: Var(y)), App(Var(+), Tup(_: Var(x), _: Var(y))))), NuFunDef(None, boo, None, [], Lam(Tup(_: Var(z)), App(Var(+), Tup(_: App(Var(bar), Tup(_: Var(z))), _: Var(x))))))), App(Sel(Bra(rcd = false, New(Some((TypeName(Foo),[1,])), TypingUnit())), boo), Tup(_: IntLit(2)))) +//│ Lifted: +//│ TypingUnit { +//│ class Foo$1([x: Int,]) { +//│ fun bar = (y,) => +((this).x, y,) +//│ fun boo = (z,) => +((this).bar(z,), (this).x,) +//│ } +//│ Code(List(('(' new Foo$1([1,]) {} ')').boo(2,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ fun boo$Foo$1(this, z) = +//│ +(this match {case obj: Foo$1 => bar$Foo$1(obj, z)}, this.x) +//│ fun bar$Foo$1(this, y) = +//│ +(this.x, y) +//│ fun main$$1() = +//│ new Foo$1 (#1) match {case obj: Foo$1 => boo$Foo$1(obj, #2)} +//│ class Foo$1(x) { +//│ } +//│ class Foo(x: Int) { +//│ fun bar: Int -> Int +//│ fun boo: Int -> Int +//│ } +//│ Int +//│ res +//│ = 4 + +:mono +class OneInt(a: Int){ + fun fac: () -> Int + fun fac = () -> + if(a > 0) then (new OneInt(a - 1)).fac() else 1 +} +(new OneInt(10)).fac() +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, OneInt, (), Tup(a: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, fac, None, [], PolyType(List(),Function(Tuple(List()),TypeName(Int)))), NuFunDef(None, fac, None, [], Lam(Tup(), Blk(...))))), App(Sel(Bra(rcd = false, New(Some((TypeName(OneInt),[10,])), TypingUnit())), fac), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class OneInt$1([a: Int,]) { +//│ fun fac = () -> Int +//│ fun fac = () => {if ('(' >((this).a, 0,) ')') then ('(' new OneInt$1([-((this).a, 1,),]) {} ')').fac() else 1} +//│ } +//│ Code(List(('(' new OneInt$1([10,]) {} ')').fac())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$1() +//│ fun fac$OneInt$1(this) = +//│ if >(this.a, #0) then new OneInt$1 (-(this.a, #1)) match {case obj: OneInt$1 => fac$OneInt$1(obj)} else #1 +//│ fun main$$1() = +//│ new OneInt$1 (#10) match {case obj: OneInt$1 => fac$OneInt$1(obj)} +//│ class OneInt$1(a) { +//│ } +//│ class OneInt(a: Int) { +//│ fun fac: () -> Int +//│ } +//│ Int +//│ res +//│ = 1 + +//:mono +//:e // FIXME: Mutable Parameters +//trait AnyFoo { +//} +//class FooPlus(#a): AnyFoo { +// fun bar(b) = a + b +//} +//class FooMinus(#a): AnyFoo { +// fun bar(b) = a - b +//} +//fun f(x) = x.bar(42) +//f(new FooPlus(1)) +//f(new FooMinus(2)) + +:mono +val any = -20 +fun f(x) = + if x > any then 0 + else g(x - 1) +fun g(x) = + if x > any then g(x - 1) + else f(x - 2) +g(1) +//│ Parsed: +//│ TypingUnit(NuFunDef(Some(false), any, None, [], IntLit(-20)), NuFunDef(None, f, None, [], Lam(Tup(_: Var(x)), Blk(...))), NuFunDef(None, g, None, [], Lam(Tup(_: Var(x)), Blk(...))), App(Var(g), Tup(_: IntLit(1)))) +//│ Lifted: +//│ TypingUnit { +//│ let any$3 = () => -20 +//│ fun f$1 = (x,) => {if (>(x, any,)) then 0 else g$2(-(x, 1,),)} +//│ fun g$2 = (x,) => {if (>(x, any,)) then g$2(-(x, 1,),) else f$1(-(x, 2,),)} +//│ Code(List(g$2(1,))) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$3() +//│ fun any$3() = +//│ #-20 +//│ fun f$1(x) = +//│ if >(x, any) then #0 else g$2(-(x, #1)) +//│ fun g$2(x) = +//│ if >(x, any) then g$2(-(x, #1)) else f$1(-(x, #2)) +//│ fun main$$3() = +//│ g$2(#1) +//│ val any: -20 +//│ fun f: Int -> 0 +//│ fun g: Int -> 0 +//│ 0 +//│ any +//│ = -20 +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:mono +class OneInt(a: Int){ + fun get = () -> a +} +class OneBool(b: Bool){ + fun get = () -> b +} +(if b then new OneInt(1) else new OneBool(true)).get() +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, OneInt, (), Tup(a: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, get, None, [], Lam(Tup(), Var(a))))), NuTypeDef(class, OneBool, (), Tup(b: Var(Bool)), (), None, None, TypingUnit(NuFunDef(None, get, None, [], Lam(Tup(), Var(b))))), App(Sel(Bra(rcd = false, If(IfThen(Var(b), New(Some((TypeName(OneInt),[1,])), TypingUnit()), Some(New(Some((TypeName(OneBool),[true,])), TypingUnit())))), get), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class OneInt$1([a: Int,]) {fun get = () => (this).a} +//│ class OneBool$2([b: Bool,]) {fun get = () => (this).b} +//│ Code(List(('(' if (b) then new OneInt$1([1,]) {} else new OneBool$2([true,]) {} ')').get())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$2() +//│ fun get$OneInt$1(this) = +//│ this.a +//│ fun get$OneBool$2(this) = +//│ this.b +//│ fun main$$2() = +//│ if b then new OneInt$1 (#1) else new OneBool$2 (true) match {case obj: OneInt$1 => get$OneInt$1(obj); case obj: OneBool$2 => get$OneBool$2(obj)} +//│ class OneInt$1(a) { +//│ } +//│ class OneBool$2(b) { +//│ } +//│ class OneInt(a: Int) { +//│ fun get: () -> Int +//│ } +//│ class OneBool(b: Bool) { +//│ fun get: () -> Bool +//│ } +//│ Int | false | true +//│ res +//│ = true + +:mono +class Bar(x: Int) { + fun foo(x) = x + fun FooMinus(y: Int) = x + y + fun car = foo(2) +} +class Car { + fun da(b: Bar) = b.foo(2) +} +fun baz(b: Bar) = b.foo(2) +let bar = Bar(42) +baz(bar) +(new Car()).da(Bar(1337)) +bar.car +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Bar, (), Tup(x: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(_: Var(x)), Var(x))), NuFunDef(None, FooMinus, None, [], Lam(Tup(y: Var(Int)), App(Var(+), Tup(_: Var(x), _: Var(y))))), NuFunDef(None, car, None, [], App(Var(foo), Tup(_: IntLit(2)))))), NuTypeDef(class, Car, (), Tup(), (), None, None, TypingUnit(NuFunDef(None, da, None, [], Lam(Tup(b: Var(Bar)), App(Sel(Var(b), foo), Tup(_: IntLit(2))))))), NuFunDef(None, baz, None, [], Lam(Tup(b: Var(Bar)), App(Sel(Var(b), foo), Tup(_: IntLit(2))))), NuFunDef(Some(false), bar, None, [], App(Var(Bar), Tup(_: IntLit(42)))), App(Var(baz), Tup(_: Var(bar))), App(Sel(Bra(rcd = false, New(Some((TypeName(Car),[])), TypingUnit())), da), Tup(_: App(Var(Bar), Tup(_: IntLit(1337))))), Sel(Var(bar), car)) +//│ Lifted: +//│ TypingUnit { +//│ class Bar$1([x: Int,]) { +//│ fun foo = (x,) => x +//│ fun FooMinus = (y: Int,) => +((this).x, y,) +//│ fun car = () => (this).foo(2,) +//│ } +//│ class Car$2([]) {fun da = (b: Bar$1,) => (b).foo(2,)} +//│ fun baz$2 = (b: Bar$1,) => (b).foo(2,) +//│ let bar$1 = () => Bar$1(42,) +//│ Code(List(baz$2(bar,))) +//│ Code(List(('(' new Car$2([]) {} ')').da(Bar$1(1337,),))) +//│ Code(List((bar).car)) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$4() +//│ main$$5() +//│ main$$6() +//│ fun bar$1() = +//│ Bar$1(#42) +//│ fun da$Car$2(this, b) = +//│ b match {} +//│ fun main$$6() = +//│ bar.car +//│ fun baz$2(b) = +//│ b match {} +//│ fun main$$5() = +//│ new Car$2 () match {case obj: Car$2 => da$Car$2(obj, Bar$1(#1337))} +//│ fun main$$4() = +//│ baz$2(bar) +//│ class Bar$1(x) { +//│ } +//│ class Car$2() { +//│ } +//│ class Bar(x: Int) { +//│ fun FooMinus: (y: Int) -> Int +//│ fun car: 2 +//│ fun foo: forall 'a. 'a -> 'a +//│ } +//│ class Car { +//│ constructor() +//│ fun da: (b: Bar) -> 2 +//│ } +//│ fun baz: (b: Bar) -> 2 +//│ let bar: Bar +//│ 2 +//│ bar +//│ = Bar {} +//│ res +//│ = 2 +//│ res +//│ = 2 +//│ res +//│ = 2 + +:mono +val c = 5 +class Sup(a: Int){ + virtual fun foo = () -> a +} +class Sub(b: Int) extends Sup(b+b){ +} +class Sub2(c: Int) extends Sub(c+c){ + fun foo = () -> a+c +} +(new Sub(10)).foo() +(new Sub2(c)).foo() +//│ Parsed: +//│ TypingUnit(NuFunDef(Some(false), c, None, [], IntLit(5)), NuTypeDef(class, Sup, (), Tup(a: Var(Int)), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(), Var(a))))), NuTypeDef(class, Sub, (), Tup(b: Var(Int)), (App(Var(Sup), Tup(_: App(Var(+), Tup(_: Var(b), _: Var(b)))))), None, None, TypingUnit()), NuTypeDef(class, Sub2, (), Tup(c: Var(Int)), (App(Var(Sub), Tup(_: App(Var(+), Tup(_: Var(c), _: Var(c)))))), None, None, TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(), App(Var(+), Tup(_: Var(a), _: Var(c))))))), App(Sel(Bra(rcd = false, New(Some((TypeName(Sub),[10,])), TypingUnit())), foo), Tup()), App(Sel(Bra(rcd = false, New(Some((TypeName(Sub2),[c,])), TypingUnit())), foo), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class Sup$1([a: Int,]) {fun foo = () => (this).a} +//│ class Sub$2([b: Int,]): Sup$1(+((this).b, (this).b,),) {} +//│ class Sub2$3([c: Int,]): Sub$2(+((this).c, (this).c,),) {fun foo = () => +((this).a, (this).c,)} +//│ let c$1 = () => 5 +//│ Code(List(('(' new Sub$2([10,]) {} ')').foo())) +//│ Code(List(('(' new Sub2$3([c,]) {} ')').foo())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$4() +//│ main$$5() +//│ fun c$1() = +//│ #5 +//│ fun main$$5() = +//│ new Sub2$3 (c) match {case obj: Sub2$3 => foo$Sub2$3(obj)} +//│ fun main$$4() = +//│ new Sub$2 (#10) match {case obj: Sub$2 => foo$Sup$1(obj)} +//│ fun foo$Sup$1(this) = +//│ this.a +//│ fun foo$Sub2$3(this) = +//│ +(this.a, this.c) +//│ class Sub2$3(c): Sub$2(+(this.c, this.c)) { +//│ } +//│ class Sup$1(a) { +//│ } +//│ class Sub$2(b): Sup$1(+(this.b, this.b)) { +//│ } +//│ val c: 5 +//│ class Sup(a: Int) { +//│ fun foo: () -> Int +//│ } +//│ class Sub(b: Int) extends Sup { +//│ fun foo: () -> Int +//│ } +//│ class Sub2(c: Int) extends Sub, Sup { +//│ fun foo: () -> Int +//│ } +//│ Int +//│ c +//│ = 5 +//│ res +//│ = 20 +//│ res +//│ = 47 + +:mono +class Foo(f: Int -> Int){ + fun foo = () -> f(1) +} +class F1() extends Foo(x => x+1){} +class F2() extends Foo(x => x+2){} +(new F1()).foo() +(new F2()).foo() +//│ Parsed: +//│ TypingUnit(NuTypeDef(class, Foo, (), Tup(f: App(Var(->), Tup(_: Var(Int), _: Var(Int)))), (), None, None, TypingUnit(NuFunDef(None, foo, None, [], Lam(Tup(), App(Var(f), Tup(_: IntLit(1))))))), NuTypeDef(class, F1, (), Tup(), (App(Var(Foo), Tup(_: Lam(Tup(_: Var(x)), App(Var(+), Tup(_: Var(x), _: IntLit(1))))))), None, None, TypingUnit()), NuTypeDef(class, F2, (), Tup(), (App(Var(Foo), Tup(_: Lam(Tup(_: Var(x)), App(Var(+), Tup(_: Var(x), _: IntLit(2))))))), None, None, TypingUnit()), App(Sel(Bra(rcd = false, New(Some((TypeName(F1),[])), TypingUnit())), foo), Tup()), App(Sel(Bra(rcd = false, New(Some((TypeName(F2),[])), TypingUnit())), foo), Tup())) +//│ Lifted: +//│ TypingUnit { +//│ class Foo$1([f: ->(Int, Int,),]) {fun foo = () => (this).f(1,)} +//│ class F1$2_Lambda1$1$4([par$F1$2,]) {fun apply = (x,) => +(x, 1,)} +//│ class F1$2([]): Foo$1({new F1$2_Lambda1$1$4([this,]) {}},) {} +//│ class F2$3_Lambda1$2$5([par$F2$3,]) {fun apply = (x,) => +(x, 2,)} +//│ class F2$3([]): Foo$1({new F2$3_Lambda1$2$5([this,]) {}},) {} +//│ Code(List(('(' new F1$2([]) {} ')').foo())) +//│ Code(List(('(' new F2$3([]) {} ')').foo())) +//│ } +//│ Mono: +//│ +//│ Defunc result: +//│ main$$5() +//│ main$$6() +//│ fun apply$F2$3_Lambda1$2$5(this, x) = +//│ +(x, #2) +//│ fun foo$Foo$1(this) = +//│ this match {case obj: Foo$1 => obj.f match {case obj$F2$3_Lambda1$2$5: F2$3_Lambda1$2$5 => apply$F2$3_Lambda1$2$5(obj$F2$3_Lambda1$2$5, #1); case obj$F1$2_Lambda1$1$4: F1$2_Lambda1$1$4 => apply$F1$2_Lambda1$1$4(obj$F1$2_Lambda1$1$4, #1)}} +//│ fun main$$6() = +//│ new F2$3 () match {case obj: F2$3 => foo$Foo$1(obj)} +//│ fun main$$5() = +//│ new F1$2 () match {case obj: F1$2 => foo$Foo$1(obj)} +//│ fun apply$F1$2_Lambda1$1$4(this, x) = +//│ +(x, #1) +//│ class F1$2(): Foo$1(new F1$2_Lambda1$1$4 (this) ) { +//│ } +//│ class F2$3_Lambda1$2$5(par$F2$3) { +//│ } +//│ class F2$3(): Foo$1(new F2$3_Lambda1$2$5 (this) ) { +//│ } +//│ class Foo$1(f) { +//│ } +//│ class F1$2_Lambda1$1$4(par$F1$2) { +//│ } +//│ class Foo(f: Int -> Int) { +//│ fun foo: () -> Int +//│ } +//│ class F1() extends Foo { +//│ fun foo: () -> Int +//│ } +//│ class F2() extends Foo { +//│ fun foo: () -> Int +//│ } +//│ Int +//│ res +//│ = 2 +//│ res +//│ = 3 diff --git a/compiler/shared/test/scala/mlscript/compiler/Test.scala b/compiler/shared/test/scala/mlscript/compiler/Test.scala index 4a0f48799..ae71f5992 100644 --- a/compiler/shared/test/scala/mlscript/compiler/Test.scala +++ b/compiler/shared/test/scala/mlscript/compiler/Test.scala @@ -1,10 +1,15 @@ -package mlscript -package compiler +package mlscript.compiler import mlscript.utils.shorthands.* import scala.util.control.NonFatal import scala.collection.mutable.StringBuilder import mlscript.codegen.Helpers.inspect as showStructure +import mlscript.{DiffTests, ModeType, TypingUnit} +import mlscript.compiler.debug.TreeDebug +import mlscript.compiler.mono.Monomorph +import mlscript.compiler.printer.ExprPrinter +import mlscript.compiler.mono.MonomorphError +import mlscript.JVMGitHelper class DiffTestCompiler extends DiffTests { import DiffTestCompiler.* @@ -16,13 +21,28 @@ class DiffTestCompiler extends DiffTests { outputBuilder ++= "\nLifted:\n" var rstUnit = unit; try - rstUnit = ClassLifter().liftTypingUnit(unit) + rstUnit = ClassLifter(mode.fullExceptionStack).liftTypingUnit(unit) outputBuilder ++= PrettyPrinter.showTypingUnit(rstUnit) catch case NonFatal(err) => outputBuilder ++= "Lifting failed: " ++ err.toString() - if mode.fullExceptionStack then outputBuilder ++= - "\n" ++ err.getStackTrace().map(_.toString()).mkString("\n") + if mode.fullExceptionStack then + outputBuilder ++= "\n" ++ err.getStackTrace().map(_.toString()).mkString("\n") + if(mode.mono){ + outputBuilder ++= "\nMono:\n" + val treeDebug = new TreeDebug() + try{ + val monomorph = new Monomorph(treeDebug) + val monomorphized = monomorph.defunctionalize(rstUnit) + outputBuilder ++= "\nDefunc result: \n" + outputBuilder ++= ExprPrinter.print(monomorphized) + outputBuilder ++= "\n" + }catch{ + case error: MonomorphError => outputBuilder ++= (error.getMessage() :: error.getStackTrace().map(_.toString()).toList).mkString("\n") + // case error: StackOverflowError => outputBuilder ++= (error.getMessage() :: error.getStackTrace().take(40).map(_.toString()).toList).mkString("\n") + } + // outputBuilder ++= treeDebug.getLines.mkString("\n") + } outputBuilder.toString().linesIterator.toList override protected lazy val files = gitHelper.getFiles(allFiles) diff --git a/doc/mls-codebase-doc.md b/doc/mls-codebase-doc.md new file mode 100644 index 000000000..50d9bac63 --- /dev/null +++ b/doc/mls-codebase-doc.md @@ -0,0 +1,377 @@ +# Documentation of the MLscript Codebase + +This is the documentation of the MLscript codebase. + +## Overview + +This codebase of the MLscript Programming Language has all the basic components +of a static-typed programming language compiler: lexer, parser, typer, and code generator. +For testing, there is a web demo of MLscript as well as a test suite. +We now give a high-level introduction to each compiler component and its correspondence to +our Scala sources. Note that source file paths are rooted in `/shared/src/main/scala/mlscript`. + +### Lexing + +The lexer accepts source strings and returns tokens to be parsed. +The corresponding files are: + +- `NewLexer.scala` contains the lexer class. +- `Token.scala` contains the token data types. + +### Parsing + +The parser accepts tokens generated by the lexer and +returns an abstract syntax tree of the input program in the surface syntax. +The corresponding files are: + +- `NewParser.scala` contains the parser class. +- `syntax.scala` contains the **surface** syntax data types of the language. + +### Typing + +The typer accepts an abstract syntax tree of a program +and performs type checking. +MLscript's typer supports principal type inference with subtyping. +For more information about the type system, +please refer to [MLstruct](https://dl.acm.org/doi/abs/10.1145/3563304). + +The corresponding files are: +- `Typer.scala` contains the typer class. +- `TypeSimplifier.scala` contains type simplification algorithms to simplify +inferred types. +- `ucs/Desugarer.scala` contains class `ucs.Desugarer` which implements desugaring +methods. +- `TypeDefs.scala` and `NuTypeDefs.scala` contain class `TypeDef` and methods for +declarations like classes, interfaces, and type aliases. +- `ConstraitSolver.scala` contains class `ConstraintSolver` which solves subtyping +constraints. +- `NormalForms.scala` contains class `NormalForms` which provides the infrastructure +to solve tricky subtyping constraints with disjunct normal forms (DNF) on the left +and conjunct normal forms (CNF) on the right. +- `TyperDatatypes.scala` contains class `TyperDatatypes` which includes +data types to support **internal** representation of types with mutable states to support +type inference with subtyping. +- `TyperHelpers.scala` contains class `TyperHelpers` that provides helper methods +for the typer. + +Note that the inheritance relationships between these typer classes do *not* have any actual semantics +- we are following Scala's *Cake Pattern*. Typer classes will be finally composed +into the `Typer` class by inheritance. + +### Code Generation + +The code generator translates MLscript AST into JavaScript AST and generates the corresponding JavaScript code. + +The corresponding files are: + +- `codegen/Codegen.scala` contains definitions of JavaScript AST nodes + and methods for JavaScript code generation. +- `codegen/Scope.scala` contains class `Scope` which manages symbols + and provides hygienic runtime name generation. +- `codegen/Symbol.scala` contains classes `NewClassSymbol`, `MixinSymbol`, + and `ModuleSymbol` which include information on `class`, `mixin` and `module` definitions. +- `JSBackend.scala` contains class `JSBackend` that translates an MLscript AST + into a JavaScript AST. Classes `JSWebBackend` and `JSTestBackend` inherit class `JSBackend` + and generate adapted code for the web demo and the test suite. + +### Web Demo and Testing + + +Testing of MLscript works as follows: + - the MLscript compiler reads the given test file one code block at a time (code blocks are separated by empty lines); + - after reading the code block, it outputs the inferred types as well as any type errors encountered; + - after that, it executes the code block in NodeJS (by shelling out to a `node` process) and outputs the results. + +We have a web demo for users to test our implementation in any modern browser. +It has a textbox for MLscript source code input and it produces typing and running +results live. The implementation can be tried online at https://hkust-taco.github.io/superoop/ +and locally in `/js/src/main/scala/Main.scala`. + +We have a "`diff`-based" test suite for our implementation. +It detects changes to MLscript test sources (using git), +generates typing and running results, and inserts those results +into test sources. The diff-based testing implementation is in +`/shared/src/test/scala/mlscript/DiffTests.scala`. +MLscript test sources are in `/shared/src/test/diff`. + +## Detailed Introduction + +We now introduce the implementation of each compiler component +in more detail. + +### Lexing + +Class `NewLexer` in `NewLexer.scala` is the lexer class. It takes an `origin` object, +which contains the original source string together with the source file name, +the number of the first line, and some helper functions. Lazy value `tokens` generates +a list of tokens with their location in the source code. Lazy value `bracketedTokens` +converts the lexed tokens into *structured tokens*, +which use `BRACKETS` constructs instead of `OPEN_BRACKET`/`CLOSE_BRACKET` and `INDENT`/`DEINDENT`. +Token and structured token data types can be found in `Tokens.scala`. + +### Parsing + +Class `NewParser` in `NewParser.scala` is the parser class. It takes a list +of structured tokens with their location information. Method `typingUnit` +calls method `block` to parse the token list into a list of `Statement` or +`IfBody` (defined in `syntax.scala`), filters out unexpected `then/else` +clauses introduced by `Ifbody`, and returns a `TypingUnit` (a list of `Statement`). + +File `syntax.scala` contains *immutable* surface syntax data types of MLscript, +which are different from the internal representations in the typer for later type inference. +Here we introduce several surface syntax data types: + +- Classes `Decl`, `TypeDef`, `MethodDef` are deprecated. +- Class `TypeDefKind` includes type definition kinds: classes and mixins, etc. +- Class `Term` includes MLscript term data types. Case class `Bind` is no longer used. +Case class `Splc` is for the rest of a parameter list, similar to the rest parameter in JavaScript. +Case classes `Forall` and `Inst` are for first-class polymorphism. +- Class `IfBody` includes if-then-else structure data types. +- Class `CaseBranches` includes case branch data types for MLscript pattern matching. +- Class `TypeLike` includes `Type`, `Signature`, and `NuDecl`. +- Class `Type` includes MLscript type data types. Case class `Rem` is for record member removal. +Case class `WithExtension` is for record type extension. For example, `A with {x : int}` +is equivalent to `A\x & {x : int}`. +- Class `TypeVar` represents the type variable. Its identifier can be an `Int` +generated internally by the compiler or `Str` specified by the user. +- Class `NuTypeDef` is a `NuDecl` for type definitions. +Note that it has optional `superAnnot` +and `thisAnnot` for precisely-typed open recursion. +- Class `NuFunDef` is a `NuDecl` for function and let-bindings. + +### Typing + +The MLscript typer (class `Typer`) works with a typing context (class `Ctx`) which +mainly maintains all global and local bindings of names to their types. +The typer accepts a typing unit from the parser, types the typing unit, and returns a typed typing unit. +The typed typing unit +is sent to the type simplifier and is finally expanded, i.e., converted +back to types in the surface syntax for presentation. +The typer has **internal** representations of types +(defined in `TyperDatatypes.scala`) +with mutable states for type inference with subtyping. + +We first introduce several typer data types defined in `TyperDatatypes.scala`: + +- Class `TypeProvenance` stores the location where a type is introduced. +- Class `LazyTypeInfo` is for type definitions including classes, mixins, modules. +Its type is lazily computed to support *mutual recursive* type +definitions. It has a `complete` method to complete typing lazily typed definitions. +- Class `PolymorphicType` represents a type with universally quantified type variables. +By convention, in the type body, type variables of levels greater than +the polymorphic type's level are polymorphic. +- Class `SimpleType` is a general type form of all types. +It requires a method `level` for level-based polymorphism. +- Class `BaseType` includes base types such as function, array, tuple, and class tag types. +It can later be refined by `RecordType`. +- Class `RecordType` is a record type. It has a list of bindings from record fields to their types. +- Class `SpliceType` is not used for now. +- Class `ProxyType` is a derived type form to store more type provenance information. +- Class `TypeRef` is a reference to named types such as type definitions like classes. +It has a list of type arguments. A type reference with type arguments is expanded to +a class tag type with the class's type parameters refined by the corresponding type arguments as type members. +For example, `Foo[Int]` is expanded to `#Foo & {Foo.A: int..int}`. +- Class `TypeTag` has different kinds of type tags including class tags and abstract tags, etc. +- Class `FieldType` represents a term field type or a type member. +When it represents a term field type, `lb` represents if the type is mutable. +Otherwise, `lb` is the lower bound of the type member. +- Class `TypeVariable` represents a type variable, which has upper and lower bounds +for type inference with subtyping. + +Method `typeTypingUnit` in class `NuTypeDefs` accepts the typing unit to type. It inspects each statement +in the typing unit. If the statement is a type definition, a `DelayedTypeInfo` (which is a subclass of `LazyTypeInfo`) +is produced and stored in the typing context (note the typing context only uses `tyDefs2` to store +type definitions). Otherwise, it desugars the statement and calls `typeTerms` to type +the desugared statements. For a single `Term`, it is passed to `typeTerm` to type. +Method `typeTerm` in class `Typer` types a term. If the term needs type information of a `LazyTypeInfo`, +the typing of that lazily typed definition will be completed. Subtyping constraints are generated during typing +and sent to `ConstraintSolver` to propagate constraints to type variables. +For more about type inference of subtyping, please refer to [MLstruct](https://dl.acm.org/doi/abs/10.1145/3563304). + +Of particular interest, +we introduce how classes and mixins are typed to implement precisely-typed open recursion in more detail. +Method `complete` of `DelayedTypeInfoImpl`, +types type definitions: classes, modules, and mixins and let-/fun-bindings. + +When a class (`Cls` which is a `NuTypeDef`) is typed, class fields are first +added into the typing context, and `this` is associated with a fresh type variable. +The `inherit` helper methods deal with the inheritance clauses of the type definitions. +The inheritance process starts with an empty record type as the initial `super` type. +It inspects each parent, accumulates members of parents, and updates the `super` type on the way. +For each parent, +if it is a mixin, and the typing context has that mixin defined, it completes the type of the mixin +and freshens each type variable of the mixin, as each mixin's type should be constrained +differently at different use-sites. Then, two subtyping constraints are generated: +the current `super` type and the final +object type (`this` type) should be subtypes of the mixin's `super` and `this` type refinements. +Finally, the mixin's members are accumulated to the class, and the current `super` type is +updated using `WithType` because methods in mixins are always *overriding*. +After processing the whole inheritance clause, +we update the current `super` type with the class fields' types as `thisType`, and we constrain that +the resulting `thisType` (i.e. the final object type) should be a subtype of `finalType` +which is a type variable with all `this` type refinements of mixins accumulated. + +Typing of mixins is not that surprising. We associate `this` and `super` +with fresh type variables in the typing context and then type the mixin body. + +### Code Generation + +The code generation consists of three steps. +Firstly, class `JSBackend` translates MLscript data types (i.e. class `NuTypeDef`) +into corresponding symbols. Then class `JSBackend` generates JavaScript AST nodes +based on those symbols. +Finally, we generate JavaScript code from JavaScript AST nodes. + +The first step is implemented in the method `declareNewTypeDefs`. +Here we extract information (including name, parameter list, type, members, parents, and so on) +of classes, mixins, and modules from the given `NuTypeDef` list and generate +a hygienic runtime name for each symbol. + +In the second step, we translate `NewClassSymbol`, `MixinSymbol`, and `ModuleSymbol` +into JavaScript AST nodes by using methods `translateNewClassDeclaration`, `translateMixinDeclaration`, and `translateModuleDeclaration`. +These three methods invoke another method `translateNewTypeDefinition` to translate +classes, mixins, and modules into JavaScript classes. +The method `translateNewClassMember` contains the translation of members. +We call `translateParents` to get the parent class of a type. +Assuming we have code: +```ts +module A extends B, C +``` + +The method `translateParents` processes the inheritance clause in a left-to-right way: + +- First, we process the parent `B`: + - If `B` is a `class` or a `module`, the JS class definition would be `class A extends B`. + - If `B` is a `mixin`, we need a base class for `B`. + Here we choose `Object` in JavaScript and the JS class definition would be `class A extends B(Object)` +- Then we process the parent `C`: + - If `C` is a `mixin`, we can use `B(Object)` as `C`'s base class. + The JS class definition would be `class A extends C(B(Object))`. + - Otherwise, we reject the code because a JavaScript class can have only one parent class. + - If module `A` has more parents on the right of `C`, + we process them similarly as we deal with `C`. + +If there are initialization parameters in the parent list, +we move the arguments into the class constructor and pass them to `super()`. +Note we need to reverse the order of arguments of `mixin`. +For example, assume we have MLscript code below: + +```ts +module A extends MixinA(1), MixinB(2, 3), MixinC(4) +``` + +The parameters in `super()` of `A` would be: +```js +super(4, 2, 3, 1); +``` + +We generate the JavaScript classes inside `typing_unit` objects. +Note we create `...rest` parameters in each constructor of `mixin` +because we have no information about the actual parent mixin until the mixin composition is finished. +For modules, we store the instance of the JavaScript class in the cache. +For classes, if they have primitive parameter lists, +we store the arrow functions in the cache as class constructors that instantiate classes. +Mixins have no constructor because of the uncertainty of the `base` parameter of mixins. + +In the final step, we emit the JavaScript code by using `toSourceCode` methods in each JavaScript AST node class. + +For a class in MLscript: +```ts +class Lit(n: int) +``` + +The generated code would be: +```js +class TypingUnit { + #Lit; + constructor() { + } + get Lit() { + const qualifier = this; + if (this.#Lit === undefined) { + class Lit { + #n; + constructor(n) { + this.#n = n; + } + static + unapply(x) { + return [x.#n]; + } + }; + this.#Lit = ((n) => Object.freeze(new Lit(n))); + this.#Lit.class = Lit; + this.#Lit.unapply = Lit.unapply; + } + return this.#Lit; + } +} +const typing_unit = new TypingUnit; +globalThis.Lit = typing_unit.Lit; +``` + +For a mixin in MLscript: +```ts +mixin EvalBase { + fun eval(e) = + if e is + Lit(n) then n: int +} +``` + +The generated code would be: +```js +class TypingUnit { + constructor() { + } + EvalBase(base) { + const qualifier = this; + return (class EvalBase extends base { + constructor(...rest) { + super(...rest); + } + eval(e) { + return ((() => { + let a; + return (a = e, a instanceof Lit.class ? (([n]) => n)(Lit.unapply(e)) : (() => { + throw new Error("non-exhaustive case expression"); + })()); + })()); + } + }); + } +} +const typing_unit = new TypingUnit; +globalThis.EvalBase = ((base) => typing_unit.EvalBase(base)); +``` + +For a module in MLscript: +```ts +module TestLang extends EvalBase, EvalNeg, EvalNegNeg +``` + +The generated code would be like this: +```js +class TypingUnit { + #TestLang; + constructor() { + } + get TestLang() { + const qualifier = this; + if (this.#TestLang === undefined) { + class TestLang extends EvalNegNeg(EvalNeg(EvalBase(Object))) { + constructor() { + super(); + } + } + this.#TestLang = new TestLang(); + this.#TestLang.class = TestLang; + } + return this.#TestLang; + } +} +const typing_unit = new TypingUnit; +globalThis.TestLang = typing_unit.TestLang; +``` + +For more code generation examples, please check the test source `shared/src/test/diff/codegen/Mixin.mls`. diff --git a/driver/js/src/main/scala/driver/Driver.scala b/driver/js/src/main/scala/driver/Driver.scala index 1843f4ecb..228ff1f21 100644 --- a/driver/js/src/main/scala/driver/Driver.scala +++ b/driver/js/src/main/scala/driver/Driver.scala @@ -136,7 +136,7 @@ class Driver(options: DriverOptions) { private def packTopModule(moduleName: Option[String], content: String) = moduleName.fold(content)(moduleName => - s"export declare module $moduleName() {\n" + + s"export declare module $moduleName {\n" + content.splitSane('\n').toIndexedSeq.filter(!_.isEmpty()).map(line => s" $line").reduceLeft(_ + "\n" + _) + "\n}\n" ) @@ -151,7 +151,7 @@ class Driver(options: DriverOptions) { private def extractSig(filename: String, moduleName: String): TypingUnit = parseAndRun(filename, { case (_, declarations, _, origin) => TypingUnit( - NuTypeDef(Mod, TypeName(moduleName), Nil, S(Tup(Nil)), N, N, Nil, N, N, TypingUnit(declarations))(S(Loc(0, 1, origin)), N, N) :: Nil) + NuTypeDef(Mod, TypeName(moduleName), Nil, N, N, N, Nil, N, N, TypingUnit(declarations))(S(Loc(0, 1, origin)), N, N) :: Nil) }) // If the current file is es5.mlsi, we allow overriding builtin type(like String and Object) @@ -163,7 +163,8 @@ class Driver(options: DriverOptions) { ) = try { val tpd = typer.typeTypingUnit(tu, N, isES5) val sim = SimplifyPipeline(tpd, pol = S(true))(ctx) - typer.expandType(sim) + val r = typer.expandType(sim) + r } catch { case t: Throwable => totalTypeErrors += 1 diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi index 4c70bc6b9..c168ea016 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Bar.mlsi @@ -1,5 +1,5 @@ import "../ts/Foo.mlsi" -export declare module Bar() { +export declare module Bar { class Bar() extends Foo { fun bar: "bar" fun foo: () -> Str diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi index 2fbc063e9..ced6e1d75 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/BazBaz.mlsi @@ -1,5 +1,5 @@ import "../ts/Baz.mlsi" -export declare module BazBaz() { +export declare module BazBaz { class BazBaz() let bazbaz: BazBaz error diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi index ae1b0f95f..f9d428e47 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS1.mlsi @@ -1,4 +1,4 @@ import "./CJS2.mlsi" -export declare module CJS1() { +export declare module CJS1 { unit } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi index 9f3263334..aaf544379 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/CJS2.mlsi @@ -1,3 +1,3 @@ -export declare module CJS2() { +export declare module CJS2 { fun add: (x: Int, y: Int) -> Int } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi index 8d8129fe8..7ee6ba4bc 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Call.mlsi @@ -1,4 +1,4 @@ import "../ts/Funs.mlsi" -export declare module Call() { +export declare module Call { unit } diff --git a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi index 5c407f39e..5d9e47dce 100644 --- a/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi +++ b/driver/js/src/test/cjsprojects/.interfaces/mlscript/Lodash.mlsi @@ -1,5 +1,5 @@ import "lodash/fp.mlsi" -export declare module Lodash() { +export declare module Lodash { fun inc: (x: Int) -> Int unit } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi index d76d8e33a..88b035bb9 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/A.mlsi @@ -1,3 +1,3 @@ -export declare module A() { +export declare module A { class Foo(x: Int) } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi index eaafadf7a..372f349d9 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/B.mlsi @@ -1,7 +1,7 @@ import "./A.mlsi" -export declare module B() { +export declare module B { fun foo: error } -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.4: export fun foo = A.Foo(12) //| ╙── ^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi index b1bd7d1fa..647c21e71 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Builtin.mlsi @@ -1,4 +1,4 @@ -export declare module Builtin() { +export declare module Builtin { let s: "abc" let n: Num unit diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi index 6c45ecabd..52aeb7646 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/C.mlsi @@ -1,10 +1,10 @@ import "./B.mlsi" -export declare module C() { +export declare module C { let a: error let b: error unit } -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.4: let b = A.Foo(0) // not allowed, unless we import "A.mls" //| ╙── ^^^^ //| ╔══[ERROR] Type mismatch in field selection: diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi index 7e33ffba8..e4541216b 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Child.mlsi @@ -1,5 +1,5 @@ import "./Parent.mlsi" -export declare module Child() { +export declare module Child { class Child1(x: Int) class Child2(y: Int) let c1: Child1 diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi index a374cada0..4eb09cb21 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi @@ -1,6 +1,6 @@ -declare module Cycle2() { +declare module Cycle2 { fun g: (x: Int) -> Int } -export declare module Cycle1() { +export declare module Cycle1 { fun f: (x: Int) -> Int } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi index 5b0e61b7c..14d08bb29 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle2.mlsi @@ -1,5 +1,5 @@ import "./Cycle1.mlsi" -export declare module Cycle2() { +export declare module Cycle2 { fun g: (x: Int) -> Int - undefined + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi index b31dad8bb..20f9bdcec 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi @@ -1,4 +1,4 @@ -export declare module Cycle3() { +export declare module Cycle3 { fun f: (x: Int) -> Int } //| Use `weak import` to break the cycle dependency `import "./Cycle4.mls"` diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi index 721fa72ce..bb3a8f60a 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi @@ -1,5 +1,5 @@ import "./Cycle3.mlsi" -export declare module Cycle4() { +export declare module Cycle4 { fun g: (x: Int) -> Int - undefined + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi index 6ceeefcd4..0a4dee357 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug1.mlsi @@ -1,5 +1,5 @@ import "./Debug2.mlsi" import "./Debug4.mlsi" -export declare module Debug1() { +export declare module Debug1 { let x: 42 } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi index 681f4a4af..b199faf06 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug2.mlsi @@ -1,21 +1,18 @@ import "./Debug3.mlsi" -export declare module Debug2() { +export declare module Debug2 { let y: 42 } -//| 0. Typing TypingUnit(List(let y = 42)) +//| 0. Typing ‹let y = 42› //| | 0. Created lazy type info for let y = 42 //| | Completing let y = 42 -//| | | UNSTASHING... (out) //| | | Type params -//| | | UNSTASHING... (out) //| | | Params //| | | 0. Typing term 42 //| | | 0. : #42 -//| | | CONSTRAIN #42 ) where //| | Typing unit statements //| | : None diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi index 6a035bef0..901b60f41 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug3.mlsi @@ -1,20 +1,17 @@ -export declare module Debug3() { +export declare module Debug3 { let z: 1 } -//| 0. Typing TypingUnit(List(let z = 1)) +//| 0. Typing ‹let z = 1› //| | 0. Created lazy type info for let z = 1 //| | Completing let z = 1 -//| | | UNSTASHING... (out) //| | | Type params -//| | | UNSTASHING... (out) //| | | Params //| | | 0. Typing term 1 //| | | 0. : #1 -//| | | CONSTRAIN #1 ) where //| | Typing unit statements //| | : None diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi index 6fac89d9a..fc22a6a63 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Debug4.mlsi @@ -1,3 +1,3 @@ -export declare module Debug4() { +export declare module Debug4 { let w: "wuwuwu" } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi index eca72170d..c72b45fa8 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MLS2TheMax.mlsi @@ -1,6 +1,6 @@ import "../ts/ReadLine.mlsi" import "./tools/Concat.mlsi" -export declare module MLS2TheMax() { +export declare module MLS2TheMax { fun ask: (question: Str) -> Str class Some[A](value: A) module None @@ -14,3 +14,40 @@ export declare module MLS2TheMax() { fun main: unit unit } +//| ╔══[WARNING] Expression in statement position should have type `unit`. +//| ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//| ╟── Type mismatch in application: +//| ║ l.5: console.log(question) +//| ║ ^^^^^^^^^^^^^^^^^^^^^ +//| ╟── type `unit` does not match type `()` +//| ║ l.20: declare fun log(args0: (anything) | (MutArray[anything])): unit +//| ║ ^^^^ +//| ╟── but it flows into application with expected type `()` +//| ║ l.5: console.log(question) +//| ╙── ^^^^^^^^^^^^^^^^^^^^^ +//| ╔══[WARNING] Expression in statement position should have type `unit`. +//| ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//| ╟── Type mismatch in if-else block: +//| ║ l.33: if parse(guess) is +//| ║ ^^^^^^^^^^^^^^^ +//| ║ l.34: Some(i) then check(i) +//| ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//| ║ l.35: _ then console.log("Not a number!") +//| ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//| ╟── type `unit` does not match type `()` +//| ║ l.20: declare fun log(args0: (anything) | (MutArray[anything])): unit +//| ║ ^^^^ +//| ╟── but it flows into application with expected type `()` +//| ║ l.34: Some(i) then check(i) +//| ╙── ^^^^^^^^ +//| ╔══[WARNING] Expression in statement position should have type `unit`. +//| ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//| ╟── Type mismatch in application: +//| ║ l.41: console.log(Concat.concat3("Hello, ", name, " welcome to the game!")) +//| ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//| ╟── type `unit` does not match type `()` +//| ║ l.20: declare fun log(args0: (anything) | (MutArray[anything])): unit +//| ║ ^^^^ +//| ╟── but it flows into application with expected type `()` +//| ║ l.41: console.log(Concat.concat3("Hello, ", name, " welcome to the game!")) +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi index db3b8c17f..9a7b7c7b9 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin1.mlsi @@ -1,5 +1,5 @@ import "./Mixin2.mlsi" -export declare module Mixin1() { +export declare module Mixin1 { class Neg[A](expr: A) mixin EvalNeg() { super: {eval: 'a -> 'b} @@ -29,12 +29,12 @@ export declare module Mixin1() { //| ╟── from reference: //| ║ l.8: else super.eval(e) //| ╙── ^^^^^ -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) //| ╙── ^^^^ -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) //| ╙── ^^^^ -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.14: let program = Mixin2.Add(Mixin2.Lit(48), Neg(Mixin2.Lit(6))) //| ╙── ^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi index fa7edfae9..504fcdcb1 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Mixin2.mlsi @@ -1,4 +1,4 @@ -export declare module Mixin2() { +export declare module Mixin2 { class Add[E](lhs: E, rhs: E) class Lit(n: Int) fun eval: forall 'a. 'a -> Int diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi index 215872ba2..a6f6d6597 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/MyPartialOrder.mlsi @@ -1,6 +1,8 @@ import "fp-ts/BoundedMeetSemilattice.mlsi" -export declare module MyPartialOrder() { - class MyPartialOrder +export declare module MyPartialOrder { + class MyPartialOrder { + constructor() + } let order: MyPartialOrder } //| ╔══[ERROR] Unsupported parent specification diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi index e62da64bc..5571ce86b 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/NewTSClass.mlsi @@ -1,5 +1,5 @@ import "../ts/MyClass.mlsi" -export declare module NewTSClass() { +export declare module NewTSClass { class Bar() error } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi index 8d79cb295..c0922ce00 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Opened.mlsi @@ -1,5 +1,5 @@ import "./tools/Inc.mlsi" -export declare module Opened() { - fun hello: (x: Int) -> undefined - undefined +export declare module Opened { + fun hello: (x: Int) -> () + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi index e0ba9d2c0..777bcdc1b 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Output.mlsi @@ -1,5 +1,5 @@ import "../ts/ConfigGen.mlsi" -export declare module Output() { +export declare module Output { let res: Str - undefined + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi index 3f8ee7825..28ed42118 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Output2.mlsi @@ -1,6 +1,6 @@ import "json5.mlsi" -export declare module Output2() { +export declare module Output2 { fun createConfig: (path: Str) -> nothing let config: nothing - undefined + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi index 4dc82c4c1..efe9f31a6 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Parent.mlsi @@ -1,8 +1,9 @@ -export declare module Parent() { +export declare module Parent { class Parent1(x: Int) { fun inc: Int } class Parent2 { + constructor() fun x: 42 } } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi index c962f2d36..7aa505010 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Self.mlsi @@ -1,4 +1,4 @@ -export declare module Self() { +export declare module Self { class Foo() } //| Cannot import driver/js/src/test/esprojects/mlscript/Self.mls from itself diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi index e4149f1d1..ab9238a55 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Simple.mlsi @@ -1,5 +1,5 @@ import "./Opened.mlsi" -export declare module Simple() { +export declare module Simple { mixin B() { this: {n: 'n} fun foo: 'n @@ -11,5 +11,5 @@ export declare module Simple() { module C { let b: 1 } - undefined + () } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi index ce7e7121a..e32beaf66 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TS.mlsi @@ -1,9 +1,12 @@ import "../ts/MyPrint.mlsi" -export declare module TS() { +export declare module TS { let tspt: error let printer: error error } -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.3: let tspt = MyPrint.DatePrint //| ╙── ^^^^^^^^^^ +//| ╔══[ERROR] Cannot use `new` on non-class variable of type ?DatePrint +//| ║ l.4: let printer = new tspt("love from ts") +//| ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi index 1b7268da2..1a42dc050 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/TyperDebug.mlsi @@ -1,36 +1,31 @@ -export declare module TyperDebug() { +export declare module TyperDebug { class A(x: Int) { fun add: (y: Int) -> Int } let aa: A unit } -//| 0. Typing TypingUnit(List(class A(x: Int,) {fun add = (y: Int,) => +(x, y,)}, let aa = A(42,), (console).log((aa).add(6,),))) +//| 0. Typing ‹class A(x: Int,) {fun add = (y: Int,) => +(x, y,)}; let aa = A(42,); (console).log((aa).add(6,),)› //| | 0. Created lazy type info for class A(x: Int,) {fun add = (y: Int,) => +(x, y,)} //| | 0. Created lazy type info for let aa = A(42,) //| | Completing class A(x: Int,) {fun add = (y: Int,) => +(x, y,)} -//| | | UNSTASHING... (out) //| | | Type params //| | | Typing type TypeName(Int) //| | | | vars=Map() newDefsInfo=Map() //| | | | 1. type TypeName(Int) //| | | | => Int //| | | => Int ——— -//| | | UNSTASHING... (out) -//| | | Params (x,Int) -//| | | UNSTASHING... (out) -//| | | UNSTASHING... (out) -//| | | 1. Finalizing inheritance with ({} w/ {x: Int} & #A) <: a815' -//| | | | CONSTRAIN ({} w/ {x: Int} & #A) ) <: a536' +//| | | | CONSTRAIN ({} w/ {x: Int} & #A) ) +(x, y,))) +//| | | | 1. C ({} w/ {x: Int} & #A) +(x, y,)› //| | | | 1. Created lazy type info for fun add = (y: Int,) => +(x, y,) //| | | | Completing fun add = (y: Int,) => +(x, y,) -//| | | | | UNSTASHING... (out) //| | | | | Type params -//| | | | | UNSTASHING... (out) //| | | | | Params //| | | | | 2. Typing term (y: Int,) => +(x, y,) //| | | | | | 2. Typing pattern [y: Int,] @@ -49,351 +44,320 @@ export declare module TyperDebug() { //| | | | | | | 2. : Int //| | | | | | | 2. Typing term y //| | | | | | | 2. : Int -//| | | | | | | CONSTRAIN ((Int, Int,) -> Int) α816'') +//| | | | | | | CONSTRAIN ((Int, Int,) -> Int) α537'') //| | | | | | | where -//| | | | | | | 2. C ((Int, Int,) -> Int) α816'') (0) -//| | | | | | | | 2. C ((Int, Int,) -> Int) α816'') (0) -//| | | | | | | | | 2. C ((Int, Int,) -> Int) α816'') (0) +//| | | | | | | 2. C ((Int, Int,) -> Int) α537'') (0) +//| | | | | | | | 2. C ((Int, Int,) -> Int) α537'') (0) +//| | | | | | | | | 2. C ((Int, Int,) -> Int) α537'') (0) //| | | | | | | | | | 2. C (Int, Int,) α816'') -//| | | | | UNSTASHING... (out) -//| | | | | CONSTRAIN ((y: Int,) -> α816'') α537'') +//| | | | | CONSTRAIN ((y: Int,) -> α537'') Int -//| | | | | 2. C ((y: Int,) -> α816'') α816'') +(x, y,),((y: Int,) -> α816'')) where -//| α816'' :> Int +//| α537'' :> Int +//| | | | | 2. C ((y: Int,) -> α537'') α537'') +(x, y,),((y: Int,) -> α537'')) where +//| α537'' :> Int //| | | | Typing unit statements //| | | | : None -//| | | Checking base class implementations... -//| | | | (List(),List(TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α816'')))) -//| | | | UNSTASHING... (out) -//| | | Checking qualifications... -//| | | Checking new implementations... -//| | | | Checking overriding for `add`... -//| | | | Checking overriding for `x`... -//| | | | UNSTASHING... (out) -//| | | UNSTASHING... (out) +//| | | baseClsImplemMembers List() +//| | | Checking `this` accesses... +//| | | Checking base class implementations against inherited signatures... +//| | | Checking new implementations against inherited signatures... +//| | | | Checking overriding for TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537'')) against None... +//| | | | Checking overriding for NuParam(x,Int,false) against None... +//| | | Checking new signatures against inherited signatures... +//| | | allMembers Map(add -> TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537'')), x -> NuParam(x,Int,false)) //| | | Computing variances of A -//| | | | Trav(+)(({} w/ {x: Int} & #A)) -//| | | | | Trav(+)({} w/ {x: Int}) -//| | | | | | Trav(+)(({}\x & {x: Int})) -//| | | | | | | Trav(+)({}\x) -//| | | | | | | | Trav(+)({}) -//| | | | | | | Trav(+)({x: Int}) -//| | | | | | | | Trav(+)(Int) -//| | | | | Trav(+)(#A) -//| | | = HashMap() -//| | | UNSTASHING... (out) +//| | | | Trav(+)(((y: Int,) -> α537'')) +//| | | | | Trav(+)(((y: Int,) -> α537'')) +//| | | | | | Trav(+;-)((y: Int,)) +//| | | | | | | Trav(+;-)(Int) +//| | | | | | Trav(+)(α537'') +//| | | | | | | Trav(+;@[+](0))(Int) +//| | | | | | | | Trav(+;@[+](0))(Int) +//| | | | | | | | | Trav(+;@[+](0))(Int) +//| | | | Trav(+)(Int) +//| | | = HashMap(α537'' -> +) //| | Completed TypedNuCls(0, TypeName(A), //| List(), -//| List((x,Int)), +//| Some(List((x,Int))), //| this: ⊤, -//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α816''))) -//| (x,NuParam(x,Int)), +//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537''))) +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) where -//| α816'' :> Int +//| α537'' :> Int //| | Completing let aa = A(42,) -//| | | UNSTASHING... (out) //| | | Type params -//| | | UNSTASHING... (out) //| | | Params //| | | 0. Typing term A(42,) //| | | | 0. Typing term A //| | | | 0. : ((x: Int,) -> #A) //| | | | 0. Typing term 42 //| | | | 0. : #42 -//| | | | CONSTRAIN ((x: Int,) -> #A) ,) -> α818) +//| | | | CONSTRAIN ((x: Int,) -> #A) ,) -> α539) //| | | | where -//| | | | 0. C ((x: Int,) -> #A) ,) -> α818) (0) -//| | | | | 0. C ((x: Int,) -> #A) ,) -> α818) (0) -//| | | | | | 0. C ((x: Int,) -> #A) ,) -> α818) (0) +//| | | | 0. C ((x: Int,) -> #A) ,) -> α539) (0) +//| | | | | 0. C ((x: Int,) -> #A) ,) -> α539) (0) +//| | | | | | 0. C ((x: Int,) -> #A) ,) -> α539) (0) //| | | | | | | 0. C (#42,) #A -//| | | 1. C α818 #A +//| α539 :> #A +//| | | 1. C α539 #A //| | Typing unit statements //| | | 0. Typing term (console).log((aa).add(6,),) //| | | | 0. Typing term (console).log //| | | | | 0. Typing term console //| | | | | 0. : ‹∀ 0. Console› -//| | | | | CONSTRAIN ‹∀ 0. Console› ) ) <: DNF(0, {log: log820}) -//| | | | | | | | | Possible: List({log: log820}) -//| | | | | | | | | 0. A {}∧#Console<> % List() % List() % List() <: DNF(0, {log: log541}) +//| | | | | | | | | Possible: List({log: log541}) +//| | | | | | | | | 0. A {}∧#Console<> % List() % List() % List() ) & {...} //| | | | | | | | | | | | | Lookup Console.log : Some(((args0: (Anything | MutArray[Anything]),) -> Unit)) where //| | | | | | | | | | | | | Fresh[0] Console.log : Some(((args0: (Anything | MutArray[Anything]),) -> Unit)) where Some() //| | | | | | | | | | | | | & None (from refinement) -//| | | | | | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) Unit) Unit) Unit) #A -//| | | | | | 0. C α818 #A +//| | | | | | 0. C α539 α816'')›) where -//| α816'' :> Int -//| | | | | | | | | | | | Fresh[0] A.add : Some(‹∀ 1. ((y: Int,) -> α816'')›) where Some( -//| α816'' :> Int) +//| | | | | | | | | | | | Lookup A.add : Some(‹∀ 1. ((y: Int,) -> α537'')›) where +//| α537'' :> Int +//| | | | | | | | | | | | Fresh[0] A.add : Some(‹∀ 1. ((y: Int,) -> α537'')›) where Some( +//| α537'' :> Int) //| | | | | | | | | | | | & None (from refinement) -//| | | | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α816'')› α537'')› -//| | | | | CONSTRAIN add821 ,) -> α822) +//| | | | | CONSTRAIN add542 ,) -> α543) //| | | | | where -//| α816'' :> Int -//| add821 :> ‹∀ 1. ((y: Int,) -> α816'')› -//| | | | | 0. C add821 ,) -> α822) (0) -//| | | | | | 0. C add821 ,) -> α822) (0) -//| | | | | | | NEW add821 UB (0) -//| | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α816'')› ,) -> α822) (2) -//| | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α816'')› ,) -> α822) (2) -//| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α816'')› ,) -> α822) (2) -//| | | | | | | | | | INST [1] ‹∀ 1. ((y: Int,) -> α816'')› +//| α537'' :> Int +//| add542 :> ‹∀ 1. ((y: Int,) -> α537'')› +//| | | | | 0. C add542 ,) -> α543) (0) +//| | | | | | 0. C add542 ,) -> α543) (0) +//| | | | | | | NEW add542 UB (0) +//| | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α537'')› ,) -> α543) (2) +//| | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α537'')› ,) -> α543) (2) +//| | | | | | | | | 0. C ‹∀ 1. ((y: Int,) -> α537'')› ,) -> α543) (2) +//| | | | | | | | | | INST [1] ‹∀ 1. ((y: Int,) -> α537'')› //| | | | | | | | | | where -//| α816'' :> Int -//| | | | | | | | | | TO [0] ~> ((y: Int,) -> α816_823) +//| α537'' :> Int +//| | | | | | | | | | TO [0] ~> ((y: Int,) -> α537_544) //| | | | | | | | | | where -//| α816_823 :> Int -//| | | | | | | | | | 0. C ((y: Int,) -> α816_823) ,) -> α822) (4) -//| | | | | | | | | | | 0. C ((y: Int,) -> α816_823) ,) -> α822) (4) +//| α537_544 :> Int +//| | | | | | | | | | 0. C ((y: Int,) -> α537_544) ,) -> α543) (4) +//| | | | | | | | | | | 0. C ((y: Int,) -> α537_544) ,) -> α543) (4) //| | | | | | | | | | | | 0. C (#6,) α824) +//| | | | | | | | | | | | 0. C α537_544 α545) //| | | | where -//| log820 :> ((args0: (Anything | MutArray[Anything]),) -> Unit) -//| α822 :> Int -//| | | | 0. C log820 α824) (0) -//| | | | | 0. C log820 α824) (0) -//| | | | | | NEW log820 UB (0) -//| | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α824) (2) -//| | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α824) (2) -//| | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α824) (2) -//| | | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α824) (2) -//| | | | | | | | | | 0. C (α822,) ((args0: (Anything | MutArray[Anything]),) -> Unit) +//| α543 :> Int +//| | | | 0. C log541 α545) (0) +//| | | | | 0. C log541 α545) (0) +//| | | | | | NEW log541 UB (0) +//| | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α545) (2) +//| | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α545) (2) +//| | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α545) (2) +//| | | | | | | | | 0. C ((args0: (Anything | MutArray[Anything]),) -> Unit) α545) (2) +//| | | | | | | | | | 0. C (α543,) +(x, y,),((y: Int,) -> α816''))) -//| (x,NuParam(x,Int)), +//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537''))) +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) -//| TypedNuFun(0,let aa = A(42,),α818) -//| Some(α824)) +//| TypedNuFun(0,let aa = A(42,),α539) +//| Some(α545)) //| where: -//| α816'' :> Int -//| α818 :> #A <: {add: add821} -//| add821 :> ‹∀ 1. ((y: Int,) -> α816'')› <: ((#6,) -> α822) -//| α822 :> Int <: (Anything | MutArray[Anything]) -//| α824 :> Unit -//| allVarPols: +α816'', +α818, +α824 -//| Renewed α816'' ~> α816_825'' -//| Renewed α818 ~> α818_826 -//| Renewed α824 ~> α824_827 +//| α537'' :> Int +//| α539 :> #A <: {add: add542} +//| add542 :> ‹∀ 1. ((y: Int,) -> α537'')› <: ((#6,) -> α543) +//| α543 :> Int <: (Anything | MutArray[Anything]) +//| α545 :> Unit +//| allVarPols: +α537'', +α539, +α545 +//| Renewed α537'' ~> α537_546'' +//| Renewed α539 ~> α539_547 +//| Renewed α545 ~> α545_548 //| ⬤ Cleaned up: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,Int)), +//| Some(List((x,Int))), //| this: ⊤, -//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α816_825''))) -//| (x,NuParam(x,Int)), +//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537_546''))) +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) -//| TypedNuFun(0,let aa = A(42,),α818_826) -//| Some(α824_827)) +//| TypedNuFun(0,let aa = A(42,),α539_547) +//| Some(α545_548)) //| where: -//| α816_825'' :> Int -//| α818_826 :> #A -//| α824_827 :> Unit -//| allVarPols: +α816_825'', +α818_826, +α824_827 -//| consed: Map((true,Int) -> α816_825'', (true,#A) -> α818_826, (true,Unit) -> α824_827) -//| !unskid-1! Int -> α816_825'' -//| !unskid-1! Int -> α816_825'' -//| !unskid-1! Int -> α816_825'' -//| !unskid-1! #A -> α818_826 +//| α537_546'' :> Int +//| α539_547 :> #A +//| α545_548 :> Unit +//| allVarPols: +α537_546'', +α539_547, +α545_548 +//| consed: Map() //| ⬤ Unskid: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,α816_825'')), +//| Some(List((x,Int))), //| this: ⊤, -//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α816_825''))) -//| (x,NuParam(x,α816_825'')), +//| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> α537_546''))) +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) -//| TypedNuFun(0,let aa = A(42,),α818_826) -//| Some(α824_827)) +//| TypedNuFun(0,let aa = A(42,),α539_547) +//| Some(α545_548)) //| where: -//| α816_825'' :> Int -//| α818_826 :> #A -//| α824_827 :> Unit -//| analyze1[+] α816_825'' -//| | analyze1[+;@[+](0)] Int -//| analyze1[+] ((y: Int,) -> α816_825'') +//| α537_546'' :> Int +//| α539_547 :> #A +//| α545_548 :> Unit +//| analyze1[+] Int +//| analyze1[+] ((y: Int,) -> α537_546'') //| | analyze1[+;-] (y: Int,) //| | | analyze1[+;-] Int -//| | analyze1[+] α816_825'' -//| analyze1[+] α816_825'' +//| | analyze1[+] α537_546'' +//| | | analyze1[+;@[+](0)] Int +//| analyze1[+] Int //| analyze1[+;-] ⊤ //| analyze1[+;-] ⊤ -//| analyze1[+] α818_826 +//| analyze1[+] α539_547 //| | analyze1[+;@[+](0)] #A -//| analyze1[+] α824_827 +//| analyze1[+] α545_548 //| | analyze1[+;@[+](0)] Unit //| [inv] -//| [nums] +α816_825'' 3 ; +α818_826 1 ; +α824_827 1 -//| analyze2[+] α816_825'' -//| | >> Processing α816_825'' at [+] -//| | go α816_825'' () -//| | | go Int (α816_825'') -//| | >> Occurrences HashSet(α816_825'', Int) -//| | >>>> occs[+α816_825''] := HashSet(α816_825'', Int) <~ None -//| | analyze2[+] Int -//| analyze2[+] ((y: Int,) -> α816_825'') +//| [nums] +α537_546'' 1 ; +α539_547 1 ; +α545_548 1 +//| analyze2[+] Int +//| analyze2[+] ((y: Int,) -> α537_546'') //| | analyze2[+;-] (y: Int,) //| | | analyze2[+;-] Int -//| | analyze2[+] α816_825'' -//| analyze2[+] α816_825'' +//| | analyze2[+] α537_546'' +//| | | >> Processing α537_546'' at [+] +//| | | go α537_546'' () +//| | | | go Int (α537_546'') +//| | | >> Occurrences HashSet(α537_546'', Int) +//| | | >>>> occs[+α537_546''] := HashSet(α537_546'', Int) <~ None +//| | | analyze2[+] Int +//| analyze2[+] Int //| analyze2[+;-] ⊤ //| analyze2[+;-] ⊤ -//| analyze2[+] α818_826 -//| | >> Processing α818_826 at [+] -//| | go α818_826 () -//| | | go #A (α818_826) -//| | >> Occurrences HashSet(#A, α818_826) -//| | >>>> occs[+α818_826] := HashSet(#A, α818_826) <~ None +//| analyze2[+] α539_547 +//| | >> Processing α539_547 at [+] +//| | go α539_547 () +//| | | go #A (α539_547) +//| | >> Occurrences HashSet(α539_547, #A) +//| | >>>> occs[+α539_547] := HashSet(α539_547, #A) <~ None //| | analyze2[+] #A -//| analyze2[+] α824_827 -//| | >> Processing α824_827 at [+] -//| | go α824_827 () -//| | | go Unit (α824_827) -//| | >> Occurrences HashSet(Unit, α824_827) -//| | >>>> occs[+α824_827] := HashSet(Unit, α824_827) <~ None +//| analyze2[+] α545_548 +//| | >> Processing α545_548 at [+] +//| | go α545_548 () +//| | | go Unit (α545_548) +//| | >> Occurrences HashSet(α545_548, Unit) +//| | >>>> occs[+α545_548] := HashSet(α545_548, Unit) <~ None //| | analyze2[+] Unit -//| [occs] +α816_825'' {α816_825'',Int} ; +α818_826 {#A,α818_826} ; +α824_827 {Unit,α824_827} -//| [vars] TreeSet(α816_825'', α818_826, α824_827) +//| [occs] +α537_546'' {α537_546'',Int} ; +α539_547 {α539_547,#A} ; +α545_548 {α545_548,Unit} +//| [vars] TreeSet(α537_546'', α539_547, α545_548) //| [rec] Set() -//| 0[1] α818_826 -//| 0[1] α824_827 -//| 1[!] α816_825'' -//| 1[!] α818_826 -//| 1[!] α824_827 -//| [sub] α816_825'' -> None, α818_826 -> None, α824_827 -> None +//| 0[1] α537_546'' +//| 0[1] α539_547 +//| 0[1] α545_548 +//| 1[!] α537_546'' +//| 1[!] α539_547 +//| 1[!] α545_548 +//| [sub] α537_546'' -> None, α539_547 -> None, α545_548 -> None //| [bounds] -//| α816_825'' :> Int -//| α818_826 :> #A -//| α824_827 :> Unit +//| α537_546'' :> Int +//| α539_547 :> #A +//| α545_548 :> Unit //| [rec] Set() -//| transform[+] α816_825'' () + None -//| | -> bound Some(true) -//| | transform[+] Int (α816_825'') +;@[+](0) None -//| | ~> Int +//| transform[+] Int () + None //| ~> Int -//| transform[+] ((y: Int,) -> α816_825'') () + None +//| transform[+] ((y: Int,) -> α537_546'') () + None //| | transform[-] (y: Int,) () +;- None //| | | transform[-] Int () +;- None //| | | ~> Int //| | ~> (y: Int,) -//| | transform[+] α816_825'' () + None +//| | transform[+] α537_546'' () + None //| | | -> bound Some(true) -//| | | transform[+] Int (α816_825'') +;@[+](0) None +//| | | transform[+] Int (α537_546'') +;@[+](0) None //| | | ~> Int //| | ~> Int //| ~> ((y: Int,) -> Int) -//| transform[+] α816_825'' () + None -//| | -> bound Some(true) -//| | transform[+] Int (α816_825'') +;@[+](0) None -//| | ~> Int +//| transform[+] Int () + None //| ~> Int //| transform[-] ⊤ () +;- None //| ~> ⊤ //| transform[+] ⊤ () + None //| ~> ⊤ -//| transform[+] (⊤ w/ {x: α816_825''} & α818_826) () + None -//| | transform[+] ⊤ w/ {x: α816_825''} () + None -//| | | transform[+] ⊤ () + None -//| | | ~> ⊤ -//| | | transform[+] α816_825'' () + None -//| | | | -> bound Some(true) -//| | | | transform[+] Int (α816_825'') +;@[+](0) None -//| | | | ~> Int -//| | | ~> Int -//| | ~> ⊤ w/ {x: Int} -//| | transform[+] α818_826 () + None -//| | | -> bound Some(true) -//| | | transform[+] #A (α818_826) +;@[+](0) None -//| | | ~> #A -//| | ~> #A -//| ~> (⊤ w/ {x: Int} & #A) -//| transform[+] α818_826 () + None +//| transform[+] α539_547 () + None //| | -> bound Some(true) -//| | transform[+] #A (α818_826) +;@[+](0) None +//| | transform[+] #A (α539_547) +;@[+](0) None //| | ~> #A //| ~> #A -//| transform[+] α824_827 () + None +//| transform[+] α545_548 () + None //| | -> bound Some(true) -//| | transform[+] Unit (α824_827) +;@[+](0) None +//| | transform[+] Unit (α545_548) +;@[+](0) None //| | ~> Unit //| ~> Unit //| ⬤ Type after simplification: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,Int)), +//| Some(List((x,Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> Int))) -//| (x,NuParam(x,Int)), +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),#A) //| Some(Unit)) @@ -402,10 +366,10 @@ export declare module TyperDebug() { //| normLike[+] TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,Int)), +//| Some(List((x,Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: Int,) -> Int))) -//| (x,NuParam(x,Int)), +//| (x,NuParam(x,Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),#A) //| Some(Unit)) @@ -433,15 +397,6 @@ export declare module TyperDebug() { //| | norm[+] ⊤ //| | | DNF: DNF(0, ) //| | ~> ⊤ -//| | norm[+] (⊤ w/ {x: Int} & #A) -//| | | DNF: DNF(0, #A{x: Int}) -//| | | norm[+] Int -//| | | | DNF: DNF(0, #Int{}) -//| | | ~> #Int -//| | | rcd2 {x: #Int} -//| | | typeRef A -//| | | clsFields -//| | ~> (A & {x: #Int}) //| | norm[+] #A //| | | DNF: DNF(0, #A{}) //| | | rcd2 {} @@ -454,10 +409,10 @@ export declare module TyperDebug() { //| ⬤ Normalized: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,#Int)), +//| Some(List((x,#Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: #Int,) -> #Int))) -//| (x,NuParam(x,#Int)), +//| (x,NuParam(x,#Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),A) //| Some(#unit<>)) @@ -466,10 +421,10 @@ export declare module TyperDebug() { //| ⬤ Cleaned up: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,#Int)), +//| Some(List((x,#Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: #Int,) -> #Int))) -//| (x,NuParam(x,#Int)), +//| (x,NuParam(x,#Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),A) //| Some(#unit<>)) @@ -479,10 +434,10 @@ export declare module TyperDebug() { //| ⬤ Unskid: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,#Int)), +//| Some(List((x,#Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: #Int,) -> #Int))) -//| (x,NuParam(x,#Int)), +//| (x,NuParam(x,#Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),A) //| Some(#unit<>)) @@ -531,14 +486,6 @@ export declare module TyperDebug() { //| ~> ⊤ //| transform[+] ⊤ () + None //| ~> ⊤ -//| transform[+] (A & {x: #Int}) () + None -//| | transform[+] A () + None -//| | ~> A -//| | transform[+] {x: #Int} () + None -//| | | transform[+] #Int () + None -//| | | ~> #Int -//| | ~> {x: #Int} -//| ~> (A & {x: #Int}) //| transform[+] A () + None //| ~> A //| transform[+] #unit<> () + None @@ -546,10 +493,10 @@ export declare module TyperDebug() { //| ⬤ Resim: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,#Int)), +//| Some(List((x,#Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: #Int,) -> #Int))) -//| (x,NuParam(x,#Int)), +//| (x,NuParam(x,#Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),A) //| Some(#unit<>)) @@ -559,10 +506,10 @@ export declare module TyperDebug() { //| ⬤ Factored: TypedTypingUnit( //| TypedNuCls(0, TypeName(A), //| List(), -//| List((x,#Int)), +//| Some(List((x,#Int))), //| this: ⊤, //| (add,TypedNuFun(1,fun add = (y: Int,) => +(x, y,),((y: #Int,) -> #Int))) -//| (x,NuParam(x,#Int)), +//| (x,NuParam(x,#Int,false)), //| : ⊤, Set(), Map()) //| TypedNuFun(0,let aa = A(42,),A) //| Some(#unit<>)) diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi index a3fe73d15..67833f4fa 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Concat.mlsi @@ -1,4 +1,4 @@ -export declare module Concat() { +export declare module Concat { fun concat2: (Str, Str) -> Str fun concat3: (Str, Str, Str) -> Str } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi index 9313554ea..942e575fa 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/tools/Inc.mlsi @@ -1,3 +1,3 @@ -export declare module Inc() { +export declare module Inc { fun inc: (x: Int) -> Int } diff --git a/driver/js/src/test/esprojects/mlscript/Opened.mls b/driver/js/src/test/esprojects/mlscript/Opened.mls index a96a22fd7..5d76d7e83 100644 --- a/driver/js/src/test/esprojects/mlscript/Opened.mls +++ b/driver/js/src/test/esprojects/mlscript/Opened.mls @@ -1,5 +1,5 @@ import "./tools/Inc.mls" -export fun hello(x: Int) = log(("hello!", Inc.inc(x))) +export fun hello(x: Int) = log(["hello!", Inc.inc(x)]) hello(114513) diff --git a/driver/npm/lib/predefs/ES5.mlsi b/driver/npm/lib/predefs/ES5.mlsi index 6fcf1da75..1058ca476 100644 --- a/driver/npm/lib/predefs/ES5.mlsi +++ b/driver/npm/lib/predefs/ES5.mlsi @@ -115,7 +115,7 @@ declare trait StringConstructor: (args0: (anything) | (undefined)) => Str { declare class Bool { declare fun valueOf(): (false) | (true) } -declare trait BooleanConstructor: forall 'T; (args0: ('T) | (undefined)) => (false) | (true) { +declare trait BooleanConstructor: forall 'T: (args0: ('T) | (undefined)) => (false) | (true) { val __new: unsupported["new(value?: any): Bool;", "ES5.d.ts", 520, 30] val prototype: Bool } @@ -361,7 +361,7 @@ declare trait Array['T] { declare fun some(args0: (value: 'T, index: Num, array: MutArray['T]) => anything, args1: (anything) | (undefined)): (false) | (true) declare fun indexOf(args0: 'T, args1: (Num) | (undefined)): Num } -declare trait ArrayConstructor: forall 'T; (args0: ('T) | (MutArray['T])) => MutArray['T] { +declare trait ArrayConstructor: forall 'T: (args0: ('T) | (MutArray['T])) => MutArray['T] { val __new: unsupported["new (...items: T[]): T[];", "ES5.d.ts", 1470, 38] declare fun isArray(args0: anything): (false) | (true) val prototype: MutArray[anything] @@ -374,7 +374,7 @@ declare trait TypedPropertyDescriptor['T] { val writable: ((false) | (true)) | (undefined) val value: ('T) | (undefined) } -type PromiseConstructorLike = forall 'T; (executor: (resolve: (value: ('T) | (PromiseLike['T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike['T] +type PromiseConstructorLike = forall 'T: (executor: (resolve: (value: ('T) | (PromiseLike['T])) => unit, reject: (reason: (anything) | (undefined)) => unit) => unit) => PromiseLike['T] declare trait PromiseLike['T] { declare fun id"then"['TResult1, 'TResult2](args0: ((value: 'T) => ('TResult1) | (PromiseLike['TResult1])) | (undefined), args1: ((reason: anything) => ('TResult2) | (PromiseLike['TResult2])) | (undefined)): PromiseLike[('TResult1) | ('TResult2)] } diff --git a/shared/src/main/scala/mlscript/ConstraintSolver.scala b/shared/src/main/scala/mlscript/ConstraintSolver.scala index 45e8a40d6..cbc446ff6 100644 --- a/shared/src/main/scala/mlscript/ConstraintSolver.scala +++ b/shared/src/main/scala/mlscript/ConstraintSolver.scala @@ -57,10 +57,16 @@ class ConstraintSolver extends NormalForms { self: Typer => /** Note: `mkType` is just for reporting errors. */ - def lookupField(mkType: () => ST, clsNme: Opt[Str], rfnt: Var => Opt[FieldType], tags: SortedSet[AbstractTag], fld: Var) + def lookupField(mkType: () => ST, clsNme: Opt[Str], rfnt: Var => Opt[FieldType], + tags: SortedSet[AbstractTag], _fld: Var) (implicit ctx: Ctx, raise: Raise) : FieldType - = trace(s"Looking up field ${fld.name} in $clsNme & ${tags} & {...}") { + = trace(s"Looking up field ${_fld.name} in $clsNme & ${tags} & {...}") { + + // * Field selections with field names starting with `#` are a typer hack to access private members. + val (fld, allowPrivateAccess) = + if (_fld.name.startsWith("#")) (Var(_fld.name.tail).withLocOf(_fld), true) + else (_fld, false) val fromRft = rfnt(fld) @@ -71,7 +77,10 @@ class ConstraintSolver extends NormalForms { self: Typer => // * The raw type of this member, with original references to the class' type variables/type parameters val raw = (if (info.isComputed) N else info.typedFields.get(fld)) match { - case S(fty) => S(fty) + case S(fty) => + if (info.privateParams.contains(fld) && !allowPrivateAccess) + err(msg"Parameter '${fld.name}' cannot tbe accessed as a field" -> fld.toLoc :: Nil) + S(fty) case N if info.isComputing => @@ -88,9 +97,13 @@ class ConstraintSolver extends NormalForms { self: Typer => case S(d: TypedNuFun) => S(d.typeSignature.toUpper(provTODO)) case S(p: NuParam) => + if (!allowPrivateAccess && !p.isPublic) + err(msg"Parameter '${p.nme.name}' cannot tbe accessed as a field" -> fld.toLoc :: + msg"Either make the parameter a `val` or access it through destructuring" -> p.nme.toLoc :: + Nil) S(p.ty) case S(m) => - S(err(msg"access to ${m.kind.str} member not yet supported", fld.toLoc).toUpper(noProv)) + S(err(msg"Access to ${m.kind.str} member not yet supported", fld.toLoc).toUpper(noProv)) case N => N } @@ -543,13 +556,19 @@ class ConstraintSolver extends NormalForms { self: Typer => RhsBases(ots, S(R(RhsField(fldNme, fldTy))), trs)) if ctx.tyDefs2.contains(nme) => if (newDefs && nme =/= "Eql" && fldNme.name === "Eql#A") { val info = ctx.tyDefs2(nme) - info.typedParams.foreach { p => - val fty = lookupField(() => done_ls.toType(sort = true), S(nme), r.fields.toMap.get, ts, p._1) - rec(fldTy.lb.getOrElse(die), RecordType(p._1 -> TypeRef(TypeName("Eql"), - fty.ub // FIXME check mutable? - :: Nil - )(provTODO).toUpper(provTODO) :: Nil)(provTODO), false) - } + if (info.typedParams.isEmpty && !primitiveTypes.contains(nme)) + // TODO shoudl actually reject all non-data classes... + err(msg"${info.decl.kind.str.capitalize} '${info.decl.name + }' does not support equality comparison because it does not have a parameter list", prov.loco) + info.typedParams + .getOrElse(Nil) // FIXME?... prim type + .foreach { p => + val fty = lookupField(() => done_ls.toType(sort = true), S(nme), r.fields.toMap.get, ts, p._1) + rec(fldTy.lb.getOrElse(die), RecordType(p._1 -> TypeRef(TypeName("Eql"), + fty.ub // FIXME check mutable? + :: Nil + )(provTODO).toUpper(provTODO) :: Nil)(provTODO), false) + } } else { val fty = lookupField(() => done_ls.toType(sort = true), S(nme), r.fields.toMap.get, ts, fldNme) rec(fty.ub, fldTy.ub, false) @@ -572,8 +591,8 @@ class ConstraintSolver extends NormalForms { self: Typer => annoying(Nil, lr, Nil, RhsBases(Nil, S(R(rf)), SortedMap.empty)) case (LhsRefined(N, ts, r, _), RhsBases(ots, S(R(RhsField(fldNme, fldTy))), trs)) if newDefs => val fty = lookupField(() => done_ls.toType(sort = true), N, r.fields.toMap.get, ts, fldNme) - rec(fty.ub, fldTy.ub, false) - recLb(fldTy, fty) + rec(fty.ub, fldTy.ub, false) + recLb(fldTy, fty) case (LhsRefined(bo, ts, r, _), RhsBases(ots, S(R(RhsField(n, t2))), trs)) => // TODO simplify - merge with above? r.fields.find(_._1 === n) match { @@ -1579,7 +1598,7 @@ class ConstraintSolver extends NormalForms { self: Typer => case tr @ TypeRef(d, ts) => TypeRef(d, ts.map(freshen(_)))(tr.prov) case pt @ PolymorphicType(polyLvl, bod) if pt.level <= above => pt // is this really useful? case pt @ PolymorphicType(polyLvl, bod) => - if (lvl > polyLvl) freshen(pt.raiseLevelTo(lvl)) + if (lvl > polyLvl) freshen(pt.raiseLevelToImpl(lvl, leaveAlone)) else PolymorphicType(polyLvl, freshenImpl(bod, below = below min polyLvl)) case ct @ ConstrainedType(cs, bod) => val cs2 = cs.map(lu => freshen(lu._1) -> freshen(lu._2)) diff --git a/shared/src/main/scala/mlscript/JSBackend.scala b/shared/src/main/scala/mlscript/JSBackend.scala index 691a75c57..6ae353624 100644 --- a/shared/src/main/scala/mlscript/JSBackend.scala +++ b/shared/src/main/scala/mlscript/JSBackend.scala @@ -277,6 +277,12 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { name -> translateTerm(value) }) :: Nil ) + // Only parenthesize binary operators + // Custom operators do not need special handling since they are desugared to plain methods + case Bra(false, trm) => trm match { + case App(Var(op), _) if JSBinary.operators.contains(op) => JSParenthesis(translateTerm(trm)) + case trm => translateTerm(trm) + } case Bra(_, trm) => translateTerm(trm) case Tup(terms) => JSArray(terms map { case (_, Fld(_, term)) => translateTerm(term) }) @@ -873,7 +879,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { val ins = unapplyScope.declareParameter(nme) JSClassMethod("unapply", JSNamePattern(ins) :: Nil, L(JSArray(fields.map { case _ -> Fld(_, trm) => trm match { - case Sel(Var(ins), Var(f)) => JSIdent(s"$ins.#$f") + case Sel(Var(ins), Var(f)) => JSIdent(s"$ins.$f") case _ => translateTerm(trm) } }))) :: Nil @@ -1060,7 +1066,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { typeDefs.foreach { case td @ NuTypeDef(Mxn, TypeName(nme), tps, tup, ctor, sig, pars, sup, ths, unit) => { - checkNewTypeName(nme) + if (!td.isDecl) checkNewTypeName(nme) val (body, members, signatures, stmts, nested, publicCtors) = prepare(nme, tup.getOrElse(Tup(Nil)).fields, pars, unit) val sym = MixinSymbol(nme, tps map { _._2.name }, body, members, signatures, stmts, publicCtors, nested, qualifier).tap(scope.register) if (!td.isDecl) mixins += sym @@ -1071,14 +1077,15 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { if (!td.isDecl) modules += sym } case td @ NuTypeDef(Als, TypeName(nme), tps, _, ctor, sig, pars, _, _, _) => { - checkNewTypeName(nme) + if (!td.isDecl) checkNewTypeName(nme) scope.declareTypeAlias(nme, tps map { _._2.name }, sig.getOrElse(Top)) } case td @ NuTypeDef(Cls, TypeName(nme), tps, tup, ctor, sig, pars, sup, ths, unit) => { - checkNewTypeName(nme) + if (!td.isDecl) checkNewTypeName(nme) val (params, preStmts) = ctor match { case S(Constructor(Tup(ls), Blk(stmts))) => (S(ls.map { case (S(Var(nme)), Fld(flags, _)) => (nme, flags.genGetter) + case (N, Fld(flags, Var(nme))) => (nme, flags.genGetter) case _ => throw CodeGenError(s"Unexpected constructor parameters in $nme.") }), stmts) case _ => (N, Nil) @@ -1093,7 +1100,7 @@ class JSBackend(allowUnresolvedSymbols: Boolean) { if (!td.isDecl) classes += sym } case td @ NuTypeDef(Trt, TypeName(nme), tps, tup, ctor, sig, pars, sup, ths, unit) => { - checkNewTypeName(nme) + if (!td.isDecl) checkNewTypeName(nme) val (body, members, _, _, _, _) = prepare(nme, tup.getOrElse(Tup(Nil)).fields, pars, unit) val sym = scope.declareTrait(nme, tps map { _._2.name }, body, members) if (!td.isDecl) traits += sym @@ -1277,7 +1284,7 @@ class JSWebBackend extends JSBackend(allowUnresolvedSymbols = true) { JSInvoke(resultsIdent("push"), JSIdent(sym.runtimeName) :: Nil).stmt :: Nil case fd @ NuFunDef(isLetRec, Var(name), _, tys, R(ty)) => Nil - case _: Def | _: TypeDef => + case _: Def | _: TypeDef | _: Constructor => throw CodeGenError("Def and TypeDef are not supported in NewDef files.") case term: Term => val name = translateTerm(term)(topLevelScope) @@ -1521,7 +1528,7 @@ class JSTestBackend extends JSBackend(allowUnresolvedSymbols = false) { } catch { case e: UnimplementedError => JSTestBackend.AbortedQuery(e.getMessage()) } - case _: Def | _: TypeDef => + case _: Def | _: TypeDef | _: Constructor => throw CodeGenError("Def and TypeDef are not supported in NewDef files.") } diff --git a/shared/src/main/scala/mlscript/MLParser.scala b/shared/src/main/scala/mlscript/MLParser.scala index c22a12ff4..b9a0e8223 100644 --- a/shared/src/main/scala/mlscript/MLParser.scala +++ b/shared/src/main/scala/mlscript/MLParser.scala @@ -23,7 +23,7 @@ class MLParser(origin: Origin, indent: Int = 0, recordLocations: Bool = true) { } def toParam(t: Term): Tup = - Tup((N, Fld(FldFlags(false, false, false), t)) :: Nil) + Tup((N, Fld(FldFlags.empty, t)) :: Nil) def toParams(t: Term): Tup = t match { case t: Tup => t diff --git a/shared/src/main/scala/mlscript/NewLexer.scala b/shared/src/main/scala/mlscript/NewLexer.scala index 54924fdca..1c5aed741 100644 --- a/shared/src/main/scala/mlscript/NewLexer.scala +++ b/shared/src/main/scala/mlscript/NewLexer.scala @@ -26,17 +26,20 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { def isDigit(c: Char): Bool = c >= '0' && c <= '9' + /* // TODO remove (unused) private val isNonStickyKeywordChar = Set( ',', ':', ';', ) + */ private val isSymKeyword = Set( // "->", + "=>", "=", ":", - ";", + ";;", "#", // ".", // "<", @@ -169,23 +172,18 @@ class NewLexer(origin: Origin, raise: Diagnostic => Unit, dbg: Bool) { // go(j, if (keywords.contains(n)) KEYWORD(n) else IDENT(n, isAlphaOp(n))) lex(j, ind, next(j, if (keywords.contains(n)) KEYWORD(n) else IDENT(n, isAlphaOp(n)))) case _ if isOpChar(c) => - if (c === '-' && isDigit(bytes(i + 1))) { - val (str, j) = takeWhile(i + 1)(isDigit) - lex(j, ind, next(j, LITVAL(IntLit(-BigInt(str))))) - } else { - val (n, j) = takeWhile(i)(isOpChar) - if (n === "." && j < length && isIdentFirstChar(bytes(j))) { - val (body, m) = - if (isIdentEscape(j)) takeIdentFromEscape(j, SELECT) - else { - val (name, k) = takeWhile(j)(isIdentChar) - (SELECT(name), k) - } - lex(m, ind, next(m, body)) + val (n, j) = takeWhile(i)(isOpChar) + if (n === "." && j < length && isIdentFirstChar(bytes(j))) { + val (body, m) = + if (isIdentEscape(j)) takeIdentFromEscape(j, SELECT) + else { + val (name, k) = takeWhile(j)(isIdentChar) + (SELECT(name), k) } - // else go(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true)) - else lex(j, ind, next(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true))) + lex(m, ind, next(m, body)) } + // else go(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true)) + else lex(j, ind, next(j, if (isSymKeyword.contains(n)) KEYWORD(n) else IDENT(n, true))) case _ if isDigit(c) => val (str, j) = takeWhile(i)(isDigit) // go(j, LITVAL(IntLit(BigInt(str)))) @@ -296,6 +294,7 @@ object NewLexer { "if", "then", "else", + "case", "fun", "val", "var", diff --git a/shared/src/main/scala/mlscript/NewParser.scala b/shared/src/main/scala/mlscript/NewParser.scala index 8dd2020ad..488821b3a 100644 --- a/shared/src/main/scala/mlscript/NewParser.scala +++ b/shared/src/main/scala/mlscript/NewParser.scala @@ -147,7 +147,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo (5, 5) case _ => val r = opStr.last - (prec(opStr.head), prec(r) - (if (r === '@' || r === '/' || r === ',') 1 else 0)) + (prec(opStr.head), prec(r) - (if (r === '@' || r === '/' || r === ',' || r === ':') 1 else 0)) } // def pe(msg: Message, l: Loc, rest: (Message, Opt[Loc])*): Unit = @@ -268,11 +268,6 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo TypingUnit(Nil) } - final def toParams(t: Term): Tup = t match { - case t: Tup => t - case Bra(false, t: Tup) => t - case _ => Tup((N, Fld(FldFlags(false, false, false), t)) :: Nil) - } final def toParamsTy(t: Type): Tuple = t match { case t: Tuple => t case _ => Tuple((N, Field(None, t)) :: Nil) @@ -352,8 +347,8 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo case (br @ BRACKETS(Round, toks), loc) :: _ => consume val as = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.argsMaybeIndented()) // TODO - val body = curlyTypingUnit.entities - Constructor(Tup(as).withLoc(S(loc)), Blk(body)) + val body = curlyTypingUnit + Constructor(Tup(as).withLoc(S(loc)), Blk(body.entities).withLocOf(body)) case _ => err(msg"Expect parameter list for the constructor" -> S(l0) :: Nil) Constructor(Tup(Nil), Blk(Nil)) @@ -457,22 +452,20 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo expr(0) :: otherParents case _ => Nil } - val tu = curlyTypingUnit - val (ctors, body) = tu.entities.partitionMap { + val fullTu = curlyTypingUnit + val (ctors, bodyStmts) = fullTu.entities.partitionMap { case c: Constructor => L(c) case t => R(t) } - - val ctor = - if (ctors.lengthIs > 1) { - err(msg"A class may only have at most one explicit constructor" -> S(l0) :: Nil) - N - } - else ctors.headOption - + val tu = TypingUnit(bodyStmts).withLocOf(fullTu) + if (ctors.lengthIs > 1) { + err(msg"A class may have at most one explicit constructor" -> S(l0) :: Nil) + N + } + val ctor = ctors.headOption val res = - NuTypeDef(kind, tn, tparams, params, ctor, sig, ps, N, N, TypingUnit(body))(isDecl, isExported, isAbs) - R(res.withLoc(S(l0 ++ res.getLoc))) + NuTypeDef(kind, tn, tparams, params, ctor, sig, ps, N, N, tu)(isDecl, isExported, isAbs) + R(res.withLoc(S(l0 ++ tn.getLoc ++ res.getLoc))) case ModifierSet(mods, (KEYWORD(kwStr @ ("fun" | "val" | "let")), l0) :: c) => // TODO support rec? consume @@ -563,7 +556,9 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo val body = expr(0) val newBody = transformBody.fold(body)(_(body)) val annotatedBody = asc.fold(newBody)(ty => Asc(newBody, ty)) - R(NuFunDef(isLetRec, v, opStr, tparams, L(ps.foldRight(annotatedBody)((i, acc) => Lam(i, acc))))(isDecl, isExported, isVirtual, N, N, genField)) + R(NuFunDef( + isLetRec, v, opStr, tparams, L(ps.foldRight(annotatedBody)((i, acc) => Lam(i, acc))) + )(isDecl, isExported, isVirtual, N, N, genField).withLoc(S(l0 ++ annotatedBody.toLoc))) case c => asc match { case S(ty) => @@ -571,35 +566,45 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo R(NuFunDef(isLetRec, v, opStr, tparams, R(PolyType(Nil, ps.foldRight(ty)((p, r) => Function(p.toType match { case L(diag) => raise(diag); Top // TODO better case R(tp) => tp - }, r)))))(isDecl, isExported, isVirtual, N, N, genField)) // TODO rm PolyType after FCP is merged + }, r)))))(isDecl, isExported, isVirtual, N, N, genField).withLoc(S(l0 ++ ty.toLoc))) + // TODO rm PolyType after FCP is merged case N => // TODO dedup: val (tkstr, loc) = c.headOption.fold(("end of input", lastLoc))(_.mapFirst(_.describe).mapSecond(some)) err(( msg"Expected ':' or '=' followed by a function body or signature; found ${tkstr} instead" -> loc :: Nil)) consume - R(NuFunDef(isLetRec, v, opStr, Nil, L(ps.foldRight(errExpr: Term)((i, acc) => Lam(i, acc))))(isDecl, isExported, isVirtual, N, N, genField)) + val bod = errExpr + R(NuFunDef( + isLetRec, v, opStr, Nil, L(ps.foldRight(bod: Term)((i, acc) => Lam(i, acc))) + )(isDecl, isExported, isVirtual, N, N, genField).withLoc(S(l0 ++ bod.toLoc))) } } } case _ => exprOrIf(0, allowSpace = false) } - yeetSpaces match { + val finalTerm = yeetSpaces match { case (KEYWORD("="), l0) :: _ => t match { case R(v: Var) => consume - block(R(Eqn(v, expr(0))) :: prev) - case _ => (t :: prev).reverse + R(Eqn(v, expr(0))) + case _ => t } - case (KEYWORD(";"), _) :: _ => consume; block(t :: prev) - case (NEWLINE, _) :: _ => consume; block(t :: prev) - case _ => (t :: prev).reverse + case _ => t + } + yeetSpaces match { + case (KEYWORD(";;"), _) :: _ => consume; block(finalTerm :: prev) + case (NEWLINE, _) :: _ => consume; block(finalTerm :: prev) + case _ => (finalTerm :: prev).reverse } } private def yeetSpaces: Ls[TokLoc] = - cur.dropWhile(_._1 === SPACE && { consume; true }) + cur.dropWhile(tkloc => + (tkloc._1 === SPACE + || tkloc._1.isInstanceOf[COMMENT] // TODO properly retrieve and sotre all comments in AST? + ) && { consume; true }) final def funParams(implicit et: ExpectThen, fe: FoundErr, l: Line): Ls[Tup] = wrap(()) { l => yeetSpaces match { @@ -676,54 +681,79 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo exprCont(Var(opStr).withLoc(S(l1)), prec, allowNewlines = false) case (br @ BRACKETS(bk @ (Round | Square | Curly), toks), loc) :: _ => consume - val res = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.argsMaybeIndented()) // TODO + val res = rec(toks, S(br.innerLoc), br.describe).concludeWith(_.argsMaybeIndented()) val bra = (bk, res) match { case (Curly, _) => Bra(true, Rcd(res.map { - case S(n) -> fld => n -> fld - case N -> (fld @ Fld(_, v: Var)) => v -> fld - case N -> fld => - err(( - msg"Record field should have a name" -> fld.value.toLoc :: Nil)) - Var("") -> fld + case S(n) -> fld => n -> fld + case N -> (fld @ Fld(_, v: Var)) => v -> fld + case N -> fld => + err(( + msg"Record field should have a name" -> fld.value.toLoc :: Nil)) + Var("") -> fld })) case (Round, (N, Fld(FldFlags(false, false, _), elt)) :: Nil) => Bra(false, elt) + case (Round, fs) => + yeetSpaces match { + case (KEYWORD("=>"), l1) :: _ => + consume + val e = expr(0) + Lam(Tup(res), e) + case (IDENT("->", true), l1) :: _ => + consume + val rhs = expr(opPrec("->")._2) + Lam(Tup(res), rhs) + case _ => + res match { + case Nil => + UnitLit(true) + case _ => + err(( + msg"Expected '=>' or '->' after this parameter section" -> S(loc) :: Nil)) + Tup(fs) + } + } case _ => - // TODO actually reject round tuples? (except for function arg lists) - Bra(false, Tup(res)) + Tup(res) } exprCont(bra.withLoc(S(loc)), prec, allowNewlines = false) case (KEYWORD("forall"), l0) :: _ => consume - val as = argsMaybeIndented() + def getIdents: Ls[TypeVar] = yeetSpaces match { + case (IDENT(nme, false), l0) :: _ => + consume + val res = TypeVar(R(nme), N).withLoc(S(l0)) + yeetSpaces match { + case (COMMA, _) :: _ => + consume + res :: getIdents + case _ => res :: Nil + } + case _ => Nil + } + val idents = getIdents val rest = cur match { - case (KEYWORD(";"), l0) :: _ => + case (KEYWORD(":"), l0) :: _ => consume expr(0) case _ => - err((msg"Expected `;` after `forall` section" -> curLoc.orElse(lastLoc) :: Nil)) + err((msg"Expected `:` after `forall` section" -> curLoc.orElse(lastLoc) :: Nil)) errExpr } - R(Forall(as.flatMap { - case N -> Fld(FldFlags(false, false, _), v: Var) => - TypeVar(R(v.name), N).withLocOf(v) :: Nil - case v -> f => - err(msg"illegal `forall` quantifier body" -> f.value.toLoc :: Nil) - Nil - }, rest)) + R(Forall(idents, rest)) case (KEYWORD("let"), l0) :: _ => consume val bs = bindings(Nil) val body = yeetSpaces match { - case (KEYWORD("in") | KEYWORD(";"), _) :: _ => + case (KEYWORD("in" | ";;"), _) :: _ => consume exprOrIf(0) case (NEWLINE, _) :: _ => consume exprOrIf(0) case _ => - R(UnitLit(true)) + R(UnitLit(true).withLoc(curLoc.map(_.left))) } bs.foldRight(body) { case ((v, r), R(acc)) => R(Let(false, v, r, acc)) @@ -731,7 +761,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo } case (KEYWORD("new"), l0) :: c => consume - val body = expr(0) + val body = expr(outer.prec('.')) val head = body match { case Var(clsNme) => S(TypeName(clsNme).withLocOf(body) -> Tup(Nil)) @@ -746,11 +776,23 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo msg"Unexpected ${body.describe} after `new` keyword" -> body.toLoc :: Nil)) N } - R(New(head, curlyTypingUnit).withLoc(S(head.foldLeft(l0)((l, h) => l ++ h._1.toLoc ++ h._2.toLoc)))) + val res = New(head, curlyTypingUnit).withLoc(S(head.foldLeft(l0)((l, h) => l ++ h._1.toLoc ++ h._2.toLoc))) + exprCont(res, prec, allowNewlines = false) case (KEYWORD("else"), l0) :: _ => consume val e = expr(0) L(IfElse(e).withLoc(S(l0 ++ e.toLoc))) + case (KEYWORD("case"), l0) :: _ => + consume + exprOrIf(0)(et = true, fe = fe, l = implicitly) match { + case L(body) => + R(Lam(PlainTup(Var("case$scrut")), If(IfOpApp(Var("case$scrut"), Var("is"), body), N))) + case R(rhs) => + err((msg"Expected 'then'/'else' clause after 'case'; found ${rhs.describe} instead" -> rhs.toLoc :: + msg"Note: 'case' expression starts here:" -> S(l0) :: Nil)) + R(Lam(PlainTup(Var("case$scrut")), If(IfElse(rhs), N))) + } + case (KEYWORD("if"), l0) :: _ => consume cur match { @@ -799,8 +841,8 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo S(e.toLoc.foldRight(l1)(_ ++ _))) case Nil => (msg"${e.describe}", e.toLoc) } - err((msg"Expected 'then'/'else' clause; found $found instead" -> loc :: - msg"Note: 'if' expression started here:" -> S(l0) :: Nil)) + err((msg"Expected 'then'/'else' clause after 'if'; found $found instead" -> loc :: + msg"Note: 'if' expression starts here:" -> S(l0) :: Nil)) R(If(IfThen(e, errExpr), N)) } } @@ -809,9 +851,21 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo case Nil => err(msg"Unexpected end of $description; an expression was expected here" -> lastLoc :: Nil) R(errExpr) - case ((KEYWORD(";") /* | NEWLINE */ /* | BRACKETS(Curly, _) */, _) :: _) => - R(UnitLit(true)) + case ((KEYWORD(";;") /* | NEWLINE */ /* | BRACKETS(Curly, _) */, l0) :: _) => + R(UnitLit(true).withLoc(S(l0))) // R(errExpr) // TODO + case (IDENT("-", true), l0) :: _ /*if opPrec("-")._1 > prec*/ => // Unary minus + consume + val v = Var("-").withLoc(S(l0)) + expr(opPrec("-")._2) match { + case IntLit(i) => // Special case for negative literals + exprCont(IntLit(-i), prec, false) + case rhs: Term => // General case + exprCont( + if (newDefs) App(v, PlainTup(IntLit(BigInt(0)), rhs)) + else App(App(v, PlainTup(IntLit(BigInt(0)))), PlainTup(rhs)) + , prec, false) + } case (tk, l0) :: _ => err(msg"Unexpected ${tk.describe} in expression position" -> S(l0) :: Nil) consume @@ -824,10 +878,15 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo final def exprCont(acc: Term, prec: Int, allowNewlines: Bool)(implicit et: ExpectThen, fe: FoundErr, l: Line): IfBody \/ Term = wrap(prec, s"`$acc`", allowNewlines) { l => cur match { - case (IDENT(opStr @ "=>", true), l0) :: (NEWLINE, l1) :: _ if opPrec(opStr)._1 > prec => + case (KEYWORD(opStr @ "=>"), l0) :: (NEWLINE, l1) :: _ if opPrec(opStr)._1 > prec => consume val rhs = Blk(typingUnit.entities) - R(Lam(toParams(acc), rhs)) + R(Lam(PlainTup(acc), rhs)) + case (KEYWORD(opStr @ "=>"), l0) :: _ if opPrec(opStr)._1 > prec => + consume + val rhs = expr(1) + val res = Lam(PlainTup(acc), rhs) + exprCont(res, prec, allowNewlines) case (IDENT(".", _), l0) :: (br @ BRACKETS(Square, toks), l1) :: _ => consume consume @@ -854,23 +913,21 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo err(msg"record literal expected here; found ${rhs.describe}" -> rhs.toLoc :: Nil) acc } - case "=>" => - Lam(toParams(acc), rhs) + case ";" => + Blk(acc :: rhs :: Nil) case _ => if (newDefs) App(v, PlainTup(acc, rhs)) - else App(App(v, toParams(acc)), toParams(rhs)) + else App(App(v, PlainTup(acc)), PlainTup(rhs)) }, prec, allowNewlines) } - case (KEYWORD(":"), l0) :: _ => + case (KEYWORD(":"), l0) :: _ if prec <= outer.prec(':') => consume R(Asc(acc, typ(0))) - // case (KEYWORD(":"), _) :: _ if prec <= 1 => - // consume - // R(Asc(acc, typ(1))) case (KEYWORD("where"), l0) :: _ if prec <= 1 => consume val tu = typingUnitMaybeIndented - R(Where(acc, tu.entities)) + val res = Where(acc, tu.entities).withLoc(S(l0)) + exprCont(res, prec, allowNewlines = false) case (SPACE, l0) :: _ => consume exprCont(acc, prec, allowNewlines) @@ -903,7 +960,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo case (NEWLINE, _) :: _ if allowNewlines => consume exprCont(acc, 0, allowNewlines) - case (COMMA | NEWLINE | KEYWORD("then" | "else" | "in" | ";" | "=") + case (COMMA | NEWLINE | KEYWORD("then" | "else" | "in" | ";;" | "=") | IDENT(_, true) | BRACKETS(Curly, _), _) :: _ => R(acc) case (KEYWORD("of"), _) :: _ if prec <= 1 => @@ -981,9 +1038,9 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo exprCont(res, prec, allowNewlines) case c @ (h :: _) if (h._1 match { - case KEYWORD(";" | "of" | "where" | "extends") | BRACKETS(Round | Square, _) + case KEYWORD(";;" | ":" | "of" | "where" | "extends") | BRACKETS(Round | Square, _) | BRACKETS(Indent, ( - KEYWORD(";" | "of") + KEYWORD(";;" | "of") | BRACKETS(Round | Square, _) | SELECT(_) , _) :: _) @@ -1122,7 +1179,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo // argsOrIf(Nil).map{case (_, L(x))=> ???; case (n, R(x))=>n->x} // TODO argsOrIf(Nil, Nil, allowNewlines, prec).flatMap{case (n, L(x))=> err(msg"Unexpected 'then'/'else' clause" -> x.toLoc :: Nil) - n->Fld(FldFlags(false, false, false), errExpr)::Nil + n->Fld(FldFlags.empty, errExpr)::Nil case (n, R(x))=>n->x::Nil} // TODO /* final def argsOrIf2()(implicit fe: FoundErr, et: ExpectThen): IfBlock \/ Ls[Opt[Var] -> Fld] = { @@ -1143,14 +1200,17 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo case Nil => seqAcc match { case res :: seqAcc => - (N -> R(Fld(FldFlags(false, false, false), Blk((res :: seqAcc).reverse))) :: acc).reverse + (N -> R(Fld(FldFlags.empty, Blk((res :: seqAcc).reverse))) :: acc).reverse case Nil => acc.reverse } case (SPACE, _) :: _ => consume argsOrIf(acc, seqAcc, allowNewlines, prec) - case (NEWLINE | IDENT(_, true), _) :: _ => // TODO: | ... + case (NEWLINE, _) :: _ => // TODO: | ... + assert(seqAcc.isEmpty) + acc.reverse + case (IDENT(nme, true), _) :: _ if nme =/= "-" => // TODO: | ... assert(seqAcc.isEmpty) acc.reverse case _ => @@ -1224,7 +1284,7 @@ abstract class NewParser(origin: Origin, tokens: Ls[Stroken -> Loc], newDefs: Bo case (SPACE, _) :: _ => consume bindings(acc) - case (NEWLINE | IDENT(_, true) | KEYWORD(";"), _) :: _ => // TODO: | ... + case (NEWLINE | IDENT(_, true) | KEYWORD(";;"), _) :: _ => // TODO: | ... acc.reverse case (IDENT(id, false), l0) :: _ => consume diff --git a/shared/src/main/scala/mlscript/NuTypeDefs.scala b/shared/src/main/scala/mlscript/NuTypeDefs.scala index e7d91974b..c95034c73 100644 --- a/shared/src/main/scala/mlscript/NuTypeDefs.scala +++ b/shared/src/main/scala/mlscript/NuTypeDefs.scala @@ -29,6 +29,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def level: Level def isImplemented: Bool def isDecl: Bool + def isPublic: Bool + def isPrivate: Bool = !isPublic // * We currently don't support `protected` def isValueParam: Bool = this match { case p: NuParam => !p.isType @@ -38,7 +40,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => protected def withLevel[R](k: Ctx => R)(implicit ctx: Ctx): R = k(ctx.copy(lvl = ctx.lvl + 1)) def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV, ST]) + (implicit ctx: Ctx, freshened: MutMap[TV, ST]) : NuMember def map(f: ST => ST)(implicit ctx: Ctx): NuMember = @@ -55,7 +57,9 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } - case class NuParam(nme: NameRef, ty: FieldType)(val level: Level) extends NuMember with TypedNuTermDef { + case class NuParam(nme: NameRef, ty: FieldType, isPublic: Bool)(val level: Level) + extends NuMember with TypedNuTermDef + { def name: Str = nme.name def isType: Bool = nme.isInstanceOf[TypeName] def kind: DeclKind = @@ -65,19 +69,20 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def isDecl: Bool = false def toLoc: Opt[Loc] = nme.toLoc def isImplemented: Bool = true + def isVirtual: Bool = false // TODO allow annotating parameters with `virtual` def typeSignature: ST = ty.ub def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV, ST]) + (implicit ctx: Ctx, freshened: MutMap[TV, ST]) : NuParam = - NuParam(nme, ty.freshenAbove(lim, rigidify))(ctx.lvl) + NuParam(nme, ty.freshenAbove(lim, rigidify), isPublic)(ctx.lvl) def mapPol(pol: Opt[Bool], smart: Bool)(f: (Opt[Bool], SimpleType) => SimpleType) (implicit ctx: Ctx): NuParam = - NuParam(nme, ty.update(t => f(pol.map(!_), t), t => f(pol, t)))(level) + NuParam(nme, ty.update(t => f(pol.map(!_), t), t => f(pol, t)), isPublic)(level) def mapPolMap(pol: PolMap)(f: (PolMap, SimpleType) => SimpleType) (implicit ctx: Ctx): NuParam = - NuParam(nme, ty.update(t => f(pol.contravar, t), t => f(pol, t)))(level) + NuParam(nme, ty.update(t => f(pol.contravar, t), t => f(pol, t)), isPublic)(level) } @@ -123,9 +128,10 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def nme: mlscript.TypeName = td.nme def members: Map[Str, NuMember] = Map.empty def isImplemented: Bool = td.sig.isDefined + def isPublic = true // TODO def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV,ST]) + (implicit ctx: Ctx, freshened: MutMap[TV,ST]) : TypedNuAls = { val outer = ctx; withLevel { implicit ctx => TypedNuAls(outer.lvl, td, tparams.map(tp => (tp._1, tp._2.freshenAbove(lim, rigidify).assertTV, tp._3)), @@ -169,14 +175,15 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true + def isPublic = true // TODO lazy val virtualMembers: Map[Str, NuMember] = members ++ tparams.map { case (nme @ TypeName(name), tv, _) => - td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO))(level) + td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO), isPublic = true)(level) } ++ parentTP def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV,ST]) + (implicit ctx: Ctx, freshened: MutMap[TV,ST]) : TypedNuTrt = { val outer = ctx; withLevel { implicit ctx => TypedNuTrt(outer.lvl, td, tparams.map(tp => (tp._1, tp._2.freshenAbove(lim, rigidify).assertTV, tp._3)), @@ -214,13 +221,13 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case class TypedNuCls( level: Level, td: NuTypeDef, tparams: TyParams, - params: Ls[Var -> FieldType], + params: Opt[Ls[Var -> FieldType]], + auxCtorParams: Opt[Ls[Var -> ST]], members: Map[Str, NuMember], thisTy: ST, sign: ST, inheritedTags: Set[TypeName], parentTP: Map[Str, NuMember] - )(val instanceType: ST, // * only meant to be used in `force` and `variances` ) extends TypedNuTypeDef(Cls) with PolyNuDecl { def decl: NuTypeDef = td @@ -229,13 +236,16 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true + def isPublic = true // TODO - def typeSignature: ST = typeSignatureOf(td, level, tparams, params, sign, inheritedTags) + /** The type of a palin term reference to this type definition. */ + def typeSignature(usesNew: Bool, loco: Opt[Loc])(implicit raise: Raise): ST = + typeSignatureOf(usesNew, loco, td, level, tparams, params, auxCtorParams, sign, inheritedTags) /** Includes class-name-coded type parameter fields. */ lazy val virtualMembers: Map[Str, NuMember] = members ++ tparams.map { case (nme @ TypeName(name), tv, _) => - td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO))(level) + td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO), isPublic = true)(level) } ++ parentTP // TODO @@ -272,7 +282,10 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } }() } - Trav(PolMap.pos)(instanceType) + members.foreach { + case (_, m: NuParam) if m.isType => + case (_, m) => Trav.applyMem(PolMap.pos)(m) + } // TODO check consistency with explicitVariances val res = store ++ tparams.iterator.collect { case (_, tv, S(vi)) => tv -> vi } @@ -288,41 +301,44 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => variances.getOrElse(tv, VarianceInfo.in) def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV,ST]) + (implicit ctx: Ctx, freshened: MutMap[TV,ST]) : TypedNuCls = { val outer = ctx; withLevel { implicit ctx => TypedNuCls(outer.lvl, td, tparams.map(tp => (tp._1, tp._2.freshenAbove(lim, rigidify).assertTV, tp._3)), - params.mapValues(_.freshenAbove(lim, rigidify)), + params.map(_.mapValues(_.freshenAbove(lim, rigidify))), + auxCtorParams.map(_.mapValues(_.freshenAbove(lim, rigidify))), members.mapValuesIter(_.freshenAbove(lim, rigidify)).toMap, thisTy.freshenAbove(lim, rigidify), sign.freshenAbove(lim, rigidify), inheritedTags, parentTP.mapValuesIter(_.freshenAbove(lim, rigidify)).toMap, - )(this.instanceType.freshenAbove(lim, rigidify)) + ) }} def mapPol(pol: Opt[Bool], smart: Bool)(f: (Opt[Bool], SimpleType) => SimpleType) (implicit ctx: Ctx): TypedNuCls = TypedNuCls(level, td, tparams.map(tp => (tp._1, f(N, tp._2).assertTV, tp._3)), - params.mapValues(_.update(t => f(pol.map(!_), t), t => f(pol, t))), + params.map(_.mapValues(_.update(t => f(pol.map(!_), t), t => f(pol, t)))), + auxCtorParams.map(_.mapValues(t => f(pol.map(!_), t))), members.mapValuesIter(_.mapPol(pol, smart)(f)).toMap, f(pol.map(!_), thisTy), f(pol, sign), inheritedTags, parentTP.mapValuesIter(_.mapPol(pol, smart)(f)).toMap, - )(f(pol, instanceType)) + ) def mapPolMap(pol: PolMap)(f: (PolMap, SimpleType) => SimpleType) (implicit ctx: Ctx): TypedNuCls = TypedNuCls(level, td, tparams.map(tp => (tp._1, f(pol.invar, tp._2).assertTV, tp._3)), - params.mapValues(_.update(t => f(pol.contravar, t), t => f(pol, t))), + params.map(_.mapValues(_.update(t => f(pol.contravar, t), t => f(pol, t)))), + auxCtorParams.map(_.mapValues(t => f(pol.contravar, t))), members.mapValuesIter(_.mapPolMap(pol)(f)).toMap, f(pol.contravar, thisTy), f(pol, sign), inheritedTags, parentTP.mapValuesIter(_.mapPolMap(pol)(f)).toMap, - )(f(pol, instanceType)) + ) override def toString: Str = s"TypedNuCls($level, ${td.nme},\n\t$tparams,\n\t$params,\n\tthis: $thisTy, ${ members.lnIndent()},\n\t: $sign, $inheritedTags, $parentTP)" @@ -332,7 +348,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case class TypedNuMxn( level: Level, td: NuTypeDef, thisTy: ST, superTy: ST, - tparams: TyParams, params: Ls[Var -> FieldType], + tparams: TyParams, + params: Ls[Var -> FieldType], members: Map[Str, NuMember], ) extends TypedNuTypeDef(Mxn) with PolyNuDecl { @@ -342,14 +359,15 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def nme: TypeName = td.nme def name: Str = nme.name def isImplemented: Bool = true + def isPublic = true // TODO lazy val virtualMembers: Map[Str, NuMember] = members ++ tparams.map { case (nme @ TypeName(name), tv, _) => - td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO))(level) + td.nme.name+"#"+name -> NuParam(nme, FieldType(S(tv), tv)(provTODO), isPublic = false)(level) } def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV,ST]) + (implicit ctx: Ctx, freshened: MutMap[TV,ST]) : TypedNuMxn = { val outer = ctx; withLevel { implicit ctx => TypedNuMxn(outer.lvl, td, thisTy.freshenAbove(lim, rigidify), @@ -385,9 +403,10 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def toLoc: Opt[Loc] = N def name: Str = d.name def isImplemented: Bool = true + def isPublic = true // TODO def typeSignature: ST = errType def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV, ST]) = + (implicit ctx: Ctx, freshened: MutMap[TV, ST]) = this def mapPol(pol: Opt[Bool], smart: Bool)(f: (Opt[Bool], SimpleType) => SimpleType) (implicit ctx: Ctx): TypedNuTermDef = @@ -411,11 +430,13 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => def kind: DeclKind = Val def isDecl: Bool = fd.isDecl def name: Str = fd.nme.name + def symbolicName: Opt[Str] = fd.symbolicNme.map(_.name) def toLoc: Opt[Loc] = fd.toLoc + def isPublic = true // TODO lazy val typeSignature: ST = PolymorphicType.mk(level, bodyType) def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV, ST]) + (implicit ctx: Ctx, freshened: MutMap[TV, ST]) : TypedNuFun = { val outer = ctx; withLevel { implicit ctx => this match { case TypedNuFun(level, fd, ty) => TypedNuFun(outer.lvl, fd, ty.freshenAbove(lim, rigidify))(isImplemented) @@ -446,23 +467,39 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => (implicit ctx: Ctx): TypedTypingUnit = TypedTypingUnit(implementedMembers.map(_.mapPolMap(pol)(f)), result.map(f(pol, _))) def freshenAbove(lim: Int, rigidify: Bool) - (implicit ctx: Ctx, shadows: Shadows, freshened: MutMap[TV, ST]) + (implicit ctx: Ctx, freshened: MutMap[TV, ST]) : TypedTypingUnit = TypedTypingUnit(implementedMembers.map(_.freshenAbove(lim, rigidify)), result.map(_.freshenAbove(lim, rigidify))) override def toString: Str = s"TypedTypingUnit(${(implementedMembers :+ result).lnIndent()})" } - def typeSignatureOf(td: NuTypeDef, level: Level, tparams: TyParams, params: Params, selfTy: ST, ihtags: Set[TypeName]) - : ST = td.kind match { - case Mod => + def typeSignatureOf(usesNew: Bool, loco: Opt[Loc], td: NuTypeDef, level: Level, + tparams: TyParams, params: Opt[Params], acParams: Opt[Ls[Var -> ST]], selfTy: ST, ihtags: Set[TypeName]) + (implicit raise: Raise) + : ST = + if ((td.kind is Mod) && params.isEmpty) ClassTag(Var(td.nme.name), ihtags + TN("Object") )(provTODO) - case Cls => + else if ((td.kind is Cls) || (td.kind is Mod)) { + if (td.kind is Mod) + err(msg"Parameterized modules are not supported", loco) + val psOpt: Opt[Params] = ( + if (usesNew) acParams.map(_.mapValues(_.toUpper(noProv))).orElse(params) + else params.orElse { + acParams.map { ps => + err(msg"Construction of unparameterized class ${td.nme.name} should use the `new` keyword", loco) + ps.mapValues(_.toUpper(noProv)) + } + } + ) + val ps = psOpt.getOrElse { + return err(msg"Class ${td.nme.name} cannot be instantiated as it exposes no such constructor", loco) + } PolymorphicType.mk(level, FunctionType( - TupleType(params.mapKeys(some))(provTODO), + TupleType(ps.mapKeys(some))(provTODO), ClassTag(Var(td.nme.name), ihtags + TN("Object") )(provTODO) & RecordType.mk( @@ -476,9 +513,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => )(provTODO) )(provTODO) ) - // case k => err - case k => errType // FIXME - } + } else errType // FIXME def getRefs(body: Statement): RefMap = { @@ -512,6 +547,12 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => // println(s"vars ${vars}") + tu.entities.foreach { + case fd: NuFunDef if fd.isLetRec.isEmpty && outer.exists(_.kind is Block) => + err(msg"Cannot use `val` or `fun` in local block; use `let` instead.", fd.toLoc) + case _ => + } + val named = mutable.Map.empty[Str, LazyTypeInfo] // * Not sure we should support declaring signature with the `ident: type` syntax @@ -525,14 +566,14 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } val funSigs = MutMap.empty[Str, NuFunDef] val implems = decls.filter { - case fd @ NuFunDef(N, nme, snme, tparams, R(rhs)) => + case fd @ NuFunDef(_, nme, snme, tparams, R(rhs)) => funSigs.updateWith(nme.name) { case S(s) => err(s"A type signature for '$nme' was already given", fd.toLoc) S(s) case N => S(fd) } - false // There will already be typed in DelayedTypeInfo + false // * Explicit signatures will already be typed in DelayedTypeInfo's typedSignatures case _ => true } @@ -606,24 +647,46 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => // * Generalize functions as they are typed. // * Note: eventually we'll want to first reorder their typing topologically so as to maximize polymorphism. ctx += res.name -> VarSymbol(res.typeSignature, res.fd.nme) + res.symbolicName.foreach(ctx += _ -> VarSymbol(res.typeSignature, res.fd.nme)) } CompletedTypeInfo(res) case res => CompletedTypeInfo(res) }) ctx ++= completedInfos + val returnsLastExpr = outer.map(_.kind) match { + case N | S(Block | Val) => true + case S(_: TypeDefKind) => false + } + // * Type the block statements def go(stmts: Ls[Statement]): Opt[ST] = stmts match { case s :: stmts => val res_ty = s match { case decl: NuDecl => N - case s: Statement => - val (diags, dss) = s.desugared - diags.foreach(raise) - S(typeTerms(dss, false, Nil)(ctx, raise, TypeProvenance(s.toLoc, s match { - case trm: Term => trm.describe - case s => "statement" - }), vars, genLambdas = false)) + case t: Term => + implicit val genLambdas: GenLambdas = true + val ty = typeTerm(t) + if (!topLevel && !(stmts.isEmpty && returnsLastExpr)) { + t match { + // * We do not include `_: Var` because references to `fun`s and lazily-initialized + // * definitions may have side effects. + case _: Lit | _: Lam => + warn("Pure expression does nothing in statement position.", t.toLoc) + case _ => + constrain(mkProxy(ty, TypeProvenance(t.toCoveringLoc, "expression in statement position")), UnitType)( + raise = err => raise(WarningReport( // Demote constraint errors from this to warnings + msg"Expression in statement position should have type `unit`." -> N :: + msg"Use the `discard` function to discard non-unit values, making the intent clearer." -> N :: + err.allMsgs, newDefs)), + prov = TypeProvenance(t.toLoc, t.describe), ctx) + } + } + S(ty) + case s: DesugaredStatement => + err(msg"Illegal position for this ${s.describe} statement.", s.toLoc)(raise) + N + case _ => die } stmts match { case Nil => res_ty @@ -652,6 +715,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val level: Level = ctx.lvl val kind: DeclKind = decl.kind + val name: Str = decl.name private implicit val prov: TP = TypeProvenance(decl.toLoc, decl.describe) @@ -709,7 +773,6 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val (fr, ptp) = refreshHelper(rawMxn, v, if (parTargs.isEmpty) N else S(parTargs)) // type args inferred val mxn = { implicit val frenshened: MutMap[TV,ST] = fr - implicit val shadows: Shadows = Shadows.empty implicit val ctx: Ctx = outerCtx rawMxn.freshenAbove(info.level, rigidify = false) } @@ -720,19 +783,25 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => err(msg"mixin $parNme expects ${ mxn.params.size.toString} parameter(s); got ${parArgs.size.toString}", Loc(v :: parArgs.unzip._2)) - val paramMems = mxn.params.lazyZip(parArgs).map { - case (nme -> p, _ -> Fld(_, a)) => // TODO check name, mut, spec + val paramMems = mxn.params.lazyZip(parArgs).flatMap { + case (nme -> p, _ -> Fld(FldFlags(mut, spec, get), a)) => // TODO factor this with code for classes: + assert(!mut && !spec && !get, "TODO") // TODO check mut, spec, get implicit val genLambdas: GenLambdas = true val a_ty = typeTerm(a) p.lb.foreach(constrain(_, a_ty)) constrain(a_ty, p.ub) - NuParam(nme, FieldType(p.lb, a_ty)(provTODO))(lvl) + val isPublic = mxn.members(nme.name).isPublic + val fty = if (p.lb.isDefined) + // * We don't refine the field type when it's mutable as that could lead to muable updates being rejected + FieldType(p.lb, p.ub)(provTODO) + else FieldType(p.lb, a_ty)(provTODO) + Option.when(isPublic)(NuParam(nme, fty, isPublic = isPublic)(lvl)) } paramMems //++ mxn.members.valuesIterator } - println(s"Members $argMembs") + println(s"Mixin arg members $argMembs") S((mxn, argMembs, Map.empty[Str, NuMember], // TODO add ptp here once we support explicit type args @@ -745,7 +814,6 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val (fr, ptp) = refreshHelper(rawTrt, v, if (parTargs.isEmpty) N else S(parTargs)) // infer ty args if not provided val trt = { implicit val frenshened: MutMap[TV,ST] = fr - implicit val shadows: Shadows = Shadows.empty implicit val ctx: Ctx = outerCtx rawTrt.freshenAbove(info.level, rigidify = false) } @@ -756,31 +824,60 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case rawCls: TypedNuCls => - // println(s"Raw $rawCls") + // println(s"Raw $rawCls where ${rawCls.showBounds}") val (fr, ptp) = refreshHelper(rawCls, v, if (parTargs.isEmpty) N else S(parTargs)) // infer ty args if not provided val cls = { implicit val frenshened: MutMap[TV,ST] = fr - implicit val shadows: Shadows = Shadows.empty implicit val ctx: Ctx = outerCtx rawCls.freshenAbove(info.level, rigidify = false) } - // println(s"Fresh[${ctx.lvl}] $cls") + // println(s"Fresh[${ctx.lvl}] $cls where ${cls.showBounds}") - if (parArgs.sizeCompare(cls.params) =/= 0) - err(msg"class $parNme expects ${ - cls.params.size.toString} parameter(s); got ${parArgs.size.toString}", Loc(v :: parArgs.unzip._2)) + def checkArgsNum(effectiveParamSize: Int) = + if (parArgs.sizeCompare(effectiveParamSize) =/= 0) + err(msg"class $parNme expects ${ + effectiveParamSize.toString} parameter(s); got ${parArgs.size.toString + }", Loc(v :: parArgs.unzip._2)) - val paramMems = cls.params.lazyZip(parArgs).map { case (nme -> p, _ -> Fld(_, a)) => // TODO check name, mut, spec + val argMembs = { implicit val genLambdas: GenLambdas = true - val a_ty = typeTerm(a) - p.lb.foreach(constrain(_, a_ty)) - constrain(a_ty, p.ub) - NuParam(nme, FieldType(p.lb, a_ty)(provTODO))(lvl) + cls.auxCtorParams match { + case S(ps) => + checkArgsNum(ps.size) + ps.lazyZip(parArgs).map { + case (nme -> p_ty, _ -> Fld(FldFlags(mut, spec, get), a)) => + assert(!mut && !spec && !get, "TODO") // TODO check mut, spec, get + val a_ty = typeTerm(a) + constrain(a_ty, p_ty) + } + Nil + case N => cls.params match { + case S(ps) => + checkArgsNum(ps.size) + ps.lazyZip(parArgs).flatMap { + case (nme -> p, _ -> Fld(FldFlags(mut, spec, get), a)) => + assert(!mut && !spec && !get, "TODO") // TODO check mut, spec, get + val a_ty = typeTerm(a) + p.lb.foreach(constrain(_, a_ty)) + constrain(a_ty, p.ub) + val isPublic = cls.members(nme.name).isPublic + val fty = if (p.lb.isDefined) + // * We don't refine the field type when it's mutable as that could lead to muable updates being rejected + FieldType(p.lb, p.ub)(provTODO) + else FieldType(p.lb, a_ty)(provTODO) + Option.when(isPublic)(NuParam(nme, fty, isPublic = isPublic)(lvl)) + } + case N => + checkArgsNum(0) + Nil + } + } } + println(s"Class arg members $argMembs") - S((cls, paramMems, ptp ++ cls.parentTP, p.toLoc)) + S((cls, argMembs, ptp ++ cls.parentTP, p.toLoc)) case als: TypedNuAls => // TODO dealias first? @@ -812,7 +909,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case Nil => tags case (p, Var(nm), lti, _, _) :: ps => lti match { case lti: DelayedTypeInfo => lti.kind match { - case Trt | Cls | Mod => lookupTags(ps, Set.single(TypeName(nm)) union lti.inheritedTags union tags) + case Trt | Cls | Mod => lookupTags(ps, Set.single(TypeName(nm)) union lti.inheritedTags union tags) case Val | Mxn | Als => lookupTags(ps, tags) } case CompletedTypeInfo(trt: TypedNuTrt) => @@ -825,20 +922,36 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } } - lazy val inheritedTags = lookupTags(parentSpecs, Set.empty) + private var inheritedTagsStartedComputing = false + lazy val inheritedTags: Set[TypeName] = + if (inheritedTagsStartedComputing) Set.empty // * Deals with malformed inheritances (cycles) + else { + inheritedTagsStartedComputing = true + lookupTags(parentSpecs, Set.empty) + } lazy val tparams: TyParams = ctx.nest.nextLevel { implicit ctx => decl match { case td: NuTypeDef => td.tparams.map(tp => - (tp._2, freshVar(TypeProvenance( - tp._2.toLoc, - "type parameter", - S(tp._2.name), - true), N, S(tp._2.name)), tp._1)) - case fd: NuFunDef => Nil // TODO + (tp._2, freshVar( + TypeProvenance(tp._2.toLoc, "type parameter", + S(tp._2.name), + isType = true), + N, S(tp._2.name)), tp._1)) + case fd: NuFunDef => + fd.tparams.map { tn => + (tn, freshVar( + TypeProvenance(tn.toLoc, "method type parameter", + originName = S(tn.name), + isType = true), + N, S(tn.name)), N) + } } } + lazy val tparamsSkolems: Ls[Str -> SkolemTag] = tparams.map { + case (tp, tv, vi) => (tp.name, SkolemTag(tv)(tv.prov)) + } lazy val explicitVariances: VarianceStore = MutMap.from(tparams.iterator.map(tp => tp._2 -> tp._3.getOrElse(VarianceInfo.in))) @@ -848,15 +961,13 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => explicitVariances.get(tv).getOrElse(VarianceInfo.in) lazy private implicit val vars: Map[Str, SimpleType] = - outerVars ++ tparams.iterator.map { - case (tp, tv, vi) => (tp.name, SkolemTag(tv)(tv.prov)) - } + outerVars ++ tparamsSkolems - lazy val typedParams: Ls[Var -> FieldType] = ctx.nest.nextLevel { implicit ctx => + lazy val typedParams: Opt[Ls[Var -> FieldType]] = ctx.nest.nextLevel { implicit ctx => decl match { case td: NuTypeDef => - td.params.getOrElse(Tup(Nil)).fields.map { - case (S(nme), Fld(FldFlags(mut, spec, _), value)) => + td.params.map(_.fields.map { + case (S(nme), Fld(FldFlags(mut, spec, getter), value)) => assert(!mut && !spec, "TODO") // TODO value.toType match { case R(tpe) => @@ -865,18 +976,18 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => nme -> FieldType(N, ty)(provTODO) case _ => ??? } - case (N, Fld(FldFlags(mut, spec, _), nme: Var)) => - // assert(!mut && !spec, "TODO") // TODO + case (N, Fld(FldFlags(mut, spec, getter), nme: Var)) => + assert(!mut && !spec, "TODO") // TODO // nme -> FieldType(N, freshVar(ttp(nme), N, S(nme.name)))(provTODO) nme -> FieldType(N, err(msg"${td.kind.str.capitalize} parameters currently need type annotations", nme.toLoc))(provTODO) case _ => ??? - } - case fd: NuFunDef => Nil + }) + case fd: NuFunDef => N } } - lazy val paramSymbols = typedParams.map(p => p._1.name -> VarSymbol(p._2.ub, p._1)) + lazy val paramSymbols = typedParams.getOrElse(Nil).map(p => p._1.name -> VarSymbol(p._2.ub, p._1)) // TODO also import signatures from base classes and mixins! lazy val (typedSignatures, funImplems) : (Ls[(NuFunDef, ST)], Ls[NuFunDef]) = decl match { @@ -924,6 +1035,20 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case _ => Set.empty}).toSet case _: NuFunDef => Set.empty } + lazy val privateParams: Set[Var] = decl match { + case td: NuTypeDef => + // td.params.dlof(_.fields)(Nil).iterator.collect { + // case (S(nme), Fld(flags, _)) if !flags.genGetter => nme + // case (N, Fld(flags, nme: Var)) if !flags.genGetter => nme + // // case (N, Fld(flags, _)) => die + // }.toSet + td.params.dlof(_.fields)(Nil).iterator.flatMap { + case (S(nme), Fld(flags, _)) => Option.when(!flags.genGetter)(nme) + case (N, Fld(flags, nme: Var)) => Option.when(!flags.genGetter)(nme) + case (N, Fld(flags, _)) => die + }.toSet + case _: NuFunDef => Set.empty + } lazy val allFields: Set[Var] = decl match { case td: NuTypeDef => @@ -933,10 +1058,12 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case _: NuFunDef => Set.empty } - lazy val typedFields: Map[Var, FieldType] = - (typedParams.toMap -- inheritedFields /* parameters can be overridden by inherited fields/methods */) ++ - typedSignatures.iterator.map(fd_ty => fd_ty._1.nme -> fd_ty._2.toUpper(noProv)) - + lazy val typedFields: Map[Var, FieldType] = {println(("privateFields"),privateParams) + (typedParams.getOrElse(Nil).toMap + // -- privateFields + -- inheritedFields /* parameters can be overridden by inherited fields/methods */ + ) ++ typedSignatures.iterator.map(fd_ty => fd_ty._1.nme -> fd_ty._2.toUpper(noProv)) + } lazy val mutRecTV: TV = freshVar( TypeProvenance(decl.toLoc, decl.describe, S(decl.name), decl.isInstanceOf[NuTypeDef]), N, @@ -1009,11 +1136,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val body_ty = ctx.nextLevel { implicit ctx: Ctx => // * Note: can't use `ctx.poly` instead of `ctx.nextLevel` because all the methods // * in the current typing unit are quantified together. - vars ++ fd.tparams.map { tn => - tn.name -> freshVar(TypeProvenance(tn.toLoc, "method type parameter", - originName = S(tn.name), - isType = true), N, S(tn.name)) - } |> { implicit vars => + assert(fd.tparams.sizeCompare(tparamsSkolems) === 0, (fd.tparams, tparamsSkolems)) + vars ++ tparamsSkolems |> { implicit vars => // * Only type methods polymorphically if they're at the top level or if // * they're annotated with a type signature. // * Otherwise, we get too much extrusion and cycle check failures @@ -1123,8 +1247,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => toImplement.foreach { m => implemsMap.get(m.name) match { case S(_) => - case N => if (!m.isDecl) - err(msg"Member `${m.name}` is declared in parent but not implemented in `${ + case N => + err(msg"Member `${m.name}` is declared (or its declaration is inherited) but is not implemented in `${ td.nme.name}`" -> td.nme.toLoc :: msg"Declared here:" -> m.toLoc :: Nil) @@ -1147,14 +1271,22 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } newMembers.foreach { m => - println(s"Checking overriding for `${m.name}`...") + println(s"Checking overriding for ${m} against ${sigMap.get(m.name)}...") (m, sigMap.get(m.name)) match { case (_, N) => case (m: TypedNuTermDef, S(fun: TypedNuTermDef)) => fun match { - // If the implementation and the declaration are in the same class, it does not require to be virtual + // * If the implementation and the declaration are in the same class, + // * it does not require to be virtual. + case _ if fun.isPrivate => () // * Private members are not actually inherited case td: TypedNuFun if (!td.fd.isVirtual && !clsSigns.contains(fun)) => - err(msg"${m.kind.str.capitalize} member `${m.name}` is not virtual and cannot be overridden" -> m.toLoc :: - msg"Declared here:" -> fun.toLoc :: + err(msg"${m.kind.str.capitalize} member `${m.name + }` is not virtual and cannot be overridden" -> m.toLoc :: + msg"Originally declared here:" -> fun.toLoc :: + Nil) + case p: NuParam if (!p.isVirtual && !clsSigns.contains(p)) => + err(msg"Inherited parameter named `${m.name + }` is not virtual and cannot be overridden" -> m.toLoc :: + msg"Originally declared here:" -> fun.toLoc :: Nil) case _ => val mSign = m.typeSignature @@ -1164,7 +1296,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case (_, S(that)) => err(msg"${m.kind.str.capitalize} member `${m.name}` cannot override ${ that.kind.str} member of the same name declared in parent" -> td.toLoc :: - msg"Declared here:" -> that.toLoc :: + msg"Originally declared here:" -> that.toLoc :: Nil) } } @@ -1185,7 +1317,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => }, a.fd.nme, N/*no sym name?*/, a.fd.tparams, a.fd.rhs)(a.fd.declareLoc, a.fd.exportLoc, a.fd.virtualLoc, N, a.fd.outer orElse b.fd.outer, a.fd.genField) S(TypedNuFun(a.level, fd, a.bodyType & b.bodyType)(a.isImplemented || b.isImplemented)) case (a: NuParam, S(b: NuParam)) => - S(NuParam(a.nme, a.ty && b.ty)(a.level)) + if (!a.isPublic) S(b) else if (!b.isPublic) S(a) + else S(NuParam(a.nme, a.ty && b.ty, isPublic = true)(a.level)) case (a: NuParam, S(b: TypedNuFun)) => S(TypedNuFun(a.level, b.fd, a.ty.ub & b.bodyType)(a.isImplemented || b.isImplemented)) case (a: TypedNuFun, S(b: NuParam)) => @@ -1221,7 +1354,6 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val ty = typeType(td.sig.getOrElse(Top)) // * Make these type vars skolems implicit val freshened: MutMap[TV, ST] = MutMap.empty - implicit val shadows: Shadows = Shadows.empty ty.freshenAbove(outer.lvl, rigidify = true) } // * Create a lower-levl type variable to extrude the type through it, @@ -1313,7 +1445,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val body_ty = td.sig match { case S(sig) => - typeType(sig) + ctx.nextLevel { implicit ctx: Ctx => typeType(sig) } case N => err(msg"Type alias definition requires a right-hand side", td.toLoc) } @@ -1326,8 +1458,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => if ((td.kind is Mod) && typedParams.nonEmpty) // * Can we do better? (Memoization semantics?) - err(msg"${td.kind.str} parameters are not supported", - Loc(typedParams.iterator.map(_._1))) + err(msg"${td.kind.str.capitalize} parameters are not supported", + typedParams.fold(td.nme.toLoc)(tp => Loc(tp.iterator.map(_._1)))) ctx ++= paramSymbols ctx ++= typedSignatures.map(nt => nt._1.name -> VarSymbol(nt._2, nt._1.nme)) @@ -1341,11 +1473,12 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val tparamMems = tparams.map { case (tp, tv, vi) => // TODO use vi val fldNme = td.nme.name + "#" + tp.name - NuParam(TypeName(fldNme).withLocOf(tp), FieldType(S(tv), tv)(tv.prov))(lvl) + val skol = SkolemTag(tv)(tv.prov) + NuParam(TypeName(fldNme).withLocOf(tp), FieldType(S(skol), skol)(tv.prov), isPublic = true)(lvl) } val tparamFields = tparamMems.map(p => p.nme.toVar -> p.ty) - assert(!typedParams.keys.exists(tparamFields.keys.toSet), ???) - + assert(!typedParams.exists(_.keys.exists(tparamFields.keys.toSet)), ???) + case class Pack( superType: ST, mxnMembers: Ls[NuMember], @@ -1356,8 +1489,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => ) def inherit(parents: Ls[TypedParentSpec], pack: Pack): Pack = parents match { - case (p, argMembs, tpms, loc) :: ps => p match { - + case (p, argMembs, tpms, loc) :: ps => println(s"=> Inheriting from $p"); p match { case mxn: TypedNuMxn => @@ -1401,18 +1533,28 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => traitMembers = membersInter(pack.traitMembers, trt.members.valuesIterator.filterNot(_.isValueParam).toList), tparamMembers = pack.tparamMembers ++ tpms )) - + case cls: TypedNuCls => val parNme = cls.nme.name pack.baseClsNme.foreach { cls => - err(msg"cannot inherit from more than one base class: ${ + err(msg"Cannot inherit from more than one base class: ${ cls} and ${parNme}", loc) } + val (baseParamMems, otherBaseMems) = + // cls.members.toList.partition(_._2.isValueParam) + cls.members.valuesIterator.toList.partition(_.isValueParam) + + println(s"argMembs $argMembs") + inherit(ps, pack.copy( baseClsNme = S(parNme), - baseClsMembers = argMembs ++ cls.members.valuesIterator.filterNot(_.isValueParam), + // baseClsMembers = argMembs ++ cls.members.valuesIterator.filterNot(_.isValueParam), + // baseClsMembers = argMembs.filterNot(_.isPrivate) ++ cls.members.valuesIterator.filterNot(_.isValueParam), + // baseClsMembers = cls.members.valuesIterator.filter(_.isValueParam) ++ argMembs ++ cls.members.valuesIterator.filterNot(_.isValueParam), + // baseClsMembers = baseParamMems ::: argMembs ::: otherBaseMems, + baseClsMembers = argMembs ++ cls.members.valuesIterator, tparamMembers = pack.tparamMembers ++ tpms )) @@ -1421,10 +1563,14 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => } case Nil => - val thisType = WithType(pack.superType, RecordType(typedParams)(ttp(td.params.getOrElse(Tup(Nil)), isType = true)))(provTODO) & - clsNameToNomTag(td)(provTODO, ctx) & - RecordType(tparamFields)(TypeProvenance(Loc(td.tparams.map(_._2)), "type parameters", isType = true)) & - sig_ty + println(s"Done inheriting: $pack") + + val thisType = WithType(pack.superType, + RecordType(typedParams.getOrElse(Nil))(ttp(td.params.getOrElse(Tup(Nil)), isType = true)) + )(provTODO) & + clsNameToNomTag(td)(provTODO, ctx) & + RecordType(tparamFields)(TypeProvenance(Loc(td.tparams.map(_._2)), "type parameters", isType = true)) & + sig_ty trace(s"${lvl}. Finalizing inheritance with $thisType <: $finalType") { assert(finalType.level === lvl) @@ -1439,7 +1585,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val baseType = RecordType(Nil)(TypeProvenance(Loc(td.parents).map(_.left), "Object")) - val paramMems = typedParams.map(f => NuParam(f._1, f._2)(lvl)) + val paramMems = typedParams.getOrElse(Nil).map(f => + NuParam(f._1, f._2, isPublic = !privateParams.contains(f._1))(lvl)) val Pack(thisType, mxnMembers, _, baseClsMembers, traitMembers, tparamMembers) = inherit(typedParents, Pack(baseType, tparamMems ++ paramMems, N, Nil, Nil, Map.empty)) @@ -1448,21 +1595,33 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => ctx += "super" -> VarSymbol(thisType, Var("super")) val ttu = typeTypingUnit(td.body, S(td)) + // * `baseClsImplemMembers` actually also includes parameter members and their arg-based refinements val (baseClsImplemMembers, baseClsIfaceMembers) = baseClsMembers.partition(_.isImplemented) + println(s"baseClsImplemMembers ${baseClsImplemMembers}") + val newImplems = ttu.implementedMembers + val clsSigns = typedSignatureMembers.map(_._2) + + trace(s"Checking `this` accesses...") { + val toCheckImplems = newImplems.filter(_.isImplemented) + qualificationCheck(toCheckImplems, td.body.entities.filter { + case _: NuDecl => false + case _ => true + } ++ td.ctor.fold[Ls[Statement]](Nil)(s => s.body.stmts), baseClsMembers, clsSigns) + }() + // * Those member implementations we inherit from the base class that are not overridden val implemsInheritedFromBaseCls = { val possiblyOverridingNames = (newImplems.iterator ++ mxnMembers).map(_.name).toSet - baseClsImplemMembers.iterator + baseClsImplemMembers.iterator.distinctBy(_.name) .filterNot(possiblyOverridingNames contains _.name) .toList } // * ... must type check against the trait signatures - trace(s"Checking base class implementations...") { - println(implemsInheritedFromBaseCls, newImplems) + trace(s"Checking base class implementations against inherited signatures...") { overrideCheck(implemsInheritedFromBaseCls, traitMembers, Nil) }() @@ -1470,22 +1629,12 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => // * (but we already know the base class implems satisfy the baseClsMembers signatures) val ifaceMembers = membersInter(baseClsMembers, traitMembers) - val clsSigns = typedSignatureMembers.map(_._2) - // * We now check current and non-overridden mixin implementations against // * the signatures from the base class and traits val toCheck = (newImplems.iterator ++ mxnMembers).distinctBy(_.name).toList - - trace(s"Checking qualifications...") { - val toCheckImplems = newImplems.filter(_.isImplemented) - qualificationCheck(toCheckImplems, td.body.entities.filter { - case _: NuDecl => false - case _ => true - }, baseClsMembers, clsSigns) - }() - - trace(s"Checking new implementations...") { + + trace(s"Checking new implementations against inherited signatures...") { overrideCheck(toCheck, (clsSigns.iterator ++ ifaceMembers).distinctBy(_.name).toList, clsSigns) }() @@ -1496,23 +1645,89 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => ++ baseClsImplemMembers ).distinctBy(_.name) - overrideCheck(clsSigns, ifaceMembers, clsSigns) + trace(s"Checking new signatures against inherited signatures...") { + overrideCheck(clsSigns, ifaceMembers, clsSigns) + }() implemCheck(impltdMems, (clsSigns.iterator ++ ifaceMembers.iterator) - .distinctBy(_.name).filterNot(_.isImplemented).toList) + .distinctBy(_.name).filterNot(m => m.isImplemented || m.isDecl).toList) val allMembers = (ifaceMembers ++ impltdMems).map(d => d.name -> d).toMap ++ typedSignatureMembers + println(s"allMembers $allMembers") + + val auxCtorParams = td.ctor match { + case S(ctor @ Constructor(ps, bod)) => outerCtx.nest.nextLevel { implicit ctx => + def getterError(loco: Opt[Loc]) = + err(msg"Cannot use `val` in constructor parameters", loco) + val res = ps.fields.map { + case (S(nme), Fld(FldFlags(mut, spec, getter), value)) => + assert(!mut && !spec, "TODO") // TODO + if (getter) + // TODO we could support this to some extent + getterError(nme.toLoc) + value.toType match { + case R(tpe) => + implicit val newDefsInfo: Map[Str, (TypeDefKind, Int)] = Map.empty // TODO? (similar as one above in file) + val ty = typeType(tpe) + nme -> ty + case _ => ??? + } + case (N, Fld(FldFlags(mut, spec, getter), nme: Var)) => + assert(!mut && !spec, "TODO") // TODO + if (getter) + getterError(nme.toLoc) + nme -> freshVar(ttp(nme), N, S(nme.name)) + case (N, Fld(_, rhs)) => + Var("") -> err(msg"Unsupported constructor parameter shape", rhs.toLoc) + } + res.foreach { case (nme, ty) => ctx += nme.name -> VarSymbol(ty, nme) } + implicit val gl: GenLambdas = false + implicit val prov: TP = + TypeProvenance(ctor.toLoc, "auxiliary class constructor") + val bodStmts = bod match { + case Blk(sts) => sts + case _ => bod :: Nil + } + // * TODO later: for each `typedParams`, first add sthg like `ctx += lhs.name -> UndefinedParam(...)` + val classParamsMap = MutMap.from(typedParams.getOrElse(Nil).mapValues(some)) + bodStmts.foreach { + case Eqn(lhs, rhs) => + classParamsMap.updateWith(lhs) { + case S(S(p)) => + val rhs_ty = typeTerm(rhs) + constrain(rhs_ty, p.ub) + ctx += lhs.name -> VarSymbol(rhs_ty, lhs) + S(N) + case S(N) => + err(msg"Class parameter '${lhs.name}' was already set", lhs.toLoc) + N + case N => + err(msg"Unknown class parameter '${lhs.name}'", lhs.toLoc) + N + } + case stmt: DesugaredStatement => + typeStatement(stmt, allowPure = false) + case _ => die + } + S(res) + } + case N => N + } + TypedNuCls(outerCtx.lvl, td, - tparams, typedParams, allMembers, + tparams, + typedParams, + auxCtorParams.orElse(Option.when( + typedParams.isEmpty && (td.kind is Cls) && !td.isAbstract)(Nil)), + allMembers, TopType, sig_ty, inheritedTags, tparamMembers - )(thisType) - .tap(_.variances) // * Force variance computation + ).tap(_.variances) // * Force variance computation } case Mxn => @@ -1522,7 +1737,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => ctx.nest.nextLevel { implicit ctx => ctx ++= paramSymbols ctx ++= typedSignatures.map(nt => nt._1.name -> VarSymbol(nt._2, nt._1.nme)) - val paramMems = typedParams.map(f => NuParam(f._1, f._2)(lvl)) + val paramMems = typedParams.map(_.map(f => + f._1.name -> NuParam(f._1, f._2, !privateParams.contains(f._1))(lvl))).getOrElse(Nil).toMap val thisTV = freshVar(provTODO, N, S("this")) val superTV = freshVar(provTODO, N, S("super")) ctx += "this" -> VarSymbol(thisTV, Var("this")) @@ -1532,8 +1748,8 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => val signs = typedSignatureMembers.map(_._2) overrideCheck(impltdMems, signs, signs) implemCheck(impltdMems, signs) - val mems = impltdMems.map(m => m.name -> m).toMap ++ typedSignatureMembers - TypedNuMxn(outer.lvl, td, thisTV, superTV, tparams, typedParams, mems) + val mems = paramMems ++ impltdMems.map(m => m.name -> m).toMap ++ typedSignatureMembers + TypedNuMxn(outer.lvl, td, thisTV, superTV, tparams, typedParams.getOrElse(Nil), mems) } } @@ -1546,7 +1762,7 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => }(r => s"Completed ${r} where ${r.showBounds}") } - def typeSignature(implicit raise: Raise): ST = + def typeSignature(usesNew: Bool, loco: Opt[Loc])(implicit raise: Raise): ST = decl match { case _: NuFunDef => if (isComputing) { @@ -1558,7 +1774,15 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case _ => die } case td: NuTypeDef => - typeSignatureOf(td, level, tparams, typedParams, TopType, inheritedTags) + // * We want to avoid forcing completion of types needlessly + // * OTOH we need the type to be completed to use its aux ctor (whose param types are optional) + // * TODO: avoid forcing when the aux ctor has type-annotated params + if (usesNew && (td.ctor.isDefined || !td.params.isDefined)) complete() match { + case cls: TypedNuCls => + cls.typeSignature(usesNew, loco) + case _: TypedNuDummy => errType + case _ => die + } else typeSignatureOf(usesNew, loco, td, level, tparams, typedParams, N, TopType, inheritedTags) } override def toString: String = @@ -1581,15 +1805,24 @@ class NuTypeDefs extends ConstraintSolver { self: Typer => case _ => println(s"Assigning ${tn.name} :: ${_tv} := $targ where ${targ.showBounds}") val tv = - freshVar(_tv.prov, S(_tv), _tv.nameHint)(targ.level) + freshVar(_tv.prov, S(_tv), _tv.nameHint, + lbs = _tv.lowerBounds, + ubs = _tv.upperBounds, + )(targ.level) println(s"Set ${tv} ~> ${_tv}") assert(tv.assignedTo.isEmpty) + + // * Note: no checks that the assigned variable satisfies the bounds... + // * When we support bounded types, bounds check will be needed at the type definition site + assert(tv.lowerBounds.isEmpty, tv.lowerBounds) + assert(tv.upperBounds.isEmpty, tv.upperBounds) tv.assignedTo = S(targ) + // println(s"Assigned ${tv.assignedTo}") tv }) freshened += _tv -> tv - rawName+"#"+tn.name -> NuParam(tn, FieldType(S(tv), tv)(provTODO))(ctx.lvl) + rawName+"#"+tn.name -> NuParam(tn, FieldType(S(tv), tv)(provTODO), isPublic = true)(ctx.lvl) } freshened -> parTP.toMap diff --git a/shared/src/main/scala/mlscript/Parser.scala b/shared/src/main/scala/mlscript/Parser.scala index 9595ccb71..ba61c790b 100644 --- a/shared/src/main/scala/mlscript/Parser.scala +++ b/shared/src/main/scala/mlscript/Parser.scala @@ -101,7 +101,7 @@ class Parser(origin: Origin, indent: Int = 0, recordLocations: Bool = true) { Index ~~ (NAME ~ ":" ~ (noCommas | suite) | noCommas.map(Var("") -> _)).rep(1, ",").map(_.toList) ~ ",".!.? ~~ Index ).map { case (_, (Var(""), x) :: Nil, N, _) => x - case (i0, xs, _, i1) => Tup(xs.map { case (n, t) => (n optionIf (_.name.nonEmpty), Fld(FldFlags(false, false, false), t)) }).withLoc(i0, i1, origin) + case (i0, xs, _, i1) => Tup(xs.map { case (n, t) => (n optionIf (_.name.nonEmpty), Fld(FldFlags.empty, t)) }).withLoc(i0, i1, origin) } def booleans[p: P]: P[Term] = P(binops rep (1, kw("and")) rep (1, kw("or"))) // TODO locs diff --git a/shared/src/main/scala/mlscript/TypeSimplifier.scala b/shared/src/main/scala/mlscript/TypeSimplifier.scala index 67614c23e..180dff973 100644 --- a/shared/src/main/scala/mlscript/TypeSimplifier.scala +++ b/shared/src/main/scala/mlscript/TypeSimplifier.scala @@ -99,44 +99,44 @@ trait TypeSimplifier { self: Typer => val prefix = fnme.takeWhile(_ =/= '#') val postfix = fnme.drop(prefix.length + 1) lazy val default = fty.update(process(_ , N), process(_ , N)) - if (postfix.isEmpty) v -> default :: Nil + if (postfix.isEmpty || prefix.isEmpty) v -> default :: Nil else ctx.tyDefs.get(prefix) match { - case S(td) => - td.tvarVariances.fold(v -> default :: Nil)(tvv => - tvv(td.tparamsargs.find(_._1.name === postfix).getOrElse(die)._2) match { - case VarianceInfo(true, true) => Nil - case VarianceInfo(co, contra) => - if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil - else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil - else v -> default :: Nil - }) - case N => - // v -> default :: Nil - ctx.tyDefs2.get(prefix) match { - case S(info) => - info.result match { - case S(cls: TypedNuCls) => - cls.varianceOf(cls.tparams.find(_._1.name === postfix).getOrElse(die)._2) match { - case VarianceInfo(true, true) => Nil - case VarianceInfo(co, contra) => - if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil - else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil - else v -> default :: Nil - } - case S(trt: TypedNuTrt) => // TODO factor w/ above & generalize - trt.tparams.iterator.find(_._1.name === postfix).flatMap(_._3).getOrElse(VarianceInfo.in) match { - case VarianceInfo(true, true) => Nil - case VarianceInfo(co, contra) => - if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil - else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil - else v -> default :: Nil - } - case S(_) => ??? // TODO: - case N => - ??? // TODO use info.explicitVariances - } - case N => die - } + case S(td) => + td.tvarVariances.fold(v -> default :: Nil)(tvv => + tvv(td.tparamsargs.find(_._1.name === postfix).getOrElse(die)._2) match { + case VarianceInfo(true, true) => Nil + case VarianceInfo(co, contra) => + if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil + else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil + else v -> default :: Nil + }) + case N => + // v -> default :: Nil + ctx.tyDefs2.get(prefix) match { + case S(info) => + info.result match { + case S(cls: TypedNuCls) => + cls.varianceOf(cls.tparams.find(_._1.name === postfix).getOrElse(die)._2) match { + case VarianceInfo(true, true) => Nil + case VarianceInfo(co, contra) => + if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil + else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil + else v -> default :: Nil + } + case S(trt: TypedNuTrt) => // TODO factor w/ above & generalize + trt.tparams.iterator.find(_._1.name === postfix).flatMap(_._3).getOrElse(VarianceInfo.in) match { + case VarianceInfo(true, true) => Nil + case VarianceInfo(co, contra) => + if (co) v -> FieldType(S(BotType), process(fty.ub, N))(fty.prov) :: Nil + else if (contra) v -> FieldType(fty.lb.map(process(_, N)), TopType)(fty.prov) :: Nil + else v -> default :: Nil + } + case S(_) => ??? // TODO: + case N => + ??? // TODO use info.explicitVariances + } + case N => lastWords(s"'$prefix' not found") + } } })(ty.prov) @@ -763,7 +763,7 @@ trait TypeSimplifier { self: Typer => // * Note: a more precise version could be the following, // * but it doesn't seem to change anything in our test suite, so I left if commented for now: // // * Only consider recursive those variables that recursive in their *reachable* bounds: - // occNums.contains(true -> v) && v.isPosRecursive_$ || occNums.contains(false -> v) && v.isNegRecursive_$ + // occNums.contains(true -> v) && v.isPosRecursive_$(false) || occNums.contains(false -> v) && v.isNegRecursive_$(false) )).toSet var recVars = computeRecVars @@ -1126,7 +1126,7 @@ trait TypeSimplifier { self: Typer => case (tv, S(pol)) => if (pol) (true, tv.lowerBounds.foldLeft(BotType: ST)(_ | _)) -> tv else (false, tv.upperBounds.foldLeft(TopType: ST)(_ &- _)) -> tv - }.toMap + }.filter { case ((pol, bnd), tv) => bnd.getVarsImpl(includeBounds = false).contains(tv) }.toMap println(s"consed: $consed") @@ -1308,7 +1308,6 @@ trait TypeSimplifier { self: Typer => // * by merging things like function types together... // * So we need another pass of simplification! cur = simplifyType(cur, removePolarVars, pol) - // cur = simplifyType(simplifyType(cur)(ct) debugOutput(s"⬤ Resim: ${cur}") debugOutput(s" where: ${cur.showBounds}") diff --git a/shared/src/main/scala/mlscript/Typer.scala b/shared/src/main/scala/mlscript/Typer.scala index 42abe7630..ade4035c9 100644 --- a/shared/src/main/scala/mlscript/Typer.scala +++ b/shared/src/main/scala/mlscript/Typer.scala @@ -86,7 +86,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne val res = k(newCtx) val ec = newCtx.extrCtx assert(constrainedTypes || newCtx.extrCtx.isEmpty) - trace(s"UNSTASHING... (out)") { + if (ec.nonEmpty) trace(s"UNSTASHING... (out)") { implicit val ctx: Ctx = this ec.foreach { case (tv, bs) => bs.foreach { case (true, b) => constrain(b, tv) @@ -116,7 +116,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne println(s"Inferred poly constr: $cty —— where ${cty.showBounds}") val cty_fresh = - // * Samnity check: uncommenting this should change nothing (modulo type simplification randomness) + // * Sanity check: uncommenting this should change nothing (modulo type simplification randomness) // cty.freshenAbove(lvl, false) cty @@ -229,7 +229,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne private val preludeLoc = Loc(0, 0, Origin("", 0, new FastParseHelpers(""))) val nuBuiltinTypes: Ls[NuTypeDef] = Ls( - NuTypeDef(Cls, TN("Object"), Nil, N, N, N, Nil, N, N, TypingUnit(Nil))(N, N, N), + NuTypeDef(Cls, TN("Object"), Nil, N, N, N, Nil, N, N, TypingUnit(Nil))(N, N, S(preludeLoc)), NuTypeDef(Trt, TN("Eql"), (S(VarianceInfo.contra), TN("A")) :: Nil, N, N, N, Nil, N, N, TypingUnit(Nil))(N, N, S(preludeLoc)), NuTypeDef(Cls, TN("Num"), Nil, N, N, N, Nil, N, N, TypingUnit(Nil))(N, N, S(preludeLoc)), NuTypeDef(Cls, TN("Int"), Nil, N, N, N, Var("Num") :: Nil, N, N, TypingUnit(Nil))(N, N, S(preludeLoc)), @@ -867,13 +867,13 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne p.typeSignature case ti: TypedNuCls => checkNotAbstract(ti.decl) - ti.typeSignature + ti.typeSignature(false, prov.loco) case ti: TypedNuDecl => err(msg"${ti.kind.str} ${ti.name} cannot be used in term position", prov.loco) } case ti: DelayedTypeInfo => checkNotAbstract(ti.decl) - ti.typeSignature + ti.typeSignature(false, prov.loco) } } mkProxy(ty, prov) @@ -917,7 +917,9 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne Asc(v, t.toTypeRaise).withLoc(v.toLoc.fold(t.toLoc)(_ ++ t.toLoc |> some)))) case _ => e } - }.map { case (n, Fld(FldFlags(mut, _, _), t)) => + }.map { case (n, Fld(FldFlags(mut, spec, getter), t)) => + if (getter) + err(msg"Cannot use `val` in this position", Loc(t :: n.toList)) val tym = typePolymorphicTerm(t) // val tym = if (n.isDefined) typeType(t.toTypeRaise) // else typePolymorphicTerm(t) @@ -1024,6 +1026,42 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne val desug = If(IfThen(lhs, rhs), S(Var("false"))) term.desugaredTerm = S(desug) typeTerm(desug) + case App(f: Term, a @ Tup(fields)) if (fields.exists(x => x._1.isDefined)) => + def getLowerBoundFunctionType(t: SimpleType): List[FunctionType] = t.unwrapProvs match { + case PolymorphicType(_, AliasOf(fun_ty @ FunctionType(_, _))) => + List(fun_ty) + case tt @ FunctionType(_, _) => + List(tt) + case tv: TypeVariable => + tv.lowerBounds.map(getLowerBoundFunctionType(_)).flatten + case ct @ ComposedType(pol, lhs, rhs) => + if (pol === false) { + getLowerBoundFunctionType(lhs) ++ getLowerBoundFunctionType(rhs) + } else + Nil + case _ => + Nil + } + val f_ty = typeTerm(f) + val fun_tys: List[FunctionType] = getLowerBoundFunctionType(f_ty) + + fun_tys match { + case FunctionType(TupleType(fields), _) :: Nil => + val hasUntypedArg = fields.exists(_._1.isEmpty) + if (hasUntypedArg) { + err("Cannot use named arguments as the function type has untyped arguments", a.toLoc) + } else { + val argsList = fields.map(x => x._1 match { + case Some(arg) => arg + case N => die // cannot happen, because already checked with the hasUntypedArg + }) + desugarNamedArgs(term, f, a, argsList, f_ty) + } + case _ :: _ :: _ => + err(msg"More than one function signature found in type `${f_ty.expPos}` for function call with named arguments", f.toLoc) + case Nil | _ :: Nil => + err(msg"Cannot retrieve appropriate function signature from type `${f_ty.expPos}` for applying named arguments", f.toLoc) + } case App(f, a) => val f_ty = typeMonomorphicTerm(f) // * ^ Note: typing the function monomorphically simplifies type inference but @@ -1316,12 +1354,46 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne } } ret_ty - case New(S((nmedTy, trm)), TypingUnit(Nil)) => + case New(S((nmedTy, trm)), TypingUnit(Nil)) if !newDefs => typeMonomorphicTerm(App(Var(nmedTy.base.name).withLocOf(nmedTy), trm)) + case nw @ New(S((nmedTy, trm: Tup)), TypingUnit(Nil)) if newDefs => + typeMonomorphicTerm(App(New(S((nmedTy, UnitLit(true))), TypingUnit(Nil)).withLocOf(nw), trm)) + case New(S((nmedTy, UnitLit(true))), TypingUnit(Nil)) if newDefs => + if (nmedTy.targs.nonEmpty) + err(msg"Type arguments in `new` expressions are not yet supported", prov.loco) + ctx.get(nmedTy.base.name).fold(err("identifier not found: " + nmedTy.base, term.toLoc): ST) { + case AbstractConstructor(absMths, traitWithMths) => die + case VarSymbol(ty, _) => + err(msg"Cannot use `new` on non-class variable of type ${ty.expPos}", term.toLoc) + case lti: LazyTypeInfo => + def checkNotAbstract(decl: NuDecl) = + if (decl.isAbstract) + err(msg"Class ${decl.name} is abstract and cannot be instantiated", term.toLoc) + lti match { + case ti: CompletedTypeInfo => + ti.member match { + case _: TypedNuFun | _: NuParam => + err(msg"${ti.member.kind.str.capitalize} ${ti.member.name + } cannot be used in `new` expression", prov.loco) + case ti: TypedNuCls => + checkNotAbstract(ti.decl) + ti.typeSignature(true, prov.loco) + case ti: TypedNuDecl => + err(msg"${ti.kind.str.capitalize} ${ti.name + } cannot be used in term position", prov.loco) + } + case dti: DelayedTypeInfo if !(dti.kind is Cls) => + err(msg"${dti.kind.str.capitalize} ${dti.name + } cannot be used in `new` expression", prov.loco) + case dti: DelayedTypeInfo => + checkNotAbstract(dti.decl) + dti.typeSignature(true, prov.loco) + } + } case New(base, args) => err(msg"Currently unsupported `new` syntax", term.toCoveringLoc) - case TyApp(_, _) => - // ??? // TODO handle - err(msg"Type application syntax is not yet supported", term.toLoc) + case TyApp(base, _) => + err(msg"Type application syntax is not yet supported", term.toLoc) // TODO handle + typeTerm(base) case Where(bod, sts) => typeTerms(sts :+ bod, false, Nil, allowPure = true) case Forall(vs, bod) => @@ -1454,7 +1526,7 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne (implicit ctx: Ctx, raise: Raise, prov: TypeProvenance, vars: Map[Str, SimpleType], genLambdas: GenLambdas): SimpleType = term match { case (trm @ Var(nme)) :: sts if rcd => // field punning - typeTerms(Tup(S(trm) -> Fld(FldFlags(false, false, false), trm) :: Nil) :: sts, rcd, fields) + typeTerms(Tup(S(trm) -> Fld(FldFlags.empty, trm) :: Nil) :: sts, rcd, fields) case Blk(sts0) :: sts1 => typeTerms(sts0 ::: sts1, rcd, fields) case Tup(Nil) :: sts => typeTerms(sts, rcd, fields) case Tup((no, Fld(FldFlags(tmut, _, _), trm)) :: ofs) :: sts => @@ -1524,6 +1596,77 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne } else TupleType(fields.reverseIterator.mapValues(_.toUpper(noProv)))(prov) } + def getNewVarName(prefix: Str, nonValidVars: Set[Var]): Str = { + // we check all possibe prefix_num combination, till we find one that is not in the nonValidVars + val ints = LazyList.from(1) + prefix + "_" + ints.find(index => { + !nonValidVars.contains(Var(prefix + "_" + index)) + }).getOrElse(die) + } + + def desugarNamedArgs(term: Term, f: Term, a: Tup, argsList: List[Var], f_ty: ST) + (implicit ctx: Ctx, raise: Raise, vars: Map[Str, SimpleType]): SimpleType = { + def rec (as: List[(String -> Fld) -> Boolean], acc: Map[String, Either[Var, Term]]): Term = { + as match { + case ((v, fld), isNamed) :: tail => + if (isNamed) { + fld.value match { + case _: Lit | _: Var => + rec(tail, acc + (v -> R(fld.value))) + case _ => + val newVar = Var(getNewVarName(v, a.freeVars)) + Let(false, newVar, fld.value, rec(tail, acc + (v -> L(newVar)))) + } + } else { + rec(tail, acc + (v -> R(fld.value))) + } + case Nil => + val y: Term = Tup(argsList.map(x => + acc.get(x.name) match { + case Some(Left(v)) => (None, Fld(FldFlags.empty, v)) + case Some(Right(t)) => (None, Fld(FldFlags.empty, t)) + case None => + err(msg"Argument named '${x.name}' is missing from this function call", a.toLoc) + (None, Fld(FldFlags.empty, Var("error"))) + } + )) + App(f, y) + } + } + val hasDefined = a.fields.exists(x => x._1.isDefined) + val hasEmpty = a.fields.exists(x => x._1.isEmpty) + val areArgsMisplaced = a.fields.indexWhere(x => x._1.isDefined) < a.fields.lastIndexWhere(x => x._1.isEmpty) + if (hasDefined && + hasEmpty && + areArgsMisplaced) { + err(msg"Unnamed arguments should appear first when using named arguments", a.toLoc) + } else + a.fields.sizeCompare(argsList) match { + case 0 => + val as = a.fields.zipWithIndex.map{ + case(x, idx) => + x._1 match { + case Some(value) => + ((value.name, x._2), true) + case N => + ((argsList(idx).name, x._2), false) + }} + val asGroupedByVarName = as.groupBy(x => x._1._1) + if (asGroupedByVarName.sizeCompare(argsList) < 0) { + asGroupedByVarName.foreach(x => + x._2 match { + case x1 :: y1 :: xs => err(msg"Argument for parameter '${x._1}' is duplicated", a.toLoc) + case _ => + }) + } + val desugared = rec(as, Map()) + println("Desugared is here => " + desugared) + term.desugaredTerm = S(desugared) + typeTerm(desugared)(ctx = ctx, raise = raise, vars = vars, genLambdas = false) + case _ => + err(msg"Number of arguments doesn't match function signature `${f_ty.expPos}`", a.toLoc) + } + } /** Convert an inferred SimpleType into the immutable Type representation. */ def expandType(st: TypeLike, stopAtTyVars: Bool = false)(implicit ctx: Ctx): mlscript.TypeLike = { @@ -1562,25 +1705,35 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne case TypedNuMxn(level, td, thisTy, superTy, tparams, params, members) => ectx(tparams) |> { implicit ectx => NuTypeDef(td.kind, td.nme, td.tparams, - S(Tup(params.map(p => N -> Fld(FldFlags(false, false, false), Asc(p._1, go(p._2.ub)))))), + S(Tup(params.map(p => N -> Fld(FldFlags.empty, Asc(p._1, go(p._2.ub)))))), N,//TODO N, Nil, // TODO mixin parents? Option.when(!(TopType <:< superTy))(go(superTy)), Option.when(!(TopType <:< thisTy))(go(thisTy)), - mkTypingUnit(thisTy, members))(td.declareLoc, td.exportLoc, td.abstractLoc) + mkTypingUnit(thisTy, members) + )(td.declareLoc, td.exportLoc, td.abstractLoc) } - case TypedNuCls(level, td, tparams, params, members, thisTy, sign, ihtags, ptps) => + case TypedNuCls(level, td, tparams, params, acParams, members, thisTy, sign, ihtags, ptps) => ectx(tparams) |> { implicit ectx => NuTypeDef(td.kind, td.nme, td.tparams, - Opt.when(td.params.isDefined)(Tup(params.map(p => N -> Fld(FldFlags(false, false, false), Asc(p._1, go(p._2.ub)))))), + params.map(ps => Tup(ps.map(p => N -> Fld(FldFlags.empty, Asc(p._1, go(p._2.ub)))))), td.ctor, Option.when(!(TopType <:< sign))(go(sign)), ihtags.toList.sorted.map(_.toVar), // TODO provide targs/args N,//TODO Option.when(!(TopType <:< thisTy))(go(thisTy)), - mkTypingUnit(thisTy, members))(td.declareLoc, td.exportLoc, td.abstractLoc) - } + { + val tun = mkTypingUnit(thisTy, members) + acParams match { + case S(ps) => TypingUnit(Constructor( + Tup(ps.map(p => N -> Fld(FldFlags.empty, Asc(p._1, go(p._2))))), + Blk(Nil)) :: tun.entities) + case N => tun + } + } + )(td.declareLoc, td.exportLoc, td.abstractLoc) + } case TypedNuTrt(level, td, tparams, members, thisTy, sign, ihtags, ptps) => ectx(tparams) |> { implicit ectx => NuTypeDef(td.kind, td.nme, td.tparams, @@ -1590,8 +1743,9 @@ class Typer(var dbg: Boolean, var verbose: Bool, var explainErrors: Bool, val ne ihtags.toList.sorted.map(_.toVar), // TODO provide targs/args N,//TODO Option.when(!(TopType <:< thisTy))(go(thisTy)), - mkTypingUnit(thisTy, members))(td.declareLoc, td.exportLoc, td.abstractLoc) - } + mkTypingUnit(thisTy, members) + )(td.declareLoc, td.exportLoc, td.abstractLoc) + } case tf @ TypedNuFun(level, fd, bodyTy) => NuFunDef(fd.isLetRec, fd.nme, fd.symbolicNme, Nil, R(go(tf.typeSignature)))(fd.declareLoc, fd.exportLoc, fd.virtualLoc, fd.signature, fd.outer, fd.genField) case p: NuParam => diff --git a/shared/src/main/scala/mlscript/TyperDatatypes.scala b/shared/src/main/scala/mlscript/TyperDatatypes.scala index ef81812c0..a8af3d047 100644 --- a/shared/src/main/scala/mlscript/TyperDatatypes.scala +++ b/shared/src/main/scala/mlscript/TyperDatatypes.scala @@ -41,12 +41,14 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => sealed abstract class LazyTypeInfo extends TypeInfo { def complete()(implicit raise: Raise): NuMember def kind: DeclKind + def name: Str } /** A LazyTypeInfo whose typing has been completed. */ case class CompletedTypeInfo(member: NuMember) extends LazyTypeInfo { def complete()(implicit raise: Raise): NuMember = member def kind: DeclKind = member.kind + val name: Str = member.name } /** Initialized lazy type information, to be computed soon. */ @@ -198,7 +200,10 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => Overload(alts.map(ft => FunctionType(f(pol.contravar, ft.lhs), f(pol, ft.rhs))(ft.prov)))(prov) def approximatePos: FunctionType = { val (lhss, rhss) = alts.map(ft => ft.lhs -> ft.rhs).unzip - FunctionType(lhss.reduce(_ & _), rhss.reduce(_ | _))(prov) + FunctionType(lhss.reduce(_ | _), rhss.reduce(_ | _))(prov) + // * Note: technically the following is another valid (but probably less useful) + // * approximation of the same function type: + // FunctionType(lhss.reduce(_ & _), rhss.reduce(_ & _))(prov) } lazy val level: Level = levelBelow(MaxLevel)(MutSet.empty) def levelBelow(ub: Level)(implicit cache: MutSet[TV]): Level = @@ -603,14 +608,19 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => } /** None: not recursive in this bound; Some(Some(pol)): polarly-recursive; Some(None): nonpolarly-recursive. * Note that if we have something like 'a :> Bot <: 'a -> Top, 'a is not truly recursive - * and its bounds can actually be inlined. */ + * and its bounds can actually be inlined. + * Also note that unfortunately, contrary to whta I previously thought, + * it is not sound to ignore quantified variables during the getVarsPol search. + * indeed, we can be in freaky situations like in `ListBuild.mls` + * where we have `'a :> Ls[('x, forall 'a. 'a)]`! */ private[mlscript] final def lbRecOccs_$(omitIrrelevantVars: Bool)(implicit ctx: Ctx): Opt[Opt[Bool]] = { // println("+", this, assignedTo getOrElse lowerBounds) // assignedTo.getOrElse(TupleType(lowerBounds.map(N -> _.toUpper(noProv)))(noProv)).getVarsPol(PolMap.pos, ignoreTopLevelOccs = true).get(this) val bs = assignedTo.fold(lowerBounds)(_ :: Nil) bs.foldLeft(BotType: ST)(_ | _).getVarsPol(PolMap.pos, ignoreTopLevelOccs = omitIrrelevantVars, - ignoreQuantifiedVars = omitIrrelevantVars, + // ignoreQuantifiedVars = omitIrrelevantVars, + ignoreQuantifiedVars = false, ).get(this) } private[mlscript] final def ubRecOccs_$(omitIrrelevantVars: Bool)(implicit ctx: Ctx): Opt[Opt[Bool]] ={ @@ -619,7 +629,8 @@ abstract class TyperDatatypes extends TyperHelpers { Typer: Typer => val bs = assignedTo.fold(upperBounds)(_ :: Nil) bs.foldLeft(TopType: ST)(_ & _).getVarsPol(PolMap.posAtNeg, ignoreTopLevelOccs = omitIrrelevantVars, - ignoreQuantifiedVars = omitIrrelevantVars, + // ignoreQuantifiedVars = omitIrrelevantVars, + ignoreQuantifiedVars = false, ).get(this) // .tap(r => println(s"= $r")) } diff --git a/shared/src/main/scala/mlscript/TyperHelpers.scala b/shared/src/main/scala/mlscript/TyperHelpers.scala index cd1503eed..34572622d 100644 --- a/shared/src/main/scala/mlscript/TyperHelpers.scala +++ b/shared/src/main/scala/mlscript/TyperHelpers.scala @@ -92,6 +92,7 @@ abstract class TyperHelpers { Typer: Typer => def subst(st: SimpleType, map: Map[SimpleType, SimpleType], substInMap: Bool = false) (implicit ctx: Ctx): SimpleType = { val cache: MutMap[TypeVariable, SimpleType] = MutMap.empty + implicit val freshened: MutMap[TV, ST] = MutMap.empty val subsLvl: Level = map.valuesIterator.map(_.level).reduceOption(_ max _).getOrElse(MinLevel) def go(st: SimpleType): SimpleType = { // trace(s"subst($st)") { @@ -116,7 +117,7 @@ abstract class TyperHelpers { Typer: Typer => v }) case poly: PolymorphicType if poly.polymLevel < subsLvl => - go(poly.raiseLevelTo(subsLvl)) + go(poly.raiseLevelToImpl(subsLvl, Set.empty)) case _ => st.map(go(_)) } } @@ -782,7 +783,7 @@ abstract class TyperHelpers { Typer: Typer => def childrenPolField(pol: PolMap)(fld: FieldType): List[PolMap -> SimpleType] = fld.lb.map(pol.contravar -> _).toList ::: pol.covar -> fld.ub :: Nil def childrenPolMem(m: NuMember): List[PolMap -> SimpleType] = m match { - case NuParam(nme, ty) => childrenPolField(PolMap.pos)(ty) // TODO invariant when mutable + case NuParam(nme, ty, pub) => childrenPolField(PolMap.pos)(ty) // TODO invariant when mutable case TypedNuFun(level, fd, ty) => pol -> ty :: Nil case td: TypedNuDecl => TypedTypingUnit(td :: Nil, N).childrenPol(pol: PolMap) // TODO refactor // case NuTypeParam(nme, ty) => childrenPolField(PolMap.pos)(ty) @@ -829,11 +830,12 @@ abstract class TyperHelpers { Typer: Typer => case cls: TypedNuCls => cls.tparams.iterator.map(pol.invar -> _._2) ++ // cls.params.flatMap(p => childrenPolField(pol.invar)(p._2)) - cls.params.flatMap(p => childrenPolField(PolMap.pos)(p._2)) ++ + cls.params.toList.flatMap(_.flatMap(p => childrenPolField(PolMap.pos)(p._2))) ++ + cls.auxCtorParams.toList.flatMap(_.map(PolMap.neg -> _._2)) ++ cls.members.valuesIterator.flatMap(childrenPolMem) ++ S(pol.contravar -> cls.thisTy) ++ S(pol.covar -> cls.sign) ++ - S(pol.covar -> cls.instanceType) ++ + // S(pol.covar -> cls.instanceType) ++ // Not a real child; to remove cls.parentTP.valuesIterator.flatMap(childrenPolMem) case trt: TypedNuTrt => trt.tparams.iterator.map(pol.invar -> _._2) ++ @@ -920,11 +922,32 @@ abstract class TyperHelpers { Typer: Typer => res.toSortedMap } - private def childrenMem(m: NuMember): List[ST] = m match { - case NuParam(nme, ty) => ty.lb.toList ::: ty.ub :: Nil - case TypedNuFun(level, fd, ty) => ty :: Nil + private def childrenMem(m: NuMember): IterableOnce[ST] = m match { + case tf: TypedNuFun => + tf.bodyType :: Nil + case als: TypedNuAls => + als.tparams.iterator.map(_._2) ++ S(als.body) + case mxn: TypedNuMxn => + mxn.tparams.iterator.map(_._2) ++ + mxn.members.valuesIterator.flatMap(childrenMem) ++ + S(mxn.superTy) ++ + S(mxn.thisTy) + case cls: TypedNuCls => + cls.tparams.iterator.map(_._2) ++ + cls.params.toList.flatMap(_.flatMap(p => p._2.lb.toList ::: p._2.ub :: Nil)) ++ + cls.auxCtorParams.toList.flatMap(_.values) ++ + cls.members.valuesIterator.flatMap(childrenMem) ++ + S(cls.thisTy) ++ + S(cls.sign) + case trt: TypedNuTrt => + trt.tparams.iterator.map(_._2) ++ + trt.members.valuesIterator.flatMap(childrenMem) ++ + S(trt.thisTy) ++ + S(trt.sign) ++ + trt.parentTP.valuesIterator.flatMap(childrenMem) + case p: NuParam => + p.ty.lb.toList ::: p.ty.ub :: Nil case TypedNuDummy(d) => Nil - case _ => Nil // TODO } def children(includeBounds: Bool): List[SimpleType] = this match { case tv @ AssignedVariable(ty) => if (includeBounds) ty :: Nil else Nil @@ -948,49 +971,23 @@ abstract class TyperHelpers { Typer: Typer => case ConstrainedType(cs, und) => cs.flatMap(lu => lu._1 :: lu._2 :: Nil) ::: und :: Nil case SpliceType(fs) => fs.flatMap{ case L(l) => l :: Nil case R(r) => r.lb.toList ::: r.ub :: Nil} case OtherTypeLike(tu) => - // tu.childrenPol(PolMap.neu).map(tp => tp._1) - val ents = tu.implementedMembers.flatMap { - case tf: TypedNuFun => - tf.bodyType :: Nil - case als: TypedNuAls => - als.tparams.iterator.map(_._2) ++ S(als.body) - case mxn: TypedNuMxn => - mxn.tparams.iterator.map(_._2) ++ - mxn.members.valuesIterator.flatMap(childrenMem) ++ - S(mxn.superTy) ++ - S(mxn.thisTy) - case cls: TypedNuCls => - cls.tparams.iterator.map(_._2) ++ - cls.params.flatMap(p => p._2.lb.toList ::: p._2.ub :: Nil) ++ - cls.members.valuesIterator.flatMap(childrenMem) ++ - S(cls.thisTy) ++ - S(cls.sign) ++ - S(cls.instanceType) - case trt: TypedNuTrt => - trt.tparams.iterator.map(_._2) ++ - trt.members.valuesIterator.flatMap(childrenMem) ++ - S(trt.thisTy) ++ - S(trt.sign) ++ - trt.parentTP.valuesIterator.flatMap(childrenMem) - case p: NuParam => - p.ty.lb.toList ::: p.ty.ub :: Nil - case TypedNuDummy(d) => Nil - } + val ents = tu.implementedMembers.flatMap(childrenMem) ents ::: tu.result.toList } - def getVars: SortedSet[TypeVariable] = { + def getVarsImpl(includeBounds: Bool): SortedSet[TypeVariable] = { val res = MutSet.empty[TypeVariable] @tailrec def rec(queue: List[TypeLike]): Unit = queue match { case (tv: TypeVariable) :: tys => if (res(tv)) rec(tys) - else { res += tv; rec(tv.children(includeBounds = true) ::: tys) } - case ty :: tys => rec(ty.children(includeBounds = true) ::: tys) + else { res += tv; rec(tv.children(includeBounds = includeBounds) ::: tys) } + case ty :: tys => rec(ty.children(includeBounds = includeBounds) ::: tys) case Nil => () } rec(this :: Nil) SortedSet.from(res)(Ordering.by(_.uid)) } + def getVars: SortedSet[TypeVariable] = getVarsImpl(includeBounds = true) def showBounds: String = getVars.iterator.filter(tv => tv.assignedTo.nonEmpty || (tv.upperBounds ++ tv.lowerBounds).nonEmpty).map { @@ -1021,9 +1018,13 @@ abstract class TyperHelpers { Typer: Typer => } def raiseLevelTo(newPolymLevel: Level, leaveAlone: Set[TV] = Set.empty) (implicit ctx: Ctx): PolymorphicType = { + implicit val freshened: MutMap[TV, ST] = MutMap.empty + raiseLevelToImpl(newPolymLevel, leaveAlone) + } + def raiseLevelToImpl(newPolymLevel: Level, leaveAlone: Set[TV]) + (implicit ctx: Ctx, freshened: MutMap[TV, ST]): PolymorphicType = { require(newPolymLevel >= polymLevel) if (newPolymLevel === polymLevel) return this - implicit val freshened: MutMap[TV, ST] = MutMap.empty PolymorphicType(newPolymLevel, Typer.freshenAbove(polymLevel, body, leaveAlone = leaveAlone)( ctx.copy(lvl = newPolymLevel + 1), // * Q: is this really fine? cf. stashing/unstashing etc. @@ -1103,7 +1104,7 @@ abstract class TyperHelpers { Typer: Typer => info.result match { case S(td: TypedNuAls) => assert(td.tparams.size === targs.size) - substSyntax(td.body)(td.tparams.lazyZip(targs).map { + subst(td.body, td.tparams.lazyZip(targs).map { case (tp, ta) => SkolemTag(tp._2)(noProv) -> ta }.toMap) case S(td: TypedNuTrt) => @@ -1300,9 +1301,10 @@ abstract class TyperHelpers { Typer: Typer => case TypedNuAls(level, td, tparams, body) => tparams.iterator.foreach(tp => apply(pol.invar)(tp._2)) apply(pol)(body) - case TypedNuCls(level, td, tparams, params, members, thisTy, sign, _, ptps) => + case TypedNuCls(level, td, tparams, params, acParams, members, thisTy, sign, _, ptps) => tparams.iterator.foreach(tp => apply(pol.invar)(tp._2)) - params.foreach(p => applyField(pol)(p._2)) + params.foreach(_.foreach(p => applyField(pol)(p._2))) + acParams.foreach(_.foreach(p => apply(pol.contravar)(p._2))) members.valuesIterator.foreach(applyMem(pol)) apply(pol.contravar)(thisTy) apply(pol.contravar)(sign) @@ -1319,7 +1321,7 @@ abstract class TyperHelpers { Typer: Typer => members.valuesIterator.foreach(applyMem(pol)) apply(pol.contravar)(thisTy) apply(pol.contravar)(superTy) - case NuParam(nme, ty) => applyField(pol)(ty) + case NuParam(nme, ty, pub) => applyField(pol)(ty) case TypedNuFun(level, fd, ty) => apply(pol)(ty) case TypedNuDummy(d) => () // case NuTypeParam(nme, ty) => applyField(pol)(ty) diff --git a/shared/src/main/scala/mlscript/codegen/Codegen.scala b/shared/src/main/scala/mlscript/codegen/Codegen.scala index d753681a9..b49da9d19 100644 --- a/shared/src/main/scala/mlscript/codegen/Codegen.scala +++ b/shared/src/main/scala/mlscript/codegen/Codegen.scala @@ -942,6 +942,11 @@ final case class JSComment(text: Str) extends JSStmt { def toSourceCode: SourceCode = SourceCode(s"// $text") } +final case class JSParenthesis(exp: JSExpr) extends JSExpr { + implicit def precedence: Int = 0 + def toSourceCode: SourceCode = exp.embed +} + object JSCodeHelpers { def id(name: Str): JSIdent = JSIdent(name) def lit(value: Int): JSLit = JSLit(value.toString()) diff --git a/shared/src/main/scala/mlscript/codegen/Helpers.scala b/shared/src/main/scala/mlscript/codegen/Helpers.scala index f5eca1046..2ffcbdcf9 100644 --- a/shared/src/main/scala/mlscript/codegen/Helpers.scala +++ b/shared/src/main/scala/mlscript/codegen/Helpers.scala @@ -49,14 +49,14 @@ object Helpers { val elems = fs.map{case L(l) => s"...${inspect(l)}" case R(Fld(_, r)) => inspect(r)}.mkString(", ") s"Splc($elems)" case If(bod, els) => s"If(${inspect(bod)}, ${els.map(inspect)})" - case New(base, body) => s"New(${base}, ${body})" + case New(base, body) => s"New(${base}, ${inspect(body)})" case TyApp(base, targs) => s"TyApp(${inspect(base)}, ${targs})" case Def(rec, nme, rhs, isByname) => s"Def($rec, $nme, ${rhs.fold(inspect, "" + _)}, $isByname)" case Where(bod, sts) => s"Where(${inspect(bod)}, ...)" case Forall(ps, bod) => s"Forall($ps, ${inspect(bod)})" case Inst(bod) => s"Inst(${inspect(bod)})" - case Eqn(lhs, rhs) => s"Ass(${inspect(lhs)}, ${inspect(rhs)})" + case Eqn(lhs, rhs) => s"Eqn(${inspect(lhs)}, ${inspect(rhs)})" case Super() => "Super()" case AdtMatchWith(cond, arms) => s"match ${inspect(cond)} with ${arms.map(patmat => s"${inspect(patmat.pat)} -> ${inspect(patmat.rhs)}").mkString(" | ")}" diff --git a/shared/src/main/scala/mlscript/codegen/Polyfill.scala b/shared/src/main/scala/mlscript/codegen/Polyfill.scala index c5d1b5230..9a01564dd 100644 --- a/shared/src/main/scala/mlscript/codegen/Polyfill.scala +++ b/shared/src/main/scala/mlscript/codegen/Polyfill.scala @@ -176,6 +176,9 @@ object Polyfill { buffer += BuiltinFunc( "log", fn(_, param("x")) { `return` { id("console.info")(id("x")) } } ) + buffer += BuiltinFunc( + "discard", fn(_, param("x"))() + ) buffer.toList } diff --git a/shared/src/main/scala/mlscript/codegen/Scope.scala b/shared/src/main/scala/mlscript/codegen/Scope.scala index fdb288251..80afdc311 100644 --- a/shared/src/main/scala/mlscript/codegen/Scope.scala +++ b/shared/src/main/scala/mlscript/codegen/Scope.scala @@ -59,6 +59,7 @@ class Scope(val name: Str, enclosing: Opt[Scope]) { "eq", "unit", "log", + "discard", ) foreach { name => register(BuiltinSymbol(name, name)) } diff --git a/shared/src/main/scala/mlscript/helpers.scala b/shared/src/main/scala/mlscript/helpers.scala index f2e4445c6..4aed52aa3 100644 --- a/shared/src/main/scala/mlscript/helpers.scala +++ b/shared/src/main/scala/mlscript/helpers.scala @@ -28,6 +28,8 @@ trait TypeLikeImpl extends Located { self: TypeLike => case Field(S(lb), Top) => s"in ${lb.showIn(ctx, 0)}" case Field(S(lb), ub) => s"in ${lb.showIn(ctx, 0)} out ${ub.showIn(ctx, 0)}" } + private def showFields(fs: Ls[Opt[Var] -> Field], ctx: ShowCtx): Ls[Str] = + fs.map(nt => s"${nt._2.mutStr}${nt._1.fold("")(_.name + ": ")}${showField(nt._2, ctx)}") def showIn(ctx: ShowCtx, outerPrec: Int): Str = this match { // TODO remove obsolete pretty-printing hacks case Top => "anything" @@ -43,7 +45,7 @@ trait TypeLikeImpl extends Located { self: TypeLike => case Nil => "()" case N -> Field(N, f) :: Nil if !f.isInstanceOf[Tuple] => f.showIn(ctx, 31) case _ => - val inner = fs.map(nt => s"${nt._2.mutStr}${nt._1.fold("")(_.name + ": ")}${showField(nt._2, ctx)}") + val inner = showFields(fs, ctx) if (ctx.newDefs) inner.mkString("(", ", ", ")") else inner.mkString("(", ", ", ",)") } parensIf(innerStr + " -> " + r.showIn(ctx, 30), outerPrec > 30) @@ -51,7 +53,8 @@ trait TypeLikeImpl extends Located { self: TypeLike => parensIf("(..." + l.showIn(ctx, 0) + ") -> " + r.showIn(ctx, 30), outerPrec > 30) case Function(l, r) => parensIf(l.showIn(ctx, 31) + " -> " + r.showIn(ctx, 30), outerPrec > 30) case Neg(t) => s"~${t.showIn(ctx, 100)}" - case Record(fs) => fs.map { nt => + case Record(fs) => + val strs = fs.map { nt => val nme = nt._1.name if (nme.isCapitalized) nt._2 match { case Field(N | S(Bot), Top) => s"$nme" @@ -61,12 +64,16 @@ trait TypeLikeImpl extends Located { self: TypeLike => case Field(S(lb), ub) => s"$nme :> ${lb.showIn(ctx, 0)} <: ${ub.showIn(ctx, 0)}" } else s"${nt._2.mutStr}${nme}: ${showField(nt._2, ctx)}" - }.mkString("{", ", ", "}") + } + if (strs.foldLeft(0)(_ + _.length) > 80) + strs.mkString("{\n" + ctx.indStr, ",\n" + ctx.indStr, "") + .indentNewLines(ShowCtx.indentation) + "\n" + ctx.indStr + "}" + else strs.mkString("{", ", ", "}") case Splice(fs) => val inner = fs.map{case L(l) => s"...${l.showIn(ctx, 0)}" case R(r) => s"${showField(r, ctx)}"} if (ctx.newDefs) inner.mkString("[", ", ", "]") else inner.mkString("(", ", ", ")") case Tuple(fs) => - val inner = fs.map(nt => s"${nt._2.mutStr}${nt._1.fold("")(_.name + ": ")}${showField(nt._2, ctx)}") + val inner = showFields(fs, ctx) if (ctx.newDefs) inner.mkString("[", ", ", "]") else inner.mkString("(", ", ", if (fs.nonEmpty) ",)" else ")") case Union(TypeName("true"), TypeName("false")) | Union(TypeName("false"), TypeName("true")) => @@ -98,7 +105,8 @@ trait TypeLikeImpl extends Located { self: TypeLike => case Literal(IntLit(n)) => n.toString case Literal(DecLit(n)) => n.toString case Literal(StrLit(s)) => "\"" + s + "\"" - case Literal(UnitLit(b)) => if (b) "undefined" else "null" + case Literal(UnitLit(b)) => + if (b) if (ctx.newDefs) "()" else "undefined" else "null" case PolyType(Nil, body) => body.showIn(ctx, outerPrec) case PolyType(targs, body) => parensIf( s"${targs.iterator.map(_.fold(_.name, _.showIn(ctx, 0))) @@ -130,10 +138,10 @@ trait TypeLikeImpl extends Located { self: TypeLike => case Bounds(lo, hi) => s"\n${ctx.indStr}${lo.showIn(ctx, 0)} <: ${hi.showIn(ctx, 0)}" // TODO print differently from bs? }.mkString}" }, outerPrec > 0) - case NuFunDef(isLetRec, nme, snme, targs, rhs) => + case fd @ NuFunDef(isLetRec, nme, snme, targs, rhs) => s"${isLetRec match { - case S(false) => "let" - case S(true) => "let rec" + case S(false) => if (fd.genField) "val" else "let" + case S(true) => if (fd.genField) die else "let rec" case N => "fun" }}${snme.fold("")(" (" + _.name + ")") } ${nme.name}${targs.map(_.showIn(ctx, 0)).mkStringOr(", ", "[", "]")}${rhs match { @@ -141,15 +149,17 @@ trait TypeLikeImpl extends Located { self: TypeLike => case R(ty) => ": " + ty.showIn(ctx, 0) }}" case Signature(decls, res) => - // decls.map(ctx.indStr + (if (ctx.indentLevel === 0) "" else "\n") + _.showIn(ctx, 0)).mkString + (decls.map(ctx.indStr + _.showIn(ctx, 0) + "\n") ::: (res match { case S(ty) => ctx.indStr + ty.showIn(ctx, 0) + "\n" :: Nil case N => Nil - // })).mkString(if (ctx.indentLevel === 0) "" else "\n", "\n", "") - // })).mkString("\n") - // })).mkString("", "\n", "\n") })).mkString case NuTypeDef(kind @ Als, nme, tparams, params, ctor, sig, parents, sup, ths, body) => + assert(params.isEmpty, params) + assert(ctor.isEmpty, ctor) + assert(parents.isEmpty, parents) + assert(sup.isEmpty, sup) + assert(ths.isEmpty, ths) + assert(body.entities.isEmpty, body) s"type ${nme.name}${tparams.map(_._2.showIn(ctx, 0)).mkStringOr(", ", "[", "]")} = ${ sig.getOrElse(die).showIn(ctx, 0)}" case td @ NuTypeDef(kind, nme, tparams, params, ctor, sig, parents, sup, ths, body) => @@ -158,8 +168,7 @@ trait TypeLikeImpl extends Located { self: TypeLike => nme.name}${tparams.map(_._2.showIn(ctx, 0)).mkStringOr(", ", "[", "]")}${params match { case S(Tup(fields)) => s"(${fields.map { case (N, Fld(_, Asc(v: Var, ty))) => v.name + ": " + ty.showIn(ctx, 0) - case (N, _) => "???" - case (S(nme), rhs) => nme.name + case (N | S(_), _) => lastWords("ill-formed type definition parameter") }.mkString(", ")})" case _ => "" }}${sig.fold("")(": " + _.showIn(bodyCtx, 0))}${parents match { @@ -168,6 +177,13 @@ trait TypeLikeImpl extends Located { self: TypeLike => }}${if (body.entities.isEmpty && sup.isEmpty && ths.isEmpty) "" else " {\n" + sup.fold("")(s"${bodyCtx.indStr}super: " + _.showIn(bodyCtx, 0) + "\n") + ths.fold("")(s"${bodyCtx.indStr}this: " + _.showIn(bodyCtx, 0) + "\n") + + body.entities.collect { + case Constructor(params, body) => s"${bodyCtx.indStr}constructor(${params.fields.map { + case N -> Fld(FldFlags.empty, Asc(Var(nme), ty)) => + s"${nme}: ${ty.showIn(bodyCtx, 0)}" + case _ => lastWords("ill-formed constructor parameter") + }.mkString(", ")})\n" + }.mkString + Signature(body.entities.collect { case d: NuDecl => d }, N).showIn(bodyCtx, 0) + ctx.indStr + "}" }" @@ -276,13 +292,14 @@ final case class ShowCtx( angletards: Bool = false, ) { - lazy val indStr: Str = " " * indentLevel + lazy val indStr: Str = ShowCtx.indentation * indentLevel def lnIndStr: Str = "\n" + indStr def indent: ShowCtx = copy(indentLevel = indentLevel + 1) def < : Str = if (angletards) "<" else "[" def > : Str = if (angletards) ">" else "]" } object ShowCtx { + def indentation: Str = " " /** * Create a context from a list of types. For named variables and * hinted variables use what is given. For unnamed variables generate @@ -365,6 +382,7 @@ trait PgrmImpl { self: Pgrm => case ot: Terms => R(ot) case NuFunDef(isLetRec, nme, _, tys, rhs) => R(Def(isLetRec.getOrElse(true), nme, rhs, isLetRec.isEmpty)) + case _: Constructor => die } diags.toList -> res } @@ -444,28 +462,38 @@ trait NuDeclImpl extends Located { self: NuDecl => lazy val genUnapply: Opt[NuFunDef] = this match { case td: NuTypeDef if td.kind is Cls => td.params.map { tup => val ret = Let(false, Var("_"), Asc(Var("x"), TypeName(name)), Tup(tup.fields.map { - case S(p) -> f => N -> Fld(f.flags, Sel(Var("x"), p)) - case N -> Fld(flags, p: Var) => N -> Fld(flags, Sel(Var("x"), p)) + case S(p) -> f => N -> Fld(FldFlags.empty, Sel(Var("x"), Var("#" + p.name).withLocOf(p))) + case N -> Fld(flags, p: Var) => N -> Fld(FldFlags.empty, Sel(Var("x"), Var("#" + p.name).withLocOf(p))) case _ => die })) NuFunDef(N, Var("unapply"), N, Nil, L(Lam( - Tup(N -> Fld(FldFlags(false, false, false), Var("x")) :: Nil), + Tup(N -> Fld(FldFlags.empty, Var("x")) :: Nil), ret)))(N, N, N, N, N, true) } case _ => N } } + trait TypingUnitImpl extends Located { self: TypingUnit => def showDbg: Str = entities.map { case t: Term => t.toString case d: NuDecl => d.showDbg - case _ => die + case c: Constructor => c.toString + case e => lastWords(s"Unexpected typing unit entity: $e") }.mkString("{", "; ", "}") + override def toString: String = s"‹${entities.mkString("; ")}›" lazy val children: List[Located] = entities } +trait ConstructorImpl { self: Constructor => + // def children: List[Located] = fields.map(_._2) + def describe: Str = "constructor" + // def showDbg: Str = s"constructor(${fields.map(_._1.name).mkString(", ")})" +} + trait TypeNameImpl extends Ordered[TypeName] { self: TypeName => - val base: TypeName = this + def base: TypeName = this + def targs: Ls[Type] = Nil def compare(that: TypeName): Int = this.name compare that.name lazy val toVar: Var = Var(name).withLocOf(this) } @@ -597,7 +625,7 @@ trait TermImpl extends StatementImpl { self: Term => try R(toType_!.withLocOf(this)) catch { case e: NotAType => import Message._ - L(ErrorReport(msg"not a recognized type" -> e.trm.toLoc::Nil, newDefs=true)) } + L(ErrorReport(msg"Not a recognized type" -> e.trm.toLoc::Nil, newDefs=true)) } protected def toType_! : Type = (this match { case Var(name) if name.startsWith("`") => TypeVar(R(name.tail), N) case Var(name) if name.startsWith("'") => TypeVar(R(name), N) @@ -665,7 +693,7 @@ private class NotAType(val trm: Statement) extends Throwable object PlainTup { def apply(fields: Term*): Term = - Tup(fields.iterator.map(t => (N, Fld(FldFlags(false, false, false), t))).toList) + Tup(fields.iterator.map(t => (N, Fld(FldFlags.empty, t))).toList) def unapplySeq(trm: Term): Opt[List[Term]] = trm match { case Tup(fields) if fields.forall(f => f._1.isEmpty && f._2.flags.mut === false && f._2.flags.spec === false @@ -839,7 +867,7 @@ trait StatementImpl extends Located { self: Statement => val pos = params.unzip._1 val bod = pars.map(tt).foldRight(Record(params): Type)(Inter) val termName = Var(nme.name).withLocOf(nme) - val ctor = Def(false, termName, L(Lam(tup, App(termName, Tup(N -> Fld(FldFlags(false, false, false), Rcd(fs.map { + val ctor = Def(false, termName, L(Lam(tup, App(termName, Tup(N -> Fld(FldFlags.empty, Rcd(fs.map { case (S(nme), fld) => nme -> Fld(FldFlags(false, false, fld.flags.genGetter), nme) case (N, fld @ Fld(_, nme: Var)) => nme -> fld case _ => die @@ -970,7 +998,7 @@ trait StatementImpl extends Located { self: Statement => case LetS(isRec, name, rhs) => s"let${if (isRec) " rec" else ""} $name = $rhs" case DatatypeDefn(head, body) => s"data type $head of $body" case DataDefn(head) => s"data $head" - case Constructor(params, _) => s"constructor($params)" + case Constructor(params, bod) => s"constructor(${params.showElems}) $bod" case _: Term => super.toString case d: Decl => d.showDbg case d: NuDecl => d.showDbg diff --git a/shared/src/main/scala/mlscript/syntax.scala b/shared/src/main/scala/mlscript/syntax.scala index 1bcb28752..00544e130 100644 --- a/shared/src/main/scala/mlscript/syntax.scala +++ b/shared/src/main/scala/mlscript/syntax.scala @@ -125,7 +125,7 @@ sealed trait Statement extends StatementImpl final case class LetS(isRec: Bool, pat: Term, rhs: Term) extends Statement final case class DataDefn(body: Term) extends Statement final case class DatatypeDefn(head: Term, body: Term) extends Statement -final case class Constructor(params: Tup, body: Blk) extends Statement // constructor(...) { ... } + class Import(val path: Str, val weak: Bool) extends Statement object Import { @@ -143,7 +143,7 @@ sealed abstract class TypeLike extends TypeLikeImpl sealed abstract class Type extends TypeLike with TypeImpl -sealed trait NamedType extends Type { val base: TypeName } +sealed trait NamedType extends Type { def base: TypeName; def targs: Ls[Type] } sealed abstract class Composed(val pol: Bool) extends Type with ComposedImpl @@ -235,6 +235,8 @@ final case class NuFunDef( def isVirtual: Bool = virtualLoc.nonEmpty || rhs.isRight } +final case class Constructor(params: Tup, body: Blk) extends DesugaredStatement with ConstructorImpl // constructor(...) { ... } + final case class VarianceInfo(isCovariant: Bool, isContravariant: Bool) { diff --git a/shared/src/main/scala/mlscript/ucs/Desugarer.scala b/shared/src/main/scala/mlscript/ucs/Desugarer.scala index d8007b9f6..d5156d86d 100644 --- a/shared/src/main/scala/mlscript/ucs/Desugarer.scala +++ b/shared/src/main/scala/mlscript/ucs/Desugarer.scala @@ -243,9 +243,9 @@ class Desugarer extends TypeDefs { self: Typer => ctx.tyDefs.get(className).map(td => (td.kind, td.positionals)) .orElse(ctx.get(className) match { case S(ti: DelayedTypeInfo) if ti.decl.kind is Cls => - S((ti.decl.kind, ti.typedParams.map(_._1.name))) + S((ti.decl.kind, ti.typedParams.getOrElse(Nil).map(_._1.name))) // * Error should be caught before if this doesn't take params case S(CompletedTypeInfo(td: TypedNuCls)) => - S((td.decl.kind, td.params.map(_._1.name))) + S((td.decl.kind, td.params.getOrElse(Nil).map(_._1.name))) // * Error should be caught before if this doesn't take params case _ => throw new DesugaringException(msg"Illegal pattern `$className`", classNameVar.toLoc) }) match { case N => @@ -809,16 +809,16 @@ class Desugarer extends TypeDefs { self: Typer => } App(Lam(Tup( - N -> Fld(FldFlags(false, false, false), Tup( + N -> Fld(FldFlags.empty, Tup( fields.distinctBy(_._1).map { case (_ -> Var(alias)) => - if (alias === "_") N -> Fld(FldFlags(false, false, false), Var(freshName)) - else N -> Fld(FldFlags(false, false, false), Var(alias)) + if (alias === "_") N -> Fld(FldFlags.empty, Var(freshName)) + else N -> Fld(FldFlags.empty, Var(alias)) }.toList )) :: Nil ), extraAlias.toList.foldRight(consequent)((lt, rs) => Let(false, Var(lt._2), Var(lt._1), rs))), - Tup(N -> Fld(FldFlags(false, false, false), App(Sel(className, Var(unapplyMtd.name)), - Tup(N -> Fld(FldFlags(false, false, false), scrutinee.reference) :: Nil)) + Tup(N -> Fld(FldFlags.empty, App(Sel(className, Var(unapplyMtd.name)), + Tup(N -> Fld(FldFlags.empty, scrutinee.reference) :: Nil)) ) :: Nil) ) case _ => mkLetFromFields(scrutinee, fields.filter(_._2.name =/= "_").toList, consequent) diff --git a/shared/src/main/scala/mlscript/ucs/helpers.scala b/shared/src/main/scala/mlscript/ucs/helpers.scala index 27140d236..0babee09b 100644 --- a/shared/src/main/scala/mlscript/ucs/helpers.scala +++ b/shared/src/main/scala/mlscript/ucs/helpers.scala @@ -16,7 +16,7 @@ object helpers { * @param t the sole element * @return a tuple term with the only element */ - def mkMonuple(t: Term): Tup = Tup(N -> Fld(FldFlags(false, false, false), t) :: Nil) + def mkMonuple(t: Term): Tup = Tup(N -> Fld(FldFlags.empty, t) :: Nil) /** * Make a binary operation. diff --git a/shared/src/main/scala/mlscript/utils/Identity.scala b/shared/src/main/scala/mlscript/utils/Identity.scala index 69e87a6aa..85dbede27 100644 --- a/shared/src/main/scala/mlscript/utils/Identity.scala +++ b/shared/src/main/scala/mlscript/utils/Identity.scala @@ -4,7 +4,7 @@ package mlscript.utils class Identity[T <: AnyRef](val value: T) { override def equals(other: Any): Boolean = other match { - case that: Identity[_] => that.value is this.value + case that: Identity[_] => (that.value: Any) is this.value case _ => false } diff --git a/shared/src/main/scala/mlscript/utils/package.scala b/shared/src/main/scala/mlscript/utils/package.scala index 10bd12024..212f8cac8 100644 --- a/shared/src/main/scala/mlscript/utils/package.scala +++ b/shared/src/main/scala/mlscript/utils/package.scala @@ -14,7 +14,7 @@ package object utils { implicit final class AnyOps[A](self: A) { def ===(other: A): Bool = self == other def =/=(other: A): Bool = self != other - def is(other: AnyRef): Bool = self.asInstanceOf[AnyRef] eq other + def is(other: A): Bool = self.asInstanceOf[AnyRef] eq other.asInstanceOf[AnyRef] def isnt(other: AnyRef): Bool = !(self.asInstanceOf[AnyRef] eq other) /** An alternative to === when in ScalaTest, which shadows our === */ def =:=(other: A): Bool = self == other diff --git a/shared/src/main/scala/mlscript/utils/shorthands.scala b/shared/src/main/scala/mlscript/utils/shorthands.scala index e84ddb954..613bfe1a4 100644 --- a/shared/src/main/scala/mlscript/utils/shorthands.scala +++ b/shared/src/main/scala/mlscript/utils/shorthands.scala @@ -28,6 +28,8 @@ object shorthands { def some[A]: A => Option[A] = Some(_) def none[A]: Option[A] = None + def nil[A]: List[A] = Nil + type Paf[-A,+B] = PartialFunction[A,B] type Exc = Exception diff --git a/shared/src/test/diff/basics/Datatypes.fun b/shared/src/test/diff/basics/Datatypes.fun index 6dd65dc09..2b2b0e737 100644 --- a/shared/src/test/diff/basics/Datatypes.fun +++ b/shared/src/test/diff/basics/Datatypes.fun @@ -115,7 +115,7 @@ data type List a of Nil Cons (head: a) (tail: List a) //│ Parsed: data type List(...a) of {Nil; Cons(...'(' {[head: a,]} ')')(...'(' {[tail: List(...a),]} ')')}; -//│ ╔══[ERROR] not a recognized type +//│ ╔══[ERROR] Not a recognized type //│ ║ l.116: Cons (head: a) (tail: List a) //│ ╙── ^^^^^^ //│ Desugared: type alias List[a] = Nil[a] | Cons[a] diff --git a/shared/src/test/diff/basics/Intersections.fun b/shared/src/test/diff/basics/Intersections.fun index 0c2144396..95d264faf 100644 --- a/shared/src/test/diff/basics/Intersections.fun +++ b/shared/src/test/diff/basics/Intersections.fun @@ -31,31 +31,7 @@ foo(1) // returns int & bool, equivalent to nothing succ / foo(1) foo(true) not / foo(true) -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.30: foo(1) // returns int & bool, equivalent to nothing -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `1` is not an instance of type `bool` -//│ ║ l.30: foo(1) // returns int & bool, equivalent to nothing -//│ ║ ^ -//│ ╟── but it flows into argument with expected type `bool` -//│ ║ l.30: foo(1) // returns int & bool, equivalent to nothing -//│ ║ ^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^^ -//│ res: bool | error | int -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.31: succ / foo(1) -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `1` is not an instance of type `bool` -//│ ║ l.31: succ / foo(1) -//│ ║ ^ -//│ ╟── but it flows into argument with expected type `bool` -//│ ║ l.31: succ / foo(1) -//│ ║ ^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^^ +//│ res: bool | int //│ ╔══[ERROR] Type mismatch in application: //│ ║ l.31: succ / foo(1) //│ ║ ^^^^^^^^^^^^^ @@ -66,31 +42,7 @@ not / foo(true) //│ ║ l.31: succ / foo(1) //│ ╙── ^^^^^^ //│ res: error | int -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.32: foo(true) -//│ ║ ^^^^^^^^^ -//│ ╟── reference of type `true` is not an instance of type `int` -//│ ║ l.32: foo(true) -//│ ║ ^^^^ -//│ ╟── but it flows into argument with expected type `int` -//│ ║ l.32: foo(true) -//│ ║ ^^^^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^ -//│ res: bool | error | int -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.33: not / foo(true) -//│ ║ ^^^^^^^^^ -//│ ╟── reference of type `true` is not an instance of type `int` -//│ ║ l.33: not / foo(true) -//│ ║ ^^^^ -//│ ╟── but it flows into argument with expected type `int` -//│ ║ l.33: not / foo(true) -//│ ║ ^^^^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^ +//│ res: bool | int //│ ╔══[ERROR] Type mismatch in application: //│ ║ l.33: not / foo(true) //│ ║ ^^^^^^^^^^^^^^^ @@ -106,76 +58,52 @@ not / foo(true) not / foo(1) foo(1) as Nothing //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.106: not / foo(1) -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `1` is not an instance of type `bool` -//│ ║ l.106: not / foo(1) -//│ ║ ^ -//│ ╟── but it flows into argument with expected type `bool` -//│ ║ l.106: not / foo(1) -//│ ║ ^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^^ -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.106: not / foo(1) -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.58: not / foo(1) +//│ ║ ^^^^^^^^^^^^ //│ ╟── reference of type `int` is not an instance of type `bool` //│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) //│ ║ ^^^ //│ ╟── but it flows into application with expected type `bool` -//│ ║ l.106: not / foo(1) -//│ ╙── ^^^^^^ +//│ ║ l.58: not / foo(1) +//│ ╙── ^^^^^^ //│ res: bool | error -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.107: foo(1) as Nothing -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `1` is not an instance of type `bool` -//│ ║ l.107: foo(1) as Nothing -//│ ║ ^ -//│ ╟── but it flows into argument with expected type `bool` -//│ ║ l.107: foo(1) as Nothing -//│ ║ ^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) -//│ ╙── ^^^^ //│ ╔══[ERROR] Type mismatch in 'as' binding: -//│ ║ l.107: foo(1) as Nothing -//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.59: foo(1) as Nothing +//│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `int` does not match type `nothing` //│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) //│ ║ ^^^ //│ ╟── but it flows into application with expected type `nothing` -//│ ║ l.107: foo(1) as Nothing -//│ ║ ^^^^^^ +//│ ║ l.59: foo(1) as Nothing +//│ ║ ^^^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.107: foo(1) as Nothing -//│ ╙── ^^^^^^^ +//│ ║ l.59: foo(1) as Nothing +//│ ╙── ^^^^^^^ //│ res: nothing :e foo as Nothing //│ ╔══[ERROR] Type mismatch in 'as' binding: -//│ ║ l.157: foo as Nothing -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.85: foo as Nothing +//│ ║ ^^^^^^^^^^^^^^ //│ ╟── type intersection of type `int -> int & bool -> bool` does not match type `nothing` //│ ║ l.26: let foo = (Int => Int) & (Bool => Bool) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `nothing` -//│ ║ l.157: foo as Nothing -//│ ║ ^^^ +//│ ║ l.85: foo as Nothing +//│ ║ ^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.157: foo as Nothing -//│ ╙── ^^^^^^^ +//│ ║ l.85: foo as Nothing +//│ ╙── ^^^^^^^ //│ res: nothing :e let oops = (&) //│ ╔══[ERROR] Illegal use of reserved operator: & -//│ ║ l.173: let oops = (&) +//│ ║ l.101: let oops = (&) //│ ╙── ^^^ //│ ╔══[ERROR] identifier not found: & -//│ ║ l.173: let oops = (&) +//│ ║ l.101: let oops = (&) //│ ╙── ^^^ //│ oops: error diff --git a/shared/src/test/diff/basics/Simplesub1.fun b/shared/src/test/diff/basics/Simplesub1.fun index 09188fee1..4b50a34f6 100644 --- a/shared/src/test/diff/basics/Simplesub1.fun +++ b/shared/src/test/diff/basics/Simplesub1.fun @@ -220,14 +220,14 @@ x => {l: x x, r: x } //│ ║ l.+1: (f => (x => f (v => (x x) v)) (x => f (v => (x x) v))) (f => x => f) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ res: error | 'a +//│ res: error | anything -> anything -> anything -> 'a //│ where -//│ 'a :> anything -> 'a +//│ 'a :> forall 'a. anything -> 'a res 1 2 -//│ res: error | 'a +//│ res: error | anything -> 'a //│ where -//│ 'a :> anything -> 'a +//│ 'a :> forall 'a. anything -> 'a let rec trutru = g => trutru (g true) @@ -359,30 +359,26 @@ x => (y => (x (y y))) //│ res: ('a -> 'b) -> ('c -> 'a & 'c) -> 'b (let rec x = (let y = (x x); (z => z)); x) -//│ res: 'x +//│ res: 'a -> 'a //│ where -//│ 'x :> 'a -> 'a -//│ 'a :> 'x +//│ 'a :> 'a -> 'a (let rec x = (y => (let z = (x x); y)); x) -//│ res: 'x +//│ res: 'a -> 'a //│ where -//│ 'x :> 'a -> 'a -//│ 'a :> 'x +//│ 'a :> 'a -> 'a (let rec x = (y => {u: y, v: (x x)}); x) -//│ res: 'x +//│ res: 'a -> 'b //│ where -//│ 'x :> 'a -> 'b +//│ 'a :> 'a -> 'b //│ 'b :> {u: 'a, v: 'b} -//│ 'a :> 'x (let rec x = (y => {u: (x x), v: y}); x) -//│ res: 'x +//│ res: 'a -> 'b //│ where -//│ 'x :> 'a -> 'b +//│ 'a :> 'a -> 'b //│ 'b :> {u: 'b, v: 'a} -//│ 'a :> 'x (let rec x = (y => (let z = (y x); y)); x) //│ res: 'x @@ -394,10 +390,9 @@ x => (y => (x (y y))) //│ res: ('v -> anything & {v: 'v}) -> 0 let rec x = (let y = (x x); (z => z)); (x (y => y.u)) // [test:T1] -//│ x: 'x +//│ x: 'a -> 'a //│ where -//│ 'x :> 'a -> 'a -//│ 'a :> 'x +//│ 'a :> 'a -> 'a //│ res: ({u: 'u} & 'a) -> ('u | 'a) | 'b //│ where //│ 'a :> forall 'u. ({u: 'u} & 'a) -> ('u | 'a) @@ -437,15 +432,15 @@ let rec x = (let y = (x x); (z => z)) (f => (x => f (v => (x x) v)) (x => f (v => (x x) v))) //│ res: ((forall 'a 'b. 'a -> 'b //│ where -//│ forall 'c 'd. 'd -> 'c +//│ forall 'c 'd. 'c -> 'd //│ where //│ 'e <: (forall 'f 'g. 'f -> 'g //│ where -//│ 'd <: 'd -> 'f -> 'g) -> 'c <: (forall 'c 'd. 'd -> 'c +//│ 'c <: 'c -> 'f -> 'g) -> 'd <: (forall 'c 'd. 'c -> 'd //│ where //│ 'e <: (forall 'f 'g. 'f -> 'g //│ where -//│ 'd <: 'd -> 'f -> 'g) -> 'c) -> 'a -> 'b) -> 'h & 'e) -> 'h +//│ 'c <: 'c -> 'f -> 'g) -> 'd) -> 'a -> 'b) -> 'h & 'e) -> 'h // * Function that takes arbitrarily many arguments: // :e // Works thanks to inconsistent constrained types... diff --git a/shared/src/test/diff/codegen/OptionalParam.mls b/shared/src/test/diff/codegen/AuxiliaryConstructors.mls similarity index 63% rename from shared/src/test/diff/codegen/OptionalParam.mls rename to shared/src/test/diff/codegen/AuxiliaryConstructors.mls index 25a2ce400..97dda3a6e 100644 --- a/shared/src/test/diff/codegen/OptionalParam.mls +++ b/shared/src/test/diff/codegen/AuxiliaryConstructors.mls @@ -36,7 +36,9 @@ class A(x: Int) {} :js class B {} -//│ class B +//│ class B { +//│ constructor() +//│ } //│ // Prelude //│ class TypingUnit1 { //│ #B; @@ -55,40 +57,101 @@ class B {} //│ globalThis.B = typing_unit1.B; //│ // End of generated code +new B +//│ B +//│ res +//│ = B {} + +:e +B() +//│ ╔══[ERROR] Construction of unparameterized class B should use the `new` keyword +//│ ║ l.66: B() +//│ ╙── ^ +//│ B +//│ res +//│ Runtime error: +//│ TypeError: Class constructor B cannot be invoked without 'new' + +abstract class C +//│ abstract class C + +:e +new C +//│ ╔══[ERROR] Class C is abstract and cannot be instantiated +//│ ║ l.79: new C +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Class C cannot be instantiated as it exposes no such constructor +//│ ║ l.79: new C +//│ ╙── ^^^^^ +//│ error +//│ res +//│ = C {} + +:e +C() +//│ ╔══[ERROR] Class C is abstract and cannot be instantiated +//│ ║ l.91: C() +//│ ╙── ^ +//│ ╔══[ERROR] Class C cannot be instantiated as it exposes no such constructor +//│ ║ l.91: C() +//│ ╙── ^ +//│ error +//│ res +//│ Runtime error: +//│ TypeError: Class constructor C cannot be invoked without 'new' + :js class C { - constructor(x: Int) + constructor(x: Int) { log(x) } } -//│ class C +//│ class C { +//│ constructor(x: Int) +//│ } //│ // Prelude -//│ class TypingUnit2 { +//│ function log(x) { +//│ return console.info(x); +//│ } +//│ class TypingUnit7 { //│ #C; //│ constructor() { //│ } //│ get C() { //│ const qualifier = this; //│ if (this.#C === undefined) { -//│ class C {}; +//│ class C { +//│ constructor(x) { +//│ log(x); +//│ } +//│ }; //│ this.#C = C; //│ } //│ return this.#C; //│ } //│ } -//│ const typing_unit2 = new TypingUnit2; -//│ globalThis.C = typing_unit2.C; +//│ const typing_unit7 = new TypingUnit7; +//│ globalThis.C = typing_unit7.C; //│ // End of generated code -:e // TODO: typing -let c = new C(1) +:e +let c = new C() //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.82: let c = new C(1) -//│ ║ ^^^^ -//│ ╟── argument of type `[1]` does not match type `[]` -//│ ║ l.82: let c = new C(1) -//│ ╙── ^^^ +//│ ║ l.136: let c = new C() +//│ ║ ^^^^^^^ +//│ ╟── argument of type `[]` does not match type `[x: Int]` +//│ ║ l.136: let c = new C() +//│ ╙── ^^ //│ let c: C | error //│ c //│ = C {} +//│ // Output +//│ undefined + +let c = new C(1) +//│ let c: C +//│ c +//│ = C {} +//│ // Output +//│ 1 :js class D(val x: Int) { @@ -97,12 +160,11 @@ class D(val x: Int) { } log(x) } -//│ class D(x: Int) -//│ // Prelude -//│ function log(x) { -//│ return console.info(x); +//│ class D(x: Int) { +//│ constructor(y: Int) //│ } -//│ class TypingUnit4 { +//│ // Prelude +//│ class TypingUnit10 { //│ #D; //│ constructor() { //│ } @@ -129,8 +191,8 @@ class D(val x: Int) { //│ return this.#D; //│ } //│ } -//│ const typing_unit4 = new TypingUnit4; -//│ globalThis.D = typing_unit4.D; +//│ const typing_unit10 = new TypingUnit10; +//│ globalThis.D = typing_unit10.D; //│ // End of generated code let dd = new D(41) @@ -144,41 +206,51 @@ dd.x //│ res //│ = 42 +let dd = D(41) +dd.x +//│ let dd: D +//│ Int +//│ dd +//│ = D {} +//│ // Output +//│ 42 +//│ res +//│ = 42 + :pe class E { constructor(x: Int) constructor(y: Int) } -//│ ╔══[PARSE ERROR] A class may only have at most one explicit constructor -//│ ║ l.148: class E { +//│ ╔══[PARSE ERROR] A class may have at most one explicit constructor +//│ ║ l.221: class E { //│ ╙── ^^^^^ -//│ class E +//│ class E { +//│ constructor(x: Int) +//│ } :e constructor(x: Int) -//│ ╔══[ERROR] constructor must be in a class. -//│ ║ l.158: constructor(x: Int) +//│ ╔══[ERROR] Illegal position for this constructor statement. +//│ ║ l.233: constructor(x: Int) //│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ [] +//│ //│ Code generation encountered an error: //│ unexpected constructor. -:e :js class F(x: Int) extends C(x + 1) {} class G extends C(2) {} class H extends B {} -//│ ╔══[ERROR] class C expects 0 parameter(s); got 1 -//│ ║ l.168: class F(x: Int) extends C(x + 1) {} -//│ ╙── ^^^^^^^ -//│ ╔══[ERROR] class C expects 0 parameter(s); got 1 -//│ ║ l.169: class G extends C(2) {} -//│ ╙── ^^^ //│ class F(x: Int) extends C -//│ class G extends C -//│ class H extends B +//│ class G extends C { +//│ constructor() +//│ } +//│ class H extends B { +//│ constructor() +//│ } //│ // Prelude -//│ class TypingUnit7 { +//│ class TypingUnit14 { //│ #F; //│ #G; //│ #H; @@ -229,10 +301,10 @@ class H extends B {} //│ return this.#H; //│ } //│ } -//│ const typing_unit7 = new TypingUnit7; -//│ globalThis.F = typing_unit7.F; -//│ globalThis.G = typing_unit7.G; -//│ globalThis.H = typing_unit7.H; +//│ const typing_unit14 = new TypingUnit14; +//│ globalThis.F = typing_unit14.F; +//│ globalThis.G = typing_unit14.G; +//│ globalThis.H = typing_unit14.H; //│ // End of generated code :js @@ -243,8 +315,8 @@ fun f(c) = _ then 0 //│ fun f: Object -> Int //│ // Prelude -//│ class TypingUnit8 {} -//│ const typing_unit8 = new TypingUnit8; +//│ class TypingUnit15 {} +//│ const typing_unit15 = new TypingUnit15; //│ // Query 1 //│ globalThis.f = function f(c) { //│ return ((() => { @@ -259,11 +331,14 @@ f(new G()) //│ Int //│ res //│ = 12 +//│ // Output +//│ 13 //│ res //│ = 2 +//│ // Output +//│ 2 :js -:e module I { class J { constructor(x: Int) @@ -272,17 +347,18 @@ module I { class L extends J(0) } } -//│ ╔══[ERROR] class J expects 0 parameter(s); got 1 -//│ ║ l.272: class L extends J(0) -//│ ╙── ^^^ //│ module I { -//│ class J +//│ class J { +//│ constructor(x: Int) +//│ } //│ module K { -//│ class L extends J +//│ class L extends J { +//│ constructor() +//│ } //│ } //│ } //│ // Prelude -//│ class TypingUnit10 { +//│ class TypingUnit17 { //│ #I; //│ constructor() { //│ } @@ -334,8 +410,8 @@ module I { //│ return this.#I; //│ } //│ } -//│ const typing_unit10 = new TypingUnit10; -//│ globalThis.I = typing_unit10.I; +//│ const typing_unit17 = new TypingUnit17; +//│ globalThis.I = typing_unit17.I; //│ // End of generated code :js @@ -349,8 +425,8 @@ fun g(x: Int) = L //│ fun g: (x: Int) -> (y: Int) -> L //│ // Prelude -//│ class TypingUnit11 {} -//│ const typing_unit11 = new TypingUnit11; +//│ class TypingUnit18 {} +//│ const typing_unit18 = new TypingUnit18; //│ // Query 1 //│ globalThis.g = function g(x) { //│ return ((() => { @@ -388,8 +464,8 @@ n.ll //│ let n: L //│ Int //│ // Prelude -//│ class TypingUnit12 {} -//│ const typing_unit12 = new TypingUnit12; +//│ class TypingUnit19 {} +//│ const typing_unit19 = new TypingUnit19; //│ // Query 1 //│ globalThis.m = g(1); //│ // Query 2 @@ -411,14 +487,15 @@ class M() let mm = new M() //│ let mm: M //│ // Prelude -//│ class TypingUnit14 {} -//│ const typing_unit14 = new TypingUnit14; +//│ class TypingUnit21 {} +//│ const typing_unit21 = new TypingUnit21; //│ // Query 1 //│ globalThis.mm = new M.class(); //│ // End of generated code //│ mm //│ = M {} +:e // TODO support first-class classes fun h(z: Int) = class N { constructor(x: Int) { @@ -426,21 +503,22 @@ fun h(z: Int) = } } N -//│ fun h: (z: Int) -> () -> N +//│ ╔══[ERROR] Construction of unparameterized class N should use the `new` keyword +//│ ║ l.505: N +//│ ╙── ^ +//│ fun h: (z: Int) -> (x: Int) -> N -:e // TODO: typing let hh = h(1) -new hh(1) -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.433: new hh(1) -//│ ║ ^^^^^ -//│ ╟── argument of type `[1]` does not match type `[]` -//│ ║ l.433: new hh(1) -//│ ╙── ^^^ -//│ let hh: () -> N -//│ N | error +//│ let hh: (x: Int) -> N //│ hh //│ = [class N] + +:e +new hh(1) +//│ ╔══[ERROR] Value hh cannot be used in `new` expression +//│ ║ l.517: new hh(1) +//│ ╙── ^^^^^^^^^ +//│ error //│ res //│ = N {} //│ // Output @@ -454,10 +532,51 @@ mixin P { constructor(x: Int) } //│ ╔══[ERROR] Explicit module constructors are not supported -//│ ║ l.451: constructor(x: Int) +//│ ║ l.529: constructor(x: Int) //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Explicit mixin constructors are not supported -//│ ║ l.454: constructor(x: Int) +//│ ║ l.532: constructor(x: Int) //│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ module O +//│ module O { +//│ constructor(x: Int) +//│ } //│ mixin P() + +:w +:e +class QQ(qq: Str) { + constructor(foo: Int) { + lol + qq = foo + } +} +//│ ╔══[ERROR] identifier not found: lol +//│ ║ l.549: lol +//│ ╙── ^^^ +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.549: lol +//│ ╙── ^^^ +//│ ╔══[ERROR] Type mismatch in auxiliary class constructor: +//│ ║ l.548: constructor(foo: Int) { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.549: lol +//│ ║ ^^^^^^^ +//│ ║ l.550: qq = foo +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.551: } +//│ ║ ^^^ +//│ ╟── type `Int` is not an instance of `Str` +//│ ║ l.548: constructor(foo: Int) { +//│ ║ ^^^ +//│ ╟── but it flows into reference with expected type `Str` +//│ ║ l.550: qq = foo +//│ ║ ^^^ +//│ ╟── Note: constraint arises from type reference: +//│ ║ l.547: class QQ(qq: Str) { +//│ ╙── ^^^ +//│ class QQ(qq: Str) { +//│ constructor(foo: Int) +//│ } +//│ Code generation encountered an error: +//│ unresolved symbol lol + diff --git a/shared/src/test/diff/codegen/ConstructorStmt.mls b/shared/src/test/diff/codegen/ConstructorStmt.mls index ee3aaf467..a61301347 100644 --- a/shared/src/test/diff/codegen/ConstructorStmt.mls +++ b/shared/src/test/diff/codegen/ConstructorStmt.mls @@ -1,17 +1,21 @@ -:NewParser :NewDefs + +log("Hello!") +//│ () +//│ res +//│ = undefined +//│ // Output +//│ Hello! + + :js module Test0 { log("Hello!") } //│ module Test0 //│ // Prelude -//│ function log(x) { -//│ return console.info(x); -//│ } -//│ let res; -//│ class TypingUnit { +//│ class TypingUnit1 { //│ #Test0; //│ constructor() { //│ } @@ -29,16 +33,16 @@ module Test0 { //│ return this.#Test0; //│ } //│ } -//│ const typing_unit = new TypingUnit; -//│ globalThis.Test0 = typing_unit.Test0; +//│ const typing_unit1 = new TypingUnit1; +//│ globalThis.Test0 = typing_unit1.Test0; //│ // End of generated code :js Test0 //│ Test0 //│ // Prelude -//│ class TypingUnit1 {} -//│ const typing_unit1 = new TypingUnit1; +//│ class TypingUnit2 {} +//│ const typing_unit2 = new TypingUnit2; //│ // Query 1 //│ res = Test0; //│ // End of generated code @@ -51,8 +55,8 @@ Test0 Test0 //│ Test0 //│ // Prelude -//│ class TypingUnit2 {} -//│ const typing_unit2 = new TypingUnit2; +//│ class TypingUnit3 {} +//│ const typing_unit3 = new TypingUnit3; //│ // Query 1 //│ res = Test0; //│ // End of generated code @@ -65,7 +69,7 @@ class A(a: Int) { } //│ class A(a: Int) //│ // Prelude -//│ class TypingUnit3 { +//│ class TypingUnit4 { //│ #A; //│ constructor() { //│ } @@ -90,16 +94,16 @@ class A(a: Int) { //│ return this.#A; //│ } //│ } -//│ const typing_unit3 = new TypingUnit3; -//│ globalThis.A = typing_unit3.A; +//│ const typing_unit4 = new TypingUnit4; +//│ globalThis.A = typing_unit4.A; //│ // End of generated code :js let aa = A(42) //│ let aa: A //│ // Prelude -//│ class TypingUnit4 {} -//│ const typing_unit4 = new TypingUnit4; +//│ class TypingUnit5 {} +//│ const typing_unit5 = new TypingUnit5; //│ // Query 1 //│ globalThis.aa = A(42); //│ // End of generated code @@ -112,8 +116,8 @@ let aa = A(42) aa //│ A //│ // Prelude -//│ class TypingUnit5 {} -//│ const typing_unit5 = new TypingUnit5; +//│ class TypingUnit6 {} +//│ const typing_unit6 = new TypingUnit6; //│ // Query 1 //│ res = aa; //│ // End of generated code @@ -124,8 +128,8 @@ aa let ab = A(0) //│ let ab: A //│ // Prelude -//│ class TypingUnit6 {} -//│ const typing_unit6 = new TypingUnit6; +//│ class TypingUnit7 {} +//│ const typing_unit7 = new TypingUnit7; //│ // Query 1 //│ globalThis.ab = A(0); //│ // End of generated code @@ -135,16 +139,30 @@ let ab = A(0) //│ 0 :e +:w :js class Foo { this: { x: Int } } //│ ╔══[ERROR] Type `#Foo` does not contain member `x` -//│ ║ l.140: this: { x: Int } +//│ ║ l.145: this: { x: Int } //│ ╙── ^ -//│ class Foo +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.145: this: { x: Int } +//│ ║ ^^^^ +//│ ╟── type `{x: Int}` does not match type `()` +//│ ║ l.145: this: { x: Int } +//│ ║ ^^^^^^^^^^ +//│ ╟── but it flows into expression in statement position with expected type `()` +//│ ║ l.145: this: { x: Int } +//│ ╙── ^^^^ +//│ class Foo { +//│ constructor() +//│ } //│ // Prelude -//│ class TypingUnit7 { +//│ class TypingUnit8 { //│ #Foo; //│ constructor() { //│ } @@ -157,24 +175,38 @@ class Foo { //│ return this.#Foo; //│ } //│ } -//│ const typing_unit7 = new TypingUnit7; -//│ globalThis.Foo = typing_unit7.Foo; +//│ const typing_unit8 = new TypingUnit8; +//│ globalThis.Foo = typing_unit8.Foo; //│ // End of generated code :e +:w :js class Bar { super: { x: Int } } //│ ╔══[ERROR] Illegal use of `super` -//│ ║ l.167: super: { x: Int } +//│ ║ l.186: super: { x: Int } //│ ╙── ^^^^^ //│ ╔══[ERROR] Type `#Bar` does not contain member `x` -//│ ║ l.167: super: { x: Int } +//│ ║ l.186: super: { x: Int } //│ ╙── ^ -//│ class Bar +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.186: super: { x: Int } +//│ ║ ^^^^^ +//│ ╟── type `{x: Int}` does not match type `()` +//│ ║ l.186: super: { x: Int } +//│ ║ ^^^^^^^^^^ +//│ ╟── but it flows into expression in statement position with expected type `()` +//│ ║ l.186: super: { x: Int } +//│ ╙── ^^^^^ +//│ class Bar { +//│ constructor() +//│ } //│ // Prelude -//│ class TypingUnit8 { +//│ class TypingUnit9 { //│ #Bar; //│ constructor() { //│ } @@ -187,25 +219,25 @@ class Bar { //│ return this.#Bar; //│ } //│ } -//│ const typing_unit8 = new TypingUnit8; -//│ globalThis.Bar = typing_unit8.Bar; +//│ const typing_unit9 = new TypingUnit9; +//│ globalThis.Bar = typing_unit9.Bar; //│ // End of generated code :js class Baz() { val x = 123 - log((1, x)) + log([1, x]) val y = - log((2, x)) + log([2, x]) x + 1 - log((3, y)) + log([3, y]) } //│ class Baz() { -//│ let x: 123 -//│ let y: Int +//│ val x: 123 +//│ val y: Int //│ } //│ // Prelude -//│ class TypingUnit9 { +//│ class TypingUnit10 { //│ #Baz; //│ constructor() { //│ } @@ -249,14 +281,14 @@ class Baz() { //│ return this.#Baz; //│ } //│ } -//│ const typing_unit9 = new TypingUnit9; -//│ globalThis.Baz = typing_unit9.Baz; +//│ const typing_unit10 = new TypingUnit10; +//│ globalThis.Baz = typing_unit10.Baz; //│ // End of generated code let baz = Baz() -log((baz.x, baz.y)) +log([baz.x, baz.y]) //│ let baz: Baz -//│ undefined +//│ () //│ baz //│ = Baz {} //│ // Output @@ -272,14 +304,14 @@ log((baz.x, baz.y)) class Q() { let q = 42 fun qq = - let f = (x: Int) => {q: x + q}; f(1) + let f = (x: Int) => {q: x + q};; f(1) } //│ class Q() { //│ let q: 42 //│ fun qq: {q: Int} //│ } //│ // Prelude -//│ class TypingUnit11 { +//│ class TypingUnit12 { //│ #Q; //│ constructor() { //│ } @@ -311,8 +343,8 @@ class Q() { //│ return this.#Q; //│ } //│ } -//│ const typing_unit11 = new TypingUnit11; -//│ globalThis.Q = typing_unit11.Q; +//│ const typing_unit12 = new TypingUnit12; +//│ globalThis.Q = typing_unit12.Q; //│ // End of generated code let q = Q() @@ -334,7 +366,7 @@ class W() { //│ let x: 42 //│ } //│ // Prelude -//│ class TypingUnit13 { +//│ class TypingUnit14 { //│ #W; //│ constructor() { //│ } @@ -363,8 +395,8 @@ class W() { //│ return this.#W; //│ } //│ } -//│ const typing_unit13 = new TypingUnit13; -//│ globalThis.W = typing_unit13.W; +//│ const typing_unit14 = new TypingUnit14; +//│ globalThis.W = typing_unit14.W; //│ // End of generated code :js @@ -373,8 +405,8 @@ www.add(42) //│ let www: W //│ Int //│ // Prelude -//│ class TypingUnit14 {} -//│ const typing_unit14 = new TypingUnit14; +//│ class TypingUnit15 {} +//│ const typing_unit15 = new TypingUnit15; //│ // Query 1 //│ globalThis.www = W(); //│ // Query 2 diff --git a/shared/src/test/diff/codegen/FieldOverride.mls b/shared/src/test/diff/codegen/FieldOverride.mls index 84d1dbb88..0fb2afb42 100644 --- a/shared/src/test/diff/codegen/FieldOverride.mls +++ b/shared/src/test/diff/codegen/FieldOverride.mls @@ -4,7 +4,7 @@ :js class C(a: Int) { val a = 1 } //│ class C(a: Int) { -//│ let a: 1 +//│ val a: 1 //│ } //│ // Prelude //│ let res; @@ -55,8 +55,8 @@ class C2(a: Int, b: Int) { val b = a + 1 } //│ class C2(a: Int, b: Int) { -//│ let a: Int -//│ let b: Int +//│ val a: Int +//│ val b: Int //│ } //│ // Prelude //│ class TypingUnit2 { @@ -118,9 +118,9 @@ class C3(a: Int) { } //│ class C3(a: Int) { //│ class C4(a: Int) { -//│ let a: 44 +//│ val a: 44 //│ } -//│ let a: 42 +//│ val a: 42 //│ } :e @@ -128,7 +128,7 @@ let c3 = C3(1) let c4 = c3.C4(2) c3.a c4.a -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.128: let c4 = c3.C4(2) //│ ╙── ^^^ //│ let c3: C3 diff --git a/shared/src/test/diff/codegen/MemberInitShadowing.mls b/shared/src/test/diff/codegen/MemberInitShadowing.mls index ccd40adc7..96682546e 100644 --- a/shared/src/test/diff/codegen/MemberInitShadowing.mls +++ b/shared/src/test/diff/codegen/MemberInitShadowing.mls @@ -63,7 +63,7 @@ class A(x0: Int) { log(x1) } //│ class A(x0: Int) { -//│ let x1: Int +//│ val x1: Int //│ } //│ // Prelude //│ class TypingUnit2 { diff --git a/shared/src/test/diff/codegen/Mixin.mls b/shared/src/test/diff/codegen/Mixin.mls index 6ea6050b6..3e28fb8da 100644 --- a/shared/src/test/diff/codegen/Mixin.mls +++ b/shared/src/test/diff/codegen/Mixin.mls @@ -2,7 +2,6 @@ :NewDefs :js -:ShowRepl class Add(lhs: E, rhs: E) class Lit(n: Int) //│ class Add[E](lhs: E, rhs: E) @@ -62,71 +61,8 @@ class Lit(n: Int) //│ globalThis.Add = typing_unit.Add; //│ globalThis.Lit = typing_unit.Lit; //│ // End of generated code -//│ ┌ Block at Mixin.mls:6 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ let res; -//│ │ │ class TypingUnit { -//│ │ │ #Add; -//│ │ │ #Lit; -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ get Add() { -//│ │ │ const qualifier = this; -//│ │ │ if (this.#Add === undefined) { -//│ │ │ class Add { -//│ │ │ #lhs; -//│ │ │ #rhs; -//│ │ │ constructor(lhs, rhs) { -//│ │ │ this.#lhs = lhs; -//│ │ │ this.#rhs = rhs; -//│ │ │ } -//│ │ │ static -//│ │ │ unapply(x) { -//│ │ │ return ([ -//│ │ │ x.#lhs, -//│ │ │ x.#rhs -//│ │ │ ]); -//│ │ │ } -//│ │ │ }; -//│ │ │ this.#Add = ((lhs, rhs) => Object.freeze(new Add(lhs, rhs))); -//│ │ │ this.#Add.class = Add; -//│ │ │ this.#Add.unapply = Add.unapply; -//│ │ │ } -//│ │ │ return this.#Add; -//│ │ │ } -//│ │ │ get Lit() { -//│ │ │ const qualifier = this; -//│ │ │ if (this.#Lit === undefined) { -//│ │ │ class Lit { -//│ │ │ #n; -//│ │ │ constructor(n) { -//│ │ │ this.#n = n; -//│ │ │ } -//│ │ │ static -//│ │ │ unapply(x) { -//│ │ │ return [x.#n]; -//│ │ │ } -//│ │ │ }; -//│ │ │ this.#Lit = ((n) => Object.freeze(new Lit(n))); -//│ │ │ this.#Lit.class = Lit; -//│ │ │ this.#Lit.unapply = Lit.unapply; -//│ │ │ } -//│ │ │ return this.#Lit; -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit = new TypingUnit; -//│ │ │ globalThis.Add = typing_unit.Add; -//│ │ │ globalThis.Lit = typing_unit.Lit; -//│ │ └── Reply -//│ │ [Function (anonymous)] { -//│ │ class: [class Lit], -//│ │ unapply: [Function: unapply] -//│ │ } -//│ └── No queries :js -:ShowRepl mixin EvalBase { fun eval(e) = if e is @@ -165,41 +101,8 @@ mixin EvalBase { //│ const typing_unit1 = new TypingUnit1; //│ globalThis.EvalBase = ((base) => typing_unit1.EvalBase(base)); //│ // End of generated code -//│ ┌ Block at Mixin.mls:130 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit1 { -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ EvalBase(base) { -//│ │ │ const qualifier = this; -//│ │ │ return (class EvalBase extends base { -//│ │ │ constructor(...rest) { -//│ │ │ super(...rest); -//│ │ │ } -//│ │ │ eval(e) { -//│ │ │ const qualifier1 = this; -//│ │ │ return ((() => { -//│ │ │ let a; -//│ │ │ return (a = e, a instanceof Lit.class ? (([n]) => n)(Lit.unapply(e)) : a instanceof Add.class ? (([ -//│ │ │ l, -//│ │ │ r -//│ │ │ ]) => qualifier1.eval(l) + qualifier1.eval(r))(Add.unapply(e)) : (() => { -//│ │ │ throw new Error("non-exhaustive case expression"); -//│ │ │ })()); -//│ │ │ })()); -//│ │ │ } -//│ │ │ }); -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit1 = new TypingUnit1; -//│ │ │ globalThis.EvalBase = ((base) => typing_unit1.EvalBase(base)); -//│ │ └── Reply -//│ │ [Function (anonymous)] -//│ └── No queries :js -:ShowRepl class Neg(expr: A) //│ class Neg[A](expr: A) //│ // Prelude @@ -230,44 +133,8 @@ class Neg(expr: A) //│ const typing_unit2 = new TypingUnit2; //│ globalThis.Neg = typing_unit2.Neg; //│ // End of generated code -//│ ┌ Block at Mixin.mls:203 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit2 { -//│ │ │ #Neg; -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ get Neg() { -//│ │ │ const qualifier = this; -//│ │ │ if (this.#Neg === undefined) { -//│ │ │ class Neg { -//│ │ │ #expr; -//│ │ │ constructor(expr) { -//│ │ │ this.#expr = expr; -//│ │ │ } -//│ │ │ static -//│ │ │ unapply(x) { -//│ │ │ return [x.#expr]; -//│ │ │ } -//│ │ │ }; -//│ │ │ this.#Neg = ((expr) => Object.freeze(new Neg(expr))); -//│ │ │ this.#Neg.class = Neg; -//│ │ │ this.#Neg.unapply = Neg.unapply; -//│ │ │ } -//│ │ │ return this.#Neg; -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit2 = new TypingUnit2; -//│ │ │ globalThis.Neg = typing_unit2.Neg; -//│ │ └── Reply -//│ │ [Function (anonymous)] { -//│ │ class: [class Neg], -//│ │ unapply: [Function: unapply] -//│ │ } -//│ └── No queries :js -:ShowRepl mixin EvalNeg { fun eval(e) = if e is Neg(d) then 0 - this.eval(d) @@ -300,35 +167,8 @@ mixin EvalNeg { //│ const typing_unit3 = new TypingUnit3; //│ globalThis.EvalNeg = ((base) => typing_unit3.EvalNeg(base)); //│ // End of generated code -//│ ┌ Block at Mixin.mls:271 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit3 { -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ EvalNeg(base) { -//│ │ │ const qualifier = this; -//│ │ │ return (class EvalNeg extends base { -//│ │ │ constructor(...rest) { -//│ │ │ super(...rest); -//│ │ │ } -//│ │ │ eval(e) { -//│ │ │ const qualifier1 = this; -//│ │ │ return ((() => { -//│ │ │ return e instanceof Neg.class ? (([d]) => 0 - qualifier1.eval(d))(Neg.unapply(e)) : super.eval(e); -//│ │ │ })()); -//│ │ │ } -//│ │ │ }); -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit3 = new TypingUnit3; -//│ │ │ globalThis.EvalNeg = ((base) => typing_unit3.EvalNeg(base)); -//│ │ └── Reply -//│ │ [Function (anonymous)] -//│ └── No queries :js -:ShowRepl mixin EvalNegNeg { fun eval(e) = if e is Neg(Neg(d)) then this.eval(d) @@ -361,43 +201,16 @@ mixin EvalNegNeg { //│ const typing_unit4 = new TypingUnit4; //│ globalThis.EvalNegNeg = ((base) => typing_unit4.EvalNegNeg(base)); //│ // End of generated code -//│ ┌ Block at Mixin.mls:332 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit4 { -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ EvalNegNeg(base) { -//│ │ │ const qualifier = this; -//│ │ │ return (class EvalNegNeg extends base { -//│ │ │ constructor(...rest) { -//│ │ │ super(...rest); -//│ │ │ } -//│ │ │ eval(e) { -//│ │ │ const qualifier1 = this; -//│ │ │ return ((() => { -//│ │ │ return e instanceof Neg.class ? (([tmp0]) => tmp0 instanceof Neg.class ? (([d]) => qualifier1.eval(d))(Neg.unapply(tmp0)) : super.eval(e))(Neg.unapply(e)) : super.eval(e); -//│ │ │ })()); -//│ │ │ } -//│ │ │ }); -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit4 = new TypingUnit4; -//│ │ │ globalThis.EvalNegNeg = ((base) => typing_unit4.EvalNegNeg(base)); -//│ │ └── Reply -//│ │ [Function (anonymous)] -//│ └── No queries :js -:ShowRepl module TestLang extends EvalBase, EvalNeg, EvalNegNeg //│ module TestLang { -//│ fun eval: 'a -> Int +//│ fun eval: (Neg['A] | Object & 'a & ~#Neg) -> Int //│ } //│ where -//│ 'a <: Neg['A] | Object & 'b & ~#Neg -//│ 'A <: Neg['a & 'A] | Neg['A] & ~#Neg | Object & 'b & ~#Neg -//│ 'b <: Add['a] | Lit | Neg['a] +//│ 'A <: Neg['A & 'b] | Neg['A] & ~#Neg | Object & 'a & ~#Neg +//│ 'b <: Neg['A] | Object & 'a & ~#Neg +//│ 'a <: Add['b] | Lit | Neg['b] //│ // Prelude //│ class TypingUnit5 { //│ #TestLang; @@ -420,86 +233,25 @@ module TestLang extends EvalBase, EvalNeg, EvalNegNeg //│ const typing_unit5 = new TypingUnit5; //│ globalThis.TestLang = typing_unit5.TestLang; //│ // End of generated code -//│ ┌ Block at Mixin.mls:393 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit5 { -//│ │ │ #TestLang; -//│ │ │ constructor() { -//│ │ │ } -//│ │ │ get TestLang() { -//│ │ │ const qualifier = this; -//│ │ │ if (this.#TestLang === undefined) { -//│ │ │ class TestLang extends EvalNegNeg(EvalNeg(EvalBase(Object))) { -//│ │ │ constructor() { -//│ │ │ super(); -//│ │ │ } -//│ │ │ } -//│ │ │ this.#TestLang = new TestLang(); -//│ │ │ this.#TestLang.class = TestLang; -//│ │ │ } -//│ │ │ return this.#TestLang; -//│ │ │ } -//│ │ │ } -//│ │ │ const typing_unit5 = new TypingUnit5; -//│ │ │ globalThis.TestLang = typing_unit5.TestLang; -//│ │ └── Reply -//│ │ TestLang { class: [Function: TestLang] } -//│ └── No queries -:js -:ShowRepl fun mk(n) = if n is 0 then Lit(0) 1 then Neg(mk(n)) _ then Add(mk(n), mk(n)) TestLang.eval(mk(0)) -//│ fun mk: forall 'E. Object -> 'E +//│ fun mk: forall 'a. Object -> (Lit | 'a) //│ Int //│ where -//│ 'E :> Add['E] | Lit | Neg['E] -//│ // Prelude -//│ class TypingUnit6 {} -//│ const typing_unit6 = new TypingUnit6; -//│ // Query 1 -//│ globalThis.mk = function mk(n) { -//│ let a; -//│ return a = n, a === 0 ? Lit(0) : a === 1 ? Neg(mk(n)) : Add(mk(n), mk(n)); -//│ }; -//│ // Query 2 -//│ res = TestLang.eval(mk(0)); -//│ // End of generated code -//│ ┌ Block at Mixin.mls:452 -//│ ├─┬ Prelude -//│ │ ├── Code -//│ │ │ class TypingUnit6 {} -//│ │ │ const typing_unit6 = new TypingUnit6; -//│ │ └── Reply -//│ │ undefined -//│ ├─┬ Query 1/2 -//│ │ ├── Prelude: -//│ │ ├── Code: -//│ │ ├── globalThis.mk = function mk(n) { -//│ │ ├── let a; -//│ │ ├── return a = n, a === 0 ? Lit(0) : a === 1 ? Neg(mk(n)) : Add(mk(n), mk(n)); -//│ │ ├── }; -//│ │ ├── Intermediate: [Function: mk] -//│ │ └── Reply: [success] [Function: mk] -//│ └─┬ Query 2/2 -//│ ├── Prelude: -//│ ├── Code: -//│ ├── res = TestLang.eval(mk(0)); -//│ ├── Intermediate: 0 -//│ └── Reply: [success] 0 +//│ 'a :> Neg[Lit | 'a] | Add[Lit | 'a] //│ res -//│ = [Function: mk] +//│ = 0 class Foo(x: Int) //│ class Foo(x: Int) -class Bar(x: Int, y: Int) extends Foo(x + y) -//│ class Bar(x: Int, y: Int) extends Foo +class Bar(x2: Int, y: Int) extends Foo(x2 + y) +//│ class Bar(x2: Int, y: Int) extends Foo mixin AA(a: Int) { @@ -620,7 +372,7 @@ mixin Base { fun x = y } //│ ╔══[ERROR] identifier not found: y -//│ ║ l.620: fun x = y +//│ ║ l.372: fun x = y //│ ╙── ^ //│ mixin Base() { //│ fun x: error diff --git a/shared/src/test/diff/codegen/ModuleInheritance.mls b/shared/src/test/diff/codegen/ModuleInheritance.mls index e18c19b49..c263a1065 100644 --- a/shared/src/test/diff/codegen/ModuleInheritance.mls +++ b/shared/src/test/diff/codegen/ModuleInheritance.mls @@ -11,7 +11,9 @@ module A { //│ class B(x: Int) { //│ fun add: (y: Int) -> Int //│ } -//│ class C +//│ class C { +//│ constructor() +//│ } //│ } :e @@ -19,10 +21,10 @@ module A { class C() extends A.B(1) class CC() extends A.C //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.19: class C() extends A.B(1) +//│ ║ l.21: class C() extends A.B(1) //│ ╙── ^^^^^^ //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.20: class CC() extends A.C +//│ ║ l.22: class CC() extends A.C //│ ╙── ^^^ //│ class C() //│ class CC() @@ -77,7 +79,7 @@ class CC() extends A.C :e C().add(3) //│ ╔══[ERROR] Type `C` does not contain member `add` -//│ ║ l.78: C().add(3) +//│ ║ l.80: C().add(3) //│ ╙── ^^^^ //│ error //│ res @@ -92,12 +94,12 @@ module B { } } //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.90: class D() extends B.C { +//│ ║ l.92: class D() extends B.C { //│ ╙── ^^^ //│ module B { //│ class C() //│ class D() { -//│ let x: 42 +//│ val x: 42 //│ } //│ } //│ // Prelude @@ -166,8 +168,8 @@ module B { :e let dd = B.D() dd.x -//│ ╔══[ERROR] access to class member not yet supported -//│ ║ l.167: let dd = B.D() +//│ ╔══[ERROR] Access to class member not yet supported +//│ ║ l.169: let dd = B.D() //│ ╙── ^^ //│ let dd: error //│ error @@ -185,7 +187,7 @@ module C { class F(val x: Int) extends D.E } //│ ╔══[ERROR] Unsupported parent specification -//│ ║ l.185: class F(val x: Int) extends D.E +//│ ║ l.187: class F(val x: Int) extends D.E //│ ╙── ^^^ //│ module C { //│ module D { @@ -271,8 +273,8 @@ module C { :e let fff = C.F(24) fff.x -//│ ╔══[ERROR] access to class member not yet supported -//│ ║ l.272: let fff = C.F(24) +//│ ╔══[ERROR] Access to class member not yet supported +//│ ║ l.274: let fff = C.F(24) //│ ╙── ^^ //│ let fff: error //│ error diff --git a/shared/src/test/diff/codegen/Modules.mls b/shared/src/test/diff/codegen/Modules.mls new file mode 100644 index 000000000..884d2a792 --- /dev/null +++ b/shared/src/test/diff/codegen/Modules.mls @@ -0,0 +1,38 @@ +:NewDefs + + +module test { // hello + fun a = 1 +} +//│ module test { +//│ fun a: 1 +//│ } + + +:ge // * FIXME +:js +fun y = 1 +module Foo { + fun x = y +} +//│ fun y: 1 +//│ module Foo { +//│ fun x: 1 +//│ } +//│ Code generation encountered an error: +//│ unresolved symbol y + +:ge // * FIXME +:js +module Foo { + fun x = y +} +fun y = 1 +//│ module Foo { +//│ fun x: 1 +//│ } +//│ fun y: 1 +//│ Code generation encountered an error: +//│ unresolved symbol y + + diff --git a/shared/src/test/diff/codegen/Nested.mls b/shared/src/test/diff/codegen/Nested.mls index 529138119..10843c74a 100644 --- a/shared/src/test/diff/codegen/Nested.mls +++ b/shared/src/test/diff/codegen/Nested.mls @@ -12,7 +12,7 @@ module A { //│ class B(x: Int) { //│ fun b: Int //│ } -//│ let a: 42 +//│ val a: 42 //│ } //│ // Prelude //│ let res; @@ -69,7 +69,7 @@ module A { :js let bb = A.B(A.a) bb.b -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.70: let bb = A.B(A.a) //│ ╙── ^^ //│ let bb: error @@ -102,18 +102,18 @@ let c = b.C(1) c.outer1 let d = b.D(1) d.outer -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.101: let c = b.C(1) //│ ╙── ^^ -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.103: let d = b.D(1) //│ ╙── ^^ //│ class B(x: Int) { //│ class C(y: Int) { -//│ let outer1: Int +//│ val outer1: Int //│ } //│ class D(outer: Int) -//│ let outer: 42 +//│ val outer: 42 //│ } //│ let b: B //│ let c: error @@ -350,7 +350,7 @@ let es = E(1) let fff = es.F(2) let gg = fff.G(3) gg.sum -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.350: let fff = es.F(2) //│ ╙── ^^ //│ let es: E @@ -549,7 +549,7 @@ module G { let jj = G.H.J(42) let i = jj.ii(2) i.x -//│ ╔══[ERROR] access to module member not yet supported +//│ ╔══[ERROR] Access to module member not yet supported //│ ║ l.549: let jj = G.H.J(42) //│ ╙── ^^ //│ let jj: error @@ -582,7 +582,7 @@ module H { //│ module H { //│ class I(x: Int) //│ class J(x: Int) { -//│ let i: I +//│ val i: I //│ } //│ } //│ // Prelude @@ -657,7 +657,7 @@ module H { :js let j = H.J(42) j.i.x -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.658: let j = H.J(42) //│ ╙── ^^ //│ let j: error @@ -687,7 +687,7 @@ class I(x: Int) { let i = I(1) let ij = i.J(0) ij.incY -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.688: let ij = i.J(0) //│ ╙── ^^ //│ class I(x: Int) { @@ -776,13 +776,13 @@ module J { class K(x: Int) {} mixin L() {} class M() extends K(1) {} - class N(x: Int) extends K(x + 2), L + class N(x2: Int) extends K(x2 + 2), L } //│ module J { //│ class K(x: Int) //│ mixin L() //│ class M() extends K -//│ class N(x: Int) extends K +//│ class N(x2: Int) extends K //│ } //│ // Prelude //│ class TypingUnit14 { @@ -847,17 +847,17 @@ module J { //│ const qualifier1 = this; //│ if (this.#N === undefined) { //│ class N extends qualifier1.L(qualifier1.K.class) { -//│ #x; -//│ constructor(x) { -//│ super(x + 2); -//│ this.#x = x; +//│ #x2; +//│ constructor(x2) { +//│ super(x2 + 2); +//│ this.#x2 = x2; //│ } //│ static //│ unapply(x) { -//│ return [x.#x]; +//│ return [x.#x2]; //│ } //│ }; -//│ this.#N = ((x) => Object.freeze(new N(x))); +//│ this.#N = ((x2) => Object.freeze(new N(x2))); //│ this.#N.class = N; //│ this.#N.unapply = N.unapply; //│ } @@ -878,10 +878,10 @@ module J { :js let m = J.M() let n = J.N(2) -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.879: let m = J.M() //│ ╙── ^^ -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.880: let n = J.N(2) //│ ╙── ^^ //│ let m: error @@ -922,7 +922,7 @@ module K { :e let m = K.L.M() m.f -//│ ╔══[ERROR] access to module member not yet supported +//│ ╔══[ERROR] Access to module member not yet supported //│ ║ l.923: let m = K.L.M() //│ ╙── ^^ //│ let m: error @@ -952,7 +952,7 @@ module L { :e let op = L.N.O.P(0) op.x -//│ ╔══[ERROR] access to module member not yet supported +//│ ╔══[ERROR] Access to module member not yet supported //│ ║ l.953: let op = L.N.O.P(0) //│ ╙── ^^ //│ let op: error @@ -979,10 +979,10 @@ module M { _ then 2 } M.N.op(M.P()) -//│ ╔══[ERROR] access to module member not yet supported +//│ ╔══[ERROR] Access to module member not yet supported //│ ║ l.981: M.N.op(M.P()) //│ ╙── ^^ -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.981: M.N.op(M.P()) //│ ╙── ^^ //│ module M { @@ -1165,7 +1165,7 @@ module N { :e N.O.P() -//│ ╔══[ERROR] access to module member not yet supported +//│ ╔══[ERROR] Access to module member not yet supported //│ ║ l.1167: N.O.P() //│ ╙── ^^ //│ error @@ -1181,12 +1181,12 @@ class I(x: Int) { } } I(1).J(3).a -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.1183: I(1).J(3).a //│ ╙── ^^ //│ class I(x: Int) { //│ class J(z: Int) { -//│ let a: [Int, Int, Int] +//│ val a: [Int, Int, Int] //│ } //│ let y: Int //│ } @@ -1258,10 +1258,10 @@ I(1).J(3).a :js fun main = - fun f(x: Int): Int = if x is + let f(x: Int): Int = if x is 0 then 1 else g(x - 1) - fun g(x: Int): Int = f(x) + let g(x: Int): Int = f(x) f //│ fun main: (x: Int) -> Int //│ // Prelude @@ -1384,9 +1384,9 @@ fun mian = :js fun main(arg) = let x = arg + 1 - fun foo(y) = x + y + let foo(y) = x + y class C(u: Int) { fun z = [foo(u), bar] } - fun bar = x + let bar = x C(123) //│ fun main: Int -> C //│ // Prelude @@ -1430,9 +1430,9 @@ module Test { log(0) module Foo { log(2) } log(1) - Foo + discard(Foo) log(3) - Foo + discard(Foo) } //│ module Test { //│ module Foo diff --git a/shared/src/test/diff/codegen/New.mls b/shared/src/test/diff/codegen/New.mls index 8a3a75346..1e8b0b88d 100644 --- a/shared/src/test/diff/codegen/New.mls +++ b/shared/src/test/diff/codegen/New.mls @@ -2,7 +2,9 @@ class C -//│ class C +//│ class C { +//│ constructor() +//│ } :js new C @@ -16,9 +18,12 @@ new C //│ res //│ = C {} -:re // TODO reject in type checking +:e :js C() +//│ ╔══[ERROR] Construction of unparameterized class C should use the `new` keyword +//│ ║ l.23: C() +//│ ╙── ^ //│ C //│ // Prelude //│ class TypingUnit2 {} @@ -31,7 +36,11 @@ C() //│ TypeError: Class constructor C cannot be invoked without 'new' :js +:e // TODO support first-class classes let c = C +//│ ╔══[ERROR] Construction of unparameterized class C should use the `new` keyword +//│ ║ l.40: let c = C +//│ ╙── ^ //│ let c: () -> C //│ // Prelude //│ class TypingUnit3 {} @@ -42,7 +51,7 @@ let c = C //│ c //│ = [class C] -:re // TODO reject in type checking +:re // TODO should eventually be reject in type checking c() //│ C //│ res diff --git a/shared/src/test/diff/codegen/NewMatching.mls b/shared/src/test/diff/codegen/NewMatching.mls index 30243e2a2..50d2dbc1d 100644 --- a/shared/src/test/diff/codegen/NewMatching.mls +++ b/shared/src/test/diff/codegen/NewMatching.mls @@ -127,7 +127,7 @@ let s2 = Some(1) :js fun foo(s) = if s is - Some(t) then let b = s2.value; b + t.x + Some(t) then let b = s2.value in b + t.x _ then 0 //│ fun foo: (Object & ~#Some | Some[{x: Int}]) -> Int //│ // Prelude @@ -148,7 +148,7 @@ foo(Some(V1(12))) fun bar(s) = if s is - Some(_) then let b = s2.value; b + 1 + Some(_) then let b = s2.value in b + 1 _ then 0 //│ fun bar: (Object & ~#Some | Some[anything]) -> Int @@ -162,7 +162,8 @@ class FooBar { val x = 42 } //│ class FooBar { -//│ let x: 42 +//│ constructor() +//│ val x: 42 //│ } //│ // Prelude //│ class TypingUnit12 { @@ -218,7 +219,7 @@ fun ft(x) = FooBar(x) then x _ then 0 //│ ╔══[ERROR] class FooBar expects 0 parameter but found 1 parameter -//│ ║ l.218: FooBar(x) then x +//│ ║ l.219: FooBar(x) then x //│ ╙── ^^^^^^^^^ //│ fun ft: anything -> error //│ Code generation encountered an error: @@ -264,7 +265,7 @@ fun c(x) = VVC(x, y, z) then x + y + z _ then 0 //│ ╔══[ERROR] class VVC expects 2 parameters but found 3 parameters -//│ ║ l.264: VVC(x, y, z) then x + y + z +//│ ║ l.265: VVC(x, y, z) then x + y + z //│ ╙── ^^^^^^^^^^^^ //│ class VVC(v: Int, vc: Int) //│ fun c: anything -> error @@ -279,7 +280,7 @@ class C[A](f: A -> A) //│ class C[A](f: A -> A) let r = C.unapply -//│ let r: forall 'f. (C[?] & {f: 'f}) -> ['f] +//│ let r: forall '#f. (C[?] & {#f: '#f}) -> ['#f] //│ r //│ = [Function: unapply] diff --git a/shared/src/test/diff/codegen/NuClasses.mls b/shared/src/test/diff/codegen/NuClasses.mls index 8993e3a75..a3f97c69f 100644 --- a/shared/src/test/diff/codegen/NuClasses.mls +++ b/shared/src/test/diff/codegen/NuClasses.mls @@ -80,8 +80,8 @@ a.f //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.78: let a = C[Int](42) //│ ╙── ^^^^^^ -//│ let a: error -//│ error +//│ let a: C[42] +//│ 42 //│ a //│ = C {} //│ res @@ -106,7 +106,7 @@ mixin M0(n: Int) { //│ mixin M0(n: Int) { //│ fun bar: Int //│ fun foo: [Int, Int, Int] -//│ let m: Int +//│ val m: Int //│ } module M1 extends M0(123) { @@ -140,12 +140,15 @@ module M2 { fun bar(x) = x + y + this.m bar(10) } +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.140: fun bar(x) = x + y + this.m +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation //│ ║ l.140: fun bar(x) = x + y + this.m //│ ╙── ^^ //│ module M2 { //│ fun foo: Int -> Int -//│ let m: 100 +//│ val m: 100 //│ } //│ // Prelude //│ class TypingUnit11 { diff --git a/shared/src/test/diff/codegen/NuFuns.mls b/shared/src/test/diff/codegen/NuFuns.mls index 120f06134..2c29fcf69 100644 --- a/shared/src/test/diff/codegen/NuFuns.mls +++ b/shared/src/test/diff/codegen/NuFuns.mls @@ -3,7 +3,7 @@ :js fun foo = - fun bar(x) = x + 1 + let bar(x) = x + 1 bar(10) //│ fun foo: Int //│ // Prelude @@ -26,24 +26,25 @@ foo //│ fun foo: Int //│ Int //│ res -//│ = [Function: foo1] +//│ = 111 -// FIXME: returns a thunk fun main = log("Hello") main -//│ fun main: undefined -//│ undefined +//│ fun main: () +//│ () //│ res -//│ = [Function: main] +//│ = undefined +//│ // Output +//│ Hello fun main = log("Hello") -//│ fun main: undefined +//│ fun main: () main -//│ undefined +//│ () //│ res //│ = undefined //│ // Output @@ -56,8 +57,12 @@ fun main = module M extends B log(2) main -//│ fun main: undefined -//│ undefined +//│ fun main: () +//│ () //│ res -//│ = [Function: main2] +//│ = undefined +//│ // Output +//│ 0 +//│ 1 +//│ 2 diff --git a/shared/src/test/diff/codegen/NuParentheses.mls b/shared/src/test/diff/codegen/NuParentheses.mls new file mode 100644 index 000000000..356a47a2f --- /dev/null +++ b/shared/src/test/diff/codegen/NuParentheses.mls @@ -0,0 +1,61 @@ +:NewDefs + + +:js +16 / (2 / 2) +//│ Num +//│ // Prelude +//│ let res; +//│ class TypingUnit {} +//│ const typing_unit = new TypingUnit; +//│ // Query 1 +//│ res = 16 / (2 / 2); +//│ // End of generated code +//│ res +//│ = 16 + +:js +1 - (3 - 5) +//│ Int +//│ // Prelude +//│ class TypingUnit1 {} +//│ const typing_unit1 = new TypingUnit1; +//│ // Query 1 +//│ res = 1 - (3 - 5); +//│ // End of generated code +//│ res +//│ = 3 + + +fun (--) minusminus(a, b) = a - b +//│ fun (--) minusminus: (Int, Int) -> Int + +:js +1 -- (3 -- 5) +//│ Int +//│ // Prelude +//│ class TypingUnit3 {} +//│ const typing_unit3 = new TypingUnit3; +//│ // Query 1 +//│ res = minusminus(1, minusminus(3, 5)); +//│ // End of generated code +//│ res +//│ = 3 + + +fun (-+-) complex(a, b) = a - 2*b +//│ fun (-+-) complex: (Int, Int) -> Int + +:js +1 -+- (3 -+- 5) +//│ Int +//│ // Prelude +//│ class TypingUnit5 {} +//│ const typing_unit5 = new TypingUnit5; +//│ // Query 1 +//│ res = complex(1, complex(3, 5)); +//│ // End of generated code +//│ res +//│ = 15 + + diff --git a/shared/src/test/diff/codegen/NuReplHost.mls b/shared/src/test/diff/codegen/NuReplHost.mls new file mode 100644 index 000000000..d4805d1c8 --- /dev/null +++ b/shared/src/test/diff/codegen/NuReplHost.mls @@ -0,0 +1,50 @@ +:NewDefs + + +// * This should crash due to `error`, +// * but the crash is somehow swallowed and we get the result of the previous statement instead! +// * The same happens with any other side effect, like `log(...)` +// * Note: this doesn't happen if the last line is in a spearate diff-test block +:showRepl +:re +fun foo(x) = error +let r = foo(1) +//│ fun foo: anything -> nothing +//│ let r: nothing +//│ ┌ Block at NuReplHost.mls:10 +//│ ├─┬ Prelude +//│ │ ├── Code +//│ │ │ function error() { +//│ │ │ throw new Error("an error was thrown"); +//│ │ │ } +//│ │ │ let res; +//│ │ │ class TypingUnit {} +//│ │ │ const typing_unit = new TypingUnit; +//│ │ └── Reply +//│ │ undefined +//│ ├─┬ Query 1/2 +//│ │ ├── Prelude: +//│ │ ├── Code: +//│ │ ├── globalThis.foo = function foo(x) { +//│ │ ├── return error(); +//│ │ ├── }; +//│ │ ├── Intermediate: [Function: foo] +//│ │ └── Reply: [success] [Function: foo] +//│ └─┬ Query 2/2 +//│ ├── Prelude: +//│ ├── Code: +//│ ├── globalThis.r = foo(1); +//│ └── Reply: [runtime error] Error: an error was thrown +//│ r +//│ Runtime error: +//│ Error: an error was thrown + +:re +r +//│ nothing +//│ res +//│ Runtime error: +//│ ReferenceError: r is not defined + + + diff --git a/shared/src/test/diff/codegen/ReplHost.mls b/shared/src/test/diff/codegen/ReplHost.mls index 00687d025..3da3fe769 100644 --- a/shared/src/test/diff/codegen/ReplHost.mls +++ b/shared/src/test/diff/codegen/ReplHost.mls @@ -1,5 +1,5 @@ -:ShowRepl +:showRepl class Box[T]: { inner: T } method Map: (T -> 'a) -> Box['a] method Map f = Box { inner = f this.inner } @@ -37,7 +37,7 @@ box0 = Box { inner = 0 } //│ box0: Box[0] //│ = Box { inner: 0 } -:ShowRepl +:showRepl box1 = Box { inner = 1 } //│ ┌ Block at ReplHost.mls:41 //│ ├── No prelude @@ -50,7 +50,7 @@ box1 = Box { inner = 1 } //│ box1: Box[1] //│ = Box { inner: 1 } -:ShowRepl +:showRepl case box1 of { Box -> 0 } //│ ┌ Block at ReplHost.mls:54 //│ ├── No prelude @@ -66,7 +66,7 @@ case box1 of { Box -> 0 } //│ res: 0 //│ = 0 -:ShowRepl +:showRepl box1.Map (fun x -> add x 1) box1.Map (fun x -> add x 2) box1.Map (fun x -> Box { inner = x }) diff --git a/shared/src/test/diff/codegen/Super.mls b/shared/src/test/diff/codegen/Super.mls index 3dfb473f6..18cd9ac2a 100644 --- a/shared/src/test/diff/codegen/Super.mls +++ b/shared/src/test/diff/codegen/Super.mls @@ -7,7 +7,7 @@ mixin Foo0 { val foo0 = 0 } //│ mixin Foo0() { -//│ let foo0: 0 +//│ val foo0: 0 //│ } //│ // Prelude //│ let res; @@ -38,8 +38,8 @@ mixin Foo1 { } //│ mixin Foo1() { //│ super: {foo0: 'foo0} -//│ let foo0: 1 -//│ let foo1: 'foo0 +//│ val foo0: 1 +//│ val foo1: 'foo0 //│ } //│ // Prelude //│ class TypingUnit1 { @@ -68,8 +68,8 @@ mixin Foo1 { module Test0 extends Foo0, Foo1 //│ module Test0 { -//│ let foo0: 1 -//│ let foo1: 0 +//│ val foo0: 1 +//│ val foo1: 0 //│ } [Test0.foo0, Test0.foo1] @@ -78,14 +78,13 @@ module Test0 extends Foo0, Foo1 //│ = [ 1, 0 ] -:ShowRepl :js :e mixin Foo2 { fun foo2 = super } //│ ╔══[ERROR] Illegal use of `super` -//│ ║ l.85: fun foo2 = super +//│ ║ l.84: fun foo2 = super //│ ╙── ^^^^^ //│ mixin Foo2() { //│ super: 'super @@ -159,6 +158,7 @@ class Foo extends Foo0 { fun foo0(n) = [super.foo0, super.foo0 + n] } //│ class Foo { +//│ constructor() //│ fun foo0: Int -> [0, Int] //│ } diff --git a/shared/src/test/diff/codegen/SymbolicOps.mls b/shared/src/test/diff/codegen/SymbolicOps.mls index c2e09605e..9dd61cb78 100644 --- a/shared/src/test/diff/codegen/SymbolicOps.mls +++ b/shared/src/test/diff/codegen/SymbolicOps.mls @@ -54,13 +54,13 @@ succ >> succ of 3 //│ ╟── from reference: //│ ║ l.4: fun (>>) compose(f, g) = x => g(f(x)) //│ ╙── ^ -//│ error | Int -> Int +//│ error | Int -> nothing //│ res //│ = [Function (anonymous)] :js let f = (>>) -//│ let f: forall 'a 'b. ((3 | 'a) -> Int, Int -> 'b) -> (Int & 'a) -> (Int | 'b) +//│ let f: forall 'a 'b 'c. ('a -> 'b, 'b -> 'c) -> 'a -> 'c //│ // Prelude //│ class TypingUnit7 {} //│ const typing_unit7 = new TypingUnit7; @@ -109,7 +109,7 @@ f(succ, succ)(3) //│ ╟── from reference: //│ ║ l.4: fun (>>) compose(f, g) = x => g(f(x)) //│ ╙── ^ -//│ error | Int -> Int +//│ error | Int -> nothing //│ res //│ = [Function (anonymous)] @@ -313,7 +313,7 @@ fun (:-D) dd(a, b) = a + b val (->) f(x, y) = [x, y] -//│ let (->) f: forall 'a 'b. ('a, 'b) -> ['a, 'b] +//│ val (->) f: forall 'a 'b. ('a, 'b) -> ['a, 'b] //│ f //│ = [Function: f1] diff --git a/shared/src/test/diff/codegen/ValLet.mls b/shared/src/test/diff/codegen/ValLet.mls index 891f084ed..1d12ae033 100644 --- a/shared/src/test/diff/codegen/ValLet.mls +++ b/shared/src/test/diff/codegen/ValLet.mls @@ -11,7 +11,7 @@ class A(x0: Int) { //│ class A(x0: Int) { //│ let x1: Int //│ let x2: Int -//│ let x3: Int +//│ val x3: Int //│ } //│ // Prelude //│ function log(x) { @@ -164,9 +164,15 @@ class B(x: Int, val y: Int) //│ globalThis.B = typing_unit4.B; //│ // End of generated code -// FIXME: should be rejected +:e B(0, 0).x -//│ Int +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.168: B(0, 0).x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.130: class B(x: Int, val y: Int) +//│ ╙── ^ +//│ Int | error //│ res //│ = undefined @@ -175,12 +181,17 @@ B(0, 0).y //│ res //│ = 0 -// TODO: is this expected? +:e :js class C { constructor(val x: Int, y: Int) } -//│ class C +//│ ╔══[ERROR] Cannot use `val` in constructor parameters +//│ ║ l.187: constructor(val x: Int, y: Int) +//│ ╙── ^ +//│ class C { +//│ constructor(x: Int, y: Int) +//│ } //│ // Prelude //│ class TypingUnit7 { //│ #C; @@ -205,10 +216,49 @@ class C { //│ globalThis.C = typing_unit7.C; //│ // End of generated code -// TODO: shoud be rejected? +// * TODO improve error location +:e fun f(val x: Int) = x + 1 +//│ ╔══[ERROR] Cannot use `val` in this position +//│ ║ l.221: fun f(val x: Int) = x + 1 +//│ ╙── ^^^^^^ //│ fun f: (x: Int) -> Int +:pe +:e +(val x: 1) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.229: (val x: 1) +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Cannot use `val` in this position +//│ ║ l.229: (val x: 1) +//│ ╙── ^^^^ +//│ [x: 1] +//│ res +//│ = [ 1 ] + +:pe +:e +(val x: 1) => +//│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here +//│ ║ l.242: (val x: 1) => +//│ ╙── ^ +//│ ╔══[ERROR] Cannot use `val` in this position +//│ ║ l.242: (val x: 1) => +//│ ╙── ^^^^ +//│ (x: 1) -> () +//│ res +//│ = [Function: res] + +:e +(val x: 1) => () +//│ ╔══[ERROR] Cannot use `val` in this position +//│ ║ l.254: (val x: 1) => () +//│ ╙── ^^^^ +//│ (x: 1) -> () +//│ res +//│ = [Function: res] + class D(x: Int) { let x = 1 } @@ -225,7 +275,7 @@ class E(x: Int) { } if E(42) is E(x) then x else 0 //│ class E(x: Int) { -//│ let x: 2 +//│ val x: 2 //│ } //│ 0 | 2 //│ res @@ -247,7 +297,7 @@ class G(val x: Int) { } G(1).x //│ class G(x: Int) { -//│ let x: 4 +//│ val x: 4 //│ } //│ 4 //│ res diff --git a/shared/src/test/diff/contys/ExplicitConstraints.mls b/shared/src/test/diff/contys/ExplicitConstraints.mls index f41cbd444..728a2f9fd 100644 --- a/shared/src/test/diff/contys/ExplicitConstraints.mls +++ b/shared/src/test/diff/contys/ExplicitConstraints.mls @@ -74,7 +74,7 @@ fun f: 'a => 'a where :e -fun f: 'a => forall 'b; 'a where +fun f: 'a => forall 'b: 'a where 'a : 'b 'b : string int : 'a @@ -94,7 +94,7 @@ fun f: 'a => forall 'b; 'a where // * Constraint is stashed! -fun f: 'a => forall 'b; 'a where +fun f: 'a => forall 'b: 'a where 'a : 'b => 'b int : 'a //│ f: 'a -> (int | 'a @@ -150,7 +150,7 @@ r + 1 //│ res: error | int -fun f: 'a => forall 'b; 'b where +fun f: 'a => forall 'b: 'b where 'a : 'b => 'b int : 'a //│ f: 'a -> ('b diff --git a/shared/src/test/diff/ecoop23/ComparePointPoly.mls b/shared/src/test/diff/ecoop23/ComparePointPoly.mls new file mode 100644 index 000000000..c90dfde58 --- /dev/null +++ b/shared/src/test/diff/ecoop23/ComparePointPoly.mls @@ -0,0 +1,90 @@ +:NewDefs + + +class Some[out A](val value: A) +module None +//│ class Some[A](value: A) +//│ module None + +mixin ComparePoint { + fun compare(lhs, rhs) = (lhs.x === rhs.x) && (lhs.y === rhs.y) +} +mixin CompareColored { + fun compare(lhs, rhs) = + super.compare(lhs, rhs) && (lhs.color === rhs.color) +} +mixin CompareNested { + fun compare(lhs, rhs) = + super.compare(lhs, rhs) && + if lhs.parent is Some(p) + then rhs.parent is Some(q) and this.compare(p, q) + else rhs.parent is None +} +//│ mixin ComparePoint() { +//│ fun compare: ({x: Eql['a], y: Eql['b]}, {x: 'a, y: 'b}) -> Bool +//│ } +//│ mixin CompareColored() { +//│ super: {compare: ('c, 'd) -> Bool} +//│ fun compare: ({color: Eql['e]} & 'c, {color: 'e} & 'd) -> Bool +//│ } +//│ mixin CompareNested() { +//│ super: {compare: ('f, 'g) -> Bool} +//│ this: {compare: ('h, 'i) -> Bool} +//│ fun compare: ({parent: Object & ~#Some | Some['h]} & 'f, {parent: Object & ~#Some | Some['i]} & 'g) -> Bool +//│ } + +class MyPoint[out Col](val x: Int, val y: Int, val color: Col, val parent: Some[MyPoint[Col]] | None) +//│ class MyPoint[Col](x: Int, y: Int, color: Col, parent: None | Some[MyPoint[Col]]) + +module CompareMyPoint extends ComparePoint, CompareColored, CompareNested +//│ module CompareMyPoint { +//│ fun compare: ('a, 'b) -> Bool +//│ } +//│ where +//│ 'b <: {color: 'c, parent: Object & ~#Some | Some['b], x: 'd, y: 'e} +//│ 'a <: {color: Eql['c], parent: Object & ~#Some | Some['a], x: Eql['d], y: Eql['e]} + +let Red = 0 +let p0 = MyPoint(0, 0, Red, None) +let p1 = MyPoint(0, 1, Red, None) +let p2 = MyPoint(0, 1, Red, None) +let p3 = MyPoint(0, 1, Red, Some(p1)) +let p4 = MyPoint(0, 1, Red, Some(p2)) +let p5 = MyPoint(0, 1, Red, Some(p3)) +//│ let Red: 0 +//│ let p0: MyPoint[0] +//│ let p1: MyPoint[0] +//│ let p2: MyPoint[0] +//│ let p3: MyPoint[0] +//│ let p4: MyPoint[0] +//│ let p5: MyPoint[0] +//│ Red +//│ = 0 +//│ p0 +//│ = MyPoint {} +//│ p1 +//│ = MyPoint {} +//│ p2 +//│ = MyPoint {} +//│ p3 +//│ = MyPoint {} +//│ p4 +//│ = MyPoint {} +//│ p5 +//│ = MyPoint {} + +CompareMyPoint.compare(p0, p1) +CompareMyPoint.compare(p1, p2) +CompareMyPoint.compare(p3, p4) +CompareMyPoint.compare(p3, p5) +//│ Bool +//│ res +//│ = false +//│ res +//│ = true +//│ res +//│ = true +//│ res +//│ = false + + diff --git a/shared/src/test/diff/ecoop23/ExpressionProblem.mls b/shared/src/test/diff/ecoop23/ExpressionProblem.mls index b4f16d2cf..88115a08f 100644 --- a/shared/src/test/diff/ecoop23/ExpressionProblem.mls +++ b/shared/src/test/diff/ecoop23/ExpressionProblem.mls @@ -192,27 +192,27 @@ mixin EvalNegNeg { module TestLang extends EvalBase, EvalNeg, EvalNegNeg //│ module TestLang { -//│ fun eval: 'a -> Int +//│ fun eval: (Neg['A] | Object & 'a & ~#Neg) -> Int //│ } //│ where -//│ 'a <: Neg['A] | Object & 'b & ~#Neg -//│ 'A <: Neg['a & 'A] | Neg['A] & ~#Neg | Object & 'b & ~#Neg -//│ 'b <: Add['a] | Lit | Neg['a] +//│ 'A <: Neg['A & 'b] | Neg['A] & ~#Neg | Object & 'a & ~#Neg +//│ 'b <: Neg['A] | Object & 'a & ~#Neg +//│ 'a <: Add['b] | Lit | Neg['b] fun mk(n) = if n is 0 then Lit(0) 1 then Neg(mk(n)) _ then Add(mk(n), mk(n)) -//│ fun mk: forall 'E. Object -> 'E +//│ fun mk: forall 'a. Object -> (Lit | 'a) //│ where -//│ 'E :> Add['E] | Lit | Neg['E] +//│ 'a :> Neg[Lit | 'a] | Add[Lit | 'a] TestLang.eval -//│ 'a -> Int +//│ (Neg['A] | Object & 'a & ~#Neg) -> Int //│ where -//│ 'a <: Neg['A] | Object & 'b & ~#Neg -//│ 'A <: Neg['a & 'A] | Neg['A] & ~#Neg | Object & 'b & ~#Neg -//│ 'b <: Add['a] | Lit | Neg['a] +//│ 'A <: Neg['A & 'b] | Neg['A] & ~#Neg | Object & 'a & ~#Neg +//│ 'b <: Neg['A] | Object & 'a & ~#Neg +//│ 'a <: Add['b] | Lit | Neg['b] //│ res //│ = [Function: eval] diff --git a/shared/src/test/diff/ecoop23/Intro.mls b/shared/src/test/diff/ecoop23/Intro.mls index 9a583c0a5..dda082110 100644 --- a/shared/src/test/diff/ecoop23/Intro.mls +++ b/shared/src/test/diff/ecoop23/Intro.mls @@ -96,7 +96,12 @@ module CompareMyPoint extends ComparePoint, CompareColored, CompareNested //│ } //│ where //│ 'b <: {color: 'color, parent: Object & ~#Some | Some['b], x: 'c, y: 'd} -//│ 'a <: {color: {equals: 'color -> Bool}, parent: Object & ~#Some | Some['a], x: Eql['c], y: Eql['d]} +//│ 'a <: { +//│ color: {equals: 'color -> Bool}, +//│ parent: Object & ~#Some | Some['a], +//│ x: Eql['c], +//│ y: Eql['d] +//│ } let p0 = MyPoint(0, 0, Red, None) diff --git a/shared/src/test/diff/ecoop23/PolymorphicVariants.mls b/shared/src/test/diff/ecoop23/PolymorphicVariants.mls index b56ed8e3f..8496e8efe 100644 --- a/shared/src/test/diff/ecoop23/PolymorphicVariants.mls +++ b/shared/src/test/diff/ecoop23/PolymorphicVariants.mls @@ -61,60 +61,67 @@ mixin EvalLambda { let l1 = this.eval(sub, t1) let l2 = this.eval(sub, t2) if t1 is - Abs(x, t) then this.eval(Cons((x, l2), Nil), t) + Abs(x, t) then this.eval(Cons([x, l2], Nil), t) else App(l1, l2) Abs(x, t) then let s = gensym() - Abs(s, this.eval(Cons((x, Var(s)), sub), t)) + Abs(s, this.eval(Cons([x, Var(s)], sub), t)) else super.eval(sub, v) } //│ mixin EvalLambda() { //│ super: {eval: ('a, 'b) -> 'c} -//│ this: {eval: ('a, 'd) -> ('A & 'e) & (Cons[[Str, 'e]], 'f) -> 'c & (Cons[[Str, Var] | 'A0], 'g) -> 'A1} +//│ this: { +//│ eval: ('a, 'd) -> ('A & 'e) & (Cons[[Str, 'e]], 'f) -> 'c & (Cons[[Str, Var] | 'A0], 'g) -> 'A1 +//│ } //│ fun eval: ('a & (Cons['A0] | Nil), Abs['g] | App['d & (Abs['f] | Object & ~#Abs)] | Object & 'b & ~#Abs & ~#App) -> (Abs['A1] | App['A] | 'c) //│ } module Test1 extends EvalVar, EvalLambda //│ module Test1 { -//│ fun eval: forall 'a. (Cons[{_1: anything, _2: 'A}] | Nil, Abs['b] | App['c] | Var) -> ('A | 'a) +//│ fun eval: (Cons[{_1: anything, _2: 'a}] | Nil, Abs['b] | App['c] | Var) -> 'a //│ } //│ where //│ 'b <: Abs['b] | App['c] | Var //│ 'c <: 'b & (Abs['b] | Object & ~#Abs) -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> Var | App['A] | Abs['A0] +//│ 'A0 :> 'a +//│ 'A :> 'a Test1.eval(Nil, Var("a")) -//│ forall 'a. 'A | 'a +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['A] | Abs['A0] | Var +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Var {} Test1.eval(Nil, Abs("b", Var("a"))) -//│ forall 'a. 'A | 'a +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> Var | App['A] | Abs['A0] +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Abs {} -Test1.eval(Cons(("c", Var("d")), Nil), App(Abs("b", Var("b")), Var("c"))) -//│ forall 'a. 'A | 'a +Test1.eval(Cons(["c", Var("d")], Nil), App(Abs("b", Var("b")), Var("c"))) +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['A] | Abs['A0] | Var +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Var {} -Test1.eval(Cons(("c", Abs("d", Var("d"))), Nil), App(Abs("b", Var("b")), Var("c"))) -//│ forall 'a. 'A | 'a +Test1.eval(Cons(["c", Abs("d", Var("d"))], Nil), App(Abs("b", Var("b")), Var("c"))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['A] | Abs['A0] | Abs[Var] | Var +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Var {} @@ -135,7 +142,7 @@ fun map_expr(f, v) = mixin EvalExpr { fun eval(sub, v) = - fun eta(e) = this.eval(sub, e) + let eta(e) = this.eval(sub, e) let vv = map_expr(eta, v) if vv is Var then super.eval(sub, vv) @@ -161,100 +168,103 @@ Test2.eval(Nil, Var("a")) //│ res //│ = Var {} -Test2.eval(Cons(("c", Abs("d", Var("d"))), Nil), Var("a")) +Test2.eval(Cons(["c", Abs("d", Var("d"))], Nil), Var("a")) //│ Abs[Var] | Numb | Var //│ res //│ = Var {} -Test2.eval(Cons(("a", Numb(1)), Nil), Var("a")) +Test2.eval(Cons(["a", Numb(1)], Nil), Var("a")) //│ Numb | Var //│ res //│ = Var {} // * This expected error shows that Test2 does not handle Abs expression inputs :e -Test2.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +Test2.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.176: Test2.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +//│ ║ l.183: Test2.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Abs[?A]` does not match type `Add[?A0] | Mul[?A1] | Numb | Var` -//│ ║ l.176: Test2.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +//│ ║ l.183: Test2.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.129: if v is +//│ ║ l.136: if v is //│ ║ ^ //│ ╟── from reference: -//│ ║ l.139: let vv = map_expr(eta, v) +//│ ║ l.146: let vv = map_expr(eta, v) //│ ╙── ^ //│ Abs[Var] | Numb | Var | error //│ res //│ Runtime error: //│ Error: non-exhaustive case expression -Test2.eval(Cons(("a", Abs("d", Var("d"))), Nil), Add(Numb(1), Var("a"))) +Test2.eval(Cons(["a", Abs("d", Var("d"))], Nil), Add(Numb(1), Var("a"))) //│ Abs[Var] | Add[Numb | Var] | Numb | Var //│ res //│ = Add {} module Test3 extends EvalVar, EvalExpr, EvalLambda //│ module Test3 { -//│ fun eval: forall 'a. (Cons[{_1: anything, _2: 'b}] | Nil, Abs['c] | App['d] | Object & 'e & ~#Abs & ~#App) -> ('A | 'a) +//│ fun eval: (Cons[{_1: anything, _2: 'a}] | Nil, Abs['b] | App['c] | Object & 'd & ~#Abs & ~#App) -> 'e //│ } //│ where -//│ 'b :> 'A +//│ 'a :> 'e //│ <: Object -//│ 'A :> 'a | Numb | Var | 'b | 'e -//│ 'e <: Add['c] | Mul['c] | Numb | Var -//│ 'c <: Abs['c] | App['d] | Object & 'e & ~#Abs & ~#App -//│ 'd <: 'c & (Abs['c] | Object & ~#Abs) -//│ 'a :> App['A] | Abs['A] - -Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) -//│ forall 'a. 'A | 'a +//│ 'e :> App['A] | Abs['A0] | Numb | Var | 'a | 'd +//│ 'd <: Add['b] | Mul['b] | Numb | Var +//│ 'b <: Abs['b] | App['c] | Object & 'd & ~#Abs & ~#App +//│ 'c <: 'b & (Abs['b] | Object & ~#Abs) +//│ 'A0 :> 'e +//│ 'A :> 'e + +Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Numb | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['A] | Abs['A0] | Abs[Var] | Numb | Var +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Abs {} -Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil), App(Abs("a", Var("a")), Add(Numb(1), Var("c")))) -//│ forall 'a. 'A | 'a +Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil), App(Abs("a", Var("a")), Add(Numb(1), Var("c")))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Add[Numb | Var] | Numb | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['A] | Abs['A0] | Abs[Var] | Add[Numb | Var] | Numb | Var +//│ 'A0 :> 'a +//│ 'A :> 'a //│ res //│ = Var {} // * Incorrect version, for regression testing – EvalLambda should be mixed in after EvalExpr module Test3 extends EvalVar, EvalLambda, EvalExpr //│ module Test3 { -//│ fun eval: (Cons[{_1: anything, _2: 'a}] | Nil, 'a & (Add['b] | Mul['b] | Numb | Var)) -> ('A | 'a | 'b) +//│ fun eval: (Cons[{_1: anything, _2: 'a}] | Nil, 'a & (Add['b] | Mul['b] | Numb | Var)) -> ('a | 'b | 'c) //│ } //│ where -//│ 'a :> 'A | 'b +//│ 'a :> 'c | 'b //│ <: Object //│ 'b <: Add['b] | Mul['b] | Numb | Var -//│ 'A :> Numb | 'a | Abs['A] | App['A] | Var +//│ 'c :> Abs[Numb | 'a | 'c] | App[Numb | 'a | 'c] | Numb | Var | 'a // * Because EvalExpr does not dispatch lambdas to super and map_expr only // * handles exprs :e -Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.242: Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +//│ ║ l.252: Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Abs[?A]` does not match type `Add[?A0] | Mul[?A1] | Numb | Var` -//│ ║ l.242: Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil), Abs("a", Var("a"))) +//│ ║ l.252: Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil), Abs("a", Var("a"))) //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.129: if v is +//│ ║ l.136: if v is //│ ║ ^ //│ ╟── from reference: -//│ ║ l.139: let vv = map_expr(eta, v) +//│ ║ l.146: let vv = map_expr(eta, v) //│ ╙── ^ -//│ error | 'A +//│ Abs[Var] | error | 'a //│ where -//│ 'A :> Abs[Var] | Numb | Abs['A] | App['A] | Var +//│ 'a :> Abs[Abs[Var] | Numb | 'a] | App[Abs[Var] | Numb | 'a] | Numb | Var //│ res //│ Runtime error: //│ Error: non-exhaustive case expression diff --git a/shared/src/test/diff/ecoop23/SimpleRegionDSL_annot.mls b/shared/src/test/diff/ecoop23/SimpleRegionDSL_annot.mls new file mode 100644 index 000000000..ae9192d9d --- /dev/null +++ b/shared/src/test/diff/ecoop23/SimpleRegionDSL_annot.mls @@ -0,0 +1,475 @@ +:NewDefs + + +// * Adapted example from Compositional Embeddings of Domain-Specific Languages (OOPSLA 2022) + + +// ******************* Initial System ******************* + +class Vector(val x: Int, val y: Int) +//│ class Vector(x: Int, y: Int) + +class Circle(radius: Int) +class Outside[out Region](a: Region) +class Union[out Region](a: Region, b: Region) +class Intersect[out Region](a: Region, b: Region) +class Translate[out Region](v: Vector, a: Region) +//│ class Circle(radius: Int) +//│ class Outside[Region](a: Region) +//│ class Union[Region](a: Region, b: Region) +//│ class Intersect[Region](a: Region, b: Region) +//│ class Translate[Region](v: Vector, a: Region) + +type BaseLang[T] = Circle | Intersect[T] | Union[T] | Outside[T] | Translate[T] +//│ type BaseLang[T] = Circle | Intersect[T] | Outside[T] | Translate[T] | Union[T] + +mixin SizeBase { + fun size(r) = + if r is + Circle(_) then 1 + Outside(a) then this.size(a) + 1 + Union(a, b) then this.size(a) + this.size(b) + 1 + Intersect(a, b) then this.size(a) + this.size(b) + 1 + Translate(_, a) then this.size(a) + 1 +} +//│ mixin SizeBase() { +//│ this: {size: 'a -> Int} +//│ fun size: (Circle | Intersect['a] | Outside['a] | Translate['a] | Union['a]) -> Int +//│ } + +// ******************* Linguistic Reuse and Meta-Language Optimizations ******************* + +fun round(n: Num): Int = 0 +//│ fun round: (n: Num) -> Int + +fun go(x, offset) = + if x is 0 then Circle(1) + else + let shared = go(x - 1, round(offset / 2)) + Union(Translate(Vector(0 - offset, 0), shared), Translate(Vector(offset, 0), shared)) +//│ fun go: forall 'a. (0 | Int & ~0, Int) -> (Circle | 'a) +//│ where +//│ 'a :> Union[Translate[Circle | 'a]] + +// * Note that first-class polymorphism manages (correctly) to preserve the universal quantification +let circles = go(2, 1024) +//│ let circles: forall 'a. Circle | 'a +//│ where +//│ 'a :> Union[Translate[Circle | 'a]] +//│ circles +//│ = Union {} + +// ******************* Adding More Language Constructs ******************* + +class Univ() +class Empty() +class Scale[out Region](v: Vector, a: Region) +//│ class Univ() +//│ class Empty() +//│ class Scale[Region](v: Vector, a: Region) + +type ExtLang[T] = Univ | Empty | Scale[T] +//│ type ExtLang[T] = Empty | Scale[T] | Univ + +mixin SizeExt { + fun size(a) = + if a is + Univ then 1 + Empty then 1 + Scale(_, b) then this.size(b) + 1 + else super.size(a) +} +//│ mixin SizeExt() { +//│ super: {size: 'a -> 'b} +//│ this: {size: 'c -> Int} +//│ fun size: (Empty | Object & 'a & ~#Empty & ~#Scale & ~#Univ | Scale['c] | Univ) -> (Int | 'b) +//│ } + +type RegionLang = BaseLang[RegionLang] | ExtLang[RegionLang] +//│ type RegionLang = BaseLang[RegionLang] | ExtLang[RegionLang] + +module TestSize extends SizeBase, SizeExt { + fun size: RegionLang -> Int +} +//│ module TestSize { +//│ fun size: RegionLang -> Int +//│ } + +TestSize.size(Empty()) +//│ Int +//│ res +//│ = 1 + +TestSize.size(circles) +//│ Int +//│ res +//│ = 13 + +TestSize.size(Scale(Vector(1, 1), circles)) +//│ Int +//│ res +//│ = 14 + +// ******************* Adding a New Interpretation ******************* +// a stupid power (Int ** Int) implementation +fun pow(x, a) = + if a is 0 then 1 + else x * pow(x, a - 1) +//│ fun pow: (Int, 0 | Int & ~0) -> Int + +mixin Contains { + fun contains(a, p) = + if a is + Circle(r) then pow(p.x, 2) + pow(p.y, 2) <= pow(r, 2) + Outside(a) then not (this.contains(a, p)) + Union(lhs, rhs) then this.contains(lhs, p) || this.contains(rhs, p) + Intersect(lhs, rhs) then this.contains(lhs, p) && this.contains(rhs, p) + Translate(v, a) then this.contains(a, Vector(p.x - v.x, p.y - v.y)) +} +//│ mixin Contains() { +//│ this: {contains: ('a, 'b) -> Bool & ('c, Vector) -> 'd} +//│ fun contains: (Circle | Intersect['a] | Outside['a] | Translate['c] | Union['a], {x: Int, y: Int} & 'b) -> (Bool | 'd) +//│ } + +type BaseRegionLang = BaseLang[BaseRegionLang] +//│ type BaseRegionLang = BaseLang[BaseRegionLang] + +module TestContains extends Contains { + fun contains: (BaseRegionLang, Vector) -> Bool +} +//│ module TestContains { +//│ fun contains: (BaseRegionLang, Vector) -> Bool +//│ } + +TestContains.contains(Translate(Vector(0, 0), Circle(1)), Vector(0, 0)) +//│ Bool +//│ res +//│ = true + +TestContains.contains(Intersect(Translate(Vector(0, 0), Circle(1)), Circle(1)), Vector(0, 0)) +//│ Bool +//│ res +//│ = true + +TestContains.contains(circles, Vector(0, 0)) +//│ Bool +//│ res +//│ = false + +// ******************* Dependencies, Complex Interpretations, and Domain-Specific Optimizations ******************* + +fun toString(a: Int): Str = "foo" +fun concat(a: Str, b: Str): Str = a +//│ fun toString: (a: Int) -> Str +//│ fun concat: (a: Str, b: Str) -> Str + +mixin Text { + fun text(e) = + if e is + Circle(r) then concat("a circular region of radius ", toString(r)) + Outside(a) then concat("outside a region of size ", toString(this.size(a))) + Union then concat("the union of two regions of size ", toString(this.size(e))) + Intersect then concat("the intersection of two regions of size ", toString(this.size(e))) + Translate then concat("a translated region of size ", toString(this.size(e))) +} +//│ mixin Text() { +//│ this: {size: (Intersect[nothing] | Translate['Region] | Union[nothing] | 'a) -> Int} +//│ fun text: (Circle | Intersect[anything] | Outside['a] | Translate['Region] | Union[anything]) -> Str +//│ } + +:e +module SizeText extends Text +//│ ╔══[ERROR] Type `#SizeText & {text: ?a -> (?b | ?c | ?d | ?e | ?f)}` does not contain member `size` +//│ ║ l.173: Translate then concat("a translated region of size ", toString(this.size(e))) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type `#SizeText & {text: ?a -> (?b | ?c | ?d | ?e | ?f)}` does not contain member `size` +//│ ║ l.172: Intersect then concat("the intersection of two regions of size ", toString(this.size(e))) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type `#SizeText & {text: ?a -> (?b | ?c | ?d | ?e | ?f)}` does not contain member `size` +//│ ║ l.171: Union then concat("the union of two regions of size ", toString(this.size(e))) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type `#SizeText & {text: ?a -> (?b | ?c | ?d | ?e | ?f)}` does not contain member `size` +//│ ║ l.170: Outside(a) then concat("outside a region of size ", toString(this.size(a))) +//│ ╙── ^^^^^ +//│ module SizeText { +//│ fun text: (Circle | Intersect[anything] | Outside[anything] | Translate[anything] | Union[anything]) -> Str +//│ } + +// * Note: this inferred type got *much worse* after this commit (field access type refinement) +module SizeText extends SizeBase, Text { + fun size: BaseRegionLang -> Int + fun text: BaseRegionLang -> Str +} +//│ module SizeText { +//│ fun size: BaseRegionLang -> Int +//│ fun text: BaseRegionLang -> Str +//│ } + +SizeText.text(circles) +//│ Str +//│ res +//│ = 'the union of two regions of size ' + +SizeText.size(circles) +//│ Int +//│ res +//│ = 13 + +SizeText.text(Intersect(Translate(Vector(0, 0), Circle(1)), Circle(1))) +//│ Str +//│ res +//│ = 'the intersection of two regions of size ' + +SizeText.size(Intersect(Translate(Vector(0, 0), Circle(1)), Circle(1))) +//│ Int +//│ res +//│ = 4 + +mixin IsUniv { + fun isUniv(e) = + if e is + Univ then true + Outside(a) then this.isEmpty(a) + Union(a, b) then this.isUniv(a) || this.isUniv(b) + Intersect(a, b) then this.isUniv(a) && this.isUniv(b) + Translate(_, a) then this.isUniv(a) + Scale(_, a) then this.isUniv(a) + else false +} +//│ mixin IsUniv() { +//│ this: {isEmpty: 'a -> 'b, isUniv: 'c -> Bool & 'd -> 'b} +//│ fun isUniv: (Intersect['c] | Object & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union & ~#Univ | Outside['a] | Scale['d] | Translate['d] | Union['c] | Univ) -> (Bool | 'b) +//│ } + +mixin IsEmpty { + fun isEmpty(e) = + if e is + Univ then true + Outside(a) then this.isUniv(a) + Union(a, b) then this.isEmpty(a) || this.isEmpty(b) + Intersect(a, b) then this.isEmpty(a) && this.isEmpty(b) + Translate(_, a) then this.isEmpty(a) + Scale(_, a) then this.isEmpty(a) + else false +} +//│ mixin IsEmpty() { +//│ this: {isEmpty: 'a -> Bool & 'b -> 'c, isUniv: 'd -> 'c} +//│ fun isEmpty: (Intersect['a] | Object & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union & ~#Univ | Outside['d] | Scale['b] | Translate['b] | Union['a] | Univ) -> (Bool | 'c) +//│ } + +module IsUnivIsEmpty extends IsUniv, IsEmpty { + fun isEmpty: RegionLang -> Bool + fun isUniv: RegionLang -> Bool +} +//│ module IsUnivIsEmpty { +//│ fun isEmpty: RegionLang -> Bool +//│ fun isUniv: RegionLang -> Bool +//│ } + +module IsUnivIsEmpty extends IsEmpty, IsUniv { + fun isEmpty: RegionLang -> Bool + fun isUniv: RegionLang -> Bool +} +//│ module IsUnivIsEmpty { +//│ fun isEmpty: RegionLang -> Bool +//│ fun isUniv: RegionLang -> Bool +//│ } + +IsUnivIsEmpty.isUniv(circles) +//│ Bool +//│ res +//│ = false + +IsUnivIsEmpty.isEmpty(circles) +//│ Bool +//│ res +//│ = false + +:e // Expected since the annotation only allows Lang variants +class Foo() +IsUnivIsEmpty.isEmpty(Scale(Vector(1, 2), Intersect(Foo(), circles))) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.290: IsUnivIsEmpty.isEmpty(Scale(Vector(1, 2), Intersect(Foo(), circles))) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── application of type `Foo` does not match type `BaseLang[RegionLang] | ExtLang[RegionLang]` +//│ ║ l.290: IsUnivIsEmpty.isEmpty(Scale(Vector(1, 2), Intersect(Foo(), circles))) +//│ ║ ^^^^^ +//│ ╟── Note: constraint arises from union type: +//│ ║ l.88: type RegionLang = BaseLang[RegionLang] | ExtLang[RegionLang] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── from type reference: +//│ ║ l.88: type RegionLang = BaseLang[RegionLang] | ExtLang[RegionLang] +//│ ╙── ^^^^^^^^^^ +//│ class Foo() +//│ error | false | true +//│ res +//│ = false + +mixin Eliminate { + fun eliminate(e) = + if e is + Outside(Outside(a)) then this.eliminate(a) + Outside(a) then Outside(this.eliminate(a)) + Union(a, b) then Union(this.eliminate(a), this.eliminate(b)) + Intersect(a, b) then Intersect(this.eliminate(a), this.eliminate(b)) + Translate(v, a) then Translate(v, this.eliminate(a)) + Scale(v, a) then Scale(v, this.eliminate(a)) + else e +} +//│ mixin Eliminate() { +//│ this: { +//│ eliminate: 'a -> 'b & 'c -> 'Region & 'd -> 'Region0 & 'e -> 'Region1 & 'f -> 'Region2 & 'g -> 'Region3 +//│ } +//│ fun eliminate: (Intersect['e] | Object & 'b & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['c & (Object & ~#Outside | Outside['a])] | Scale['g] | Translate['f] | Union['d]) -> (Intersect['Region1] | Outside['Region] | Scale['Region3] | Translate['Region2] | Union['Region0] | 'b) +//│ } + +module TestElim extends Eliminate { + fun eliminate: RegionLang -> RegionLang +} +//│ module TestElim { +//│ fun eliminate: RegionLang -> RegionLang +//│ } + +TestElim.eliminate(Outside(Outside(Univ()))) +//│ RegionLang +//│ res +//│ = Univ {} + +TestElim.eliminate(circles) +//│ RegionLang +//│ res +//│ = Union {} + +fun mk(n) = if n is + 1 then Outside(mk(n)) + 2 then Union(mk(n), mk(n)) + 3 then Intersect(mk(n), mk(n)) + 4 then Translate(Vector(0, 0), mk(n)) + _ then Scale(Vector(0, 0), mk(n)) +//│ fun mk: forall 'a. Object -> 'a +//│ where +//│ 'a :> Outside['a] | Translate['a] | Scale['a] | Union['a] | Intersect['a] + +:re +TestElim.eliminate(mk(100)) +//│ RegionLang +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +// ************************************************************************* + +module Lang extends SizeBase, SizeExt, Contains, Text, IsUniv, IsEmpty, Eliminate { + fun contains: (BaseRegionLang, Vector) -> Bool + fun eliminate: RegionLang -> RegionLang + fun isEmpty: RegionLang -> Bool + fun isUniv: RegionLang -> Bool + fun size: RegionLang -> Int + fun text: BaseRegionLang -> Str +} +//│ module Lang { +//│ fun contains: (BaseRegionLang, Vector) -> Bool +//│ fun eliminate: RegionLang -> RegionLang +//│ fun isEmpty: RegionLang -> Bool +//│ fun isUniv: RegionLang -> Bool +//│ fun size: RegionLang -> Int +//│ fun text: BaseRegionLang -> Str +//│ } + +Lang.size(circles) +//│ Int +//│ res +//│ = 13 + +Lang.contains(circles, Vector(0, 0)) +//│ Bool +//│ res +//│ = false + +Lang.text(circles) +//│ Str +//│ res +//│ = 'the union of two regions of size ' + +Lang.isUniv(circles) +//│ Bool +//│ res +//│ = false + +Lang.isEmpty(circles) +//│ Bool +//│ res +//│ = false + +Lang.size(Lang.eliminate(circles)) +//│ Int +//│ res +//│ = 13 + +:re +Lang.size(mk(100)) +//│ Int +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:e +:re +Lang.contains(mk(100), Vector(0, 0)) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.418: Lang.contains(mk(100), Vector(0, 0)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── application of type `Scale[?Region]` does not match type `Circle | Intersect[BaseRegionLang] | Outside[BaseRegionLang] | Translate[BaseRegionLang] | Union[BaseRegionLang]` +//│ ║ l.348: _ then Scale(Vector(0, 0), mk(n)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── Note: constraint arises from union type: +//│ ║ l.23: type BaseLang[T] = Circle | Intersect[T] | Union[T] | Outside[T] | Translate[T] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── from type reference: +//│ ║ l.134: type BaseRegionLang = BaseLang[BaseRegionLang] +//│ ╙── ^^^^^^^^^^^^^^ +//│ error | false | true +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:e +:re +Lang.text(mk(100)) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.438: Lang.text(mk(100)) +//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ╟── application of type `Scale[?Region]` does not match type `Circle | Intersect[BaseRegionLang] | Outside[BaseRegionLang] | Translate[BaseRegionLang] | Union[BaseRegionLang]` +//│ ║ l.348: _ then Scale(Vector(0, 0), mk(n)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── Note: constraint arises from union type: +//│ ║ l.23: type BaseLang[T] = Circle | Intersect[T] | Union[T] | Outside[T] | Translate[T] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── from type reference: +//│ ║ l.134: type BaseRegionLang = BaseLang[BaseRegionLang] +//│ ╙── ^^^^^^^^^^^^^^ +//│ Str | error +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:re +Lang.isUniv(mk(100)) +//│ Bool +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:re +Lang.isEmpty(mk(100)) +//│ Bool +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +:re +Lang.size(Lang.eliminate(mk(100))) +//│ Int +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded diff --git a/shared/src/test/diff/ecoop23/SimpleRegionDSL.mls b/shared/src/test/diff/ecoop23/SimpleRegionDSL_raw.mls similarity index 86% rename from shared/src/test/diff/ecoop23/SimpleRegionDSL.mls rename to shared/src/test/diff/ecoop23/SimpleRegionDSL_raw.mls index c268e1d78..30bde4667 100644 --- a/shared/src/test/diff/ecoop23/SimpleRegionDSL.mls +++ b/shared/src/test/diff/ecoop23/SimpleRegionDSL_raw.mls @@ -44,15 +44,15 @@ fun go(x, offset) = else let shared = go(x - 1, round(offset / 2)) Union(Translate(Vector(0 - offset, 0), shared), Translate(Vector(offset, 0), shared)) -//│ fun go: forall 'Region. (0 | Int & ~0, Int) -> 'Region +//│ fun go: forall 'a. (0 | Int & ~0, Int) -> (Circle | 'a) //│ where -//│ 'Region :> Circle | Union[Translate['Region]] +//│ 'a :> Union[Translate[Circle | 'a]] // * Note that first-class polymorphism manages (correctly) to preserve the universal quantification let circles = go(2, 1024) -//│ let circles: forall 'Region. 'Region +//│ let circles: forall 'a. Circle | 'a //│ where -//│ 'Region :> Circle | Union[Translate['Region]] +//│ 'a :> Union[Translate[Circle | 'a]] //│ circles //│ = Union {} @@ -291,32 +291,31 @@ mixin Eliminate { else e } //│ mixin Eliminate() { -//│ this: {eliminate: 'a -> 'b & 'c -> 'Region & 'd -> 'Region0 & 'e -> 'Region1 & 'f -> 'Region2 & 'g -> 'Region3} +//│ this: { +//│ eliminate: 'a -> 'b & 'c -> 'Region & 'd -> 'Region0 & 'e -> 'Region1 & 'f -> 'Region2 & 'g -> 'Region3 +//│ } //│ fun eliminate: (Intersect['e] | Object & 'b & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['c & (Object & ~#Outside | Outside['a])] | Scale['g] | Translate['f] | Union['d]) -> (Intersect['Region1] | Outside['Region] | Scale['Region3] | Translate['Region2] | Union['Region0] | 'b) //│ } module TestElim extends Eliminate //│ module TestElim { -//│ fun eliminate: forall 'a. 'b -> ('Region | 'a) +//│ fun eliminate: 'a -> 'b //│ } //│ where -//│ 'b <: Intersect['b] | Object & 'Region & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['b & (Object & ~#Outside | Outside['b])] | Scale['b] | Translate['b] | Union['b] -//│ 'Region :> 'a -//│ 'a :> Outside['Region] | Union['Region] | Intersect['Region] | Translate['Region] | Scale['Region] +//│ 'a <: Intersect['a] | Object & 'b & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['a & (Object & ~#Outside | Outside['a])] | Scale['a] | Translate['a] | Union['a] +//│ 'b :> Union['b] | Intersect['b] | Translate['b] | Scale['b] | Outside['b] TestElim.eliminate(Outside(Outside(Univ()))) -//│ forall 'a. 'Region | 'a +//│ 'a //│ where -//│ 'Region :> Univ | 'a -//│ 'a :> Outside['Region] | Union['Region] | Intersect['Region] | Translate['Region] | Scale['Region] +//│ 'a :> Univ | Intersect['a] | Translate[Univ | 'a] | Scale[Univ | 'a] | Outside[Univ | 'a] | Union[Univ | 'a] //│ res //│ = Univ {} TestElim.eliminate(circles) -//│ forall 'a. 'Region | 'a +//│ 'a //│ where -//│ 'Region :> Circle | 'a -//│ 'a :> Outside['Region] | Union['Region] | Intersect['Region] | Translate['Region] | Scale['Region] +//│ 'a :> Circle | Scale[Circle | 'a] | Outside[Circle | 'a] | Union[Circle | 'a] | Intersect['a] | Translate[Circle | 'a] //│ res //│ = Union {} @@ -326,13 +325,13 @@ fun mk(n) = if n is 3 then Intersect(mk(n), mk(n)) 4 then Translate(Vector(0, 0), mk(n)) _ then Scale(Vector(0, 0), mk(n)) -//│ fun mk: forall 'Region. Object -> 'Region +//│ fun mk: forall 'a. Object -> 'a //│ where -//│ 'Region :> Intersect['Region] | Outside['Region] | Scale['Region] | Translate['Region] | Union['Region] +//│ 'a :> Outside['a] | Translate['a] | Scale['a] | Union['a] | Intersect['a] :re TestElim.eliminate(mk(100)) -//│ forall 'a. 'a +//│ 'a //│ where //│ 'a :> Outside['a] | Union['a] | Intersect['a] | Translate['a] | Scale['a] //│ res @@ -344,22 +343,19 @@ TestElim.eliminate(mk(100)) module Lang extends SizeBase, SizeExt, Contains, Text, IsUniv, IsEmpty, Eliminate //│ module Lang { //│ fun contains: ('a, {x: Int, y: Int}) -> Bool -//│ fun eliminate: forall 'b. 'c -> ('Region | 'b) +//│ fun eliminate: 'b -> 'c //│ fun isEmpty: 'd -> Bool //│ fun isUniv: 'e -> Bool //│ fun size: 'f -> Int -//│ fun text: 'g -> Str +//│ fun text: (Circle | Intersect['g] | Outside['g] | Translate['g] | Union['g]) -> Str //│ } //│ where -//│ 'g <: Circle | Intersect['h] | Outside['h] | Translate['h] | Union['h] -//│ 'h <: Empty | Object & 'g & ~#Empty & ~#Scale & ~#Univ | Scale['h] | Univ -//│ 'f <: Empty | Object & 'i & ~#Empty & ~#Scale & ~#Univ | Scale['f] | Univ -//│ 'i <: Circle | Intersect['f] | Outside['f] | Translate['f] | Union['f] +//│ 'g <: Empty | Object & (Circle | Intersect['g] | Outside['g] | Translate['g] | Union['g]) & ~#Empty & ~#Scale & ~#Univ | Scale['g] | Univ +//│ 'f <: Empty | Object & (Circle | Intersect['f] | Outside['f] | Translate['f] | Union['f]) & ~#Empty & ~#Scale & ~#Univ | Scale['f] | Univ //│ 'e <: Intersect['e] | Object & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union & ~#Univ | Outside['e] | Scale['e] | Translate['e] | Union['e] | Univ //│ 'd <: Intersect['d] | Object & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union & ~#Univ | Outside['d] | Scale['d] | Translate['d] | Union['d] | Univ -//│ 'c <: Intersect['c] | Object & 'Region & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['c & (Object & ~#Outside | Outside['c])] | Scale['c] | Translate['c] | Union['c] -//│ 'Region :> 'b -//│ 'b :> Outside['Region] | Union['Region] | Intersect['Region] | Translate['Region] | Scale['Region] +//│ 'b <: Intersect['b] | Object & 'c & ~#Intersect & ~#Outside & ~#Scale & ~#Translate & ~#Union | Outside['b & (Object & ~#Outside | Outside['b])] | Scale['b] | Translate['b] | Union['b] +//│ 'c :> Scale['c] | Outside['c] | Union['c] | Intersect['c] | Translate['c] //│ 'a <: Circle | Intersect['a] | Outside['a] | Translate['a] | Union['a] Lang.size(circles) @@ -403,10 +399,10 @@ Lang.size(mk(100)) :re Lang.contains(mk(100), Vector(0, 0)) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.404: Lang.contains(mk(100), Vector(0, 0)) +//│ ║ l.400: Lang.contains(mk(100), Vector(0, 0)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Scale[?Region]` does not match type `Circle | Intersect[?Region0] | Outside[?Region1] | Translate[?Region2] | Union[?Region3]` -//│ ║ l.328: _ then Scale(Vector(0, 0), mk(n)) +//│ ║ l.327: _ then Scale(Vector(0, 0), mk(n)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.113: if a is @@ -426,13 +422,13 @@ Lang.contains(mk(100), Vector(0, 0)) :re Lang.text(mk(100)) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.427: Lang.text(mk(100)) +//│ ║ l.423: Lang.text(mk(100)) //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Scale[?Region]` does not match type `Circle | Intersect[?Region0] | Outside[?Region1] | Translate[?Region2] | Union[?Region3]` -//│ ║ l.328: _ then Scale(Vector(0, 0), mk(n)) +//│ ║ l.327: _ then Scale(Vector(0, 0), mk(n)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── but it flows into application with expected type `Circle | Intersect[?Region4] | Outside[?Region5] | Translate[?Region6] | Union[?Region7]` -//│ ║ l.427: Lang.text(mk(100)) +//│ ║ l.423: Lang.text(mk(100)) //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.156: if e is diff --git a/shared/src/test/diff/fcp-lit/variations_PolyML.mls b/shared/src/test/diff/fcp-lit/variations_PolyML.mls index 64f6308d3..9a971c816 100644 --- a/shared/src/test/diff/fcp-lit/variations_PolyML.mls +++ b/shared/src/test/diff/fcp-lit/variations_PolyML.mls @@ -57,10 +57,10 @@ def simple_and_double c = let l1 = c.Fold (fun y -> fun x -> Cons x y) Nil in let l2 = c.Fold (fun y -> fun x -> Cons ((x, x),) y) Nil in (l1, l2) -//│ simple_and_double: Collection['a] -> (forall 'tail. 'tail, forall 'tail0. 'tail0,) +//│ simple_and_double: Collection['a] -> (forall 'b. Nil | 'b, forall 'c. Nil | 'c,) //│ where -//│ 'tail0 :> (Cons[('a, 'a,)] with {tail: 'tail0}) | Nil -//│ 'tail :> (Cons['a] with {tail: 'tail}) | Nil +//│ 'c :> Cons[('a, 'a,)] with {tail: forall 'c. Nil | 'c} +//│ 'b :> Cons['a] with {tail: forall 'b. Nil | 'b} diff --git a/shared/src/test/diff/fcp/Church_CT.mls b/shared/src/test/diff/fcp/Church_CT.mls index 1f279fcf2..3ab215b05 100644 --- a/shared/src/test/diff/fcp/Church_CT.mls +++ b/shared/src/test/diff/fcp/Church_CT.mls @@ -1088,8 +1088,8 @@ to_church_ty = to_ch_simplif //│ where //│ 'a :> forall 'b 'c 'd 'e. 'b -> ('c -> 'e //│ where -//│ 'a <: 'b -> 'c -> 'd -//│ 'b <: 'd -> 'e) +//│ 'b <: 'd -> 'e +//│ 'a <: 'b -> 'c -> 'd) //│ ╙── //│ anything -> 'a -> ('b -> 'c //│ where @@ -1102,7 +1102,7 @@ to_church_ty = to_ch_simplif //│ 'e <: 'f -> 'g -> 'h) //│ <: to_church_ty: //│ int -> ChurchInt -//│ ╔══[ERROR] Subtyping constraint of the form `forall ?to_ch_simplif. ?to_ch_simplif <: int -> ChurchInt` exceeded recursion depth limit (250) +//│ ╔══[ERROR] Cyclic-looking constraint while typing def definition; a type annotation may be required //│ ║ l.1086: to_church_ty = to_ch_simplif //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. @@ -1113,20 +1113,20 @@ to_church_ty = to_ch_simplif rec def to_ch_simplif n = s (to_ch_simplif n) //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a :> forall 'b 'c 'd 'e. 'b -> ('c -> 'e +//│ 'a :> forall 'b 'c 'd 'e. 'c -> ('d -> 'b //│ where -//│ 'b <: 'd -> 'e -//│ 'a <: 'b -> 'c -> 'd) +//│ 'a <: 'c -> 'd -> 'e +//│ 'c <: 'e -> 'b) //│ ╙── //│ to_ch_simplif: anything -> 'a -> ('b -> 'c //│ where -//│ 'd <: 'a -> 'b -> 'e -//│ 'a <: 'e -> 'c) +//│ 'a <: 'd -> 'c +//│ 'e <: 'a -> 'b -> 'd) //│ where -//│ 'd :> forall 'f 'g 'h 'i. 'f -> ('g -> 'i +//│ 'e :> forall 'f 'g 'h 'i. 'f -> ('g -> 'i //│ where //│ 'f <: 'h -> 'i -//│ 'd <: 'f -> 'g -> 'h) +//│ 'e <: 'f -> 'g -> 'h) //│ = [Function: to_ch_simplif1] :e // * Since the removal of "recursive definition hacks" @@ -1135,21 +1135,21 @@ to_church_ty = to_ch_simplif //│ where //│ 'a :> forall 'b 'c 'd 'e. 'b -> ('c -> 'e //│ where -//│ 'b <: 'd -> 'e -//│ 'a <: 'b -> 'c -> 'd) +//│ 'a <: 'b -> 'c -> 'd +//│ 'b <: 'd -> 'e) //│ ╙── //│ anything -> 'a -> ('b -> 'c //│ where //│ 'a <: 'd -> 'c //│ 'e <: 'a -> 'b -> 'd) //│ where -//│ 'e :> forall 'f 'g 'h 'i. 'g -> ('h -> 'f +//│ 'e :> forall 'f 'g 'h 'i. 'f -> ('g -> 'i //│ where -//│ 'g <: 'i -> 'f -//│ 'e <: 'g -> 'h -> 'i) +//│ 'f <: 'h -> 'i +//│ 'e <: 'f -> 'g -> 'h) //│ <: to_church_ty: //│ int -> ChurchInt -//│ ╔══[ERROR] Subtyping constraint of the form `forall ?to_ch_simplif. ?to_ch_simplif <: int -> ChurchInt` exceeded recursion depth limit (250) +//│ ╔══[ERROR] Cyclic-looking constraint while typing def definition; a type annotation may be required //│ ║ l.1133: to_church_ty = to_ch_simplif //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. @@ -1160,19 +1160,19 @@ to_church_ty = to_ch_simplif to_church_ty = to_ch_A1 //│ ╔══[ERROR] Inferred recursive type: 'to_ch_A1 //│ where -//│ 'to_ch_A1 :> forall 'to_ch_A1. int -> (forall 'a 'b 'c 'd 'e. (? & 'e) -> (('a & 'c) -> ('c | 'd) +//│ 'to_ch_A1 :> forall 'to_ch_A1. int -> (forall 'a 'b 'c 'd 'e. (? & 'd) -> (('e & 'c) -> ('c | 'b) //│ where -//│ ChurchInt <: 'e -> 'a -> 'b -//│ 'e <: 'b -> 'd)) +//│ 'd <: 'a -> 'b +//│ ChurchInt <: 'd -> 'e -> 'a)) //│ where //│ 'to_ch_A1 <: int -> ChurchInt //│ ╙── //│ 'to_ch_A1 //│ where -//│ 'to_ch_A1 :> forall 'to_ch_A1. int -> (forall 'a 'b 'c 'd 'e. 'd -> (('c & 'a) -> ('a | 'b) +//│ 'to_ch_A1 :> forall 'to_ch_A1. int -> (forall 'a 'b 'c 'd 'e. 'd -> (('e & 'b) -> ('b | 'c) //│ where -//│ 'd <: 'e -> 'b -//│ ChurchInt <: 'd -> 'c -> 'e)) +//│ ChurchInt <: 'd -> 'e -> 'a +//│ 'd <: 'a -> 'c)) //│ where //│ 'to_ch_A1 <: int -> ChurchInt //│ <: to_church_ty: @@ -1187,8 +1187,8 @@ to_church_ty = to_ch_A1 to_church_ty = to_church_mix //│ int -> 'a -> ('b -> ('b | 'c) //│ where -//│ 'a <: 'd -> 'c -//│ ChurchInt <: 'a -> 'b -> 'd) +//│ ChurchInt <: 'a -> 'b -> 'd +//│ 'a <: 'd -> 'c) //│ <: to_church_ty: //│ int -> ChurchInt //│ = [Function: to_church_mix] diff --git a/shared/src/test/diff/fcp/FunnyId.mls b/shared/src/test/diff/fcp/FunnyId.mls index 0a5dcc514..9558b9767 100644 --- a/shared/src/test/diff/fcp/FunnyId.mls +++ b/shared/src/test/diff/fcp/FunnyId.mls @@ -35,10 +35,9 @@ rec def id x = let tmp = id id x in x //│ <: ? & 'a //│ ║ l.30: rec def id x = let tmp = id id x in x //│ ╙── ^^^^^ -//│ id: 'id +//│ id: 'a -> 'a //│ where -//│ 'id :> 'a -> 'a -//│ 'a :> 'id +//│ 'a :> 'a -> 'a //│ <: 'a -> anything //│ = [Function: id1] @@ -53,10 +52,10 @@ id 1 //│ ║ l.30: rec def id x = let tmp = id id x in x //│ ╙── ^^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.47: id 1 +//│ ║ l.46: id 1 //│ ║ ^^^^ //│ ╟── integer literal of type `1` is not a function -//│ ║ l.47: id 1 +//│ ║ l.46: id 1 //│ ║ ^ //│ ╟── Note: constraint arises from application: //│ ║ l.30: rec def id x = let tmp = id id x in x @@ -80,15 +79,14 @@ id_ty = id //│ <: ? & 'a //│ ║ l.30: rec def id x = let tmp = id id x in x //│ ╙── ^^^^^ -//│ 'id +//│ 'a -> 'a //│ where -//│ 'id :> 'a -> 'a -//│ 'a :> 'id +//│ 'a :> 'a -> 'a //│ <: 'a -> anything //│ <: id_ty: //│ 'a -> 'a //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.75: id_ty = id +//│ ║ l.74: id_ty = id //│ ║ ^^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.4: def id_ty: forall 'a. 'a -> 'a @@ -133,19 +131,17 @@ rec def id x = if true then x else id id x //│ <: 'c //│ 'c :> 'b -> 'c //│ <: 'a -//│ ║ l.128: rec def id x = if true then x else id id x +//│ ║ l.126: rec def id x = if true then x else id id x //│ ╙── ^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.128: rec def id x = if true then x else id id x +//│ ║ l.126: rec def id x = if true then x else id id x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id: 'id +//│ id: 'a -> 'b //│ where -//│ 'id :> 'a -> 'b -//│ 'a :> 'id +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id3] :e @@ -157,28 +153,26 @@ id_ty = id //│ 'c :> 'a | 'c -> 'b //│ <: 'a //│ 'a <: 'b -//│ ║ l.128: rec def id x = if true then x else id id x +//│ ║ l.126: rec def id x = if true then x else id id x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ 'id +//│ 'a -> 'b //│ where -//│ 'id :> 'a -> 'b -//│ 'a :> 'id +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ <: id_ty: //│ 'a -> 'a //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.152: id_ty = id +//│ ║ l.148: id_ty = id //│ ║ ^^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.4: def id_ty: forall 'a. 'a -> 'a //│ ║ ^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.128: rec def id x = if true then x else id id x +//│ ║ l.126: rec def id x = if true then x else id id x //│ ║ ^^^^^^^ //│ ╟── from reference: -//│ ║ l.128: rec def id x = if true then x else id id x +//│ ║ l.126: rec def id x = if true then x else id id x //│ ║ ^ //│ ╟── Note: quantified type variable 'a is defined at: //│ ║ l.4: def id_ty: forall 'a. 'a -> 'a @@ -195,47 +189,35 @@ def choose: 'a -> 'a -> 'a //│ choose: 'a -> 'a -> 'a rec def id1 x = choose x (id1 id1 x) -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b id1 id -//│ res: 'a -> 'b | 'id +//│ res: ('a & 'b) -> 'a //│ where -//│ 'a :> forall 'id 'c 'd. 'a -> 'b | 'id -//│ <: 'b -//│ 'b :> forall 'id 'c 'd. 'id -//│ <: 'a -> 'b -//│ 'id :> 'c -> 'd -//│ 'c :> 'id -//│ <: 'd -//│ 'd :> 'id -//│ <: 'c -> 'd +//│ 'a :> forall 'c 'd. ('a & 'b & 'd) -> 'a +//│ <: ((forall 'c 'd. 'd -> 'c) | 'b) -> 'a +//│ 'd :> 'd -> 'c +//│ <: 'c +//│ 'c := 'd -> 'c rec def id1 x = if true then x else id1 id1 x -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b id1 id -//│ res: 'a -> 'b | 'id +//│ res: ('a & 'b) -> 'a //│ where -//│ 'a :> forall 'id 'c 'd. 'a -> 'b | 'id -//│ <: 'b -//│ 'b :> forall 'id 'c 'd. 'id -//│ <: 'a -> 'b -//│ 'id :> 'c -> 'd -//│ 'c :> 'id +//│ 'a :> forall 'c 'd. ('a & 'b & 'c) -> 'a +//│ <: ((forall 'c 'd. 'c -> 'd) | 'b) -> 'a +//│ 'c :> 'c -> 'd //│ <: 'd -//│ 'd :> 'id -//│ <: 'c -> 'd +//│ 'd := 'c -> 'd diff --git a/shared/src/test/diff/fcp/ListBuild.mls b/shared/src/test/diff/fcp/ListBuild.mls index 2d68dfb39..1dfe4f454 100644 --- a/shared/src/test/diff/fcp/ListBuild.mls +++ b/shared/src/test/diff/fcp/ListBuild.mls @@ -70,15 +70,16 @@ def build0 (g: forall 'b. ('a -> 'a -> 'b) -> 'b) = g (fun x -> fun y -> single( //│ = //│ single is not implemented -:e // * This is recursive because we place the list-typed value inside a new list along with the head +:e // * This is recursive because we place the list-typed value inside a new list along with the head. def build0 (g: forall 'b. ('a -> 'b -> 'b) -> 'b) = g (fun x -> fun y -> single((x, y))) //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a :> Ls[(?, 'a,)] -//│ ╙── +//│ 'a :> Ls[(?, forall 'a. 'a,)] +//│ ║ l.74: def build0 (g: forall 'b. ('a -> 'b -> 'b) -> 'b) = g (fun x -> fun y -> single((x, y))) +//│ ╙── ^^^^^^^^^^^^^^ //│ build0: (forall 'b. ('a -> 'b -> 'b) -> 'b) -> 'c //│ where -//│ 'c :> Ls[('a, 'c,)] +//│ 'c :> Ls[('a, forall 'c. 'c,)] //│ = //│ single is not implemented @@ -184,13 +185,13 @@ build: forall 'a. (forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> Ls['a] :e build: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.185: build: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] +//│ ║ l.186: build: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] //│ ║ ^^^^^ //│ ╟── type `Ls['a]` does not match type `'b` -//│ ║ l.185: build: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] +//│ ║ l.186: build: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] //│ ║ ^^^^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.142: def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> cons (x, xs)) nil +//│ ║ l.143: def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> cons (x, xs)) nil //│ ╙── ^^ //│ res: (('a -> Ls['a] -> Ls['a]) -> Ls['a] -> Ls['a]) -> Ls['a] //│ = [Function: build] @@ -264,16 +265,16 @@ b g x = build_ g x //│ <: b: //│ (forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> Ls['a] //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.262: b g x = build_ g x +//│ ║ l.263: b g x = build_ g x //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── type `Ls['a]` is not a function //│ ║ l.22: def nil: Ls['a] //│ ║ ^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.262: b g x = build_ g x +//│ ║ l.263: b g x = build_ g x //│ ║ ^^^^^^^^^^ //│ ╟── from application: -//│ ║ l.203: def build_ = fun g -> g (fun x -> fun xs -> cons (x, xs)) nil +//│ ║ l.204: def build_ = fun g -> g (fun x -> fun xs -> cons (x, xs)) nil //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ = [Function: b3] diff --git a/shared/src/test/diff/fcp/NestedDataTypes.mls b/shared/src/test/diff/fcp/NestedDataTypes.mls index 9c0eb4f5d..65fbaf106 100644 --- a/shared/src/test/diff/fcp/NestedDataTypes.mls +++ b/shared/src/test/diff/fcp/NestedDataTypes.mls @@ -220,10 +220,14 @@ rec def map f tree = case tree of { //│ ║ l.67: } //│ ║ ^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ map: ('value -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'value0) & 'a -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'b & 'A) & 'c -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'd & 'A) & 'e -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'f & 'A) & 'g -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'h & 'A)) -> 'i -> 'subTree +//│ map: ('value -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'value0) & 'a -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'b & 'A) & 'c -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'd & 'A) & 'e -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'f & 'A) & 'g -> (Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'h & 'A)) -> 'i -> (Leaf[((nothing, (nothing, nothing,) | 'd,) | 'b, ((nothing, nothing,) | 'h, nothing,) | 'f,) | 'value0] | 'j) //│ where -//│ 'subTree :> Leaf[((nothing, (nothing, nothing,) | 'd,) | 'b, ((nothing, nothing,) | 'h, nothing,) | 'f,) | 'value0] | (Node['A] with {subTree: 'subTree}) -//│ 'i <: Leaf[?] & {value: ((anything, (anything, anything,) & 'c,) & 'a, ((anything, anything,) & 'g, anything,) & 'e,) & 'value} | (Node[?] with {subTree: 'i}) +//│ 'j :> Node['A] with { +//│ subTree: Leaf[((nothing, (nothing, nothing,) | 'd,) | 'b, ((nothing, nothing,) | 'h, nothing,) | 'f,) | 'value0] | 'j +//│ } +//│ 'i <: Leaf[?] & { +//│ value: ((anything, (anything, anything,) & 'c,) & 'a, ((anything, anything,) & 'g, anything,) & 'e,) & 'value +//│ } | (Node[?] with {subTree: 'i}) //│ 'A :> ((nothing, nothing,) | 'h, (nothing, nothing,) | 'd,) //│ <: Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two[Two['A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] & 'A] //│ = [Function: map] @@ -257,15 +261,15 @@ rec def map f tree = case tree of { map succ n4 //│ ╔══[ERROR] Inferred recursive type: 'map //│ where -//│ 'map :> forall 'A 'subTree 'value 'subTree0 'a 'value0. 'a -> ((Leaf[?] & {value: 'value} | (Node[?] with {subTree: 'subTree0})) -> (Leaf['value0] | (Node['A] with {subTree: 'subTree})) +//│ 'map :> forall 'value 'value0 'subTree 'A 'subTree0. 'a -> ((Leaf[?] & {value: 'value0} | (Node[?] with {subTree: 'subTree})) -> (Leaf['value] | (Node['A] with {subTree: 'subTree0})) //│ where //│ 'map <: (forall 'b 'c 'd 'e. (('b, 'd,),) -> ('c, 'e,) //│ where -//│ 'a <: 'b -> 'c & 'd -> 'e) -> 'subTree0 -> (PerfectTree[Two['A]] & 'subTree) -//│ 'a <: 'value -> 'value0) +//│ 'a <: 'b -> 'c & 'd -> 'e) -> 'subTree -> (PerfectTree[Two['A]] & 'subTree0) +//│ 'a <: 'value0 -> 'value) //│ ╙── -//│ ╔══[ERROR] Subtyping constraint of the form `?a <: (forall ?b. ?b) -> ?c` exceeded recursion depth limit (250) -//│ ║ l.257: map succ n4 +//│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required +//│ ║ l.261: map succ n4 //│ ║ ^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error diff --git a/shared/src/test/diff/fcp/NestedDataTypesGADT.mls b/shared/src/test/diff/fcp/NestedDataTypesGADT.mls index db15e3718..3e49f0f67 100644 --- a/shared/src/test/diff/fcp/NestedDataTypesGADT.mls +++ b/shared/src/test/diff/fcp/NestedDataTypesGADT.mls @@ -63,7 +63,10 @@ d1_ : HTree[Z, int] //│ = [Function: d1_] d2 = DNode { subTree = (d1_, d1_); n = S{} } -//│ d2: DNode['N, 1] with {n: forall 'P. S['P], subTree: (forall 'a. (DLeaf[1] -> 'a) -> 'a, forall 'a. (DLeaf[1] -> 'a) -> 'a,)} +//│ d2: DNode['N, 1] with { +//│ n: forall 'P. S['P], +//│ subTree: (forall 'a. (DLeaf[1] -> 'a) -> 'a, forall 'a. (DLeaf[1] -> 'a) -> 'a,) +//│ } //│ = DNode { n: S {}, subTree: [ [Function: d1_], [Function: d1_] ] } def d1_ty: HTree[Z, int] @@ -91,11 +94,11 @@ d2_ k = k d2 :e // FIXME d2_ : HTree[S[Z], int] //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.92: d2_ : HTree[S[Z], int] +//│ ║ l.95: d2_ : HTree[S[Z], int] //│ ║ ^^^ //│ ╟── expression of type `S[in Z & 'p out Z | 'p]` is not an instance of `Z` //│ ╟── Note: constraint arises from type reference: -//│ ║ l.69: def d1_ty: HTree[Z, int] +//│ ║ l.72: def d1_ty: HTree[Z, int] //│ ║ ^ //│ ╟── Note: class type parameter N is defined at: //│ ║ l.36: class DNode[N, A]: HTreeBase[S[N], A] & { subTree: Two[HTree[N, A]] } @@ -111,10 +114,10 @@ d2_ : HTree[S[Z], int] //│ = //│ d2 and d1_ty are not implemented //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.109: d2_ : HTree[S[Z], int] +//│ ║ l.112: d2_ : HTree[S[Z], int] //│ ║ ^^^ //│ ╟── type `HTreeBase[S[Z], ?]` does not match type `DLeaf[int] | DNode[S[in Z & 'p out Z | 'p], int]` -//│ ║ l.108: d2_ k = k (d2:HTreeBase[S[Z], int]) +//│ ║ l.111: d2_ k = k (d2:HTreeBase[S[Z], int]) //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.37: type HTree[N, A] = forall 'r. (forall 'p. (DLeaf[A] | DNode[S['p], A] & DNode[N, A]) -> 'r) -> 'r diff --git a/shared/src/test/diff/fcp/NoRecursiveTypes.mls b/shared/src/test/diff/fcp/NoRecursiveTypes.mls new file mode 100644 index 000000000..1775cd71d --- /dev/null +++ b/shared/src/test/diff/fcp/NoRecursiveTypes.mls @@ -0,0 +1,15 @@ +:NoRecursiveTypes + + +:e +foo = + let rec f x = f x.a in 0 +//│ ╔══[ERROR] Inferred recursive type: 'a +//│ where +//│ 'a <: {a: 'a} +//│ ║ l.6: let rec f x = f x.a in 0 +//│ ╙── ^^^ +//│ foo: 0 +//│ = 0 + + diff --git a/shared/src/test/diff/fcp/OCamlList.mls b/shared/src/test/diff/fcp/OCamlList.mls index 23cf1512c..04f1c9b7d 100644 --- a/shared/src/test/diff/fcp/OCamlList.mls +++ b/shared/src/test/diff/fcp/OCamlList.mls @@ -714,9 +714,7 @@ def concat_map = let rec r = { | Nil -> r.concat_map f xs | Cons(y, ys) -> r.prepend_concat_map ys f xs } in r.concat_map -//│ ('A -> List[?]) -> List['A] -> 'a -//│ where -//│ 'a :> List[nothing] +//│ ('A -> List[?]) -> List['A] -> (List[nothing] | 'a) //│ <: concat_map: //│ ('a -> List['b]) -> List['a] -> List['b] diff --git a/shared/src/test/diff/fcp/Overloads.mls b/shared/src/test/diff/fcp/Overloads.mls index 5a713da7a..71a328bb5 100644 --- a/shared/src/test/diff/fcp/Overloads.mls +++ b/shared/src/test/diff/fcp/Overloads.mls @@ -31,12 +31,12 @@ IISS : ZZII //│ ╔══[ERROR] Type mismatch in type ascription: //│ ║ l.30: IISS : ZZII //│ ║ ^^^^ -//│ ╟── type `0` is not an instance of type `string` -//│ ║ l.7: type ZZII = 0 -> 0 & int -> int -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: +//│ ╟── type `int` does not match type `0` //│ ║ l.12: def IISS: int -> int & string -> string -//│ ╙── ^^^^^^ +//│ ║ ^^^ +//│ ╟── Note: constraint arises from literal type: +//│ ║ l.7: type ZZII = 0 -> 0 & int -> int +//│ ╙── ^ //│ res: ZZII :e @@ -44,12 +44,9 @@ IISS : BBNN //│ ╔══[ERROR] Type mismatch in type ascription: //│ ║ l.43: IISS : BBNN //│ ║ ^^^^ -//│ ╟── type `bool` is not an instance of type `int` +//│ ╟── type `bool` does not match type `int | string` //│ ║ l.6: type BBNN = bool -> bool & number -> number -//│ ║ ^^^^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ╙── ^^^ +//│ ╙── ^^^^ //│ res: BBNN @@ -61,53 +58,20 @@ IISS : int -> int IISS : (0 | 1) -> number //│ res: (0 | 1) -> number -:e IISS : 'a -> 'a -//│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.65: IISS : 'a -> 'a -//│ ║ ^^^^ -//│ ╟── type `int` is not an instance of type `string` -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ║ ^^^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ║ ^^^^^^ -//│ ╟── from type variable: -//│ ║ l.65: IISS : 'a -> 'a -//│ ╙── ^^ -//│ res: nothing -> (error | int | string) +//│ res: ('a & (int | string)) -> (int | string | 'a) -:e IISS 0 -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.81: IISS 0 -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `0` is not an instance of type `string` -//│ ║ l.81: IISS 0 -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ╙── ^^^^^^ -//│ res: error | int | string +//│ res: int | string (IISS : int -> int) 0 //│ res: int -:e (if true then IISS else BBNN) 0 -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.97: (if true then IISS else BBNN) 0 -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── integer literal of type `0` is not an instance of type `string` -//│ ║ l.97: (if true then IISS else BBNN) 0 -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ╙── ^^^^^^ -//│ res: bool | error | number | string +//│ res: bool | number | string fun x -> (if true then IISS else BBNN) x -//│ res: nothing -> (bool | number | string) +//│ res: int -> (bool | number | string) if true then IISS else BBNN //│ res: bool -> bool & number -> number | int -> int & string -> string @@ -121,14 +85,11 @@ if true then IISS else BBNN :e (if true then IISS else BBNN) : (0 | 1 | true) -> number //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.122: (if true then IISS else BBNN) : (0 | 1 | true) -> number -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── type `0` is not an instance of type `string` -//│ ║ l.122: (if true then IISS else BBNN) : (0 | 1 | true) -> number -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.12: def IISS: int -> int & string -> string -//│ ╙── ^^^^^^ +//│ ║ l.86: (if true then IISS else BBNN) : (0 | 1 | true) -> number +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type `true` does not match type `int | string` +//│ ║ l.86: (if true then IISS else BBNN) : (0 | 1 | true) -> number +//│ ╙── ^^^^ //│ res: (0 | 1 | true) -> number diff --git a/shared/src/test/diff/fcp/PaperTable.mls b/shared/src/test/diff/fcp/PaperTable.mls index 14fe4909b..f7306471b 100644 --- a/shared/src/test/diff/fcp/PaperTable.mls +++ b/shared/src/test/diff/fcp/PaperTable.mls @@ -612,13 +612,11 @@ rec def id1 x = if true then x else id1 id1 x //│ ║ l.601: rec def id1 x = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id11] :e @@ -667,7 +665,7 @@ id1 id1 //│ ║ l.601: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Subtyping constraint of the form `forall ?id1. ?id1 <: (forall ?id10. ?id10) -> ?a` exceeded recursion depth limit (250) -//│ ║ l.626: id1 id1 +//│ ║ l.624: id1 id1 //│ ║ ^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -677,7 +675,7 @@ id1 id1 :e auto auto //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.678: auto auto +//│ ║ l.676: auto auto //│ ║ ^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.163: def auto : (forall 'a. 'a -> 'a) -> (forall 'b. 'b -> 'b) @@ -696,7 +694,7 @@ auto auto :e (fun x -> x x) (fun x -> x x) //│ ╔══[ERROR] Subtyping constraint of the form `?a -> ?b <: (forall ?c ?d. ?c -> ?d) -> ?e` exceeded recursion depth limit (250) -//│ ║ l.697: (fun x -> x x) (fun x -> x x) +//│ ║ l.695: (fun x -> x x) (fun x -> x x) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -1010,19 +1008,17 @@ rec def id1 x = if true then x else id1 id1 x //│ <: 'c //│ 'c :> 'b -> 'c //│ <: 'a -//│ ║ l.1005: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1003: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Subtyping constraint of the form `?a -> ?b <: ?id1` exceeded recursion depth limit (250) -//│ ║ l.1005: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1003: rec def id1 x = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id12] :e @@ -1068,10 +1064,10 @@ id1 id1 //│ 'b :> 'b -> 'c //│ <: 'c //│ 'c := 'b -> 'c -//│ ║ l.1005: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1003: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Subtyping constraint of the form `forall ?id1. ?id1 <: (forall ?id10. ?id10) -> ?a` exceeded recursion depth limit (250) -//│ ║ l.1030: id1 id1 +//│ ║ l.1026: id1 id1 //│ ║ ^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -1081,7 +1077,7 @@ id1 id1 :e auto auto //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.1082: auto auto +//│ ║ l.1078: auto auto //│ ║ ^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.163: def auto : (forall 'a. 'a -> 'a) -> (forall 'b. 'b -> 'b) @@ -1100,7 +1096,7 @@ auto auto :e (fun x -> x x) (fun x -> x x) //│ ╔══[ERROR] Subtyping constraint of the form `?a -> ?b <: (forall ?c ?d. ?c -> ?d) -> ?e` exceeded recursion depth limit (250) -//│ ║ l.1101: (fun x -> x x) (fun x -> x x) +//│ ║ l.1097: (fun x -> x x) (fun x -> x x) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -1414,19 +1410,17 @@ rec def id1 x = if true then x else id1 id1 x //│ <: 'c //│ 'c :> 'b -> 'c //│ <: 'a -//│ ║ l.1409: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1405: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.1409: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1405: rec def id1 x = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id13] :e @@ -1449,10 +1443,10 @@ id1 id1 //│ 'b :> 'b -> 'c //│ <: 'c //│ 'c := 'b -> 'c -//│ ║ l.1409: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.1405: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1434: id1 id1 +//│ ║ l.1428: id1 id1 //│ ║ ^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -1462,7 +1456,7 @@ id1 id1 :e auto auto //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.1463: auto auto +//│ ║ l.1457: auto auto //│ ║ ^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.163: def auto : (forall 'a. 'a -> 'a) -> (forall 'b. 'b -> 'b) @@ -1481,7 +1475,7 @@ auto auto :e (fun x -> x x) (fun x -> x x) //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1482: (fun x -> x x) (fun x -> x x) +//│ ║ l.1476: (fun x -> x x) (fun x -> x x) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -1787,35 +1781,29 @@ to_ch: int -> ChurchInt // G8 rec def id1 x = if true then x else id1 id1 x -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id14] // G9 id1 id1 -//│ res: 'a -> 'b | 'id1 +//│ res: ('a & 'b) -> 'a //│ where -//│ 'a :> forall 'id1 'c 'd. 'a -> 'b | 'id1 -//│ <: 'b -//│ 'b :> forall 'id1 'c 'd. 'id1 -//│ <: 'a -> 'b -//│ 'id1 :> 'c -> 'd -//│ 'c :> 'id1 +//│ 'a :> forall 'c 'd. ('a & 'b & 'c) -> ('a | 'd) +//│ <: ((forall 'c 'd. 'c -> 'd) | 'b) -> 'a +//│ 'c :> 'c -> 'd //│ <: 'd -//│ 'd :> 'id1 -//│ <: 'c -> 'd +//│ 'd := 'c -> 'd //│ = [Function: id14] // Gn :e auto auto //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.1816: auto auto +//│ ║ l.1804: auto auto //│ ║ ^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.163: def auto : (forall 'a. 'a -> 'a) -> (forall 'b. 'b -> 'b) @@ -1834,7 +1822,7 @@ auto auto :e (fun x -> x x) (fun x -> x x) //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1835: (fun x -> x x) (fun x -> x x) +//│ ║ l.1823: (fun x -> x x) (fun x -> x x) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error diff --git a/shared/src/test/diff/fcp/QML_exist_Classes.mls b/shared/src/test/diff/fcp/QML_exist_Classes.mls index 683f832a8..f550afb0f 100644 --- a/shared/src/test/diff/fcp/QML_exist_Classes.mls +++ b/shared/src/test/diff/fcp/QML_exist_Classes.mls @@ -45,7 +45,12 @@ baseImpl = ArraysImpl { update = fun r -> fun (i : int) -> fun a -> a; fold = fun f -> fun b -> fun r -> f r b } -//│ baseImpl: ArraysImpl['Rep, 'Rep] with {fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> int -> 'e, update: forall 'f. anything -> int -> 'f -> 'f} +//│ baseImpl: ArraysImpl['Rep, 'Rep] with { +//│ fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> int -> 'e, +//│ update: forall 'f. anything -> int -> 'f -> 'f +//│ } //│ = ArraysImpl { //│ init: [Function: init], //│ sub: [Function: sub], @@ -57,7 +62,12 @@ def base: Arrays['a] def base f = f baseImpl //│ base: Arrays['a] //│ = -//│ ((forall 'Rep. ArraysImpl['Rep, 'Rep] with {fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> int -> 'e, update: forall 'f. anything -> int -> 'f -> 'f}) -> 'g) -> 'g +//│ ((forall 'Rep. ArraysImpl['Rep, 'Rep] with { +//│ fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> int -> 'e, +//│ update: forall 'f. anything -> int -> 'f -> 'f +//│ }) -> 'g) -> 'g //│ <: base: //│ Arrays['a] //│ = [Function: base] @@ -72,15 +82,20 @@ def simpleStepImpl arrImpl = ArraysImpl { update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.Update r0 i a, "updated"); fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.Fold f b r0 } -//│ simpleStepImpl: ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with {fold: forall 'b. ('A0 -> 'b -> 'b) -> 'b -> (('Rep0, anything,),) -> 'b, init: 'A -> ('Rep, "initialized",), sub: (('Rep0, anything,),) -> int -> 'A0, update: forall 'c. (('Rep0 & 'c, anything,),) -> int -> 'A -> ('Rep | 'c, "updated",)}) -//│ where -//│ 'Rep1 :> ('Rep | 'd, "initialized" | "updated",) -//│ <: ('Rep0 & 'a, anything,) -//│ 'a <: 'Rep0 & 'd -//│ 'd :> 'Rep -//│ <: 'Rep0 & 'a -//│ 'A1 :> 'A0 -//│ <: 'A +//│ simpleStepImpl: ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with { +//│ fold: forall 'b. ('A0 -> 'b -> 'b) -> 'b -> (('Rep0, anything,),) -> 'b, +//│ init: 'A -> ('Rep, "initialized",), +//│ sub: (('Rep0, anything,),) -> int -> 'A0, +//│ update: forall 'c. (('Rep0 & 'c, anything,),) -> int -> 'A -> ('Rep | 'c, "updated",) +//│ }) +//│ where +//│ 'Rep1 :> ('Rep | 'd, "initialized" | "updated",) +//│ <: ('Rep0 & 'a, anything,) +//│ 'a <: 'Rep0 & 'd +//│ 'd :> 'Rep +//│ <: 'Rep0 & 'a +//│ 'A1 :> 'A0 +//│ <: 'A //│ = [Function: simpleStepImpl] def simpleStepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] @@ -88,15 +103,20 @@ def simpleStepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ = simpleStepImpl_ty = simpleStepImpl -//│ ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with {fold: forall 'b. ('A0 -> 'b -> 'b) -> 'b -> (('Rep0, anything,),) -> 'b, init: 'A -> ('Rep, "initialized",), sub: (('Rep0, anything,),) -> int -> 'A0, update: forall 'c. (('Rep0 & 'c, anything,),) -> int -> 'A -> ('Rep | 'c, "updated",)}) -//│ where -//│ 'Rep1 :> ('Rep | 'd, "initialized" | "updated",) -//│ <: ('Rep0 & 'a, anything,) -//│ 'a <: 'Rep0 & 'd -//│ 'd :> 'Rep -//│ <: 'Rep0 & 'a -//│ 'A1 :> 'A0 -//│ <: 'A +//│ ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with { +//│ fold: forall 'b. ('A0 -> 'b -> 'b) -> 'b -> (('Rep0, anything,),) -> 'b, +//│ init: 'A -> ('Rep, "initialized",), +//│ sub: (('Rep0, anything,),) -> int -> 'A0, +//│ update: forall 'c. (('Rep0 & 'c, anything,),) -> int -> 'A -> ('Rep | 'c, "updated",) +//│ }) +//│ where +//│ 'Rep1 :> ('Rep | 'd, "initialized" | "updated",) +//│ <: ('Rep0 & 'a, anything,) +//│ 'a <: 'Rep0 & 'd +//│ 'd :> 'Rep +//│ <: 'Rep0 & 'a +//│ 'A1 :> 'A0 +//│ <: 'A //│ <: simpleStepImpl_ty: //│ ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string,)] //│ = [Function: simpleStepImpl] @@ -108,7 +128,7 @@ simpleStepImpl_ty = simpleStepImpl :stats simpleStepImpl : ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ ╔══[ERROR] Subtyping constraint of the form `forall ?a ?b. ?a -> ?b <: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string,)]` took too many steps and ran out of fuel (10000) -//│ ║ l.109: simpleStepImpl : ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] +//│ ║ l.129: simpleStepImpl : ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ ║ ^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string,)] @@ -185,7 +205,7 @@ sb (fun arr -> arr.Sub (arr.Init true) 1) :e // * Type error is expected – argument order confusion sb (fun arr -> arr.Sub 0 (arr.Init true)) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.186: sb (fun arr -> arr.Sub 0 (arr.Init true)) +//│ ║ l.206: sb (fun arr -> arr.Sub 0 (arr.Init true)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `'Rep` is not an instance of type `int` //│ ║ l.37: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r @@ -194,7 +214,7 @@ sb (fun arr -> arr.Sub 0 (arr.Init true)) //│ ║ l.9: method Sub: Rep -> int -> A //│ ║ ^^^ //│ ╟── from application: -//│ ║ l.186: sb (fun arr -> arr.Sub 0 (arr.Init true)) +//│ ║ l.206: sb (fun arr -> arr.Sub 0 (arr.Init true)) //│ ║ ^^^^^^^^^^^^^ //│ ╟── Note: quantified type variable 'Rep is defined at: //│ ║ l.37: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r @@ -213,26 +233,26 @@ sb (fun arr -> arr.Update (arr.Init true) 1 false) :e // * Rightly prevent skolem confusion sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ╔══[ERROR] Type error in application -//│ ║ l.214: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) +//│ ║ l.234: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'Rep` leaks out of its scope //│ ║ l.37: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this application: -//│ ║ l.214: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) +//│ ║ l.234: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ║ ^^^^^^^^^^^^^^ //│ ╟── • this application: -//│ ║ l.173: sb = simpleStep base +//│ ║ l.193: sb = simpleStep base //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── • this reference: -//│ ║ l.214: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) +//│ ║ l.234: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ║ ^^ //│ ╟── • this reference: -//│ ║ l.214: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) +//│ ║ l.234: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ║ ^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.214: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) +//│ ║ l.234: sb (fun arr1 -> sb (fun arr2 -> arr2.Update (arr1.Init true))) //│ ╙── ^^^^^^^^^^^^^^ //│ res: error | int -> anything -> (??Rep | ??Rep0) //│ = [Function (anonymous)] @@ -250,63 +270,73 @@ sb (fun arr -> :e def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) -//│ ((forall 'Rep 'a 'A 'c 'A0 'd 'Rep0 'A1. ArraysRep[in 'A1 & 'A & 'A0 out 'A | 'A1, in 'Rep0 & 'Rep & 'c out 'Rep0 | 'Rep] -> ((forall 'Rep1. ArraysImpl['A0, 'Rep1] with {fold: forall 'b. ('A -> 'b -> 'b) -> 'b -> (('Rep, anything,),) -> 'b, init: 'A1 -> ('Rep0, "initialized",), sub: (('Rep, anything,),) -> int -> 'A, update: forall 'e. (('Rep & 'e, anything,),) -> int -> 'A1 -> ('Rep0 | 'e, "updated",)}) -> 'a) -> 'a) -> 'f) -> 'f -//│ where -//│ 'Rep1 :> ('Rep0 | 'd, "initialized" | "updated",) -//│ <: ('Rep & 'c, anything,) -//│ 'c <: 'Rep & 'd -//│ 'd :> 'Rep0 -//│ <: 'Rep & 'c -//│ 'A0 :> 'A -//│ <: 'A1 +//│ ((forall 'Rep 'a 'A 'c 'A0 'd 'Rep0 'A1. ArraysRep[in 'A1 & 'A & 'A0 out 'A | 'A1, in 'Rep0 & 'Rep & 'c out 'Rep0 | 'Rep] -> ((forall 'Rep1. ArraysImpl['A0, 'Rep1] with { +//│ fold: forall 'b. ('A -> 'b -> 'b) -> 'b -> (('Rep, anything,),) -> 'b, +//│ init: 'A1 -> ('Rep0, "initialized",), +//│ sub: (('Rep, anything,),) -> int -> 'A, +//│ update: forall 'e. (('Rep & 'e, anything,),) -> int -> 'A1 -> ('Rep0 | 'e, "updated",) +//│ }) -> 'a) -> 'a) -> 'f) -> 'f +//│ where +//│ 'Rep1 :> ('Rep0 | 'd, "initialized" | "updated",) +//│ <: ('Rep & 'c, anything,) +//│ 'c <: 'Rep & 'd +//│ 'd :> 'Rep0 +//│ <: 'Rep & 'c +//│ 'A0 :> 'A +//│ <: 'A1 //│ <: simpleStep: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.252: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) +//│ ║ l.272: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'Rep` leaks out of its scope //│ ║ l.37: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this applied expression: -//│ ║ l.252: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) +//│ ║ l.272: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) //│ ║ ^^^ //│ ╟── • this function: -//│ ║ l.252: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) +//│ ║ l.272: def simpleStep arr = arr (fun impl -> fun k -> k (simpleStepImpl impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.71: sub = fun ((r0, r1)) -> fun i -> arrImpl.Sub r0 i; +//│ ║ l.81: sub = fun ((r0, r1)) -> fun i -> arrImpl.Sub r0 i; //│ ╙── ^^ //│ = [Function: simpleStep1] :e def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) -//│ ((ArraysRep[out 'A, out 'Rep] -> 'a) -> 'c) -> ((forall 'Rep0. ArraysImpl[in 'A & 'A0 out 'A0, 'Rep0] with {fold: forall 'b. (nothing -> 'b -> 'b) -> 'b -> (('Rep, anything,),) -> 'b, init: 'A -> (nothing, "initialized",), sub: (('Rep, anything,),) -> int -> nothing, update: forall 'd. (('Rep & 'd, anything,),) -> int -> 'A -> ('d, "updated",)}) -> 'a) -> 'c -//│ where -//│ 'Rep0 :> ('e | 'f, "initialized" | "updated",) -//│ <: ('Rep & 'g & 'h, anything,) -//│ 'f :> 'e -//│ <: 'Rep & 'g & 'h -//│ 'h <: 'Rep & 'f -//│ 'e <: 'Rep & 'g -//│ 'g <: 'Rep & 'e +//│ ((ArraysRep[out 'A, out 'Rep] -> 'a) -> 'c) -> ((forall 'Rep0. ArraysImpl[in 'A & 'A0 out 'A0, 'Rep0] with { +//│ fold: forall 'b. (nothing -> 'b -> 'b) -> 'b -> (('Rep, anything,),) -> 'b, +//│ init: 'A -> (nothing, "initialized",), +//│ sub: (('Rep, anything,),) -> int -> nothing, +//│ update: forall 'd. (('Rep & 'd, anything,),) -> int -> 'A -> ('d, "updated",) +//│ }) -> 'a) -> 'c +//│ where +//│ 'Rep0 :> ('e | 'f, "initialized" | "updated",) +//│ <: ('Rep & 'g & 'h, anything,) +//│ 'f :> 'e +//│ <: 'Rep & 'g & 'h +//│ 'h <: 'Rep & 'f +//│ 'e <: 'Rep & 'g +//│ 'g <: 'Rep & 'e //│ <: simpleStep2: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.283: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) +//│ ║ l.308: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'Rep` leaks out of its scope //│ ║ l.37: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this reference: -//│ ║ l.73: fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.Fold f b r0 +//│ ║ l.83: fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.Fold f b r0 //│ ║ ^^^^^^^ //│ ╟── • this reference: -//│ ║ l.283: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) +//│ ║ l.308: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) //│ ║ ^^^^ //│ ╟── • this applied expression: -//│ ║ l.283: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) +//│ ║ l.308: def simpleStep2 arr k = arr (fun impl -> k (simpleStepImpl impl)) //│ ╙── ^^^ //│ = [Function: simpleStep21] @@ -350,18 +380,23 @@ def stepImpl arrImpl = ArraysImpl { else (r0, arrImpl.Update r1 (div i 2) a); fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.Fold f (arrImpl.Fold f b r0) r1 } -//│ stepImpl: ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a & 'c out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with {fold: forall 'b 'b0. ('A0 -> 'b0 -> 'b0 & 'A0 -> 'b -> ('b0 & 'b)) -> ('b0 & 'b) -> (('Rep0, 'Rep0,),) -> 'b0, init: 'A -> ('Rep, 'Rep,), sub: (('Rep0, 'Rep0,),) -> int -> 'A0, update: forall 'd 'e. (('Rep0 & 'd, 'Rep0 & 'e,),) -> int -> 'A -> ('Rep | 'd, 'Rep | 'e,)}) -//│ where -//│ 'Rep1 :> ('Rep | 'a | 'f, 'Rep | 'c | 'g,) -//│ <: ('Rep0 & 'a, 'Rep0 & 'c,) -//│ 'c <: 'Rep0 & 'g -//│ 'g :> 'Rep -//│ <: 'Rep0 & 'c -//│ 'a <: 'Rep0 & 'f -//│ 'f :> 'Rep -//│ <: 'Rep0 & 'a -//│ 'A1 :> 'A0 -//│ <: 'A +//│ stepImpl: ArraysRep[in 'A & 'A0 & 'A1 out 'A0 | 'A, in 'Rep & 'Rep0 & 'a & 'c out 'Rep | 'Rep0] -> (ArraysImpl['A1, 'Rep1] with { +//│ fold: forall 'b 'b0. ('A0 -> 'b0 -> 'b0 & 'A0 -> 'b -> ('b0 & 'b)) -> ('b0 & 'b) -> (('Rep0, 'Rep0,),) -> 'b0, +//│ init: 'A -> ('Rep, 'Rep,), +//│ sub: (('Rep0, 'Rep0,),) -> int -> 'A0, +//│ update: forall 'd 'e. (('Rep0 & 'd, 'Rep0 & 'e,),) -> int -> 'A -> ('Rep | 'd, 'Rep | 'e,) +//│ }) +//│ where +//│ 'Rep1 :> ('Rep | 'a | 'f, 'Rep | 'c | 'g,) +//│ <: ('Rep0 & 'a, 'Rep0 & 'c,) +//│ 'c <: 'Rep0 & 'g +//│ 'g :> 'Rep +//│ <: 'Rep0 & 'c +//│ 'a <: 'Rep0 & 'f +//│ 'f :> 'Rep +//│ <: 'Rep0 & 'a +//│ 'A1 :> 'A0 +//│ <: 'A //│ = [Function: stepImpl] diff --git a/shared/src/test/diff/fcp/QML_exist_Classes_min.mls b/shared/src/test/diff/fcp/QML_exist_Classes_min.mls index 60ee08358..fff2ca6ed 100644 --- a/shared/src/test/diff/fcp/QML_exist_Classes_min.mls +++ b/shared/src/test/diff/fcp/QML_exist_Classes_min.mls @@ -22,13 +22,15 @@ type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r def simpleStepImpl arrImpl = ArraysImpl { update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.Update r0 i a, "updated") } -//│ simpleStepImpl: ArraysRep['A, in 'Rep & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A, 'Rep1] with {update: forall 'b. (('Rep0 & 'b, anything,),) -> int -> 'A -> ('Rep | 'b, "updated",)}) -//│ where -//│ 'Rep1 :> ('c, "updated",) -//│ <: ('a, anything,) -//│ 'a <: 'Rep0 & 'c -//│ 'c :> 'Rep -//│ <: 'a +//│ simpleStepImpl: ArraysRep['A, in 'Rep & 'a out 'Rep | 'Rep0] -> (ArraysImpl['A, 'Rep1] with { +//│ update: forall 'b. (('Rep0 & 'b, anything,),) -> int -> 'A -> ('Rep | 'b, "updated",) +//│ }) +//│ where +//│ 'Rep1 :> ('c, "updated",) +//│ <: ('a, anything,) +//│ 'a <: 'Rep0 & 'c +//│ 'c :> 'Rep +//│ <: 'a //│ = [Function: simpleStepImpl] @@ -51,17 +53,17 @@ mkArrays impl k = k impl :e def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) //│ ╔══[ERROR] Type error in application -//│ ║ l.52: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) +//│ ║ l.54: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'Rep` leaks out of its scope //│ ║ l.18: type Arrays[A] = (forall 'Rep. ArraysRep[A, 'Rep] -> 'r) -> 'r //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this function: -//│ ║ l.52: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) +//│ ║ l.54: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── • this reference: -//│ ║ l.52: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) +//│ ║ l.54: def stepped = arr (fun arrImpl -> fun k -> k (simpleStepImpl arrImpl)) //│ ║ ^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.23: update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.Update r0 i a, "updated") diff --git a/shared/src/test/diff/fcp/QML_exist_Records_D.mls b/shared/src/test/diff/fcp/QML_exist_Records_D.mls index b86167df9..0d709ad75 100644 --- a/shared/src/test/diff/fcp/QML_exist_Records_D.mls +++ b/shared/src/test/diff/fcp/QML_exist_Records_D.mls @@ -31,7 +31,12 @@ baseImpl = { update = fun r -> fun i -> fun a -> a; fold = fun f -> fun b -> fun r -> f r b } -//│ baseImpl: {fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> anything -> 'e, update: forall 'f. anything -> anything -> 'f -> 'f} +//│ baseImpl: { +//│ fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> anything -> 'e, +//│ update: forall 'f. anything -> anything -> 'f -> 'f +//│ } //│ = { //│ init: [Function: init], //│ sub: [Function: sub], @@ -56,7 +61,12 @@ def base: Arrays['a] // * (not within a more polymorphic context), // * so we do not need first-class parametric polymorphism to type check the definition. def base f = f baseImpl -//│ ({fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> anything -> 'e, update: forall 'f. anything -> anything -> 'f -> 'f} -> 'g) -> 'g +//│ ({ +//│ fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> anything -> 'e, +//│ update: forall 'f. anything -> anything -> 'f -> 'f +//│ } -> 'g) -> 'g //│ <: base: //│ Arrays['a] //│ = [Function: base] @@ -84,11 +94,21 @@ def stepImpl (arrImpl: ArraysImpl['a, 'r]) = { update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.update r0 i a, "hey"); fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.fold f b r0 } -//│ stepImpl: ArraysImpl['a, 'r] -> {fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('r, anything,),) -> 'b, init: 'a -> ('r, "hi",), sub: (('r, anything,),) -> int -> 'a, update: (('r, anything,),) -> int -> 'a -> ('r, "hey",)} +//│ stepImpl: ArraysImpl['a, 'r] -> { +//│ fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('r, anything,),) -> 'b, +//│ init: 'a -> ('r, "hi",), +//│ sub: (('r, anything,),) -> int -> 'a, +//│ update: (('r, anything,),) -> int -> 'a -> ('r, "hey",) +//│ } //│ = [Function: stepImpl] stepImpl_ty = stepImpl -//│ ArraysImpl['a, 'r] -> {fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('r, anything,),) -> 'b, init: 'a -> ('r, "hi",), sub: (('r, anything,),) -> int -> 'a, update: (('r, anything,),) -> int -> 'a -> ('r, "hey",)} +//│ ArraysImpl['a, 'r] -> { +//│ fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('r, anything,),) -> 'b, +//│ init: 'a -> ('r, "hi",), +//│ sub: (('r, anything,),) -> int -> 'a, +//│ update: (('r, anything,),) -> int -> 'a -> ('r, "hey",) +//│ } //│ <: stepImpl_ty: //│ ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string,)] //│ = [Function: stepImpl] @@ -261,20 +281,20 @@ def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (ste //│ <: step2: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.259: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.279: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.17: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this reference: -//│ ║ l.259: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.279: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^^ //│ ╟── • this reference: -//│ ║ l.259: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.279: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.76: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] +//│ ║ l.86: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ ╙── ^^ //│ = [Function: step24] @@ -287,44 +307,49 @@ def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) //│ <: step: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.285: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) +//│ ║ l.305: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.17: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this applied expression: -//│ ║ l.285: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) +//│ ║ l.305: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) //│ ║ ^^^ //│ ╟── • this function: -//│ ║ l.285: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) +//│ ║ l.305: def step arr = arr (fun impl -> fun k -> k (stepImpl_ty impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.76: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] +//│ ║ l.86: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ ╙── ^^ //│ = [Function: step5] // * Still doesn't work if we only annotate `arr`, as `k` still leaks the internal repr :e def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) -//│ Arrays['a] -> ({fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> ((??rep & 'r, anything,),) -> 'b, init: 'a -> ('r | ??rep0, "hi",), sub: ((??rep & 'r, anything,),) -> int -> 'a, update: ((??rep & 'r, anything,),) -> int -> 'a -> ('r | ??rep0, "hey",)} -> 'c) -> 'c +//│ Arrays['a] -> ({ +//│ fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> ((??rep & 'r, anything,),) -> 'b, +//│ init: 'a -> ('r | ??rep0, "hi",), +//│ sub: ((??rep & 'r, anything,),) -> int -> 'a, +//│ update: ((??rep & 'r, anything,),) -> int -> 'a -> ('r | ??rep0, "hey",) +//│ } -> 'c) -> 'c //│ <: step: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.309: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) +//│ ║ l.329: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.17: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this function: -//│ ║ l.309: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) +//│ ║ l.329: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── • this reference: -//│ ║ l.309: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) +//│ ║ l.329: def step (arr: Arrays['a]) = arr (fun impl -> fun k -> k (stepImpl impl)) //│ ║ ^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.83: sub = fun ((r0, r1)) -> fun i -> arrImpl.sub r0 i; +//│ ║ l.93: sub = fun ((r0, r1)) -> fun i -> arrImpl.sub r0 i; //│ ╙── ^^ //│ = [Function: step6] @@ -428,11 +453,26 @@ def stepImpl_Ann = forall 'a 'rep. fun arrImpl -> { update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.update r0 i a, "hey"); fold = fun f -> fun b -> fun ((r0, r1)) -> (arrImpl.fold: Fold['a, 'rep]) f b r0 } -//│ stepImpl_Ann: {fold: Fold['a, 'rep], init: 'c -> 'd, sub: 'e -> 'f -> 'g, update: 'h -> 'i -> 'j -> 'k} -> {fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('rep, anything,),) -> 'b, init: 'c -> ('d, "hi",), sub: (('e, anything,),) -> 'f -> 'g, update: (('h, anything,),) -> 'i -> 'j -> ('k, "hey",)} +//│ stepImpl_Ann: { +//│ fold: Fold['a, 'rep], +//│ init: 'c -> 'd, +//│ sub: 'e -> 'f -> 'g, +//│ update: 'h -> 'i -> 'j -> 'k +//│ } -> { +//│ fold: forall 'b. ('a -> 'b -> 'b) -> 'b -> (('rep, anything,),) -> 'b, +//│ init: 'c -> ('d, "hi",), +//│ sub: (('e, anything,),) -> 'f -> 'g, +//│ update: (('h, anything,),) -> 'i -> 'j -> ('k, "hey",) +//│ } //│ = [Function: stepImpl_Ann] def step arr = arr (fun impl -> fun (k: ArraysImplConsumer['a, 'r]) -> k (stepImpl_Ann impl)) -//│ ((forall 'a 'rep 'b. {fold: Fold['a, 'rep], init: 'a -> 'rep, sub: 'rep -> int -> 'a, update: 'rep -> int -> 'a -> 'rep} -> ArraysImplConsumer['a, 'b] -> 'b) -> 'c) -> 'c +//│ ((forall 'a 'rep 'b. { +//│ fold: Fold['a, 'rep], +//│ init: 'a -> 'rep, +//│ sub: 'rep -> int -> 'a, +//│ update: 'rep -> int -> 'a -> 'rep +//│ } -> ArraysImplConsumer['a, 'b] -> 'b) -> 'c) -> 'c //│ <: step: //│ Arrays['a] -> Arrays['a] //│ = [Function: step17] diff --git a/shared/src/test/diff/fcp/QML_exist_Records_ND.mls b/shared/src/test/diff/fcp/QML_exist_Records_ND.mls index d3bb90fb6..dd130a67e 100644 --- a/shared/src/test/diff/fcp/QML_exist_Records_ND.mls +++ b/shared/src/test/diff/fcp/QML_exist_Records_ND.mls @@ -33,7 +33,12 @@ baseImpl = { update = fun r -> fun i -> fun a -> a; fold = fun f -> fun b -> fun r -> f r b } -//│ baseImpl: {fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> anything -> 'e, update: anything -> anything -> (forall 'f. 'f -> 'f)} +//│ baseImpl: { +//│ fold: forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> anything -> 'e, +//│ update: anything -> anything -> (forall 'f. 'f -> 'f) +//│ } //│ = { //│ init: [Function: init], //│ sub: [Function: sub], @@ -58,7 +63,12 @@ def base: Arrays['a] // * (not within a more polymorphic context), // * so we do not need first-class parametric polymorphism to type check the definition. def base f = f baseImpl -//│ ({fold: forall 'a 'b 'c. ('c -> 'a -> 'b) -> 'a -> 'c -> 'b, init: forall 'd. 'd -> 'd, sub: forall 'e. 'e -> anything -> 'e, update: anything -> anything -> (forall 'f. 'f -> 'f)} -> 'g) -> 'g +//│ ({ +//│ fold: forall 'a 'b 'c. ('c -> 'a -> 'b) -> 'a -> 'c -> 'b, +//│ init: forall 'd. 'd -> 'd, +//│ sub: forall 'e. 'e -> anything -> 'e, +//│ update: anything -> anything -> (forall 'f. 'f -> 'f) +//│ } -> 'g) -> 'g //│ <: base: //│ Arrays['a] //│ = [Function: base] @@ -86,11 +96,21 @@ def stepImpl (arrImpl: ArraysImpl['a, 'r]) = { update = fun ((r0, r1)) -> fun i -> fun a -> (arrImpl.update r0 i a, "hey"); fold = fun f -> fun b -> fun ((r0, r1)) -> arrImpl.fold f b r0 } -//│ stepImpl: ArraysImpl['a, 'r] -> {fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'c. ('b & 'c) -> (('r, anything,),) -> ('b0 | 'c)), init: 'a -> ('r, "hi",), sub: (('r, anything,),) -> int -> 'a, update: (('r, anything,),) -> int -> 'a -> ('r, "hey",)} +//│ stepImpl: ArraysImpl['a, 'r] -> { +//│ fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'c. ('b & 'c) -> (('r, anything,),) -> ('b0 | 'c)), +//│ init: 'a -> ('r, "hi",), +//│ sub: (('r, anything,),) -> int -> 'a, +//│ update: (('r, anything,),) -> int -> 'a -> ('r, "hey",) +//│ } //│ = [Function: stepImpl] stepImpl_ty = stepImpl -//│ ArraysImpl['a, 'r] -> {fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'c. ('b & 'c) -> (('r, anything,),) -> ('b0 | 'c)), init: 'a -> ('r, "hi",), sub: (('r, anything,),) -> int -> 'a, update: (('r, anything,),) -> int -> 'a -> ('r, "hey",)} +//│ ArraysImpl['a, 'r] -> { +//│ fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'c. ('b & 'c) -> (('r, anything,),) -> ('b0 | 'c)), +//│ init: 'a -> ('r, "hi",), +//│ sub: (('r, anything,),) -> int -> 'a, +//│ update: (('r, anything,),) -> int -> 'a -> ('r, "hey",) +//│ } //│ <: stepImpl_ty: //│ ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string,)] //│ = [Function: stepImpl] @@ -157,17 +177,22 @@ def helper (impl: ArraysImpl['a, 'rep]) (k: ArraysImplConsumer['b, 'res]) = k (s // * FIXME this works with `:Fuel 4000000` but takes ~10s!! // * Why require so much fuel? (notably, more than in the same `helper` but *without* the impl annot) // * -> probably due to 'b being generalized too early +// * Note [2023-10-06]: +// * It seems the fuel might be needed because of TV reconstraining after extrusion, +// * which is currently implemented in a very naive and wasteful way! +// * Indeed, if we set (includeBounds = true) in the `getVars` method, +// * which is used for reconstraining, then this no longer require extra fuel! :e def step (arr: Arrays['a]) = arr helper //│ Arrays['a] -> error //│ <: step: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Subtyping constraint of the form `Arrays['a] <: (forall 'a0 'rep. ArraysImpl['a0, 'rep] -> (forall ?a 'res 'b. ArraysImplConsumer['b, 'res] -> ?a)) -> ?b` took too many steps and ran out of fuel (10000) -//│ ║ l.161: def step (arr: Arrays['a]) = arr helper +//│ ║ l.186: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Subtyping constraint of the form `forall 'a ?a. Arrays['a] -> ?a <: forall 'a0. Arrays['a0] -> Arrays['a0]` took too many steps and ran out of fuel (10000) -//│ ║ l.161: def step (arr: Arrays['a]) = arr helper +//│ ║ l.186: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ = [Function: step3] @@ -193,62 +218,77 @@ def step (arr: Arrays['a]) = arr helper // * Doesn't work (`'rep` leaks out of its scope in `step`) def helper impl k = k (stepImpl impl) -//│ helper: ArraysImpl[in 'a out 'a | 'a0, in 'r out 'r | 'r0] -> (forall 'a1 'r1 'c. ({fold: forall 'b 'b0. (('a | 'a1) -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('r0 & 'r1, anything,),) -> ('b0 | 'd)), init: ('a0 & 'a1) -> ('r | 'r1, "hi",), sub: (('r0 & 'r1, anything,),) -> int -> ('a | 'a1), update: (('r0 & 'r1, anything,),) -> int -> ('a0 & 'a1) -> ('r | 'r1, "hey",)} -> 'c) -> 'c) +//│ helper: ArraysImpl[in 'a out 'a | 'a0, in 'r out 'r | 'r0] -> (forall 'a1 'r1 'c. ({ +//│ fold: forall 'b 'b0. (('a | 'a1) -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('r0 & 'r1, anything,),) -> ('b0 | 'd)), +//│ init: ('a0 & 'a1) -> ('r | 'r1, "hi",), +//│ sub: (('r0 & 'r1, anything,),) -> int -> ('a | 'a1), +//│ update: (('r0 & 'r1, anything,),) -> int -> ('a0 & 'a1) -> ('r | 'r1, "hey",) +//│ } -> 'c) -> 'c) //│ = [Function: helper4] // * Idem def helper (impl: ArraysImpl['a, 'rep]) k = k (stepImpl impl) -//│ helper: ArraysImpl['a, 'rep] -> (forall 'c. ({fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('rep, anything,),) -> ('b0 | 'd)), init: 'a -> ('rep, "hi",), sub: (('rep, anything,),) -> int -> 'a, update: (('rep, anything,),) -> int -> 'a -> ('rep, "hey",)} -> 'c) -> 'c) +//│ helper: ArraysImpl['a, 'rep] -> (forall 'c. ({ +//│ fold: forall 'b 'b0. ('a -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('rep, anything,),) -> ('b0 | 'd)), +//│ init: 'a -> ('rep, "hi",), +//│ sub: (('rep, anything,),) -> int -> 'a, +//│ update: (('rep, anything,),) -> int -> 'a -> ('rep, "hey",) +//│ } -> 'c) -> 'c) //│ = [Function: helper5] :e def step (arr: Arrays['a]) = arr helper -//│ Arrays['a] -> (forall 'c. error | ({fold: forall 'b 'b0. (('a0 | 'a) -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('rep & 'rep0, anything,),) -> ('b0 | 'd)), init: 'a -> ('rep, "hi",), sub: (('rep & 'rep0, anything,),) -> int -> ('a0 | 'a), update: (('rep & 'rep0, anything,),) -> int -> 'a -> ('rep, "hey",)} -> 'c) -> 'c) -//│ where -//│ 'rep :> ??rep -//│ <: 'rep0 -//│ 'rep0 <: ??rep0 & 'rep -//│ 'a <: 'a0 -//│ 'a0 := 'a +//│ Arrays['a] -> (forall 'c. error | ({ +//│ fold: forall 'b 'b0. (('a0 | 'a) -> 'b -> ('b & 'b0)) -> (forall 'd. ('b & 'd) -> (('rep & 'rep0, anything,),) -> ('b0 | 'd)), +//│ init: 'a -> ('rep, "hi",), +//│ sub: (('rep & 'rep0, anything,),) -> int -> ('a0 | 'a), +//│ update: (('rep & 'rep0, anything,),) -> int -> 'a -> ('rep, "hey",) +//│ } -> 'c) -> 'c) +//│ where +//│ 'rep :> ??rep +//│ <: 'rep0 +//│ 'rep0 <: ??rep0 & 'rep +//│ 'a <: 'a0 +//│ 'a0 := 'a //│ <: step: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in application -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.19: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this function: -//│ ║ l.200: def helper (impl: ArraysImpl['a, 'rep]) k = k (stepImpl impl) +//│ ║ l.230: def helper (impl: ArraysImpl['a, 'rep]) k = k (stepImpl impl) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── • this reference: -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^ //│ ╟── • this reference: -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.83: def stepImpl (arrImpl: ArraysImpl['a, 'r]) = { +//│ ║ l.93: def stepImpl (arrImpl: ArraysImpl['a, 'r]) = { //│ ╙── ^^ //│ ╔══[ERROR] Type error in def definition -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.19: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this function: -//│ ║ l.200: def helper (impl: ArraysImpl['a, 'rep]) k = k (stepImpl impl) +//│ ║ l.230: def helper (impl: ArraysImpl['a, 'rep]) k = k (stepImpl impl) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── • this reference: -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^^^^ //│ ╟── • this reference: -//│ ║ l.205: def step (arr: Arrays['a]) = arr helper +//│ ║ l.240: def step (arr: Arrays['a]) = arr helper //│ ║ ^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.85: sub = fun ((r0, r1)) -> fun i -> arrImpl.sub r0 i; +//│ ║ l.95: sub = fun ((r0, r1)) -> fun i -> arrImpl.sub r0 i; //│ ╙── ^^ //│ = [Function: step5] @@ -496,20 +536,20 @@ def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (ste //│ <: step2: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.494: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.534: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'rep` leaks out of its scope //│ ║ l.19: type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R //│ ║ ^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this reference: -//│ ║ l.494: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.534: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^^ //│ ╟── • this reference: -//│ ║ l.494: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.534: def step2 = forall 'a. fun (arr: Arrays['a]) -> fun k -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.78: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] +//│ ║ l.88: def stepImpl_ty: ArraysImpl['a, 'r] -> ArraysImpl['a, ('r, string)] //│ ╙── ^^ //│ = [Function: step25] @@ -521,7 +561,7 @@ def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr ( //│ <: step2: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.517: def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.557: def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr (fun impl -> k (stepImpl_ty impl)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'r` leaks out of its scope //│ ║ l.22: type Arrays[A] = forall 'r. ArraysImplConsumer[A, 'r] -> 'r @@ -531,7 +571,7 @@ def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr ( //│ ║ ^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this application: -//│ ║ l.517: def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.557: def step2 = forall 'a. fun arr -> fun (k: ArraysImplConsumer['a, 'rep]) -> arr (fun impl -> k (stepImpl_ty impl)) //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ = [Function: step26] @@ -565,7 +605,7 @@ step2 = s //│ <: step2: //│ Arrays['a] -> Arrays['a] //│ ╔══[ERROR] Type error in def definition -//│ ║ l.563: step2 = s +//│ ║ l.603: step2 = s //│ ║ ^^^^^^^^^ //│ ╟── type variable `'r` leaks out of its scope //│ ║ l.22: type Arrays[A] = forall 'r. ArraysImplConsumer[A, 'r] -> 'r @@ -575,10 +615,10 @@ step2 = s //│ ║ ^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this reference: -//│ ║ l.563: step2 = s +//│ ║ l.603: step2 = s //│ ║ ^ //│ ╟── • this application: -//│ ║ l.540: def s arr (k: ArraysImplConsumer['a, 'rep]) = arr (fun impl -> k (stepImpl_ty impl)) +//│ ║ l.580: def s arr (k: ArraysImplConsumer['a, 'rep]) = arr (fun impl -> k (stepImpl_ty impl)) //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ = [Function: s] diff --git a/shared/src/test/diff/fcp/QML_exist_Records_min_1.mls b/shared/src/test/diff/fcp/QML_exist_Records_min_1.mls index bba79c34e..b39b761b0 100644 --- a/shared/src/test/diff/fcp/QML_exist_Records_min_1.mls +++ b/shared/src/test/diff/fcp/QML_exist_Records_min_1.mls @@ -142,9 +142,11 @@ def step: Arrays2 -> Arrays2 def step arr k = k (arr stepImpl) //│ 'a -> (('b -> 'c) -> 'c //│ where -//│ 'a <: (forall 'd. 'd -> {fold: forall 'e 'f 'g. 'e -> ('f -> 'g -//│ where -//│ 'd <: {fold: 'e -> 'f -> 'g})}) -> 'b) +//│ 'a <: (forall 'd. 'd -> { +//│ fold: forall 'e 'f 'g. 'e -> ('f -> 'g +//│ where +//│ 'd <: {fold: 'e -> 'f -> 'g}) +//│ }) -> 'b) //│ <: step: //│ Arrays2 -> Arrays2 //│ ╔══[ERROR] Type error in def definition diff --git a/shared/src/test/diff/fcp/QML_exist_nu.mls b/shared/src/test/diff/fcp/QML_exist_nu.mls new file mode 100644 index 000000000..39fa4e19e --- /dev/null +++ b/shared/src/test/diff/fcp/QML_exist_nu.mls @@ -0,0 +1,339 @@ +// * TODO also a GADT version of this where we use `Arrays[A]: ArraysImpl[A, ?]` + +:NewDefs + +:DontDistributeForalls // * Also works without this + + + +declare module Math { + fun trunc: Num -> Int +} +//│ declare module Math { +//│ fun trunc: Num -> Int +//│ } + +fun div(a, b) = Math.trunc(a/b) +fun mod(a, b) = if a < b then a else mod(a - b, b) +//│ fun div: (Num, Num) -> Int +//│ fun mod: (Int, Int) -> Int + + + +abstract class ArraysImpl[A, Rep] { + fun init: A -> Rep + fun sub: (Rep, Int) -> A + fun update: (Rep, Int, A) -> Rep + fun fold: (Rep, 'b, A -> 'b -> 'b) -> 'b +} +//│ abstract class ArraysImpl[A, Rep] { +//│ fun fold: forall 'b. (Rep, 'b, A -> 'b -> 'b) -> 'b +//│ fun init: A -> Rep +//│ fun sub: (Rep, Int) -> A +//│ fun update: (Rep, Int, A) -> Rep +//│ } + +type ArraysImplConsumer[A, R] = forall 'rep: ArraysImpl[A, 'rep] -> R +//│ type ArraysImplConsumer[A, R] = forall 'rep. ArraysImpl[A, 'rep] -> R + +abstract class Arrays[A] { + fun use: ArraysImplConsumer[A, 'res] -> 'res +} +//│ abstract class Arrays[A] { +//│ fun use: forall 'res. ArraysImplConsumer[A, 'res] -> 'res +//│ } + + +class BaseImpl[A]() extends ArraysImpl[A, A] { + fun init (a) = a + fun sub (r, i) = r + fun update(r, i, a) = a + fun fold (r, b, f) = f(r)(b) +} +//│ class BaseImpl[A]() extends ArraysImpl { +//│ fun fold: forall 'a 'b 'c. ('a, 'b, 'a -> 'b -> 'c) -> 'c +//│ fun init: forall 'd. 'd -> 'd +//│ fun sub: forall 'e. ('e, anything) -> 'e +//│ fun update: forall 'f. (anything, anything, 'f) -> 'f +//│ } + +class StepImpl[A, R](underlying: ArraysImpl[A, R]) extends ArraysImpl[A, [R, R]] { + fun init(a) = [underlying.init(a), underlying.init(a)] + fun sub([r0, r1], i) = + if mod(i, 2) === 0 + then underlying.sub(r0, div(i, 2)) + else underlying.sub(r1, div(i, 2)) + fun update([r0, r1], i, a) = + if mod(i, 2) == 0 + then [underlying.update(r0, div(i, 2), a), r1] + else [r0, underlying.update(r1, div(i, 2), a)] + fun fold([r0, r1], b, f) = + underlying.fold(r0, underlying.fold(r1, b, f), f) +} +//│ class StepImpl[A, R](underlying: ArraysImpl[A, R]) extends ArraysImpl { +//│ fun fold: forall 'b 'b0. ([R, R], 'b & 'b0, A -> ('b -> ('b & 'b0) & 'b0 -> 'b0)) -> 'b0 +//│ fun init: A -> [R, R] +//│ fun sub: ([R, R], Eql[0] & Int) -> A +//│ fun update: ([R, R], Int, A) -> [R, R] +//│ } + + +class Base[A]() extends Arrays[A] { + val impl = BaseImpl() + fun use(k) = k(impl) +} +//│ class Base[A]() extends Arrays { +//│ val impl: BaseImpl[A] +//│ fun use: forall 'a. (BaseImpl[A] -> 'a) -> 'a +//│ } + +class Step[A](from: Arrays[A]) extends Arrays[A] { + + // * Note: expansion of alias is capture-avoiding of polymorphic levels + fun use(k: ArraysImplConsumer[A, 'res]) = from.use of + forall 'rep: + (impl: ArraysImpl[A, 'rep]) => k(StepImpl(impl)) + +} +//│ class Step[A](from: Arrays[A]) extends Arrays { +//│ fun use: forall 'res. (k: ArraysImplConsumer[A, 'res]) -> 'res +//│ } + +// * A version with fewer annotations +class Step[A](from: Arrays[A]) extends Arrays[A] { + + fun use(k: ArraysImplConsumer[A, 'res]) = + from.use of impl => k(StepImpl(impl)) + + // * Spelling out the type synonym: + fun use': ArraysImplConsumer[A, 'res] -> 'res + fun use'(k: forall 'rep: ArraysImpl[A, 'rep] -> 'res) = + from.use of impl => k of StepImpl(impl) + +} +//│ class Step[A](from: Arrays[A]) extends Arrays { +//│ fun use: forall 'res. (k: ArraysImplConsumer[A, 'res]) -> 'res +//│ fun use': forall 'res0. ArraysImplConsumer[A, 'res0] -> 'res0 +//│ } + +// * Note: the annotation on `k` is required, otherwise we leak the locally-polymorphic `impl` +// * (We don't currently do any bidirectional typing.) +:e +class Step'[A](from: Arrays[A]) extends Arrays[A] { + fun use(k) = + from.use of impl => k(StepImpl(impl)) +} +//│ ╔══[ERROR] Type error in definition of method use +//│ ║ l.123: fun use(k) = +//│ ║ ^^^^^^^^ +//│ ║ l.124: from.use of impl => k(StepImpl(impl)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type variable `'rep` leaks out of its scope +//│ ║ l.36: type ArraysImplConsumer[A, R] = forall 'rep: ArraysImpl[A, 'rep] -> R +//│ ║ ^^^^ +//│ ╟── adding a type annotation to any of the following terms may help resolve the problem +//│ ╟── • this reference: +//│ ║ l.124: from.use of impl => k(StepImpl(impl)) +//│ ║ ^^^^ +//│ ╟── • this signature of member `use`: +//│ ║ l.40: fun use: ArraysImplConsumer[A, 'res] -> 'res +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── • this field selection: +//│ ║ l.124: from.use of impl => k(StepImpl(impl)) +//│ ╙── ^^^^^^^^ +//│ class Step'[A](from: Arrays[A]) extends Arrays { +//│ fun use: forall 'R 'a. (StepImpl[A, in ??rep & 'R out 'R | ??rep0] -> 'a) -> 'a +//│ } +//│ Syntax error: +//│ Unexpected string + + +let ssb = Step(Step(Base())) +//│ let ssb: Step['A] +//│ ssb +//│ = Step {} + +ssb.use of impl => + let r = impl.update(impl.init(true), 1, false) + log(r) + [impl.sub(r, 0), impl.sub(r, 1)] +//│ [Bool, Bool] +//│ res +//│ = [ true, false ] +//│ // Output +//│ [ [ true, true ], [ false, true ] ] + +fun mkMonoArray(n) = + if n === 0 then Base() else Step(mkMonoArray(n - 1)) +//│ fun mkMonoArray: forall 'A. (Eql[0] & Int) -> (Base['A] | Step['A]) + +let snb = mkMonoArray(3) +//│ let snb: Base['A] | Step['A] +//│ snb +//│ = Step {} + +snb.use of impl => + let r = impl.update(impl.init(true), 1, false) + log(r) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ [ +//│ [ [ true, true ], [ true, true ] ], +//│ [ [ false, true ], [ true, true ] ] +//│ ] + +// * Here we are trying to leak the internally-quantified representation, resulting in the `??rep` extrusion +snb.use of impl => impl.init(true) +// :d +//│ true | ??rep +//│ res +//│ = [ +//│ [ [ true, true ], [ true, true ] ], +//│ [ [ true, true ], [ true, true ] ] +//│ ] + + +// * An alternative implementation of Step with the existential opened outside the function. + +class StepAlt[A](from: Arrays[A]) extends Arrays[A] { + val use = from.use of impl => + (k: ArraysImplConsumer[A, 'res]) => k(StepImpl(impl)) +} +//│ class StepAlt[A](from: Arrays[A]) extends Arrays { +//│ val use: forall 'res. (k: ArraysImplConsumer[A, 'res]) -> 'res +//│ } + +// * With the following, we get "type variable `'rep` leaks out of its scope" +:e +class StepAlt'[A](from: Arrays[A]) extends Arrays[A] { + val use = from.use of impl => + k => k(StepImpl(impl)) + // * ^ This is because we leak impl's representation to `k` in the local `k =>` lambda, + // * which flows to the type of `use`, where it's extruded: + // * forall 'r; (StepImpl[A, ??impl] -> 'r) -> 'r + // * Interestingly, once we use first-class existentials to extrude things, + // * this should start working, because we'll get + // * exists impl; forall 'r; (StepImpl[A, impl] -> 'r) -> 'r + // * which is a sutbype of the required + // * (forall 'rep; ArraysImpl[A, 'rep] -> 'res) -> 'res + // * because we can 0-rigidify `impl` and then subtype + // * 0. (StepImpl[A, impl] -> 'r) -> 'r <: (forall 'rep; ArraysImpl[A, 'rep] -> 'res) -> 'res + // * ie, constraining the parameters and 1-instantiating `forall 'rep`: + // * 1. ArraysImpl[A, 'rep] -> 'res <: (StepImpl[A, impl] -> 'r) -> 'r + // * which eventually leads to 'rep := impl and 'r := 'res. +} +//│ ╔══[ERROR] Type error in application +//│ ║ l.211: val use = from.use of impl => +//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.212: k => k(StepImpl(impl)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type variable `'rep` leaks out of its scope +//│ ║ l.36: type ArraysImplConsumer[A, R] = forall 'rep: ArraysImpl[A, 'rep] -> R +//│ ║ ^^^^ +//│ ╟── adding a type annotation to any of the following terms may help resolve the problem +//│ ╟── • this function: +//│ ║ l.211: val use = from.use of impl => +//│ ║ ^^^^^^^ +//│ ║ l.212: k => k(StepImpl(impl)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── • this signature of member `use`: +//│ ║ l.40: fun use: ArraysImplConsumer[A, 'res] -> 'res +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── • this field selection: +//│ ║ l.211: val use = from.use of impl => +//│ ╙── ^^^^^^^^ +//│ class StepAlt'[A](from: Arrays[A]) extends Arrays { +//│ val use: forall 'R 'a. error | (StepImpl[A, 'R] -> 'a) -> 'a +//│ } +//│ where +//│ 'R :> ??rep +//│ <: ??rep0 +//│ Syntax error: +//│ Unexpected string + + +// * An alternative implementation of Step which only allocates one StepImpl per instance! + +class StepAlt[A](from: Arrays[A]) extends Arrays[A] { + + // * The explicit `forall 'res` is needed with distributivity turned off + val use = forall 'res: from.use of impl => + val impl2 = StepImpl(impl) + (k: ArraysImplConsumer[A, 'res]) => k(impl2) + + // * Version with full annotations (not necessary): + val use2: ArraysImplConsumer[A, 'res] -> 'res + val use2 = forall 'res: from.use of forall 'rr: (impl : ArraysImpl[A, 'rr]) => + val impl2 = StepImpl(impl) + (k: ArraysImplConsumer[A, 'res]) => k(impl2) + +} +//│ class StepAlt[A](from: Arrays[A]) extends Arrays { +//│ val use: forall 'res. (k: ArraysImplConsumer[A, 'res]) -> 'res +//│ val use2: forall 'res0. ArraysImplConsumer[A, 'res0] -> 'res0 +//│ } + + +// * A variation of the above without explicitly binding 'res, so it has to be distributed out + +:DistributeForalls // * Distributivity is needed here! + +class StepAlt[A](from: Arrays[A]) extends Arrays[A] { + val use = from.use of impl => + val impl2 = StepImpl(impl) + (k: ArraysImplConsumer[A, 'res]) => k(impl2) +} +//│ class StepAlt[A](from: Arrays[A]) extends Arrays { +//│ val use: forall 'res. (k: ArraysImplConsumer[A, 'res]) -> 'res +//│ } + + +// * Works the same: + +let ssb = StepAlt(StepAlt(Base())) +//│ let ssb: StepAlt['A] +//│ ssb +//│ = StepAlt {} + +ssb.use of impl => + let r = impl.update(impl.init(true), 1, false) + log(r) + [impl.sub(r, 0), impl.sub(r, 1)] +//│ [Bool, Bool] +//│ res +//│ = [ true, false ] +//│ // Output +//│ [ [ true, true ], [ false, true ] ] + +fun mkMonoArray(n) = + if n === 0 then Base() else StepAlt(mkMonoArray(n - 1)) +//│ fun mkMonoArray: forall 'A. (Eql[0] & Int) -> (forall 'A0. Base['A0] | StepAlt['A]) + +let snb = mkMonoArray(3) +//│ let snb: forall 'A 'A0. Base['A] | StepAlt['A0] +//│ snb +//│ = StepAlt {} + +snb.use of impl => + let r = impl.update(impl.init(true), 1, false) + log(r) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ [ +//│ [ [ true, true ], [ true, true ] ], +//│ [ [ false, true ], [ true, true ] ] +//│ ] + +snb.use of impl => impl.init(true) +//│ true | ??rep +//│ res +//│ = [ +//│ [ [ true, true ], [ true, true ] ], +//│ [ [ true, true ], [ true, true ] ] +//│ ] + + diff --git a/shared/src/test/diff/fcp/SystemF.mls b/shared/src/test/diff/fcp/SystemF.mls index 720eff295..903f7b261 100644 --- a/shared/src/test/diff/fcp/SystemF.mls +++ b/shared/src/test/diff/fcp/SystemF.mls @@ -399,7 +399,7 @@ E q = q id // shallow (not (not true)) -- Shallow encoding. // λid.id(λb t f.b f t)(id(λb t f.b f t)(λx y.x)) sh id = (id not) ((id not) tru) -//│ sh: ((forall 'a 'b 'c. ('a -> 'b -> 'c) -> 'b -> 'a -> 'c) -> ('d -> 'e & (forall 'f. 'f -> anything -> 'f) -> 'd)) -> 'e +//│ sh: ((forall 'a 'b 'c. ('b -> 'c -> 'a) -> 'c -> 'b -> 'a) -> ('d -> 'e & (forall 'f. 'f -> anything -> 'f) -> 'd)) -> 'e //│ = [Function: sh] // E[forall X.X->X->X](shallow (not( not true))) diff --git a/shared/src/test/diff/fcp/SystemF_2.mls b/shared/src/test/diff/fcp/SystemF_2.mls index 932b3da42..7246a3e9b 100644 --- a/shared/src/test/diff/fcp/SystemF_2.mls +++ b/shared/src/test/diff/fcp/SystemF_2.mls @@ -40,10 +40,10 @@ iter2 iter2 K //│ where //│ 'a :> ? -> ? -> 'a //│ ╙── -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] iter2 iter2 iter2 @@ -128,7 +128,7 @@ c2_ c2_ K //│ ╔══[ERROR] Inferred recursive type: 'a //│ where //│ 'a :> ? -> ('a | 'b | 'c | 'd) -//│ 'c :> ? -> ('b | 'd) | 'd +//│ 'c :> ? -> ('b | 'c | 'd) //│ 'd :> ? -> ('b | 'c) //│ 'b :> ? -> ('a | 'b) //│ ╙── @@ -154,10 +154,10 @@ c2__ c2__ K //│ where //│ 'a :> ? -> ? -> 'a //│ ╙── -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] @@ -165,36 +165,36 @@ c2__ c2__ K :RecursiveTypes iter2 iter2 K -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] res id -//│ res: 'a +//│ res: anything -> 'a //│ where -//│ 'a :> forall 'b. anything -> anything -> ('b -> 'b | 'a) +//│ 'a :> forall 'b. anything -> 'b -> ('a | 'b) //│ = [Function (anonymous)] r1 = res id id id id id -//│ r1: 'a -> 'a | 'b +//│ r1: 'a -> ('b | 'a) //│ where -//│ 'b :> forall 'c. anything -> 'c -> ('b | 'c) +//│ 'b :> forall 'c. 'c -> (anything -> 'b | 'c) //│ = [Function: id] r1 iter2 iter2 K -//│ res: ('a & 'b & 'c) -> (anything -> anything -> 'b | 'd | 'c | 'e) +//│ res: ('a & 'b & 'c) -> (anything -> (anything -> 'b | 'd) | 'e | 'c) //│ where -//│ 'd :> forall 'f. anything -> 'f -> ('d | 'f) -//│ 'a :> 'e -//│ 'e :> anything -> anything -> 'a +//│ 'e :> forall 'f. anything -> 'f -> ('e | 'f) +//│ 'a :> anything -> 'd +//│ 'd :> anything -> 'a //│ = [Function (anonymous)] r = r1 iter2 iter2 -//│ r: ('a -> 'b & 'b -> 'c & 'd -> 'e & 'e -> ('d & 'f)) -> ('a & 'd) -> ('c | 'f) | 'g +//│ r: ('a -> 'b & 'b -> 'c & 'd -> 'e & 'e -> ('d & 'f)) -> (('a & 'd) -> ('c | 'f) | 'g) //│ where -//│ 'g :> forall 'h. anything -> 'h -> ('g | 'h) +//│ 'g :> forall 'h. 'h -> (anything -> 'g | 'h) //│ = [Function (anonymous)] r iter2 @@ -229,17 +229,17 @@ iter2 f x = f(f x) iter2 iter2 //│ res: 'a -> 'b //│ where -//│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f +//│ forall 'c. 'c -> (forall 'd 'e 'f. 'e -> 'd //│ where -//│ 'c <: 'd -> 'e & 'e -> 'f) <: 'a -> 'g & 'g -> 'b +//│ 'c <: 'e -> 'f & 'f -> 'd) <: 'a -> 'g & 'g -> 'b //│ = [Function (anonymous)] id iter2 iter2 //│ res: 'a -> 'b //│ where -//│ forall 'c. 'c -> (forall 'd 'e 'f. 'e -> 'd +//│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f //│ where -//│ 'c <: 'e -> 'f & 'f -> 'd) <: 'a -> 'g & 'g -> 'b +//│ 'c <: 'd -> 'e & 'e -> 'f) <: 'a -> 'g & 'g -> 'b //│ = [Function (anonymous)] @@ -334,10 +334,10 @@ c2 c2 K c2_ = succ_ (succ_ n0) //│ c2_: 'a -> (forall 'b 'c 'd. 'b -> 'd //│ where -//│ forall 'e. 'e -> (forall 'f 'g 'h. 'f -> 'h +//│ forall 'e. 'e -> (forall 'f 'g 'h. 'h -> 'g //│ where -//│ 'e <: 'g -> 'h -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'e -> 'f -> 'g) <: 'a -> 'b -> 'c +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'e -> 'h -> 'f +//│ 'e <: 'f -> 'g) <: 'a -> 'b -> 'c //│ 'a <: 'c -> 'd) //│ = [Function (anonymous)] @@ -347,20 +347,20 @@ c2_ c2_ //│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f //│ where //│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'c -> 'd -> 'e -//│ 'c <: 'e -> 'f) <: (forall 'g. 'g -> (forall 'h 'i 'j. 'j -> 'i +//│ 'c <: 'e -> 'f) <: (forall 'g. 'g -> (forall 'h 'i 'j. 'h -> 'j //│ where -//│ 'g <: 'h -> 'i +//│ 'g <: 'i -> 'j //│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n //│ where -//│ 'k <: 'm -> 'n -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm) <: 'g -> 'j -> 'h)) -> 'a -> 'o -//│ forall 'g. 'g -> (forall 'h 'i 'j. 'j -> 'i +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm +//│ 'k <: 'm -> 'n) <: 'g -> 'h -> 'i)) -> 'a -> 'o +//│ forall 'g. 'g -> (forall 'h 'i 'j. 'h -> 'j //│ where -//│ 'g <: 'h -> 'i +//│ 'g <: 'i -> 'j //│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n //│ where -//│ 'k <: 'm -> 'n -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm) <: 'g -> 'j -> 'h) <: 'o -> 'b +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm +//│ 'k <: 'm -> 'n) <: 'g -> 'h -> 'i) <: 'o -> 'b //│ = [Function (anonymous)] :e @@ -370,70 +370,70 @@ c2_ c2_ K //│ 'a :> forall 'b 'c 'd 'e. ('b & 'e) -> (? -> 'e | 'd) //│ where //│ 'a <: 'c -> 'd -//│ forall 'f. 'f -> (forall 'g 'h 'i. 'g -> 'i +//│ forall 'f. 'f -> (forall 'g 'h 'i. 'i -> 'h //│ where -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'f -> 'g -> 'h -//│ 'f <: 'h -> 'i) <: 'a -> 'b -> 'c +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'f -> 'i -> 'g +//│ 'f <: 'g -> 'h) <: 'a -> 'b -> 'c //│ ╙── //│ res: 'a -> 'b //│ where -//│ forall 'c. 'c -> (forall 'd 'e 'f. 'f -> 'e +//│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f //│ where -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'c -> 'f -> 'd -//│ 'c <: 'd -> 'e) <: (forall 'g 'h 'i. 'i -> 'h +//│ 'c <: 'e -> 'f +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'c -> 'd -> 'e) <: (forall 'g 'h 'i. 'g -> 'i //│ where -//│ 'j <: 'g -> 'h -//│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n +//│ forall 'j. 'j -> (forall 'k 'l 'm. 'k -> 'm //│ where -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm -//│ 'k <: 'm -> 'n) <: 'j -> 'i -> 'g) -> 'a -> 'o -//│ forall 'g 'h 'i. 'i -> 'h +//│ 'j <: 'l -> 'm +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'j -> 'k -> 'l) <: 'n -> 'g -> 'h +//│ 'n <: 'h -> 'i) -> 'a -> 'o +//│ forall 'g 'h 'i. 'g -> 'i //│ where -//│ 'j <: 'g -> 'h -//│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n +//│ forall 'j. 'j -> (forall 'k 'l 'm. 'k -> 'm //│ where -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'k -> 'l -> 'm -//│ 'k <: 'm -> 'n) <: 'j -> 'i -> 'g <: 'o -> 'b +//│ 'j <: 'l -> 'm +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 'j -> 'k -> 'l) <: 'n -> 'g -> 'h +//│ 'n <: 'h -> 'i <: 'o -> 'b //│ where -//│ 'j :> forall 'p 'q 'r 's. ('p & 's) -> (anything -> 's | 'r) +//│ 'n :> forall 'p 'q 'r 's. ('p & 's) -> (anything -> 's | 'r) //│ where //│ forall 't. 't -> (forall 'u 'v 'w. 'u -> 'w //│ where -//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 't -> 'u -> 'v -//│ 't <: 'v -> 'w) <: 'j -> 'p -> 'q -//│ 'j <: 'q -> 'r +//│ 't <: 'v -> 'w +//│ forall 'X. ('X -> 'X) -> 'X -> 'X <: 't -> 'u -> 'v) <: 'n -> 'p -> 'q +//│ 'n <: 'q -> 'r //│ = [Function (anonymous)] c2__ = succ_ (succ_ n0_) //│ c2__: 'a -> (forall 'b 'c 'd. 'b -> 'd //│ where -//│ 'a <: 'c -> 'd -//│ forall 'e. 'e -> (forall 'f 'g 'h. 'f -> 'h +//│ forall 'e. 'e -> (forall 'f 'g 'h. 'h -> 'g //│ where -//│ anything -> (forall 'i. 'i -> 'i) <: 'e -> 'f -> 'g -//│ 'e <: 'g -> 'h) <: 'a -> 'b -> 'c) +//│ anything -> (forall 'i. 'i -> 'i) <: 'e -> 'h -> 'f +//│ 'e <: 'f -> 'g) <: 'a -> 'b -> 'c +//│ 'a <: 'c -> 'd) //│ = [Function (anonymous)] c2__ c2__ //│ res: 'a -> 'b //│ where -//│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f +//│ forall 'c. 'c -> (forall 'd 'e 'f. 'e -> 'd //│ where +//│ 'c <: 'f -> 'd //│ forall 'g. 'g -> (forall 'h 'i 'j. 'h -> 'j //│ where -//│ 'g <: 'i -> 'j -//│ anything -> (forall 'k. 'k -> 'k) <: 'g -> 'h -> 'i) <: 'c -> 'd -> 'e -//│ 'c <: 'e -> 'f) <: 'l -> 'b +//│ anything -> (forall 'k. 'k -> 'k) <: 'g -> 'h -> 'i +//│ 'g <: 'i -> 'j) <: 'c -> 'e -> 'f) <: 'l -> 'b //│ forall 'm. 'm -> (forall 'n 'o 'p. 'n -> 'p //│ where -//│ anything -> (forall 'k. 'k -> 'k) <: 'm -> 'n -> 'o -//│ 'm <: 'o -> 'p) <: (forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f +//│ 'm <: 'o -> 'p +//│ anything -> (forall 'k. 'k -> 'k) <: 'm -> 'n -> 'o) <: (forall 'c. 'c -> (forall 'd 'e 'f. 'e -> 'd //│ where +//│ 'c <: 'f -> 'd //│ forall 'g. 'g -> (forall 'h 'i 'j. 'h -> 'j //│ where -//│ 'g <: 'i -> 'j -//│ anything -> (forall 'k. 'k -> 'k) <: 'g -> 'h -> 'i) <: 'c -> 'd -> 'e -//│ 'c <: 'e -> 'f)) -> 'a -> 'l +//│ anything -> (forall 'k. 'k -> 'k) <: 'g -> 'h -> 'i +//│ 'g <: 'i -> 'j) <: 'c -> 'e -> 'f)) -> 'a -> 'l //│ = [Function (anonymous)] c2__ c2__ K @@ -441,20 +441,20 @@ c2__ c2__ K //│ where //│ forall 'c. 'c -> (forall 'd 'e 'f. 'd -> 'f //│ where -//│ anything -> (forall 'g. 'g -> 'g) <: 'c -> 'd -> 'e -//│ 'c <: 'e -> 'f) <: (forall 'h 'i 'j. 'h -> 'j +//│ 'c <: 'e -> 'f +//│ anything -> (forall 'g. 'g -> 'g) <: 'c -> 'd -> 'e) <: (forall 'h 'i 'j. 'h -> 'j //│ where -//│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n +//│ forall 'k. 'k -> (forall 'l 'm 'n. 'm -> 'l //│ where -//│ anything -> (forall 'g. 'g -> 'g) <: 'k -> 'l -> 'm -//│ 'k <: 'm -> 'n) <: (forall 'o. 'o -> anything -> 'o) -> 'h -> 'i +//│ 'k <: 'n -> 'l +//│ anything -> (forall 'g. 'g -> 'g) <: 'k -> 'm -> 'n) <: (forall 'o. 'o -> anything -> 'o) -> 'h -> 'i //│ forall 'o. 'o -> anything -> 'o <: 'i -> 'j) -> 'a -> 'p //│ forall 'h 'i 'j. 'h -> 'j //│ where -//│ forall 'k. 'k -> (forall 'l 'm 'n. 'l -> 'n +//│ forall 'k. 'k -> (forall 'l 'm 'n. 'm -> 'l //│ where -//│ anything -> (forall 'g. 'g -> 'g) <: 'k -> 'l -> 'm -//│ 'k <: 'm -> 'n) <: (forall 'o. 'o -> anything -> 'o) -> 'h -> 'i +//│ 'k <: 'n -> 'l +//│ anything -> (forall 'g. 'g -> 'g) <: 'k -> 'm -> 'n) <: (forall 'o. 'o -> anything -> 'o) -> 'h -> 'i //│ forall 'o. 'o -> anything -> 'o <: 'i -> 'j <: 'p -> 'b //│ = [Function (anonymous)] diff --git a/shared/src/test/diff/gadt/Exp1.mls b/shared/src/test/diff/gadt/Exp1.mls index 707f2221f..93212b89a 100644 --- a/shared/src/test/diff/gadt/Exp1.mls +++ b/shared/src/test/diff/gadt/Exp1.mls @@ -3,8 +3,10 @@ class Exp[A]: Pair | Lit class Lit(n: Int) extends Exp[Int] -class Pair[L, R](lhs: L, rhs: R) extends Exp[(L, R)] -//│ class Exp[A]: Lit | Pair[anything, anything] +class Pair[L, R](val lhs: L, val rhs: R) extends Exp[[L, R]] +//│ class Exp[A]: Lit | Pair[anything, anything] { +//│ constructor() +//│ } //│ class Lit(n: Int) extends Exp //│ class Pair[L, R](lhs: L, rhs: R) extends Exp @@ -25,7 +27,7 @@ fun f(e) = if e is //│ fun f: forall 'a 'b. (Lit | Pair['a, 'b]) -> (Int | ['a, 'b]) (e: Exp['X]) => f(e) -//│ (e: Exp['X]) -> (Int | [??L, ??R]) +//│ forall 'X. (e: Exp['X]) -> (Int | [??L, ??R]) //│ res //│ = [Function: res] @@ -34,7 +36,7 @@ fun f(e) = if e is fun f(e) = if e is Pair['a, 'b](l, r) then [l, r] //│ ╔══[ERROR] illegal pattern -//│ ║ l.35: Pair['a, 'b](l, r) then [l, r] +//│ ║ l.37: Pair['a, 'b](l, r) then [l, r] //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ fun f: anything -> error //│ Code generation encountered an error: @@ -46,11 +48,14 @@ fun f(e) = if e is Pair(l: a, r) then fun f(x: a) = x f(l) +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.49: fun f(x: a) = x +//│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: a -//│ ║ l.47: fun f(x: a) = x +//│ ║ l.49: fun f(x: a) = x //│ ╙── ^ //│ ╔══[ERROR] identifier not found: l -//│ ║ l.48: f(l) +//│ ║ l.50: f(l) //│ ╙── ^ //│ fun f: Pair[anything, anything] -> error //│ Code generation encountered an error: diff --git a/shared/src/test/diff/gadt/Exp2.mls b/shared/src/test/diff/gadt/Exp2.mls index 52e62ecda..55421697d 100644 --- a/shared/src/test/diff/gadt/Exp2.mls +++ b/shared/src/test/diff/gadt/Exp2.mls @@ -2,9 +2,11 @@ class Exp[A]: Pair | Lit -class Lit(n: Int) extends Exp[Int] -class Pair[L, R](lhs: Exp[L], rhs: Exp[R]) extends Exp[(L, R)] -//│ class Exp[A]: Lit | Pair[?, ?] +class Lit(val n: Int) extends Exp[Int] +class Pair[L, R](val lhs: Exp[L], val rhs: Exp[R]) extends Exp[[L, R]] +//│ class Exp[A]: Lit | Pair[?, ?] { +//│ constructor() +//│ } //│ class Lit(n: Int) extends Exp //│ class Pair[L, R](lhs: Exp[L], rhs: Exp[R]) extends Exp @@ -27,12 +29,12 @@ fun f(e) = if e is :e (e: Exp['X]) => f(e) //│ ╔══[ERROR] Type error in application -//│ ║ l.28: (e: Exp['X]) => f(e) +//│ ║ l.30: (e: Exp['X]) => f(e) //│ ║ ^^^^ //│ ╟── type variable `L` leaks out of its scope -//│ ║ l.6: class Pair[L, R](lhs: Exp[L], rhs: Exp[R]) extends Exp[(L, R)] +//│ ║ l.6: class Pair[L, R](val lhs: Exp[L], val rhs: Exp[R]) extends Exp[[L, R]] //│ ╙── ^ -//│ (e: Exp['X]) -> (Int | error | [Exp['L], Exp['R]]) +//│ forall 'X 'L 'R. (e: Exp['X]) -> (Int | error | [Exp['L], Exp['R]]) //│ where //│ 'R :> ??R //│ <: ??R0 @@ -47,24 +49,24 @@ fun f(e) = if e is Pair(l, r) then f(l) + f(r) Lit(n) then n //│ ╔══[ERROR] Type error in definition -//│ ║ l.46: fun f(e) = if e is +//│ ║ l.48: fun f(e) = if e is //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.47: Pair(l, r) then f(l) + f(r) +//│ ║ l.49: Pair(l, r) then f(l) + f(r) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.48: Lit(n) then n +//│ ║ l.50: Lit(n) then n //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── type variable `L` leaks out of its scope -//│ ║ l.6: class Pair[L, R](lhs: Exp[L], rhs: Exp[R]) extends Exp[(L, R)] +//│ ║ l.6: class Pair[L, R](val lhs: Exp[L], val rhs: Exp[R]) extends Exp[[L, R]] //│ ╙── ^ //│ ╔══[ERROR] Type error in definition -//│ ║ l.46: fun f(e) = if e is +//│ ║ l.48: fun f(e) = if e is //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.47: Pair(l, r) then f(l) + f(r) +//│ ║ l.49: Pair(l, r) then f(l) + f(r) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.48: Lit(n) then n +//│ ║ l.50: Lit(n) then n //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── type variable `R` leaks out of its scope -//│ ║ l.6: class Pair[L, R](lhs: Exp[L], rhs: Exp[R]) extends Exp[(L, R)] +//│ ║ l.6: class Pair[L, R](val lhs: Exp[L], val rhs: Exp[R]) extends Exp[[L, R]] //│ ╙── ^ //│ fun f: forall 'L 'R. (Lit | Pair['L, 'R]) -> Int //│ where diff --git a/shared/src/test/diff/gadt/ThisMatching.mls b/shared/src/test/diff/gadt/ThisMatching.mls index bd4491f5d..9178a4229 100644 --- a/shared/src/test/diff/gadt/ThisMatching.mls +++ b/shared/src/test/diff/gadt/ThisMatching.mls @@ -27,10 +27,10 @@ Dummy.introspect //│ = 'duh!' -// * TODO: simplify `forall 'a. Int | 'a` – seems it's not because it shares a var... class Funny: Int { fun test = this + 1 } -//│ class Funny: Int | 'a { -//│ fun test: forall 'a. Int | 'a +//│ class Funny: Int { +//│ constructor() +//│ fun test: Int //│ } :e @@ -42,6 +42,7 @@ class Unfunny { fun test = this + 1 } //│ ║ l.37: class Unfunny { fun test = this + 1 } //│ ╙── ^^^^ //│ class Unfunny { +//│ constructor() //│ fun test: Int | error //│ } @@ -54,6 +55,7 @@ class Exp: Pair | Lit { class Lit(n: Int) extends Exp class Pair(lhs: Exp, rhs: Exp) extends Exp //│ class Exp: Lit | Pair { +//│ constructor() //│ fun test: 0 | 1 //│ } //│ class Lit(n: Int) extends Exp { @@ -72,6 +74,7 @@ class Exp: Pair | Lit { class Lit(n: Int) extends Exp class Pair(lhs: Exp, rhs: Exp) extends Exp //│ class Exp: Lit | Pair { +//│ constructor() //│ fun test: 0 | 1 //│ } //│ class Lit(n: Int) extends Exp { @@ -96,9 +99,10 @@ class Exp: Pair | Lit { class Lit(n: Int) extends Exp class Pair(lhs: Exp, rhs: Exp) extends Exp //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.94: Pair(l, r) then l.test + r.test +//│ ║ l.97: Pair(l, r) then l.test + r.test //│ ╙── ^^^^^ //│ class Exp: Lit | Pair { +//│ constructor() //│ fun test: Int | error //│ } //│ class Lit(n: Int) extends Exp { @@ -118,6 +122,7 @@ class Exp: Pair | Lit { class Lit(n: Int) extends Exp class Pair(lhs: Exp, rhs: Exp) extends Exp //│ class Exp: Lit | Pair { +//│ constructor() //│ fun test: Int //│ } //│ class Lit(n: Int) extends Exp { @@ -135,27 +140,30 @@ class Exp[A]: Pair | Lit { Pair then 1 } class Lit(n: Int) extends Exp[Int] -class Pair[L, R](lhs: L, rhs: R) extends Exp[(L, R)] +class Pair[L, R](lhs: L, rhs: R) extends Exp[[L, R]] //│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.132: class Exp[A]: Pair | Lit { +//│ ║ l.137: class Exp[A]: Pair | Lit { //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.133: fun test = if this is +//│ ║ l.138: fun test = if this is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.134: Lit then 0 +//│ ║ l.139: Lit then 0 //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.135: Pair then 1 -//│ ╙── ^^^^^^^^^^^^^^^ +//│ ║ l.140: Pair then 1 +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.141: } +//│ ╙── ^ //│ ╔══[ERROR] Type error in `case` expression -//│ ║ l.133: fun test = if this is +//│ ║ l.138: fun test = if this is //│ ║ ^^^^^^^ -//│ ║ l.134: Lit then 0 +//│ ║ l.139: Lit then 0 //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.135: Pair then 1 +//│ ║ l.140: Pair then 1 //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── type variable `L` leaks out of its scope -//│ ║ l.138: class Pair[L, R](lhs: L, rhs: R) extends Exp[(L, R)] +//│ ║ l.143: class Pair[L, R](lhs: L, rhs: R) extends Exp[[L, R]] //│ ╙── ^ //│ class Exp[A]: Lit | Pair[anything, anything] { +//│ constructor() //│ fun test: 0 | 1 //│ } //│ class Lit(n: Int) extends Exp { diff --git a/shared/src/test/diff/gen/genTests_v1-0.14-15-x2.fun b/shared/src/test/diff/gen/genTests_v1-0.14-15-x2.fun index 4cb68f818..7743c733e 100644 --- a/shared/src/test/diff/gen/genTests_v1-0.14-15-x2.fun +++ b/shared/src/test/diff/gen/genTests_v1-0.14-15-x2.fun @@ -2579,9 +2579,9 @@ add //│ res: {u: forall 'a. 'a -> 'a} (let rec x = {v: (y => x)}; {u: x.v}) -//│ res: {u: 'v} +//│ res: {u: anything -> 'x} //│ where -//│ 'v :> anything -> {v: 'v} +//│ 'x :> {v: anything -> 'x} (x => 0.v) //│ ╔══[ERROR] Type mismatch in field selection: @@ -2940,9 +2940,9 @@ add //│ res: {v: int -> int -> int} (let rec x = {v: {v: x}}; x.v) -//│ res: 'v +//│ res: {v: 'x} //│ where -//│ 'v :> {v: {v: 'v}} +//│ 'x :> {v: {v: 'x}} 0.u //│ ╔══[ERROR] Type mismatch in field selection: diff --git a/shared/src/test/diff/mlf-examples/ex_casparticuliers.mls b/shared/src/test/diff/mlf-examples/ex_casparticuliers.mls index 6dbbf0de8..495ff59ed 100644 --- a/shared/src/test/diff/mlf-examples/ex_casparticuliers.mls +++ b/shared/src/test/diff/mlf-examples/ex_casparticuliers.mls @@ -593,8 +593,8 @@ succ' succ' {} //│ res: 'a -> (forall 'b 'c 'd. 'b -> 'd //│ where -//│ 'a <: 'c -> 'd -//│ anything <: 'a -> 'b -> 'c) +//│ anything <: 'a -> 'b -> 'c +//│ 'a <: 'c -> 'd) //│ = [Function (anonymous)] // :e // * Error delayed by inconsistent constrained types diff --git a/shared/src/test/diff/mlf-examples/ex_concrete.mls b/shared/src/test/diff/mlf-examples/ex_concrete.mls index fb2be246d..a90987d1d 100644 --- a/shared/src/test/diff/mlf-examples/ex_concrete.mls +++ b/shared/src/test/diff/mlf-examples/ex_concrete.mls @@ -51,9 +51,9 @@ rec def map f l = case l of { Nil -> Nil | Cons -> Cons (f l.head, map f l.tail) } -//│ map: ('head -> 'head0) -> 'a -> 'tail +//│ map: ('head -> 'head0) -> 'a -> (Nil | 'b) //│ where -//│ 'tail :> (Cons['head0] with {tail: 'tail}) | Nil +//│ 'b :> Cons['head0] with {tail: Nil | 'b} //│ 'a <: (Cons[?] with {head: 'head, tail: 'a}) | Nil //│ = [Function: map] :NoRecursiveTypes diff --git a/shared/src/test/diff/mlf-examples/ex_demo.mls b/shared/src/test/diff/mlf-examples/ex_demo.mls index 055eafa42..2bc5aa996 100644 --- a/shared/src/test/diff/mlf-examples/ex_demo.mls +++ b/shared/src/test/diff/mlf-examples/ex_demo.mls @@ -254,13 +254,11 @@ rec def id1 x = if true then x else id1 id1 x //│ ║ l.243: rec def id1 x = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id1] @@ -280,13 +278,11 @@ def id1 x = if true then x else idy_ty idy_ty x // * but it does need at least recursive types: :RecursiveTypes rec def id1 x = if true then x else id1 id1 x -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id11] id1 id //│ res: ('a & 'b) -> 'b | 'c @@ -297,36 +293,32 @@ id1 id //│ <: 'a -> 'b & 'c //│ = [Function: id] id1 id1 -//│ res: 'a -> 'b | 'id1 +//│ res: ('a & 'b) -> 'a //│ where -//│ 'a :> forall 'id1 'c 'd. 'a -> 'b | 'id1 -//│ <: 'b -//│ 'b :> forall 'id1 'c 'd. 'id1 -//│ <: 'a -> 'b -//│ 'id1 :> 'c -> 'd -//│ 'c :> 'id1 +//│ 'a :> forall 'c 'd. ('a & 'b & 'c) -> ('a | 'd) +//│ <: ((forall 'c 'd. 'c -> 'd) | 'b) -> 'a +//│ 'c :> 'c -> 'd //│ <: 'd -//│ 'd :> 'id1 -//│ <: 'c -> 'd +//│ 'd := 'c -> 'd //│ = [Function: id11] // * Note that it can't be applied when typed with :precise-rec-typing AND :DontDistributeForalls :DontDistributeForalls :precise-rec-typing rec def id1_p x = if true then x else id1_p id1_p x -//│ id1_p: 'id1_p +//│ id1_p: 'a -> 'b //│ where -//│ 'id1_p :> forall 'a. ('a & 'b) -> 'a -//│ 'a :> 'c -//│ 'c :> 'id1_p -//│ <: 'b -> 'c -//│ 'b :> 'id1_p -//│ <: 'c +//│ 'a <: 'b & 'c +//│ 'b :> 'd +//│ 'd :> forall 'a 'b. 'a -> 'b +//│ <: 'c -> 'd +//│ 'c :> forall 'a 'b. 'a -> 'b +//│ <: 'd //│ = [Function: id1_p] // * Can't apply it: :e id1_p id //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.327: id1_p id +//│ ║ l.319: id1_p id //│ ║ ^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error | ('a & 'b) -> 'a | 'c @@ -344,21 +336,17 @@ id1_p id // * TODO type pp – inline id1? :e id1 -//│ ╔══[ERROR] Inferred recursive type: 'id1 +//│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ ╙── -//│ res: 'id1 +//│ res: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id11] :e @@ -368,19 +356,19 @@ id1: nothing //│ 'a := 'b -> 'a //│ 'b :> 'b -> 'a //│ <: 'a -//│ ║ l.282: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.280: rec def id1 x = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.365: id1: nothing +//│ ║ l.353: id1: nothing //│ ║ ^^^ //│ ╟── function of type `?a -> ?b` does not match type `nothing` -//│ ║ l.282: rec def id1 x = if true then x else id1 id1 x +//│ ║ l.280: rec def id1 x = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `nothing` -//│ ║ l.365: id1: nothing +//│ ║ l.353: id1: nothing //│ ║ ^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.365: id1: nothing +//│ ║ l.353: id1: nothing //│ ╙── ^^^^^^^ //│ res: nothing //│ = [Function: id11] @@ -391,7 +379,7 @@ rec def id1_ x = id1_ id1_ x //│ where //│ 'a <: ('b -> 'c | 'b) -> 'c //│ 'c <: 'a -//│ ║ l.389: rec def id1_ x = id1_ id1_ x +//│ ║ l.377: rec def id1_ x = id1_ id1_ x //│ ╙── ^^^^^^^^^ //│ id1_: anything -> nothing //│ = [Function: id1_] @@ -401,46 +389,46 @@ rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ╔══[ERROR] Inferred recursive type: 'b //│ where //│ 'b <: (forall 'a. 'a -> 'a) -> (??a & 'b) -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Type mismatch in binding of lambda expression: -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `'a` is not a function -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^ //│ ╟── but it flows into quantified type variable with expected type `'a0 -> 'a0` -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^ //│ ╟── Note: constraint arises from function type: -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] Type error in binding of lambda expression -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'a` leaks out of its scope -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this application: -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Type error in binding of lambda expression -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'a` leaks out of its scope -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^ //│ ╟── adding a type annotation to any of the following terms may help resolve the problem //│ ╟── • this application: -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.400: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x +//│ ║ l.388: rec def id1 (x: forall 'a. 'a -> 'a) = if true then x else id1 id1 x //│ ╙── ^^^^^^^^^ //│ id1: (forall 'a. 'a -> 'a) -> 'a0 -> 'a0 //│ = [Function: id12] @@ -487,7 +475,7 @@ ex1_1 (fun ((x, f)) -> f x) //│ A String ex1_2 = if true then make_ex1 ((42, print_int)) else ex1_1 -//│ ex1_2: (forall 'a 'a0. (('a0, 'a0 -> unit,),) -> 'b & (('a, 'a -> unit,),) -> 'b) -> 'b +//│ ex1_2: (forall 'a 'a0. (('a, 'a -> unit,),) -> 'b & (('a0, 'a0 -> unit,),) -> 'b) -> 'b //│ = [Function (anonymous)] ex1_2 (fun ((x, f)) -> f x) @@ -525,7 +513,7 @@ ex_list1 = cons (make_ex1 (("A String", print_string))) ex_list2 = cons (make_ex2 (("String", "String", eqstring))) (cons (make_ex2 ((1250, 4890, eqint))) (cons (make_ex2 ((true, false, eqbool))) nil)) -//│ ex_list2: List[forall 'b. (forall 'a 'c 'a0 'a1. (('a, 'a, 'a -> 'a -> (forall 'c. bool | 'c),),) -> 'b & (('a0, 'a0, 'a0 -> 'a0 -> (bool | false | 'c),),) -> 'b & (('a1, 'a1, 'a1 -> 'a1 -> (forall 'c. bool | 'c),),) -> 'b) -> 'b] +//│ ex_list2: List[forall 'b. (forall 'a 'a0 'a1. (('a1, 'a1, 'a1 -> 'a1 -> bool,),) -> 'b & (('a, 'a, 'a -> 'a -> (bool | false),),) -> 'b & (('a0, 'a0, 'a0 -> 'a0 -> bool,),) -> 'b) -> 'b] //│ = Cons { //│ head: [Function (anonymous)], //│ tail: Cons { @@ -943,17 +931,17 @@ def c_mul m (n: Fint) = m (c_add n) c_i0 //│ = [Function: c_mul] def c_mul_ m n = m (c_add_ n) c_i0 -//│ c_mul_: ((forall 'a. ((forall 'b 'c 'd 'e. ('d -> 'e -> 'b) -> ('c -> 'e & 'd) -> 'c -> 'b) -> 'f -> 'a) -> 'a) -> (forall 'g. anything -> 'g -> 'g) -> 'h) -> 'f -> 'h +//│ c_mul_: ((forall 'a. ((forall 'b 'c 'd 'e. ('b -> 'c -> 'd) -> ('e -> 'c & 'b) -> 'e -> 'd) -> 'f -> 'a) -> 'a) -> (forall 'g. anything -> 'g -> 'g) -> 'h) -> 'f -> 'h //│ = [Function: c_mul_] // let c_pow n (m:Int) = m (c_mul n) c_i1 def c_pow m (n: Fint) = m (c_mul n) c_i1 -//│ c_pow: ((Fint -> (forall 'b 'a. (('a | 'b) -> 'a) -> 'b -> ('a | 'b) | Fint)) -> (forall 'c 'd. ('c -> 'd) -> 'c -> 'd) -> 'e) -> Fint -> 'e +//│ c_pow: ((Fint -> (forall 'a 'b. (('a | 'b) -> 'a) -> 'b -> ('a | 'b) | Fint)) -> (forall 'c 'd. ('c -> 'd) -> 'c -> 'd) -> 'e) -> Fint -> 'e //│ = [Function: c_pow] def c_pow_ m n = m (c_mul_ n) c_i1 -//│ c_pow_: (('a -> 'b) -> (forall 'c 'd. ('c -> 'd) -> 'c -> 'd) -> 'e) -> ((forall 'f. ((forall 'g 'h 'i 'j. ('g -> 'h -> 'i) -> ('j -> 'h & 'g) -> 'j -> 'i) -> 'a -> 'f) -> 'f) -> (forall 'k. anything -> 'k -> 'k) -> 'b) -> 'e +//│ c_pow_: (('a -> 'b) -> (forall 'c 'd. ('c -> 'd) -> 'c -> 'd) -> 'e) -> ((forall 'f. ((forall 'g 'h 'i 'j. ('j -> 'g -> 'h) -> ('i -> 'g & 'j) -> 'i -> 'h) -> 'a -> 'f) -> 'f) -> (forall 'k. anything -> 'k -> 'k) -> 'b) -> 'e //│ = [Function: c_pow_] @@ -973,7 +961,7 @@ def c_pred_ n = let s = fun p -> c_pair (c_2_2_ p) (c_succ_ (c_2_2_ p)) in let z = c_pair c_i0 c_i0 in c_1_2_ (n s z) -//│ c_pred_: ((forall 'a 'b 'c 'd 'e 'f. ((forall 'g. anything -> 'g -> 'g) -> ('f -> 'd -> 'a & 'b)) -> ('b -> (('c -> 'd & 'f) -> 'c -> 'a) -> 'e) -> 'e) -> (forall 'h. ((forall 'i. anything -> 'i -> 'i) -> (forall 'i. anything -> 'i -> 'i) -> 'h) -> 'h) -> (forall 'j. 'j -> anything -> 'j) -> 'k) -> 'k +//│ c_pred_: ((forall 'a 'b 'c 'd 'e 'f. ((forall 'g. anything -> 'g -> 'g) -> ('a -> 'd -> 'e & 'f)) -> ('f -> (('b -> 'd & 'a) -> 'b -> 'e) -> 'c) -> 'c) -> (forall 'h. ((forall 'i. anything -> 'i -> 'i) -> (forall 'i. anything -> 'i -> 'i) -> 'h) -> 'h) -> (forall 'j. 'j -> anything -> 'j) -> 'k) -> 'k //│ = [Function: c_pred_] @@ -1071,7 +1059,7 @@ def c_fact_A: Fint -> Fint def c_fact_A n = c_if (c_iszero n) (fun u -> c_i1) (fun u -> c_mul n (c_fact_A (c_pred n))) -//│ (Fint & (Fint -> (forall 'a 'b. (('a | 'b) -> 'a) -> 'b -> 'a | Fint)) -> (forall 'c. anything -> 'c -> 'c) -> 'd) -> (('e -> 'f) -> 'e -> 'f | 'd) +//│ (Fint & (Fint -> (forall 'b 'a. (('a | 'b) -> 'a) -> 'b -> 'a | Fint)) -> (forall 'c. anything -> 'c -> 'c) -> 'd) -> (('e -> 'f) -> 'e -> 'f | 'd) //│ <: c_fact_A: //│ Fint -> Fint //│ = @@ -1085,28 +1073,28 @@ rec def c_fact_ n = (fun _ -> c_mul_ n (c_fact_ (c_pred_ n))) //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (? -> 'j) -> 'k & (forall 'l. ((forall 'm 'n 'o 'p. ('m -> 'n -> 'o) -> ('p -> 'n & 'm) -> 'p -> 'o) -> 'k -> 'l) -> 'l) -> (forall 'c. ? -> 'c -> 'c) -> 'j & (forall 'q 'r 's 't 'u 'v. ((forall 'w. ? -> 'w -> 'w) -> ('s -> 'v -> 'q & 'r)) -> ('r -> (('t -> 'v & 's) -> 't -> 'q) -> 'u) -> 'u) -> 'a) -//│ ║ l.975: c_1_2_ (n s z) +//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (? -> 'j) -> 'k & (forall 'l. ((forall 'm 'n 'o 'p. ('m -> 'n -> 'o) -> ('p -> 'n & 'm) -> 'p -> 'o) -> 'k -> 'l) -> 'l) -> (forall 'c. ? -> 'c -> 'c) -> 'j & (forall 'q 'r 's 't 'u 'v. ((forall 'w. ? -> 'w -> 'w) -> ('u -> 'v -> 'r & 't)) -> ('t -> (('s -> 'v & 'u) -> 's -> 'r) -> 'q) -> 'q) -> 'a) +//│ ║ l.963: c_1_2_ (n s z) //│ ╙── ^^^ //│ c_fact_: 'a -> 'b //│ where -//│ 'a <: (forall 'c. anything -> anything -> ((forall 'd. 'd -> 'd) -> 'c) -> 'c) -> (forall 'e. ((forall 'd. 'd -> 'd) -> 'e) -> anything -> 'e) -> (forall 'f 'g. anything -> ('f -> 'g) -> 'f -> 'g) -> (anything -> 'h) -> 'b & (forall 'i. ((forall 'j 'k 'l 'm. ('k -> 'l -> 'm) -> ('j -> 'l & 'k) -> 'j -> 'm) -> 'b -> 'i) -> 'i) -> (forall 'n. anything -> 'n -> 'n) -> 'h & (forall 'o 'p 'q 'r 's 't. ((forall 'u. anything -> 'u -> 'u) -> ('r -> 's -> 't & 'o)) -> ('o -> (('q -> 's & 'r) -> 'q -> 't) -> 'p) -> 'p) -> (forall 'v. ((forall 'n. anything -> 'n -> 'n) -> (forall 'n. anything -> 'n -> 'n) -> 'v) -> 'v) -> (forall 'w. 'w -> anything -> 'w) -> 'a +//│ 'a <: (forall 'c. anything -> anything -> ((forall 'd. 'd -> 'd) -> 'c) -> 'c) -> (forall 'e. ((forall 'd. 'd -> 'd) -> 'e) -> anything -> 'e) -> (forall 'f 'g. anything -> ('f -> 'g) -> 'f -> 'g) -> (anything -> 'h) -> 'b & (forall 'i. ((forall 'j 'k 'l 'm. ('j -> 'k -> 'l) -> ('m -> 'k & 'j) -> 'm -> 'l) -> 'b -> 'i) -> 'i) -> (forall 'n. anything -> 'n -> 'n) -> 'h & (forall 'o 'p 'q 'r 's 't. ((forall 'u. anything -> 'u -> 'u) -> ('q -> 's -> 'p & 'o)) -> ('o -> (('t -> 's & 'q) -> 't -> 'p) -> 'r) -> 'r) -> (forall 'v. ((forall 'n. anything -> 'n -> 'n) -> (forall 'n. anything -> 'n -> 'n) -> 'v) -> 'v) -> (forall 'w. 'w -> anything -> 'w) -> 'a //│ = [Function: c_fact_] :e // * The type we infer without any annotations can't be checked against the desired signature c_fact_A = c_fact_ //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('n -> 'o -> 'p) -> ('q -> 'o & 'n) -> 'q -> 'p) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('t -> 'y -> 'x & 'v)) -> ('v -> (('u -> 'y & 't) -> 'u -> 'x) -> 'w) -> 'w) -> 'a) -//│ ║ l.975: c_1_2_ (n s z) +//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('q -> 'n -> 'o) -> ('p -> 'n & 'q) -> 'p -> 'o) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('t -> 'x -> 'w & 'u)) -> ('u -> (('v -> 'x & 't) -> 'v -> 'w) -> 'y) -> 'y) -> 'a) +//│ ║ l.963: c_1_2_ (n s z) //│ ╙── ^^^ //│ 'a -> 'b //│ where -//│ 'a <: (forall 'c. anything -> anything -> ((forall 'd. 'd -> 'd) -> 'c) -> 'c) -> (forall 'e. ((forall 'd. 'd -> 'd) -> 'e) -> anything -> 'e) -> (forall 'f 'g. anything -> ('f -> 'g) -> 'f -> 'g) -> (anything -> 'h) -> 'b & (forall 'i. ((forall 'j 'k 'l 'm. ('j -> 'k -> 'l) -> ('m -> 'k & 'j) -> 'm -> 'l) -> 'b -> 'i) -> 'i) -> (forall 'n. anything -> 'n -> 'n) -> 'h & (forall 'o 'p 'q 'r 's 't. ((forall 'u. anything -> 'u -> 'u) -> ('s -> 't -> 'o & 'q)) -> ('q -> (('r -> 't & 's) -> 'r -> 'o) -> 'p) -> 'p) -> (forall 'v. ((forall 'n. anything -> 'n -> 'n) -> (forall 'n. anything -> 'n -> 'n) -> 'v) -> 'v) -> (forall 'w. 'w -> anything -> 'w) -> 'a +//│ 'a <: (forall 'c. anything -> anything -> ((forall 'd. 'd -> 'd) -> 'c) -> 'c) -> (forall 'e. ((forall 'd. 'd -> 'd) -> 'e) -> anything -> 'e) -> (forall 'f 'g. anything -> ('f -> 'g) -> 'f -> 'g) -> (anything -> 'h) -> 'b & (forall 'i. ((forall 'j 'k 'l 'm. ('j -> 'k -> 'l) -> ('m -> 'k & 'j) -> 'm -> 'l) -> 'b -> 'i) -> 'i) -> (forall 'n. anything -> 'n -> 'n) -> 'h & (forall 'o 'p 'q 'r 's 't. ((forall 'u. anything -> 'u -> 'u) -> ('p -> 's -> 'r & 'q)) -> ('q -> (('o -> 's & 'p) -> 'o -> 'r) -> 't) -> 't) -> (forall 'v. ((forall 'n. anything -> 'n -> 'n) -> (forall 'n. anything -> 'n -> 'n) -> 'v) -> 'v) -> (forall 'w. 'w -> anything -> 'w) -> 'a //│ <: c_fact_A: //│ Fint -> Fint //│ ╔══[ERROR] Cyclic-looking constraint while typing def definition; a type annotation may be required -//│ ║ l.1097: c_fact_A = c_fact_ +//│ ║ l.1085: c_fact_A = c_fact_ //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ = [Function: c_fact_] @@ -1137,11 +1125,11 @@ def print_fact_ n = print_string "\n" //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('q -> 'n -> 'o) -> ('p -> 'n & 'q) -> 'p -> 'o) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('y -> 'v -> 'u & 'x)) -> ('x -> (('t -> 'v & 'y) -> 't -> 'u) -> 'w) -> 'w) -> 'a) -//│ ║ l.975: c_1_2_ (n s z) +//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('n -> 'o -> 'p) -> ('q -> 'o & 'n) -> 'q -> 'p) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('x -> 'u -> 'y & 'w)) -> ('w -> (('t -> 'u & 'x) -> 't -> 'y) -> 'v) -> 'v) -> 'a) +//│ ║ l.963: c_1_2_ (n s z) //│ ╙── ^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1136: let _ = c_printint_ (c_fact_ (to_church_ n)) in +//│ ║ l.1124: let _ = c_printint_ (c_fact_ (to_church_ n)) in //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ print_fact_: int -> unit @@ -1172,11 +1160,11 @@ def print_fact2_ n = (c_printint2_ (c_fact_ (to_church_ n))) )) //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('p -> 'q -> 'n) -> ('o -> 'q & 'p) -> 'o -> 'n) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('t -> 'v -> 'x & 'y)) -> ('y -> (('w -> 'v & 't) -> 'w -> 'x) -> 'u) -> 'u) -> 'a) -//│ ║ l.975: c_1_2_ (n s z) +//│ 'a <: (forall 'b. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'b) -> 'b) -> (forall 'd. 'd -> ? -> 'd) -> ((forall 'e. ? -> ? -> ((forall 'f. 'f -> 'f) -> 'e) -> 'e) -> (forall 'g. ((forall 'f. 'f -> 'f) -> 'g) -> ? -> 'g) -> (forall 'h 'i. ? -> ('h -> 'i) -> 'h -> 'i) -> (forall 'j. ? -> (? -> 'j -> 'j | 'k)) -> 'l & (forall 'm. ((forall 'n 'o 'p 'q. ('n -> 'o -> 'p) -> ('q -> 'o & 'n) -> 'q -> 'p) -> (forall 'r 's. ('r -> 's) -> 'r -> 's | 'l) -> 'm) -> 'm) -> (forall 'c. ? -> 'c -> 'c) -> 'k & (forall 't 'u 'v 'w 'x 'y. ((forall 'z. ? -> 'z -> 'z) -> ('t -> 'w -> 'y & 'v)) -> ('v -> (('u -> 'w & 't) -> 'u -> 'y) -> 'x) -> 'x) -> 'a) +//│ ║ l.963: c_1_2_ (n s z) //│ ╙── ^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1172: (c_printint2_ (c_fact_ (to_church_ n))) )) +//│ ║ l.1160: (c_printint2_ (c_fact_ (to_church_ n))) )) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ print_fact2_: int -> string @@ -1222,14 +1210,14 @@ this_should_be_98_ = let c_98_ = c_pred_ c_99_ in c_printint2_ c_98_ //│ ╔══[ERROR] Inferred recursive type: nothing -//│ ║ l.743: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) +//│ ║ l.731: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) //│ ╙── ^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1219: let c_i10_ = c_mul_ c_i5_ c_i2_ in +//│ ║ l.1207: let c_i10_ = c_mul_ c_i5_ c_i2_ in //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1220: let c_i9_ = c_pred_ c_i10_ in +//│ ║ l.1208: let c_i9_ = c_pred_ c_i10_ in //│ ║ ^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ this_should_be_98_: string @@ -1252,15 +1240,15 @@ c_i5_ = c_add_ c_i3_ c_i2_ :e c_i10_ = c_mul_ c_i5_ c_i2_ //│ ╔══[ERROR] Inferred recursive type: nothing -//│ ║ l.743: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) +//│ ║ l.731: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) //│ ╙── ^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1253: c_i10_ = c_mul_ c_i5_ c_i2_ +//│ ║ l.1241: c_i10_ = c_mul_ c_i5_ c_i2_ //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ c_i10_: error | ((forall 'a 'b 'c. ('a -> 'b & 'b -> 'c) -> 'a -> 'c | 'd) -> ('e -> 'f -> ('g & 'h & 'i & 'j & 'k & 'l & 'm) & 'n) & (('o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 's) -> 'o -> 'r | 'n) -> ('t -> 'u -> ('h & 'i & 'j & 'k & 'l & 'm) & 'v) & (('w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's) -> 'w -> 'g | 'v) -> ('x -> 'y -> ('i & 'j & 'k & 'l & 'm) & 'z) & (('a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't) -> 'a1 -> 'h | 'z) -> ('b1 -> 'c1 -> ('j & 'k & 'l & 'm) & 'd1) & (('e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x) -> 'e1 -> 'i | 'd1) -> ('f1 -> 'g1 -> ('k & 'l & 'm) & 'h1) & (('i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1) -> 'i1 -> 'j | 'h1) -> ('j1 -> 'k1 -> ('l & 'm) & 'l1) & (('m1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1) -> 'm1 -> 'k | 'l1) -> ('n1 -> 'o1 -> 'm & 'p1) & (('q1 -> ('k1 & 'm1) & 'm1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1 & 'j1) -> 'q1 -> 'l | 'p1) -> ('r1 & 's1)) -> ('s -> 'p -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'd) -> (('t1 -> ('o1 & 'q1) & 'q1 -> ('k1 & 'm1) & 'm1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1 & 'j1 & 'n1) -> 't1 -> 'm | 'r1) | 's1 +//│ c_i10_: error | ((forall 'a 'b 'c. ('b -> 'c & 'c -> 'a) -> 'b -> 'a | 'd) -> ('e -> 'f -> ('g & 'h & 'i & 'j & 'k & 'l & 'm) & 'n) & (('o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 's) -> 'o -> 'r | 'n) -> ('t -> 'u -> ('h & 'i & 'j & 'k & 'l & 'm) & 'v) & (('w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's) -> 'w -> 'g | 'v) -> ('x -> 'y -> ('i & 'j & 'k & 'l & 'm) & 'z) & (('a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't) -> 'a1 -> 'h | 'z) -> ('b1 -> 'c1 -> ('j & 'k & 'l & 'm) & 'd1) & (('e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x) -> 'e1 -> 'i | 'd1) -> ('f1 -> 'g1 -> ('k & 'l & 'm) & 'h1) & (('i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1) -> 'i1 -> 'j | 'h1) -> ('j1 -> 'k1 -> ('l & 'm) & 'l1) & (('m1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1) -> 'm1 -> 'k | 'l1) -> ('n1 -> 'o1 -> 'm & 'p1) & (('q1 -> ('k1 & 'm1) & 'm1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1 & 'j1) -> 'q1 -> 'l | 'p1) -> ('r1 & 's1)) -> ('s -> 'p -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'd) -> (('t1 -> ('o1 & 'q1) & 'q1 -> ('k1 & 'm1) & 'm1 -> ('g1 & 'i1) & 'i1 -> ('c1 & 'e1) & 'e1 -> ('y & 'a1) & 'a1 -> ('u & 'w) & 'w -> ('f & 'o) & 'o -> 'p & 'p -> 'q & 'q -> ('g & 'h & 'i & 'j & 'k & 'l & 'm & 'r) & 'e & 's & 't & 'x & 'b1 & 'f1 & 'j1 & 'n1) -> 't1 -> 'm | 'r1) | 's1 //│ where -//│ 's1 <: (forall 'u1 'v1 'w1 'x1. ('u1 -> 'v1 -> 'w1) -> ('x1 -> 'v1 & 'u1) -> 'x1 -> 'w1) -> (forall 'y1 'z1 'a2. ('y1 -> 'z1 & 'z1 -> 'a2) -> 'y1 -> 'a2) -> 's1 +//│ 's1 <: (forall 'u1 'v1 'w1 'x1. ('u1 -> 'v1 -> 'w1) -> ('x1 -> 'v1 & 'u1) -> 'x1 -> 'w1) -> (forall 'y1 'z1 'a2. ('a2 -> 'y1 & 'y1 -> 'z1) -> 'a2 -> 'z1) -> 's1 //│ = [Function (anonymous)] //│ constrain calls : 1274 //│ annoying calls : 0 @@ -1288,11 +1276,11 @@ c_i9_ = c_pred_ c_i10_ c_99_ = c_add_ (c_mul_ c_i9_ c_i10_) c_i9_ //│ ╔══[ERROR] Inferred recursive type: 'b //│ where -//│ 'b <: (forall 'c 'd 'e 'f. ('c -> 'd -> 'e) -> ('f -> 'd & 'c) -> 'f -> 'e) -> ((forall 'a 'g 'a0 'a1 'a2. (('a0 | 'g) -> 'a0 & ('a1 | 'g) -> 'a1 & ('a2 | 'g) -> 'a2 & ('a | 'g) -> 'a) -> 'g -> ('a0 | 'a1 | 'a2 | 'a) | Fint) -> ? & (forall 'a3 'h 'a4. (('a3 | 'h) -> 'a3 & ('a4 | 'h) -> 'a4) -> 'h -> ('a3 | 'a4) | Fint) -> anything) -//│ ║ l.915: def c_succ_ n = fun f -> fun x -> n f (f x) +//│ 'b <: (forall 'c 'd 'e 'f. ('c -> 'd -> 'e) -> ('f -> 'd & 'c) -> 'f -> 'e) -> ((forall 'a 'a0 'a1 'g 'a2. (('a | 'g) -> 'a & ('a1 | 'g) -> 'a1 & ('a2 | 'g) -> 'a2 & ('a0 | 'g) -> 'a0) -> 'g -> ('a | 'a1 | 'a2 | 'a0) | Fint) -> ? & (forall 'a3 'h 'a4. (('a3 | 'h) -> 'a3 & ('a4 | 'h) -> 'a4) -> 'h -> ('a3 | 'a4) | Fint) -> anything) +//│ ║ l.903: def c_succ_ n = fun f -> fun x -> n f (f x) //│ ╙── ^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.1288: c_99_ = c_add_ (c_mul_ c_i9_ c_i10_) c_i9_ +//│ ║ l.1276: c_99_ = c_add_ (c_mul_ c_i9_ c_i10_) c_i9_ //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ c_99_: error | ('a -> 'a & 'b -> 'b & 'c -> 'c & 'd -> 'd) -> ('a & 'b & 'c & 'd) -> error @@ -1392,10 +1380,10 @@ def c_succ_ n = fun f -> fun x -> n f (f x) //│ where //│ 'b <: 'a -> 'a & 'c -> 'a)) //│ = [Function: c_succ1] -//│ c_succ_: 'a -> (forall 'b. 'b -> (forall 'c 'd 'e. 'c -> 'e +//│ c_succ_: 'a -> (forall 'b. 'b -> (forall 'c 'd 'e. 'e -> 'd //│ where -//│ 'a <: 'b -> 'd -> 'e -//│ 'b <: 'c -> 'd)) +//│ 'a <: 'b -> 'c -> 'd +//│ 'b <: 'e -> 'c)) //│ = [Function: c_succ_1] def c_add_ n m = m c_succ_ n @@ -1419,12 +1407,12 @@ def c_i2_ = c_succ_ c_i1 //│ where //│ 'b <: 'a -> 'a & 'c -> 'a) //│ = [Function: c_i22] -//│ c_i2_: 'a -> (forall 'b 'c 'd. 'd -> 'c +//│ c_i2_: 'a -> (forall 'b 'c 'd. 'c -> 'b //│ where -//│ 'a <: 'd -> 'b +//│ 'a <: 'c -> 'd //│ forall 'e. 'e -> (forall 'f 'g. 'f -> 'g //│ where -//│ 'e <: 'f -> 'g) <: 'a -> 'b -> 'c) +//│ 'e <: 'f -> 'g) <: 'a -> 'd -> 'b) //│ = [Function: c_i2_1] // let c_i3 = c_succ c_i2 @@ -1453,23 +1441,23 @@ c_i5_ = c_add_ c_i3_ c_i2 //│ 'b <: 'c -> 'e -> 'f //│ forall 'h. 'h -> (forall 'i 'j 'k. 'k -> 'j //│ where -//│ 'h <: 'k -> 'i //│ forall 'l. 'l -> (forall 'a 'm. 'm -> 'a //│ where -//│ 'l <: 'a -> 'a & 'm -> 'a) <: 'h -> 'i -> 'j) <: 'c -> 'd -> 'f) +//│ 'l <: 'a -> 'a & 'm -> 'a) <: 'h -> 'i -> 'j +//│ 'h <: 'k -> 'i) <: 'c -> 'd -> 'f) //│ ╙── //│ c_i5_: 'b //│ where -//│ 'b :> forall 'c. 'c -> (forall 'd 'e 'f 'g. 'f -> 'e +//│ 'b :> forall 'c. 'c -> (forall 'd 'e 'f 'g. 'g -> 'f //│ where -//│ 'c <: 'f -> 'd & 'f -> 'g -//│ forall 'h. 'h -> (forall 'i 'j 'k. 'k -> 'j +//│ 'c <: 'g -> 'e & 'g -> 'd +//│ forall 'h. 'h -> (forall 'i 'j 'k. 'i -> 'k //│ where -//│ 'h <: 'k -> 'i +//│ 'h <: 'i -> 'j //│ forall 'l. 'l -> (forall 'a 'm. 'm -> 'a //│ where -//│ 'l <: 'a -> 'a & 'm -> 'a) <: 'h -> 'i -> 'j) <: 'c -> 'g -> 'e -//│ 'b <: 'c -> 'd -> 'e) +//│ 'l <: 'a -> 'a & 'm -> 'a) <: 'h -> 'j -> 'k) <: 'c -> 'd -> 'f +//│ 'b <: 'c -> 'e -> 'f) //│ = [Function (anonymous)] //│ constrain calls : 140 //│ annoying calls : 0 @@ -1479,10 +1467,10 @@ c_i5_ = c_add_ c_i3_ c_i2 :e c_i10_ = c_mul_ c_i5_ c_i2_ //│ ╔══[ERROR] Inferred recursive type: nothing -//│ ║ l.743: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) +//│ ║ l.731: type Fint = forall 'a. ('a -> 'a) -> ('a -> 'a) //│ ╙── ^^ -//│ ╔══[ERROR] Subtyping constraint of the form `forall ?a ?b ?c. ?c -> ?a -> ?b <: (forall ?d. ?d) -> ?e` exceeded recursion depth limit (250) -//│ ║ l.1480: c_i10_ = c_mul_ c_i5_ c_i2_ +//│ ╔══[ERROR] Subtyping constraint of the form `forall ?a ?b ?c. ?b -> ?a -> ?c <: (forall ?d. ?d) -> ?e` exceeded recursion depth limit (250) +//│ ║ l.1468: c_i10_ = c_mul_ c_i5_ c_i2_ //│ ║ ^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ c_i10_: error diff --git a/shared/src/test/diff/mlf-examples/ex_predicative.mls b/shared/src/test/diff/mlf-examples/ex_predicative.mls index 708c5a75b..ca9d05090 100644 --- a/shared/src/test/diff/mlf-examples/ex_predicative.mls +++ b/shared/src/test/diff/mlf-examples/ex_predicative.mls @@ -286,15 +286,14 @@ def t_ y = (fun h -> h (h (h (fun x -> y)))) (fun f -> fun n -> n (fun v -> k2) //│ ╔══[ERROR] Inferred recursive type: ? -> (((forall 'a. nothing -> ('a -> 'a | ?) | ?) | 'b) -> ((forall 'c. ? -> 'c -> 'c) -> nothing & 'd) & (forall 'e 'f. ((forall 'c. ? -> 'c -> 'c) -> (forall 'c. ? -> 'c -> 'c) -> 'e & 'f) -> (? -> 'f | 'e) | 'd | ?) -> ((forall 'c. ? -> 'c -> 'c) -> nothing & 'b)) //│ ║ l.285: def t_ y = (fun h -> h (h (h (fun x -> y)))) (fun f -> fun n -> n (fun v -> k2) k app (fun g -> fun x -> n (f (n (fun p -> fun s -> s (p k2) (fun f -> fun x -> f (p k2 f x))) (fun s -> s k2 k2) k) g) x)) three //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ t_: ('a -> ('b -> 'c & 'd & 'e)) -> ('a & 'f) -> ((forall 'g. anything -> 'g -> 'g) -> ((forall 'h 'i 'j 'k 'l 'm. ((forall 'g. anything -> 'g -> 'g) -> ('j -> 'h -> 'm & 'k)) -> ('k -> (forall 'n. ('m -> 'n & 'j) -> 'h -> 'n) -> 'l) -> ('i -> 'i | 'l) | 'o | 'd) -> (forall 'p 'q. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'p & 'q) -> (anything -> 'q | 'p) | 'r | 's | 't | 'c | 'u) -> 'b & 'v) & 't) -> ('c | 'u) +//│ t_: ('a -> ((forall 'b 'c. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'b & 'c) -> (anything -> 'c | 'b) | 'e | 'f | 'g | 'h | 'i | 'j) -> 'i & 'k)) -> ('a & 'l) -> ((forall 'd. anything -> 'd -> 'd) -> ((forall 'm 'n 'o 'p 'q 'r. ((forall 'd. anything -> 'd -> 'd) -> ('m -> 'r -> 'p & 'q)) -> ('q -> (forall 's. ('p -> 's & 'm) -> 'r -> 's) -> 'n) -> ('o -> 'o | 'n) | 't | 'k) -> (forall 'u 'v. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'u & 'v) -> (anything -> 'v | 'u) | 'w | 'g | 'h | 'i | 'j) -> 'f & 'x) & 'h) -> ('i | 'j) //│ where -//│ 'b :> forall 'w 'x. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'w & 'x & 'w) -> (anything -> 'x | 'w) | 's | 't | 'c | 'u -//│ <: (forall 'g. anything -> 'g -> 'g) -> nothing -> nothing -> anything -//│ 's :> forall 'y 'z. ((forall 'a1 'b1. anything -> 'a1 -> ('b1 -> 'b1 | 'a1) | 'v) -> (forall 'c1. ('b -> 'c1 & 'o) -> ('b & 'r) -> 'c1) -> 'y) -> ('z -> 'z | 'y) | 'c -//│ <: (forall 'g. anything -> 'g -> 'g) -> (nothing -> nothing -> anything & 'd1) -//│ 'c <: (forall 'g. anything -> 'g -> 'g) -> ((forall 'h 'i 'j 'k 'l 'm. ((forall 'g. anything -> 'g -> 'g) -> ('j -> 'h -> 'm & 'k)) -> ('k -> (forall 'n. ('m -> 'n & 'j) -> 'h -> 'n) -> 'l) -> ('i -> 'i | 'l) | 'o | 'd) -> (forall 'e1 'f1. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'e1 & 'f1) -> (anything -> 'f1 | 'e1) | 'r | 's | 't | 'c | 'u) -> 'b & 'v & 'd1) -//│ 'd1 <: (forall 'g1. anything -> anything -> 'g1 -> 'g1) -> (forall 'h1. 'h1 -> anything -> 'h1) -> (forall 'i1 'j1. ('i1 -> 'j1) -> 'i1 -> 'j1) -> ('a -> ('b & 'r & 'k1) -> 'c) -> 'f -> ('s -> ((forall 'g. anything -> 'g -> 'g) -> ((forall 'h 'i 'j 'k 'l 'm. ((forall 'g. anything -> 'g -> 'g) -> ('j -> 'h -> 'm & 'k)) -> ('k -> (forall 'n. ('m -> 'n & 'j) -> 'h -> 'n) -> 'l) -> ('i -> 'i | 'l) | 'o | 'd) -> (forall 'l1 'm1. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'm1 & 'l1) -> (anything -> 'l1 | 'm1) | 'r | 's | 't | 'c | 'u) -> 'b & 'v) & 'u) & (forall 'n1 'o1. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'n1 & 'o1) -> (anything -> 'o1 | 'n1) | 't | 'c | 'u) -> 's) & (forall 'h 'j 'k 'l 'm. ((forall 'g. anything -> 'g -> 'g) -> ('j -> 'h -> 'm & 'k)) -> ('k -> (forall 'n. ('m -> 'n & 'j) -> 'h -> 'n) -> 'l) -> 'l) -> (forall 'p1. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'p1) -> 'p1) -> (forall 'h1. 'h1 -> anything -> 'h1) -> anything & 'd -> 'e -//│ 'e <: (forall 'q1 'r1. ((forall 'g. anything -> 'g -> 'g) -> (forall 'g. anything -> 'g -> 'g) -> 'q1 & 'r1) -> (anything -> 'r1 | 'q1) | 'k1 | 's | 't | 'c | 'u) -> 'c +//│ 'f :> forall 'y 'z. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'y & 'z & 'y) -> (anything -> 'z | 'y) | 'g | 'h | 'i | 'j +//│ <: (forall 'd. anything -> 'd -> 'd) -> nothing -> nothing -> anything +//│ 'g :> forall 'a1 'b1. ((forall 'c1 'd1. anything -> 'c1 -> ('d1 -> 'd1 | 'c1) | 'x) -> (forall 'e1. ('f -> 'e1 & 't) -> ('f & 'w) -> 'e1) -> 'a1) -> ('b1 -> 'b1 | 'a1) | 'i +//│ <: (forall 'd. anything -> 'd -> 'd) -> (nothing -> nothing -> anything & 'f1) +//│ 'i <: (forall 'd. anything -> 'd -> 'd) -> ((forall 'm 'n 'o 'p 'q 'r. ((forall 'd. anything -> 'd -> 'd) -> ('m -> 'r -> 'p & 'q)) -> ('q -> (forall 's. ('p -> 's & 'm) -> 'r -> 's) -> 'n) -> ('o -> 'o | 'n) | 't | 'k) -> (forall 'g1 'h1. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'g1 & 'h1) -> (anything -> 'h1 | 'g1) | 'w | 'g | 'h | 'i | 'j) -> 'f & 'x & 'f1) +//│ 'f1 <: (forall 'i1. anything -> anything -> 'i1 -> 'i1) -> (forall 'j1. 'j1 -> anything -> 'j1) -> (forall 'k1 'l1. ('k1 -> 'l1) -> 'k1 -> 'l1) -> ('a -> ('f & 'w & 'e) -> 'i) -> 'l -> ('g -> ((forall 'd. anything -> 'd -> 'd) -> ((forall 'm 'n 'o 'p 'q 'r. ((forall 'd. anything -> 'd -> 'd) -> ('m -> 'r -> 'p & 'q)) -> ('q -> (forall 's. ('p -> 's & 'm) -> 'r -> 's) -> 'n) -> ('o -> 'o | 'n) | 't | 'k) -> (forall 'm1 'n1. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'm1 & 'n1) -> (anything -> 'n1 | 'm1) | 'w | 'g | 'h | 'i | 'j) -> 'f & 'x) & 'j) & (forall 'o1 'p1. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'o1 & 'p1) -> (anything -> 'p1 | 'o1) | 'h | 'i | 'j) -> 'g) & (forall 'm 'n 'p 'q 'r. ((forall 'd. anything -> 'd -> 'd) -> ('m -> 'r -> 'p & 'q)) -> ('q -> (forall 's. ('p -> 's & 'm) -> 'r -> 's) -> 'n) -> 'n) -> (forall 'q1. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'q1) -> 'q1) -> (forall 'j1. 'j1 -> anything -> 'j1) -> anything & 'k -> (forall 'r1 's1. ((forall 'd. anything -> 'd -> 'd) -> (forall 'd. anything -> 'd -> 'd) -> 'r1 & 's1) -> (anything -> 's1 | 'r1) | 'e | 'g | 'h | 'i | 'j) -> 'i //│ = [Function: t_2] :ResetFuel @@ -312,11 +311,14 @@ t id succ 0 :stats :e // * Strange recursive error. The bounds graph is quite large and hard to analyze for debugging... t_ id succ 0 -//│ ╔══[ERROR] Inferred recursive type: nothing +//│ ╔══[ERROR] Inferred recursive type: 'a +//│ where +//│ 'a :> int -> int +//│ <: (forall 'b 'c 'd 'e 'f 'g 'h. ((forall 'i. ? -> 'i -> 'i) -> (forall 'i. ? -> 'i -> 'i) -> 'c & 'h) -> (? -> 'h | 'c) | ? | ((forall 'i. ? -> 'i -> 'i) -> (forall 'i. ? -> 'i -> 'i) -> 'e & 'f & 'b) -> (? -> 'b | 'e | 'f) | nothing -> ('d -> 'd | ?) | 'j | nothing -> ('g -> 'g | ?)) -> nothing //│ ║ l.285: def t_ y = (fun h -> h (h (h (fun x -> y)))) (fun f -> fun n -> n (fun v -> k2) k app (fun g -> fun x -> n (f (n (fun p -> fun s -> s (p k2) (fun f -> fun x -> f (p k2 f x))) (fun s -> s k2 k2) k) g) x)) three -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.314: t_ id succ 0 +//│ ║ l.313: t_ id succ 0 //│ ║ ^^^^^^^^^^ //│ ╟── function of type `?a -> ?b` is not an instance of type `int` //│ ║ l.285: def t_ y = (fun h -> h (h (h (fun x -> y)))) (fun f -> fun n -> n (fun v -> k2) k app (fun g -> fun x -> n (f (n (fun p -> fun s -> s (p k2) (fun f -> fun x -> f (p k2 f x))) (fun s -> s k2 k2) k) g) x)) three @@ -325,7 +327,7 @@ t_ id succ 0 //│ = 6 //│ constrain calls : 352 //│ annoying calls : 0 -//│ subtyping calls : 2632 +//│ subtyping calls : 3162 // let t (z : 0) = let x = (fun (y: ['t > 0] 'a -> 't) -> y z y) in x x;; @@ -357,7 +359,7 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x :e (fun x -> x x) (fun x -> x x) //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.358: (fun x -> x x) (fun x -> x x) +//│ ║ l.360: (fun x -> x x) (fun x -> x x) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error @@ -370,22 +372,21 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x :e (fun f -> fun x -> f (f x)) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ ╔══[ERROR] Inferred recursive type: 'a +//│ ╔══[ERROR] Inferred recursive type: ? -> ? -> ? +//│ ║ l.374: (fun f -> fun x -> f (f x)) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) +//│ ╙── ^^^ +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> anything -> anything -> 'a -//│ ╙── -//│ res: 'a -> 'b -//│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] :RecursiveTypes (fun f -> fun x -> f (f x)) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] :NoRecursiveTypes @@ -395,22 +396,21 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x :e (fun two -> fun k -> two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ ╔══[ERROR] Inferred recursive type: 'a +//│ ╔══[ERROR] Inferred recursive type: ? -> ? -> ? +//│ ║ l.398: (fun two -> fun k -> two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) +//│ ╙── ^^^ +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> anything -> anything -> 'a -//│ ╙── -//│ res: 'a -> 'b -//│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] :RecursiveTypes (fun two -> fun k -> two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b -//│ 'b :> anything -> anything -> 'a +//│ 'a :> anything -> 'b +//│ 'b :> anything -> 'a //│ = [Function (anonymous)] :NoRecursiveTypes @@ -418,26 +418,28 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x // * Rank 5, causes huge blowup. Do not attempt to output skeletons ! // (fun two k -> two two two k)(fun f -x -> f (f x)) (fun v w -> v) +// :d :e (fun two -> fun k -> two two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ ╔══[ERROR] Inferred recursive type: 'a +//│ ╔══[ERROR] Inferred recursive type: ? -> 'a //│ where -//│ 'a :> anything -> 'a -//│ ╙── -//│ res: 'a -> 'b +//│ 'a :> ? -> (? | 'a) +//│ ║ l.423: (fun two -> fun k -> two two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) +//│ ╙── ^^^ +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b | 'c -//│ 'b :> anything -> 'c -//│ 'c :> anything -> 'a | 'b +//│ 'a :> forall 'c. anything -> 'b | 'c +//│ 'b :> forall 'c. 'c +//│ 'c :> anything -> ('a | 'b) //│ = [Function (anonymous)] :RecursiveTypes (fun two -> fun k -> two two two k) (fun f -> fun x -> f (f x)) (fun v -> fun w -> v) -//│ res: 'a -> 'b +//│ res: 'a -> anything -> 'b //│ where -//│ 'a :> 'b | 'c -//│ 'b :> anything -> 'c -//│ 'c :> anything -> 'a | 'b +//│ 'a :> forall 'c. 'c +//│ 'c :> anything -> ('a | 'b) +//│ 'b :> forall 'c. 'c //│ = [Function (anonymous)] :NoRecursiveTypes @@ -448,43 +450,43 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x //│ where //│ forall 'c. 'c //│ where -//│ forall 'd 'e 'f. 'd -> ('e -> 'f +//│ forall 'd 'e 'f. 'e -> ('f -> 'd //│ where -//│ 'd <: (forall 'g. 'g +//│ 'e <: (forall 'g. 'g //│ where -//│ 'd <: 'e -> 'g) -> 'f) <: (forall 'h. 'h +//│ 'e <: 'f -> 'g) -> 'd) <: (forall 'h. 'h //│ where //│ forall 'i. 'i //│ where -//│ forall 'd 'j 'k. 'd -> ('j -> 'k +//│ forall 'j 'k 'e. 'e -> ('j -> 'k //│ where -//│ 'd <: (forall 'l. 'l +//│ 'e <: (forall 'l. 'l //│ where -//│ 'd <: 'j -> 'l) -> 'k) <: (forall 'd 'm 'n. 'd -> ('m -> 'n +//│ 'e <: 'j -> 'l) -> 'k) <: (forall 'm 'n 'e. 'e -> ('m -> 'n //│ where -//│ 'd <: (forall 'o. 'o +//│ 'e <: (forall 'o. 'o //│ where -//│ 'd <: 'm -> 'o) -> 'n)) -> 'i <: (forall 'p. 'p -> anything -> 'p) -> 'h) -> 'c <: (forall 'q. 'q +//│ 'e <: 'm -> 'o) -> 'n)) -> 'i <: (forall 'p. 'p -> anything -> 'p) -> 'h) -> 'c <: (forall 'q. 'q //│ where //│ forall 'c. 'c //│ where -//│ forall 'd 'e 'f. 'd -> ('e -> 'f +//│ forall 'd 'e 'f. 'e -> ('f -> 'd //│ where -//│ 'd <: (forall 'g. 'g +//│ 'e <: (forall 'g. 'g //│ where -//│ 'd <: 'e -> 'g) -> 'f) <: (forall 'h. 'h +//│ 'e <: 'f -> 'g) -> 'd) <: (forall 'h. 'h //│ where //│ forall 'i. 'i //│ where -//│ forall 'd 'j 'k. 'd -> ('j -> 'k +//│ forall 'j 'k 'e. 'e -> ('j -> 'k //│ where -//│ 'd <: (forall 'l. 'l +//│ 'e <: (forall 'l. 'l //│ where -//│ 'd <: 'j -> 'l) -> 'k) <: (forall 'd 'm 'n. 'd -> ('m -> 'n +//│ 'e <: 'j -> 'l) -> 'k) <: (forall 'm 'n 'e. 'e -> ('m -> 'n //│ where -//│ 'd <: (forall 'o. 'o +//│ 'e <: (forall 'o. 'o //│ where -//│ 'd <: 'm -> 'o) -> 'n)) -> 'i <: (forall 'p. 'p -> anything -> 'p) -> 'h) -> 'c <: 'a -> 'q) -> 'b +//│ 'e <: 'm -> 'o) -> 'n)) -> 'i <: (forall 'p. 'p -> anything -> 'p) -> 'h) -> 'c <: 'a -> 'q) -> 'b //│ = [Function (anonymous)] :NoConstrainedTypes @@ -500,15 +502,15 @@ def t (z: nothing) = let x = fun (y: forall 't. 'a -> 't) -> y z in x x (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a <: (('b & 'c & 'd) -> ('e | 'd) | 'f) -> 'c -> 'd & (forall 'g 'h 'i 'j 'k. ((forall 'l. ? -> 'l -> 'l) -> 'k & (forall 'm. ? -> 'm -> 'm) -> 'h -> 'i -> 'j) -> ('k -> (forall 'n. ('j -> 'n & 'h) -> 'i -> 'n) -> 'g) -> 'g) -> (forall 'o. ((forall 'p. ? -> 'p -> 'p) -> (forall 'q. ? -> 'q -> 'q) -> 'o) -> 'o) -> (forall 'r. 'r -> ? -> 'r) -> 'a & (forall 's. ? -> ? -> 's -> 's) -> (forall 'r. 'r -> ? -> 'r) -> (forall 't 'u. ('t -> 'u) -> 't -> 'u) -> (('b -> 'e & 'f & 'v) -> ('c & 'd) -> 'd) -> 'v -> 'f -//│ ║ l.500: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) +//│ 'a <: (('b & 'c & 'd) -> ('e | 'd) | 'f) -> 'c -> 'd & (forall 'g 'h 'i 'j 'k. ((forall 'l. ? -> 'l -> 'l) -> 'h & (forall 'm. ? -> 'm -> 'm) -> 'k -> 'g -> 'i) -> ('h -> (forall 'n. ('i -> 'n & 'k) -> 'g -> 'n) -> 'j) -> 'j) -> (forall 'o. ((forall 'p. ? -> 'p -> 'p) -> (forall 'q. ? -> 'q -> 'q) -> 'o) -> 'o) -> (forall 'r. 'r -> ? -> 'r) -> 'a & (forall 's. ? -> ? -> 's -> 's) -> (forall 'r. 'r -> ? -> 'r) -> (forall 't 'u. ('t -> 'u) -> 't -> 'u) -> (('b -> 'e & 'f & 'v) -> ('c & 'd) -> 'd) -> 'v -> 'f +//│ ║ l.502: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.500: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) +//│ ║ l.502: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.500: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) +//│ ║ l.502: (fun h -> (fun x -> h (x x)) (fun x -> h (x x))) (fun f -> fun n -> n (fun v -> fun x -> fun y -> y) k (fun f -> fun x -> f x)(fun g -> fun x -> n (f (n (fun p -> fun s -> s (p (fun x -> fun y -> y)) (fun f -> fun x -> f (p (fun x -> fun y -> y) f x))) (fun s -> s (fun f -> fun x -> x) (fun f -> fun x -> x)) k) g) x)) (fun f -> fun x -> f (f x)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ res: error diff --git a/shared/src/test/diff/mlf-examples/ex_selfapp.mls b/shared/src/test/diff/mlf-examples/ex_selfapp.mls index e3655e366..16d071a20 100644 --- a/shared/src/test/diff/mlf-examples/ex_selfapp.mls +++ b/shared/src/test/diff/mlf-examples/ex_selfapp.mls @@ -73,9 +73,9 @@ rec def foo xs = elim xs ( rec def foo = fun xs -> case xs of Nil -> Nil, Cons -> Cons (xs.head + 1, foo (foo xs.tail)) -//│ foo: 'a -> 'tail +//│ foo: 'a -> (Nil | 'b) //│ where -//│ 'tail :> (Cons[int] with {tail: 'tail}) | Nil +//│ 'b :> Cons[int] with {tail: Nil | 'b} //│ 'a <: (Cons[?] with {head: int, tail: 'a}) | Nil //│ = [Function: foo2] // * An simplified version, easier to type check, just for the record @@ -83,9 +83,9 @@ rec def foo = fun xs -> case xs of { Nil -> Nil | Cons -> Cons (xs.head + 1, foo xs.tail) } -//│ foo: 'a -> 'tail +//│ foo: 'a -> (Nil | 'b) //│ where -//│ 'tail :> (Cons[int] with {tail: 'tail}) | Nil +//│ 'b :> Cons[int] with {tail: Nil | 'b} //│ 'a <: (Cons[?] with {head: int, tail: 'a}) | Nil //│ = [Function: foo3] :NoRecursiveTypes @@ -133,6 +133,11 @@ def build_ = fun g -> g (fun x -> fun xs -> Cons (x, xs)) Nil :e // * Expected: List is a structural equirecursive types and recursive types are disabled build_ : forall 'a. (forall 'b. (('a -> 'b -> 'b) -> 'b -> 'b)) -> List['a] +//│ ╔══[ERROR] Inferred recursive type: 'a +//│ where +//│ 'a :> Cons[?] with {tail: forall 'a. Nil | 'a} +//│ ║ l.130: def build_ = fun g -> g (fun x -> fun xs -> Cons (x, xs)) Nil +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing type ascription; a type annotation may be required //│ ║ l.135: build_ : forall 'a. (forall 'b. (('a -> 'b -> 'b) -> 'b -> 'b)) -> List['a] //│ ║ ^^^^^^ @@ -144,21 +149,22 @@ build_ : forall 'a. (forall 'b. (('a -> 'b -> 'b) -> 'b -> 'b)) -> List['a] def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> Cons (x, xs)) Nil //│ ╔══[ERROR] Inferred recursive type: 'a //│ where -//│ 'a :> Cons[?]\tail & {tail: Nil | 'a} -//│ ╙── +//│ 'a :> Cons[?] with {tail: forall 'a. Nil | 'a} +//│ ║ l.149: def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> Cons (x, xs)) Nil +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.144: def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> Cons (x, xs)) Nil +//│ ║ l.149: def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> Cons (x, xs)) Nil //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ build: (forall 'b. ('head -> 'b -> 'b) -> 'b -> 'b) -> (Nil | error | 'a) //│ where -//│ 'a :> Cons['head] with {tail: Nil | 'a} +//│ 'a :> Cons['head] with {tail: forall 'a. Nil | 'a} //│ = [Function: build] :RecursiveTypes def build = fun (g: forall 'b. ('a -> 'b -> 'b) -> 'b -> 'b) -> g (fun x -> fun xs -> Cons (x, xs)) Nil //│ build: (forall 'b. ('head -> 'b -> 'b) -> 'b -> 'b) -> (Nil | 'a) //│ where -//│ 'a :> Cons['head] with {tail: Nil | 'a} +//│ 'a :> Cons['head] with {tail: forall 'a. Nil | 'a} //│ = [Function: build1] :NoRecursiveTypes @@ -207,7 +213,7 @@ rec def foldr = fun k -> fun z -> fun xs -> //│ ╔══[ERROR] Inferred recursive type: 'a //│ where //│ 'a <: {head: ?, tail: Cons[?] & 'a} -//│ ║ l.204: case xs of +//│ ║ l.210: case xs of //│ ╙── ^^ //│ foldr: ('head -> 'a -> 'a) -> 'a -> 'b -> 'a //│ where @@ -265,7 +271,7 @@ rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ <: k: //│ int -> Ba -> Ba //│ ╔══[ERROR] Type error in binding of lambda expression -//│ ║ l.263: rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) +//│ ║ l.269: rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'b` leaks out of its scope //│ ║ l.100: type Ba = forall 'b. (int -> 'b -> 'b) -> 'b -> 'b @@ -277,7 +283,7 @@ rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ l.101: type Baa = forall 'a 'b. ('a -> 'b -> 'b) -> 'b -> 'b //│ ╙── ^^ //│ ╔══[ERROR] Type error in def definition -//│ ║ l.263: rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) +//│ ║ l.269: rec def k = fun x -> fun (xs: Ba) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `'b` leaks out of its scope //│ ║ l.100: type Ba = forall 'b. (int -> 'b -> 'b) -> 'b -> 'b @@ -302,10 +308,10 @@ k = k_ //│ <: k: //│ int -> Ba -> Ba //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.298: k = k_ +//│ ║ l.304: k = k_ //│ ║ ^^^^^^ //│ ╟── function of type `?a -> (forall ?b. ?b -> ?b)` does not match type `'b` -//│ ║ l.223: def z_ = fun c -> fun n -> n +//│ ║ l.229: def z_ = fun c -> fun n -> n //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from type variable: //│ ║ l.100: type Ba = forall 'b. (int -> 'b -> 'b) -> 'b -> 'b @@ -340,10 +346,10 @@ def bfoo xs = build (foldr k z xs) :e def bfoo_ xs = build_ (foldr k_ z_ xs) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.341: def bfoo_ xs = build_ (foldr k_ z_ xs) +//│ ║ l.347: def bfoo_ xs = build_ (foldr k_ z_ xs) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── function of type `?b -> (forall ?c. ?c -> ?c)` does not match type `Cons[?a] | Nil` -//│ ║ l.223: def z_ = fun c -> fun n -> n +//│ ║ l.229: def z_ = fun c -> fun n -> n //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.33: type List[a] = Nil | Cons[a] @@ -357,9 +363,9 @@ def bfoo_ xs = build_ (foldr k_ z_ xs) //│ = [Function: bfoo_] // * Alt (requires :RecursiveTypes): def bfoo_ xs = build_ (foldr k z_ xs) -//│ bfoo_: 'a -> 'tail +//│ bfoo_: 'a -> (Nil | 'b) //│ where -//│ 'tail :> (Cons[int] with {tail: 'tail}) | Nil +//│ 'b :> Cons[int] with {tail: forall 'b. Nil | 'b} //│ 'a <: (Cons[?] with {head: int, tail: 'a}) | Nil //│ = [Function: bfoo_1] @@ -401,9 +407,9 @@ bfoo lst0 //│ } bfoo_ lst0 -//│ res: 'tail +//│ res: Nil | 'a //│ where -//│ 'tail :> (Cons[int] with {tail: 'tail}) | Nil +//│ 'a :> Cons[int] with {tail: forall 'a. Nil | 'a} //│ = Cons { //│ head: 1, //│ tail: Cons { head: 2, tail: Cons { head: 4, tail: [Cons] } } @@ -430,10 +436,10 @@ def k = fun x -> fun (xs: Baa) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ <: k: //│ int -> Baa -> Baa //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.428: def k = fun x -> fun (xs: Baa) -> fun c -> fun n -> c (x + 1) (xs k z c n) +//│ ║ l.434: def k = fun x -> fun (xs: Baa) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `int` does not match type `'a` -//│ ║ l.428: def k = fun x -> fun (xs: Baa) -> fun c -> fun n -> c (x + 1) (xs k z c n) +//│ ║ l.434: def k = fun x -> fun (xs: Baa) -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ ^^^^^ //│ ╟── Note: constraint arises from type variable: //│ ║ l.101: type Baa = forall 'a 'b. ('a -> 'b -> 'b) -> 'b -> 'b @@ -454,10 +460,10 @@ k = k_ // nope //│ <: k: //│ int -> Baa -> Baa //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.452: k = k_ // nope +//│ ║ l.458: k = k_ // nope //│ ║ ^^^^^^ //│ ╟── operator application of type `int` does not match type `'a` -//│ ║ l.446: def k_ = fun x -> fun xs -> fun c -> fun n -> c (x + 1) (xs k z c n) +//│ ║ l.452: def k_ = fun x -> fun xs -> fun c -> fun n -> c (x + 1) (xs k z c n) //│ ║ ^^^^^ //│ ╟── Note: constraint arises from type variable: //│ ║ l.101: type Baa = forall 'a 'b. ('a -> 'b -> 'b) -> 'b -> 'b @@ -484,16 +490,15 @@ k = k_ // nope //│ 'a <: 'c -> 'd //│ 'c :> 'e -> 'f -> 'd //│ <: 'g -//│ 'e :> 'k_ +//│ 'e :> int -> 'g -> 'e -> 'f -> 'd //│ <: int -> 'a & ? -> 'b -> 'b //│ 'b :> 'e -> 'f -> 'd //│ <: 'g -//│ 'k_ :> int -> 'g -> 'e -> 'f -> 'd +//│ 'g <: (int -> 'g -> 'e -> 'f -> 'd) -> Baa -> 'h //│ 'd :> 'e -> 'f -> 'd //│ <: 'c & 'h -//│ 'g <: 'k_ -> Baa -> 'h //│ 'h <: 'e -> (Baa | 'f) -> 'c -//│ ║ l.470: rec def k_ = fun x -> fun xs -> fun c -> fun n -> c (x + 1) (xs k_ z c n) +//│ ║ l.476: rec def k_ = fun x -> fun xs -> fun c -> fun n -> c (x + 1) (xs k_ z c n) //│ ╙── ^^^^^^^^^ //│ 'k_ //│ where @@ -501,7 +506,7 @@ k = k_ // nope //│ <: k: //│ int -> Baa -> Baa //│ ╔══[ERROR] Cyclic-looking constraint while typing def definition; a type annotation may be required -//│ ║ l.481: k = k_ // nope +//│ ║ l.487: k = k_ // nope //│ ║ ^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ = [Function: k_1] diff --git a/shared/src/test/diff/mlf-examples/ex_validate.mls b/shared/src/test/diff/mlf-examples/ex_validate.mls index 51ab627ab..85d6c4459 100644 --- a/shared/src/test/diff/mlf-examples/ex_validate.mls +++ b/shared/src/test/diff/mlf-examples/ex_validate.mls @@ -938,13 +938,11 @@ rec def id_ x = if true then x else id_ id_ x //│ ║ l.927: rec def id_ x = if true then x else id_ id_ x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ id_: 'id_ +//│ id_: 'a -> 'b //│ where -//│ 'id_ :> 'a -> 'b -//│ 'a :> 'id_ +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id_ -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = [Function: id_] // let rec (id:sid) x = if true then x else id id x @@ -963,32 +961,30 @@ rec def id x = if true then x else id id x //│ <: 'c //│ 'c :> 'b -> 'c //│ <: 'a -//│ ║ l.958: rec def id x = if true then x else id id x +//│ ║ l.956: rec def id x = if true then x else id id x //│ ╙── ^^^^^ -//│ 'id +//│ 'a -> 'b //│ where -//│ 'id :> 'a -> 'b -//│ 'a :> 'id +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ <: id: //│ Sid //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.958: rec def id x = if true then x else id id x +//│ ║ l.956: rec def id x = if true then x else id id x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.958: rec def id x = if true then x else id id x +//│ ║ l.956: rec def id x = if true then x else id id x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `'a` is not a function //│ ║ l.765: type Sid = forall 'a. 'a -> 'a //│ ║ ^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.958: rec def id x = if true then x else id id x +//│ ║ l.956: rec def id x = if true then x else id id x //│ ║ ^^^^^^^ //│ ╟── from reference: -//│ ║ l.958: rec def id x = if true then x else id id x +//│ ║ l.956: rec def id x = if true then x else id id x //│ ║ ^ //│ ╟── Note: quantified type variable 'a is defined at: //│ ║ l.765: type Sid = forall 'a. 'a -> 'a diff --git a/shared/src/test/diff/mlf-examples/merge_regression_min.mls b/shared/src/test/diff/mlf-examples/merge_regression_min.mls index 52140e4eb..4f17ce611 100644 --- a/shared/src/test/diff/mlf-examples/merge_regression_min.mls +++ b/shared/src/test/diff/mlf-examples/merge_regression_min.mls @@ -6,13 +6,11 @@ def choose: 'a -> 'a -> 'a //│ = rec def id1 x = choose x (id1 id1 x) -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = //│ choose is not implemented @@ -40,13 +38,11 @@ id1 id //│ id1 and choose are not implemented rec def id1 x = choose x (id1 id1 x) -//│ id1: 'id1 +//│ id1: 'a -> 'b //│ where -//│ 'id1 :> 'a -> 'b -//│ 'a :> 'id1 +//│ 'a :> 'a -> 'b //│ <: 'b -//│ 'b :> 'id1 -//│ <: 'a -> 'b +//│ 'b := 'a -> 'b //│ = //│ choose is not implemented diff --git a/shared/src/test/diff/mlscript/Addable.mls b/shared/src/test/diff/mlscript/Addable.mls index e08d70a83..c6deb7162 100644 --- a/shared/src/test/diff/mlscript/Addable.mls +++ b/shared/src/test/diff/mlscript/Addable.mls @@ -101,12 +101,10 @@ addNTimes n 12 rec def addNTimes a n = if n <= 0 then 0 else a.Add addNTimes a (n - 1) -//│ addNTimes: 'addNTimes +//│ addNTimes: 'a -> int -> 'b //│ where -//│ 'addNTimes :> 'a -> int -> 'b //│ 'a <: Addable['A] -//│ 'A :> 'addNTimes -//│ <: 'a -> int -> 'b +//│ 'A := 'a -> int -> 'b //│ 'b :> 0 addNTimes n 12 diff --git a/shared/src/test/diff/mlscript/BadPolym.mls b/shared/src/test/diff/mlscript/BadPolym.mls index 44dbedef4..d8695bb76 100644 --- a/shared/src/test/diff/mlscript/BadPolym.mls +++ b/shared/src/test/diff/mlscript/BadPolym.mls @@ -22,12 +22,12 @@ foo = fooImpl //│ ╔══[ERROR] Type mismatch in def definition: //│ ║ l.18: foo = fooImpl //│ ║ ^^^^^^^^^^^^^ -//│ ╟── integer literal of type `1` is not an instance of type `string` -//│ ║ l.13: fooImpl f = f 1 -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: +//│ ╟── type `int` is not a 0-element tuple //│ ║ l.9: def foo: (int -> int & string -> string) -> () -//│ ╙── ^^^^^^ +//│ ║ ^^^ +//│ ╟── Note: constraint arises from tuple type: +//│ ║ l.9: def foo: (int -> int & string -> string) -> () +//│ ╙── ^^ //│ = [Function: fooImpl] foo id @@ -39,35 +39,25 @@ fooImpl id //│ = 1 -:e fooImpl2 (f: int -> int & string -> string) = f 1 -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.43: fooImpl2 (f: int -> int & string -> string) = f 1 -//│ ║ ^^^ -//│ ╟── integer literal of type `1` is not an instance of type `string` -//│ ║ l.43: fooImpl2 (f: int -> int & string -> string) = f 1 -//│ ║ ^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.43: fooImpl2 (f: int -> int & string -> string) = f 1 -//│ ╙── ^^^^^^ -//│ fooImpl2: (int -> int & string -> string) -> (error | int | string) +//│ fooImpl2: (int -> int & string -> string) -> (int | string) //│ = [Function: fooImpl2] fooImpl2 id -//│ res: error | int | string +//│ res: int | string //│ = 1 :e :re res "oops" //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.62: res "oops" +//│ ║ l.52: res "oops" //│ ║ ^^^^^^^^^^ //│ ╟── type `int` is not a function -//│ ║ l.43: fooImpl2 (f: int -> int & string -> string) = f 1 +//│ ║ l.42: fooImpl2 (f: int -> int & string -> string) = f 1 //│ ║ ^^^ //│ ╟── but it flows into reference with expected type `"oops" -> ?a` -//│ ║ l.62: res "oops" +//│ ║ l.52: res "oops" //│ ╙── ^^^ //│ res: error //│ Runtime error: diff --git a/shared/src/test/diff/mlscript/ByNameByValue.mls b/shared/src/test/diff/mlscript/ByNameByValue.mls index e47b2b32e..3e8764077 100644 --- a/shared/src/test/diff/mlscript/ByNameByValue.mls +++ b/shared/src/test/diff/mlscript/ByNameByValue.mls @@ -142,15 +142,15 @@ rec def xs = Cons 0 (Cons 1 xs) //│ return Cons1(0)(Cons1(1)(xs())); //│ }; //│ // End of generated code -//│ xs: 'tail +//│ xs: 'a //│ where -//│ 'tail :> Cons[0 | 1] with {head: 0, tail: Cons[0 | 1] with {head: 1, tail: 'tail}} +//│ 'a :> Cons[0 | 1] with {head: 0, tail: Cons[0 | 1] with {head: 1, tail: forall 'a. 'a}} //│ = [Function: xs] :re xs -//│ res: 'tail +//│ res: 'a //│ where -//│ 'tail :> Cons[0 | 1] with {head: 0, tail: Cons[0 | 1] with {head: 1, tail: 'tail}} +//│ 'a :> Cons[0 | 1] with {head: 0, tail: Cons[0 | 1] with {head: 1, tail: forall 'a. 'a}} //│ Runtime error: //│ RangeError: Maximum call stack size exceeded diff --git a/shared/src/test/diff/mlscript/David2.mls b/shared/src/test/diff/mlscript/David2.mls index 2112cc5cd..cc4e59915 100644 --- a/shared/src/test/diff/mlscript/David2.mls +++ b/shared/src/test/diff/mlscript/David2.mls @@ -18,9 +18,9 @@ addOne1 x = case x of { rec def loopy() = Integer { value = 1; addOne = fun x -> loopy() } -//│ loopy: () -> 'a +//│ loopy: () -> (Integer with {addOne: 'addOne, value: 1}) //│ where -//│ 'a :> Integer with {addOne: anything -> 'a, value: 1} +//│ 'addOne :> anything -> (Integer with {addOne: 'addOne, value: 1}) //│ = [Function: loopy] addOne1 (loopy()) @@ -38,9 +38,9 @@ res : Integer // * so it could be anything; example: funny = loopy() with { value = "oops!" } -//│ funny: 'a\value & {value: "oops!"} +//│ funny: Integer with {addOne: 'addOne, value: "oops!"} //│ where -//│ 'a :> Integer with {addOne: anything -> 'a, value: 1} +//│ 'addOne :> anything -> (Integer with {addOne: 'addOne, value: 1}) //│ = Integer { value: 'oops!', addOne: [Function: addOne] } addOne1 funny @@ -70,15 +70,15 @@ addOne1 (Integer { value = 1; addOne = id }) // * Now for properly closing the loop with a constructor for Integer: rec def mkInteger value = Integer { value; addOne = fun n -> mkInteger (n.value + 1) } -//│ mkInteger: int -> 'a +//│ mkInteger: int -> (Integer with {addOne: 'addOne}) //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ = [Function: mkInteger] n = mkInteger 42 -//│ n: 'a +//│ n: Integer with {addOne: 'addOne} //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ = Integer { value: 42, addOne: [Function: addOne] } n : Integer @@ -102,9 +102,9 @@ def mkInteger2: int -> Integer def mkInteger2 = mkInteger //│ mkInteger2: int -> Integer //│ = -//│ int -> 'a +//│ int -> (Integer with {addOne: 'addOne}) //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ <: mkInteger2: //│ int -> Integer //│ = [Function: mkInteger2] @@ -119,9 +119,9 @@ def mkInteger_oops: (int & 'a) -> (Integer & { value: 'a }) :e rec def mkInteger_oops value = Integer { value; addOne = fun n -> mkInteger_oops (n.value + 1) } -//│ int -> 'a +//│ int -> (Integer with {addOne: 'addOne}) //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ <: mkInteger_oops: //│ (int & 'a) -> (Integer\addOne with {value: 'a}) //│ ╔══[ERROR] Type mismatch in def definition: @@ -140,7 +140,9 @@ rec def mkInteger_oops value = Integer { value; addOne = fun n -> mkInteger_oops :precise-rec-typing rec def mkInteger_oops value = Integer { value; addOne = fun n -> mkInteger_oops (n.value + 1) } -//│ (int & 'value) -> (Integer with {addOne: {value: int} -> (Integer with {addOne: nothing}), value: 'value}) +//│ (int & 'value) -> (Integer with {addOne: forall 'a. {value: int} -> 'a, value: 'value}) +//│ where +//│ 'a :> Integer with {addOne: forall 'a. {value: int} -> 'a} //│ <: mkInteger_oops: //│ (int & 'a) -> (Integer\addOne with {value: 'a}) //│ = [Function: mkInteger_oops1] @@ -148,13 +150,16 @@ rec def mkInteger_oops value = Integer { value; addOne = fun n -> mkInteger_oops // * We may still want to retain the precise typing of the `value` part: def mkIntegerPrecise value = Integer { value; addOne = addOne1 } -//│ mkIntegerPrecise: (int & 'value) -> (Integer with {addOne: forall 'a 'b. ((Integer\value with {addOne: 'a -> 'b}) & 'a) -> 'b, value: 'value}) +//│ mkIntegerPrecise: (int & 'value) -> (Integer with { +//│ addOne: forall 'a 'b. ((Integer\value with {addOne: 'a -> 'b}) & 'a) -> 'b, +//│ value: 'value +//│ }) //│ = [Function: mkIntegerPrecise] def mkIntegerPrecise value = Integer { value; addOne = fun n -> mkInteger (n.value + 1) } -//│ mkIntegerPrecise: (int & 'value) -> (Integer with {addOne: forall 'a. {value: int} -> 'a, value: 'value}) +//│ mkIntegerPrecise: (int & 'value) -> (Integer with {addOne: forall 'addOne. 'addOne, value: 'value}) //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ = [Function: mkIntegerPrecise1] def mkIntegerPrecise value = Integer { value; addOne = fun (n: Integer) -> mkInteger2 (n.value + 1) } @@ -197,19 +202,19 @@ def mkIntegerPrecise3: (int & 'a) -> (Integer & { value: 'a }) // * Note: works with :precise-rec-typing when typing mkInteger :e def mkIntegerPrecise3 = mkInteger -//│ int -> 'a +//│ int -> (Integer with {addOne: 'addOne}) //│ where -//│ 'a :> Integer with {addOne: {value: int} -> 'a} +//│ 'addOne :> {value: int} -> (Integer with {addOne: 'addOne}) //│ <: mkIntegerPrecise3: //│ (int & 'a) -> (Integer\addOne with {value: 'a}) //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.199: def mkIntegerPrecise3 = mkInteger +//│ ║ l.204: def mkIntegerPrecise3 = mkInteger //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `int` does not match type `'a` //│ ║ l.72: rec def mkInteger value = Integer { value; addOne = fun n -> mkInteger (n.value + 1) } //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.193: def mkIntegerPrecise3: (int & 'a) -> (Integer & { value: 'a }) +//│ ║ l.198: def mkIntegerPrecise3: (int & 'a) -> (Integer & { value: 'a }) //│ ╙── ^^ //│ = [Function: mkIntegerPrecise3] @@ -217,10 +222,10 @@ def mkIntegerPrecise3 = mkInteger :e addOne1 (Stri { value = ""; addOne = error }) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.218: addOne1 (Stri { value = ""; addOne = error }) +//│ ║ l.223: addOne1 (Stri { value = ""; addOne = error }) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Stri & {addOne: ?addOne, value: ?value}` does not match type `Integer & ?a` -//│ ║ l.218: addOne1 (Stri { value = ""; addOne = error }) +//│ ║ l.223: addOne1 (Stri { value = ""; addOne = error }) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.11: addOne1 x = case x of { @@ -252,9 +257,9 @@ def mkStr: string -> Stri rec def mkStr value = Stri { value; addOne = fun s -> mkStr (concat s.value "1") } //│ mkStr: string -> Stri //│ = -//│ string -> 'a +//│ string -> (Stri with {addOne: 'addOne}) //│ where -//│ 'a :> Stri with {addOne: {value: string} -> 'a} +//│ 'addOne :> {value: string} -> (Stri with {addOne: 'addOne}) //│ <: mkStr: //│ string -> Stri //│ = [Function: mkStr] diff --git a/shared/src/test/diff/mlscript/DavidB.mls b/shared/src/test/diff/mlscript/DavidB.mls index 68486a5a2..e6c3e3f8c 100644 --- a/shared/src/test/diff/mlscript/DavidB.mls +++ b/shared/src/test/diff/mlscript/DavidB.mls @@ -151,31 +151,31 @@ rec def foo xs = case xs of let tmp = foo xs.t.t in if xs.h then Con { h = xs.t.h; t = tmp } else tmp, N -> xs -//│ foo: 'a -> 'T +//│ foo: 'a -> 'b //│ where -//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h, t: 'a}} | N & 'T -//│ 'T :> Con['h, 'T] +//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h, t: 'a}} | N & 'b +//│ 'b :> Con['h, 'b] //│ = [Function: foo1] rec def foo xs = case xs of Con -> if xs.h then Con { h = xs.t.h; t = foo xs.t.t } else foo xs.t.t, N -> xs -//│ foo: 'a -> 'T +//│ foo: 'a -> 'b //│ where -//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h, t: 'a}} | N & 'T -//│ 'T :> Con['h, 'T] +//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h, t: 'a}} | N & 'b +//│ 'b :> Con['h, 'b] //│ = [Function: foo2] foo (N{}) -//│ res: 'T +//│ res: 'a //│ where -//│ 'T :> Con[nothing, 'T] | N +//│ 'a :> Con[nothing, 'a] | N //│ = N {} foo (Con{ h = true; t = Con{ h = 0; t = N{} } }) -//│ res: 'T +//│ res: 'a //│ where -//│ 'T :> Con[0, 'T] | N +//│ 'a :> Con[0, 'a] | N //│ = Con { h: 0, t: N {} } def inf: Con[true, Con[0, 'I]] as 'I @@ -185,9 +185,9 @@ def inf: Con[true, Con[0, 'I]] as 'I //│ = foo inf -//│ res: 'T +//│ res: 'a //│ where -//│ 'T :> Con[0, 'T] +//│ 'a :> Con[0, 'a] //│ = //│ inf is not implemented @@ -195,12 +195,12 @@ foo inf rec def foo2 xs = case xs of Con -> if xs.h then Con { h = xs.t.h; t = foo xs.t.t } else foo xs.t.t, N -> N{} -//│ foo2: (Con[?, ?] & {h: bool, t: {h: 'h, t: 'a & 'b}} | N) -> (Con['h, forall 'T. 'T] | N | 'T0) +//│ foo2: (Con[?, ?] & {h: bool, t: {h: 'h, t: 'a & 'b}} | N) -> (Con['h, forall 'c. 'c | 'd] | N | 'e) //│ where -//│ 'T :> Con['h0, 'T] | 'c -//│ 'b <: Con[?, ?] & {h: bool, t: {h: 'h1, t: 'b}} | N & 'T0 -//│ 'T0 :> Con['h1, 'T0] -//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h0, t: 'a}} | N & 'c +//│ 'c :> Con['h0, 'c | 'd] | 'd +//│ 'b <: Con[?, ?] & {h: bool, t: {h: 'h1, t: 'b}} | N & 'e +//│ 'e :> Con['h1, 'e] +//│ 'a <: Con[?, ?] & {h: bool, t: {h: 'h0, t: 'a}} | N & 'd //│ = [Function: foo21] diff --git a/shared/src/test/diff/mlscript/ExprProb.mls b/shared/src/test/diff/mlscript/ExprProb.mls index 760192b61..4425dbc97 100644 --- a/shared/src/test/diff/mlscript/ExprProb.mls +++ b/shared/src/test/diff/mlscript/ExprProb.mls @@ -281,12 +281,13 @@ rec def prettier11 k ev e = case e of { } //│ prettier11: ('a -> string) -> ('rhs -> number) -> 'b -> string //│ where -//│ 'b <: Add[?] & {lhs: 'c, rhs: 'rhs & 'b} | Lit | 'a & ~#Add & ~#Lit -//│ 'c <: Add[?] & {lhs: 'c, rhs: 'c} | Lit | 'a & ~#Add & ~#Lit +//│ 'b <: Add[?] & {lhs: Add[?] & 'c | Lit | 'a & ~#Add & ~#Lit, rhs: 'rhs & 'b} | Lit | 'a & ~#Add & ~#Lit +//│ 'c <: {lhs: 'd, rhs: 'd} +//│ 'd <: Add[?] & 'c | Lit | 'a & ~#Add & ~#Lit //│ = [Function: prettier11] //│ constrain calls : 191 //│ annoying calls : 0 -//│ subtyping calls : 746 +//│ subtyping calls : 799 // Doesn't make much sense, but generates very ugly type unless aggressively simplified: :stats @@ -297,14 +298,15 @@ rec def prettier12 k ev e = case e of { in if ev e == 0 then tmp else concat tmp (pretty1 k e.rhs) | _ -> k e } -//│ prettier12: ('a -> string & 'b -> 'c) -> ('d -> number) -> (Add[?] & {lhs: 'e, rhs: 'f} & 'd | Lit | 'b & ~#Add & ~#Lit) -> (string | 'c) +//│ prettier12: ('a -> string & 'b -> 'c) -> ('d -> number) -> (Add[?] & {lhs: Add[?] & 'e | Lit | 'a & ~#Add & ~#Lit, rhs: 'f} & 'd | Lit | 'b & ~#Add & ~#Lit) -> (string | 'c) //│ where //│ 'f <: Add[?] & {lhs: 'f, rhs: 'f} | Lit | 'a & ~#Add & ~#Lit -//│ 'e <: Add[?] & {lhs: 'e, rhs: 'e} | Lit | 'a & ~#Add & ~#Lit +//│ 'e <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'e | Lit | 'a & ~#Add & ~#Lit //│ = [Function: prettier12] //│ constrain calls : 166 //│ annoying calls : 0 -//│ subtyping calls : 788 +//│ subtyping calls : 841 :stats @@ -314,7 +316,10 @@ pretty1 done e1 prettier1 done (eval1 done) e1 prettier11 done (eval1 done) e1 prettier12 done (eval1 done) e1 -//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}} +//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ } //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Add { lhs: Lit { val: 2 }, rhs: Lit { val: 3 } } @@ -340,7 +345,10 @@ pretty1 done e1 prettier1 done (eval1 done) e1 prettier11 done (eval1 done) e1 prettier12 done (eval1 done) e1 -//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}} +//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ } //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Add { lhs: Lit { val: 2 }, rhs: Lit { val: 3 } } @@ -398,16 +406,19 @@ rec def prettier22 k ev = prettier12 (fun x -> case x of { | Nega -> concat "-" (prettier22 k ev x.arg) | _ -> k x }) ev -//│ prettier22: ('a -> string) -> ('b -> number) -> 'arg -> string -//│ where -//│ 'b <: {lhs: 'c, rhs: 'd} -//│ 'd <: Add[?] & {lhs: 'd, rhs: 'd} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega -//│ 'c <: Add[?] & {lhs: 'c, rhs: 'c} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega -//│ 'arg <: Add[?] & 'b | Lit | (Nega[?] & {arg: 'arg} | 'a & ~#Nega) & ~#Add & ~#Lit +//│ prettier22: ('a -> string) -> ('b -> number) -> (Add[?] & 'b | Lit | 'c & ~#Add & ~#Lit) -> string +//│ where +//│ 'b <: {lhs: Add[?] & 'd | Lit | 'e & ~#Add & ~#Lit, rhs: 'f} +//│ 'f <: Add[?] & {lhs: 'f, rhs: 'f} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega +//│ 'd <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'd | Lit | 'e & ~#Add & ~#Lit +//│ 'e <: Nega[?] & {arg: 'arg} | 'a & ~#Nega +//│ 'arg <: Add[?] & 'b | Lit | 'c & ~#Add & ~#Lit +//│ 'c <: Nega[?] & {arg: 'arg} | 'a & ~#Nega //│ = [Function: prettier22] //│ constrain calls : 208 //│ annoying calls : 0 -//│ subtyping calls : 1025 +//│ subtyping calls : 1063 @@ -420,7 +431,16 @@ eval2 done e1 //│ subtyping calls : 1263 e2 = add (lit 1) (nega e1) -//│ e2: Add[Lit & {val: 1} | Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}]] with {lhs: Lit & {val: 1}, rhs: Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}]} +//│ e2: Add[Lit & {val: 1} | Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ }]] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ }] +//│ } //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Nega { arg: Add { lhs: [Lit], rhs: [Add] } } @@ -456,13 +476,15 @@ prettier2 done //│ = [Function (anonymous)] prettier22 done -//│ res: ('a -> number) -> 'arg -> string +//│ res: ('a -> number) -> (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string //│ where -//│ 'a <: {lhs: 'b, rhs: 'c} -//│ 'c <: Add[?] & {lhs: 'c, rhs: 'c} | Lit | 'd -//│ 'b <: Add[?] & {lhs: 'b, rhs: 'b} | Lit | 'd +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'd & ~#Add & ~#Lit, rhs: 'e} +//│ 'e <: Add[?] & {lhs: 'e, rhs: 'e} | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'f, rhs: 'f} +//│ 'f <: Add[?] & 'c | Lit | 'd & ~#Add & ~#Lit //│ 'd <: Nega[?] & {arg: 'arg} -//│ 'arg <: Add[?] & 'a | Lit | 'd & ~#Add & ~#Lit +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} //│ = [Function (anonymous)] :stats @@ -481,12 +503,15 @@ prettier2 done (eval1 done) prettier22 done (eval1 done) -//│ res: 'arg -> string -//│ where -//│ 'arg <: Add[?] & {lhs: 'a, rhs: 'a} & 'b | Lit | 'c & ~#Add & ~#Lit -//│ 'b <: Add[?] & {lhs: 'b, rhs: 'b} | Lit -//│ 'a <: Add[?] & {lhs: 'a, rhs: 'a} | Lit | 'c -//│ 'c <: Nega[?] & {arg: 'arg} +//│ res: (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string +//│ where +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit, rhs: 'd} & 'e +//│ 'e <: Add[?] & {lhs: 'e, rhs: 'e} | Lit +//│ 'd <: Add[?] & {lhs: 'd, rhs: 'd} | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'f, rhs: 'f} +//│ 'f <: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit //│ = [Function (anonymous)] // * TODO could probably merge `c` and `b` here! @@ -517,13 +542,16 @@ prettier2 done (eval2 done) d2 prettier22 done (eval2 done) prettier22 done (eval2 done) e2 prettier22 done (eval2 done) d2 -//│ res: 'arg -> string -//│ where -//│ 'arg <: Add[?] & {lhs: 'a, rhs: 'a} & 'b | Lit | 'c & ~#Add & ~#Lit -//│ 'b <: Add[?] & {lhs: 'b, rhs: 'b} | Lit | 'd & ~#Add & ~#Lit -//│ 'd <: Nega[?] & {arg: 'b} -//│ 'a <: Add[?] & {lhs: 'a, rhs: 'a} | Lit | 'c -//│ 'c <: Nega[?] & {arg: 'arg} +//│ res: (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string +//│ where +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit, rhs: 'd} & 'e +//│ 'e <: Add[?] & {lhs: 'e, rhs: 'e} | Lit | 'f & ~#Add & ~#Lit +//│ 'f <: Nega[?] & {arg: 'e} +//│ 'd <: Add[?] & {lhs: 'd, rhs: 'd} | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit //│ = [Function (anonymous)] //│ res: string //│ = '1-123' @@ -531,7 +559,7 @@ prettier22 done (eval2 done) d2 //│ = '-1' //│ constrain calls : 1178 //│ annoying calls : 390 -//│ subtyping calls : 10194 +//│ subtyping calls : 10299 @@ -548,7 +576,7 @@ eval1 done e2 //│ ║ l.+1: eval1 done e2 //│ ║ ^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` does not match type `nothing` -//│ ║ l.362: def nega arg = Nega { arg } +//│ ║ l.370: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.4: def done x = case x of {} @@ -603,7 +631,7 @@ prettier2 done (eval1 done) e2 //│ ║ l.+1: prettier2 done (eval1 done) e2 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` does not match type `nothing` -//│ ║ l.362: def nega arg = Nega { arg } +//│ ║ l.370: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.4: def done x = case x of {} @@ -675,7 +703,7 @@ prettier2 done eval2 e1 //│ ║ l.18: def lit val = Lit { val } //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.371: | _ -> k x +//│ ║ l.379: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.262: else if ev e.rhs == 0 then prettier1 k ev e.lhs @@ -713,7 +741,7 @@ prettier2 done eval2 e2 //│ ║ l.18: def lit val = Lit { val } //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.371: | _ -> k x +//│ ║ l.379: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.262: else if ev e.rhs == 0 then prettier1 k ev e.lhs @@ -748,10 +776,10 @@ prettier2 done eval2 d2 //│ ║ l.+1: prettier2 done eval2 d2 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` is not a function -//│ ║ l.362: def nega arg = Nega { arg } +//│ ║ l.370: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.371: | _ -> k x +//│ ║ l.379: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.262: else if ev e.rhs == 0 then prettier1 k ev e.lhs diff --git a/shared/src/test/diff/mlscript/ExprProb2.mls b/shared/src/test/diff/mlscript/ExprProb2.mls index a797d6d2f..f607f6a63 100644 --- a/shared/src/test/diff/mlscript/ExprProb2.mls +++ b/shared/src/test/diff/mlscript/ExprProb2.mls @@ -49,7 +49,10 @@ def eval1f eval1 e = case e of { e1 = add (lit 1) (add (lit 2) (lit 3)) -//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}} +//│ e1: Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ } //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Add { lhs: Lit { val: 2 }, rhs: Lit { val: 3 } } @@ -72,10 +75,12 @@ eval1_fixed_1 e1 rec def eval1_fixed_2 = eval1f (fun x -> eval1f eval1_fixed_2 x) -//│ eval1_fixed_2: (Add[?] & 'a | (Lit with {val: 'val})) -> (int | 'val) +//│ eval1_fixed_2: (Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit\val & {val: 'val}) -> (int | 'val) //│ where -//│ 'a <: {lhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit, rhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit} -//│ 'rhs <: Add[?] & 'a | Lit +//│ 'lhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'lhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'rhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit //│ = [Function: eval1_fixed_2] eval1_fixed_2 e1 @@ -87,9 +92,21 @@ eval1_fixed_2 e1 def eval1_fixed_3 = let fixed fixed = eval1f (fun x -> eval1f (fixed fixed) x) in fixed fixed! -//│ eval1_fixed_3: (Add[?] & {lhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit, rhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit} | (Lit with {val: 'val})) -> (int | 'val) -//│ where -//│ 'rhs <: Add[?] & {lhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit, rhs: Add[?] & {lhs: 'rhs, rhs: 'rhs} | Lit} | Lit +//│ eval1_fixed_3: (Add[?] & { +//│ lhs: Add[?] & { +//│ lhs: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit, +//│ rhs: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ } | Lit, +//│ rhs: Add[?] & { +//│ lhs: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit, +//│ rhs: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ } | Lit +//│ } | Lit\val & {val: 'val}) -> (int | 'val) +//│ where +//│ 'lhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'lhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'rhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit //│ = [Function: eval1_fixed_3] eval1_fixed_3 e1 @@ -124,7 +141,16 @@ def eval2f eval2 e = case e of { e2 = add (lit 1) (nega e1) -//│ e2: Add[Lit & {val: 1} | Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}]] with {lhs: Lit & {val: 1}, rhs: Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with {lhs: Lit & {val: 1}, rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}]} +//│ e2: Add[Lit & {val: 1} | Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ }]] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Nega[Add[Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} | Lit & {val: 1}] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Add[Lit & {val: 2 | 3}] & {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}} +//│ }] +//│ } //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Nega { arg: Add { lhs: [Lit], rhs: [Add] } } @@ -149,11 +175,9 @@ def fix f = let fixed = fun x -> f (fun v -> (x x) v) in fixed fixed! //│ = [Function: fix] def eval2_fixed_2 = fix eval2f -//│ eval2_fixed_2: (Add[?] & 'a | (Lit with {val: 'val}) | Nega[?] & 'b) -> (int | 'val) +//│ eval2_fixed_2: (Add[?] & {lhs: 'a, rhs: 'a} | (Lit with {val: 'val}) | Nega[?] & {arg: 'a}) -> (int | 'val) //│ where -//│ 'a <: {lhs: 'c, rhs: 'c} -//│ 'c <: Add[?] & 'a | Lit | Nega[?] & 'b -//│ 'b <: {arg: 'c} +//│ 'a <: Add[?] & {lhs: 'a, rhs: 'a} | Lit | Nega[?] & {arg: 'a} //│ = [Function: eval2_fixed_2] :stats @@ -192,10 +216,12 @@ rec def eval1_fixed = eval1f (eval1f eval1_fixed) //│ return eval1f(eval1f(eval1_fixed())); //│ }; //│ // End of generated code -//│ eval1_fixed: (Add[?] & 'a | Lit\val & {val: 'val}) -> (int | 'val) +//│ eval1_fixed: (Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit\val & {val: 'val}) -> (int | 'val) //│ where -//│ 'a <: {lhs: Add[?] & 'b | Lit, rhs: Add[?] & 'b | Lit} -//│ 'b <: {lhs: Add[?] & 'a | Lit, rhs: Add[?] & 'a | Lit} +//│ 'lhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'lhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'rhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit //│ = [Function: eval1_fixed] :re @@ -205,10 +231,12 @@ eval1_fixed e1 //│ RangeError: Maximum call stack size exceeded rec def eval1_fixed() = eval1f (eval1f (eval1_fixed())) -//│ eval1_fixed: () -> (Add[?] & 'a | Lit\val & {val: 'val}) -> (int | 'val) +//│ eval1_fixed: () -> (Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit\val & {val: 'val}) -> (int | 'val) //│ where -//│ 'a <: {lhs: Add[?] & 'b | Lit, rhs: Add[?] & 'b | Lit} -//│ 'b <: {lhs: Add[?] & 'a | Lit, rhs: Add[?] & 'a | Lit} +//│ 'lhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'lhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Add[?] & {lhs: 'lhs0, rhs: 'rhs0} | Lit +//│ 'rhs0 <: Add[?] & {lhs: 'lhs, rhs: 'rhs} | Lit //│ = [Function: eval1_fixed1] :re @@ -240,7 +268,10 @@ def eval1_fixed = eval1f (fun x -> eval1f eval1f x) //│ ╟── Note: constraint arises from application: //│ ║ l.32: | Add -> eval1 e.lhs + eval1 e.rhs //│ ╙── ^^^^^^^^^^^ -//│ eval1_fixed: (Add[?] & {lhs: Add[?] & {lhs: nothing -> int, rhs: nothing -> int} | Lit, rhs: Add[?] & {lhs: nothing -> int, rhs: nothing -> int} | Lit} | (Lit with {val: 'val})) -> (int | 'val) +//│ eval1_fixed: (Add[?] & { +//│ lhs: Add[?] & {lhs: nothing -> int, rhs: nothing -> int} | Lit, +//│ rhs: Add[?] & {lhs: nothing -> int, rhs: nothing -> int} | Lit +//│ } | (Lit with {val: 'val})) -> (int | 'val) rec def eval1_fixed = eval1f (fun x -> eval1_fixed eval1_fixed x) //│ ╔══[ERROR] Type mismatch in binding of application: @@ -328,7 +359,7 @@ eval2_broken eval2_broken! e2 //│ ║ l.20: | Add -> eval1 eval1 e.lhs + eval1 eval1 e.rhs //│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── from field selection: -//│ ║ l.314: | Nega -> e.arg +//│ ║ l.345: | Nega -> e.arg //│ ╙── ^^^^^ //│ res: error | int @@ -345,13 +376,13 @@ fix eval2f_oops e2 //│ ║ l.+1: fix eval2f_oops e2 //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── function of type `?a -> (forall ?b. ?b)` does not match type `Add[?] & ?c | Lit & ?d` -//│ ║ l.147: def fix f = let fixed = fun x -> f (fun v -> (x x) v) in fixed fixed! +//│ ║ l.173: def fix f = let fixed = fun x -> f (fun v -> (x x) v) in fixed fixed! //│ ║ ^^^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.18: def eval1 eval1 e = case e of { //│ ║ ^ //│ ╟── from reference: -//│ ║ l.336: def eval2f_oops eval2 e = case e of { +//│ ║ l.367: def eval2f_oops eval2 e = case e of { //│ ╙── ^ //│ res: error diff --git a/shared/src/test/diff/mlscript/ExprProb_Inv.mls b/shared/src/test/diff/mlscript/ExprProb_Inv.mls index 213727c53..40e3cb75a 100644 --- a/shared/src/test/diff/mlscript/ExprProb_Inv.mls +++ b/shared/src/test/diff/mlscript/ExprProb_Inv.mls @@ -283,12 +283,13 @@ rec def prettier11 k ev e = case e of { } //│ prettier11: ('a -> string) -> ('rhs -> number) -> 'b -> string //│ where -//│ 'b <: (Add[?] with {lhs: 'c, rhs: 'rhs & 'b}) | Lit | 'a & ~#Add & ~#Lit -//│ 'c <: (Add[?] with {lhs: 'c, rhs: 'c}) | Lit | 'a & ~#Add & ~#Lit +//│ 'b <: (Add[?] with {lhs: Add[?] & 'c | Lit | 'a & ~#Add & ~#Lit, rhs: 'rhs & 'b}) | Lit | 'a & ~#Add & ~#Lit +//│ 'c <: {lhs: 'd, rhs: 'd} +//│ 'd <: Add[?] & 'c | Lit | 'a & ~#Add & ~#Lit //│ = [Function: prettier11] //│ constrain calls : 191 //│ annoying calls : 0 -//│ subtyping calls : 782 +//│ subtyping calls : 820 // Doesn't make much sense, but generates very ugly type unless aggressively simplified: :stats @@ -299,14 +300,15 @@ rec def prettier12 k ev e = case e of { in if ev e == 0 then tmp else concat tmp (pretty1 k e.rhs) | _ -> k e } -//│ prettier12: ('a -> string & 'b -> 'c) -> ('d -> number) -> (Add[?]\lhs\rhs & {lhs: 'e, rhs: 'f} & 'd | Lit | 'b & ~#Add & ~#Lit) -> (string | 'c) +//│ prettier12: ('a -> string & 'b -> 'c) -> ('d -> number) -> ((Add[?] with {lhs: Add[?] & 'e | Lit | 'a & ~#Add & ~#Lit, rhs: 'f}) & 'd | Lit | 'b & ~#Add & ~#Lit) -> (string | 'c) //│ where -//│ 'f <: Add[?]\lhs\rhs & {lhs: 'f, rhs: 'f} | Lit | 'a & ~#Add & ~#Lit -//│ 'e <: Add[?]\lhs\rhs & {lhs: 'e, rhs: 'e} | Lit | 'a & ~#Add & ~#Lit +//│ 'f <: (Add[?] with {lhs: 'f, rhs: 'f}) | Lit | 'a & ~#Add & ~#Lit +//│ 'e <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'e | Lit | 'a & ~#Add & ~#Lit //│ = [Function: prettier12] //│ constrain calls : 166 //│ annoying calls : 0 -//│ subtyping calls : 833 +//│ subtyping calls : 877 :stats @@ -406,16 +408,19 @@ rec def prettier22 k ev = prettier12 (fun x -> case x of { | Nega -> concat "-" (prettier22 k ev x.arg) | _ -> k x }) ev -//│ prettier22: ('a -> string) -> ('b -> number) -> 'arg -> string -//│ where -//│ 'b <: {lhs: 'c, rhs: 'd} -//│ 'd <: Add[?]\lhs\rhs & {lhs: 'd, rhs: 'd} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega -//│ 'c <: Add[?]\lhs\rhs & {lhs: 'c, rhs: 'c} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega -//│ 'arg <: Add[?] & 'b | Lit | (Nega[?] & {arg: 'arg} | 'a & ~#Nega) & ~#Add & ~#Lit +//│ prettier22: ('a -> string) -> ('b -> number) -> (Add[?] & 'b | Lit | 'c & ~#Add & ~#Lit) -> string +//│ where +//│ 'b <: {lhs: Add[?] & 'd | Lit | 'e & ~#Add & ~#Lit, rhs: 'f} +//│ 'f <: Add[?]\lhs\rhs & {lhs: 'f, rhs: 'f} | Lit | Nega[?] & {arg: 'arg} | 'a & ~#Add & ~#Lit & ~#Nega +//│ 'd <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'd | Lit | 'e & ~#Add & ~#Lit +//│ 'e <: Nega[?] & {arg: 'arg} | 'a & ~#Nega +//│ 'arg <: Add[?] & 'b | Lit | 'c & ~#Add & ~#Lit +//│ 'c <: Nega[?] & {arg: 'arg} | 'a & ~#Nega //│ = [Function: prettier22] //│ constrain calls : 208 //│ annoying calls : 0 -//│ subtyping calls : 1053 +//│ subtyping calls : 1083 @@ -428,11 +433,14 @@ eval2 done e1 //│ subtyping calls : 1263 e2 = add (lit 1) (nega e1) -//│ e2: Add['E] with {lhs: Lit & {val: 1}, rhs: Nega[forall 'E0 'E1. Add['E0] with {lhs: Lit & {val: 1}, rhs: Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}]} -//│ where -//│ 'E :> Lit & {val: 1} | Nega[forall 'E0 'E1. Add['E0] with {lhs: Lit & {val: 1}, rhs: Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}] -//│ 'E0 :> (Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}) | Lit & {val: 1} -//│ 'E1 :> Lit & {val: 2 | 3} +//│ e2: Add['E] with { +//│ lhs: Lit & {val: 1}, +//│ rhs: Nega[forall 'E0 'E1. Add['E0] with {lhs: Lit & {val: 1}, rhs: Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}] +//│ } +//│ where +//│ 'E :> Lit & {val: 1} | Nega[forall 'E0 'E1. Add['E0] with {lhs: Lit & {val: 1}, rhs: Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}}] +//│ 'E0 :> (Add['E1] with {lhs: Lit & {val: 2}, rhs: Lit & {val: 3}}) | Lit & {val: 1} +//│ 'E1 :> Lit & {val: 2 | 3} //│ = Add { //│ lhs: Lit { val: 1 }, //│ rhs: Nega { arg: Add { lhs: [Lit], rhs: [Add] } } @@ -470,13 +478,15 @@ prettier2 done //│ = [Function (anonymous)] prettier22 done -//│ res: ('a -> number) -> 'arg -> string +//│ res: ('a -> number) -> (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string //│ where -//│ 'a <: {lhs: 'b, rhs: 'c} -//│ 'c <: Add[?]\lhs\rhs & {lhs: 'c, rhs: 'c} | Lit | 'd -//│ 'b <: Add[?]\lhs\rhs & {lhs: 'b, rhs: 'b} | Lit | 'd +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'd & ~#Add & ~#Lit, rhs: 'e} +//│ 'e <: Add[?]\lhs\rhs & {lhs: 'e, rhs: 'e} | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'f, rhs: 'f} +//│ 'f <: Add[?] & 'c | Lit | 'd & ~#Add & ~#Lit //│ 'd <: Nega[?] & {arg: 'arg} -//│ 'arg <: Add[?] & 'a | Lit | 'd & ~#Add & ~#Lit +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} //│ = [Function (anonymous)] :stats @@ -494,12 +504,15 @@ prettier2 done (eval1 done) prettier22 done (eval1 done) -//│ res: 'arg -> string -//│ where -//│ 'arg <: Add[?] & {lhs: 'a, rhs: 'a} & 'b | Lit | 'c & ~#Add & ~#Lit -//│ 'b <: (Add[?] with {lhs: 'b, rhs: 'b}) | Lit -//│ 'a <: (Add[?] with {lhs: 'a, rhs: 'a}) | Lit | 'c -//│ 'c <: Nega[?] & {arg: 'arg} +//│ res: (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string +//│ where +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit, rhs: 'd} & 'e +//│ 'e <: (Add[?] with {lhs: 'e, rhs: 'e}) | Lit +//│ 'd <: (Add[?] with {lhs: 'd, rhs: 'd}) | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'f, rhs: 'f} +//│ 'f <: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit //│ = [Function (anonymous)] // TODO could probably merge `a` and `b` here! @@ -530,13 +543,16 @@ prettier2 done (eval2 done) d2 prettier22 done (eval2 done) prettier22 done (eval2 done) e2 prettier22 done (eval2 done) d2 -//│ res: 'arg -> string -//│ where -//│ 'arg <: Add[?] & {lhs: 'a, rhs: 'a} & 'b | Lit | 'c & ~#Add & ~#Lit -//│ 'b <: (Add[?] with {lhs: 'b, rhs: 'b}) | Lit | 'd & ~#Add & ~#Lit -//│ 'd <: Nega[?] & {arg: 'b} -//│ 'a <: (Add[?] with {lhs: 'a, rhs: 'a}) | Lit | 'c -//│ 'c <: Nega[?] & {arg: 'arg} +//│ res: (Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit) -> string +//│ where +//│ 'a <: {lhs: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit, rhs: 'd} & 'e +//│ 'e <: (Add[?] with {lhs: 'e, rhs: 'e}) | Lit | 'f & ~#Add & ~#Lit +//│ 'f <: Nega[?] & {arg: 'e} +//│ 'd <: (Add[?] with {lhs: 'd, rhs: 'd}) | Lit | Nega[?] & {arg: 'arg} +//│ 'c <: {lhs: 'g, rhs: 'g} +//│ 'g <: Add[?] & 'c | Lit | 'b & ~#Add & ~#Lit +//│ 'b <: Nega[?] & {arg: 'arg} +//│ 'arg <: Add[?] & 'a | Lit | 'b & ~#Add & ~#Lit //│ = [Function (anonymous)] //│ res: string //│ = '1-123' @@ -544,7 +560,7 @@ prettier22 done (eval2 done) d2 //│ = '-1' //│ constrain calls : 1178 //│ annoying calls : 390 -//│ subtyping calls : 10266 +//│ subtyping calls : 10358 @@ -561,7 +577,7 @@ eval1 done e2 //│ ║ l.+1: eval1 done e2 //│ ║ ^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` does not match type `nothing` -//│ ║ l.370: def nega arg = Nega { arg } +//│ ║ l.372: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.4: def done x = case x of {} @@ -616,7 +632,7 @@ prettier2 done (eval1 done) e2 //│ ║ l.+1: prettier2 done (eval1 done) e2 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` does not match type `nothing` -//│ ║ l.370: def nega arg = Nega { arg } +//│ ║ l.372: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.4: def done x = case x of {} @@ -637,7 +653,7 @@ prettier2 done eval2 //│ ╔══[ERROR] Type mismatch in application: //│ ║ l.+1: prettier2 done eval2 //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ╟── function of type `?a -> (forall ?b ?c. ?b | ?c)` is not an instance of type `number` +//│ ╟── function of type `?a -> (forall ?b ?c. ?c | ?b)` is not an instance of type `number` //│ ║ l.72: rec def eval1 k e = case e of { //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.73: | Lit -> e.val @@ -688,7 +704,7 @@ prettier2 done eval2 e1 //│ ║ l.19: def lit val = Lit { val } //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.379: | _ -> k x +//│ ║ l.381: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.264: else if ev e.rhs == 0 then prettier1 k ev e.lhs @@ -705,7 +721,7 @@ prettier2 done eval2 e2 //│ ╔══[ERROR] Type mismatch in application: //│ ║ l.+1: prettier2 done eval2 e2 //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ╟── function of type `?a -> (forall ?b ?c. ?b | ?c)` is not an instance of type `number` +//│ ╟── function of type `?a -> (forall ?b ?c. ?c | ?b)` is not an instance of type `number` //│ ║ l.72: rec def eval1 k e = case e of { //│ ║ ^^^^^^^^^^^^^^^ //│ ║ l.73: | Lit -> e.val @@ -726,7 +742,7 @@ prettier2 done eval2 e2 //│ ║ l.19: def lit val = Lit { val } //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.379: | _ -> k x +//│ ║ l.381: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.264: else if ev e.rhs == 0 then prettier1 k ev e.lhs @@ -761,10 +777,10 @@ prettier2 done eval2 d2 //│ ║ l.+1: prettier2 done eval2 d2 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Nega[?E] & {Nega#E = ?E, arg: ?arg}` is not a function -//│ ║ l.370: def nega arg = Nega { arg } +//│ ║ l.372: def nega arg = Nega { arg } //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from application: -//│ ║ l.379: | _ -> k x +//│ ║ l.381: | _ -> k x //│ ║ ^^^ //│ ╟── from field selection: //│ ║ l.264: else if ev e.rhs == 0 then prettier1 k ev e.lhs diff --git a/shared/src/test/diff/mlscript/Group_2022_06_09.mls b/shared/src/test/diff/mlscript/Group_2022_06_09.mls index 6b803e4c3..cc0953fd1 100644 --- a/shared/src/test/diff/mlscript/Group_2022_06_09.mls +++ b/shared/src/test/diff/mlscript/Group_2022_06_09.mls @@ -132,12 +132,13 @@ def evalComposed evalComposed = evalN evalN! (eval evalComposed) // * of the need for an algorithm to tie recursive TV knots and inline the rest; // * once we inline, `b` we should get the expected simplified recursive type. ev2 = evalComposed evalComposed! -//│ ev2: ((Add with {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg}) | (Lit with {n: 'n}) | (Neg with {e: 'c})) -> (int | 'n) +//│ ev2: (Add\lhs\rhs & {lhs: Neg\e & {e: 'a} | 'b & ~#Neg, rhs: Neg\e & {e: 'a} | 'b & ~#Neg} | Lit\n & {n: 'n} | Neg\e & {e: 'c}) -> (int | 'n) //│ where -//│ 'c <: (Add with {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg}) | Lit | (Neg with {e: 'c}) -//│ 'a <: {e: 'd} -//│ 'd <: 'b | (Neg with {e: 'd}) -//│ 'b <: Add & {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg} | Lit +//│ 'c <: Add\lhs\rhs & {lhs: Neg\e & {e: 'a} | 'b & ~#Neg, rhs: Neg\e & {e: 'a} | 'b & ~#Neg} | Lit | Neg\e & {e: 'c} +//│ 'a <: Add\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Lit | Neg\e & {e: 'a} +//│ 'lhs <: Neg\e & {e: 'a} | 'b & ~#Neg +//│ 'b <: Add\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Neg\e & {e: 'a} | 'b & ~#Neg //│ = [Function (anonymous)] ev2 e3 @@ -152,12 +153,13 @@ def ev2_ty: (Add & { lhs: 'a; rhs: 'a } | Lit | Neg & { e: 'a } as 'a) -> int //│ = ev2_ty = ev2 -//│ ((Add with {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg}) | (Lit with {n: 'n}) | (Neg with {e: 'c})) -> (int | 'n) +//│ (Add\lhs\rhs & {lhs: Neg\e & {e: 'a} | 'b & ~#Neg, rhs: Neg\e & {e: 'a} | 'b & ~#Neg} | Lit\n & {n: 'n} | Neg\e & {e: 'c}) -> (int | 'n) //│ where -//│ 'c <: (Add with {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg}) | Lit | (Neg with {e: 'c}) -//│ 'a <: {e: 'd} -//│ 'd <: 'b | (Neg with {e: 'd}) -//│ 'b <: Add & {lhs: Neg & 'a | 'b & ~#Neg, rhs: Neg & 'a | 'b & ~#Neg} | Lit +//│ 'c <: Add\lhs\rhs & {lhs: Neg\e & {e: 'a} | 'b & ~#Neg, rhs: Neg\e & {e: 'a} | 'b & ~#Neg} | Lit | Neg\e & {e: 'c} +//│ 'a <: Add\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Lit | Neg\e & {e: 'a} +//│ 'lhs <: Neg\e & {e: 'a} | 'b & ~#Neg +//│ 'b <: Add\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Lit +//│ 'rhs <: Neg\e & {e: 'a} | 'b & ~#Neg //│ <: ev2_ty: //│ 'a -> int //│ where diff --git a/shared/src/test/diff/mlscript/HeadOption.mls b/shared/src/test/diff/mlscript/HeadOption.mls index 1fb3ead7c..0326c0220 100644 --- a/shared/src/test/diff/mlscript/HeadOption.mls +++ b/shared/src/test/diff/mlscript/HeadOption.mls @@ -99,7 +99,9 @@ Cons.HeadOption l2 :stats l3 = Cons { head = 0-1; tail = l2 } -//│ l3: Cons[int] with {tail: Cons[0] with {tail: Cons[1] with {tail: Cons[2] with {tail: Cons[3] with {tail: Nil[?]}}}}} +//│ l3: Cons[int] with { +//│ tail: Cons[0] with {tail: Cons[1] with {tail: Cons[2] with {tail: Cons[3] with {tail: Nil[?]}}}} +//│ } //│ constrain calls : 34 //│ annoying calls : 1 //│ subtyping calls : 253 @@ -130,12 +132,12 @@ Cons.HeadOption lr1 :stats rec def lr2 = Cons { head = 0; tail = Cons { head = 1; tail = Cons { head = 3; tail = lr2 } } } -//│ lr2: 'tail +//│ lr2: Cons[0] with {tail: 'tail} //│ where -//│ 'tail :> Cons[0] with {tail: Cons[1] with {tail: Cons[3] with {tail: 'tail}}} +//│ 'tail :> Cons[1] with {tail: Cons[3] with {tail: Cons[0] with {tail: 'tail}}} //│ constrain calls : 49 //│ annoying calls : 0 -//│ subtyping calls : 258 +//│ subtyping calls : 280 :stats Cons.HeadOption lr2 @@ -148,23 +150,25 @@ Cons.HeadOption lr2 :e l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── record literal of type `{tail: ?a}` does not have field 'head' -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── record literal of type `{tail: ?a}` does not have field 'head' -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── record literal of type `{tail: ?a}` does not have field 'head' -//│ ║ l.149: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } +//│ ║ l.151: l1 = Cons { tail = Cons { tail = Cons { tail = Nil {} } } } //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ l1: (Cons[nothing] with {tail: (Cons[nothing] with {tail: (Cons[nothing] with {tail: Nil[?]}) | error}) | error}) | error +//│ l1: (Cons[nothing] with { +//│ tail: (Cons[nothing] with {tail: (Cons[nothing] with {tail: Nil[?]}) | error}) | error +//│ }) | error diff --git a/shared/src/test/diff/mlscript/Neg.mls b/shared/src/test/diff/mlscript/Neg.mls index edae4853f..e3f02f971 100644 --- a/shared/src/test/diff/mlscript/Neg.mls +++ b/shared/src/test/diff/mlscript/Neg.mls @@ -136,13 +136,13 @@ def f: (~{x: 1 | 2} & 'a | ~{x: 2 | 3} & 'a) -> 'a f = id //│ 'a -> 'a //│ <: f: -//│ 'a -> 'a +//│ nothing -> nothing //│ = [Function: id] f x = case x of {} //│ nothing -> nothing //│ <: f: -//│ 'a -> 'a +//│ nothing -> nothing //│ = [Function: f2] def f: (~{x: 1 | 2} & ~lit & 'a | ~{x: 2 | 3} & ~lit & 'a) -> 'a diff --git a/shared/src/test/diff/mlscript/NestedClassArgs.mls b/shared/src/test/diff/mlscript/NestedClassArgs.mls index 340efed85..5e7d5250a 100644 --- a/shared/src/test/diff/mlscript/NestedClassArgs.mls +++ b/shared/src/test/diff/mlscript/NestedClassArgs.mls @@ -72,16 +72,15 @@ mkC = mkC' //│ 'a -> C2['a] rec def rc = mkC(rc) -//│ rc: 'b +//│ rc: C2['a] //│ where -//│ 'b :> C2['a] -//│ 'a :> 'b +//│ 'a :> C2['a] rec def rc = mkC'(rc) //│ rc: 'a //│ where -//│ 'a :> C2['A] with {a: 'a} -//│ 'A :> 'a +//│ 'a :> C2['A] & {a: forall 'a. 'a} +//│ 'A :> forall 'a. 'a @@ -141,17 +140,17 @@ def c: 'a -> C5['a] //│ c: 'a -> C5['a] rec def c5 a = C5{ a = C2 { a = c5 a } } -//│ c5: anything -> 'a +//│ c5: anything -> (C5['A] with {a: 'a}) //│ where -//│ 'a :> C5['A] with {a: C2['A0] with {a: 'a}} -//│ 'A0 :> C5['A] | 'a +//│ 'a :> C2['A0] with {a: C5['A] with {a: 'a}} +//│ 'A0 :> (C5['A] with {a: 'a}) | C5['A] //│ <: C5['A] c = c5 -//│ anything -> 'a +//│ anything -> (C5['A] with {a: 'a}) //│ where -//│ 'a :> C5['A] with {a: C2['A0] with {a: 'a}} -//│ 'A0 :> C5['A] | 'a +//│ 'a :> C2['A0] with {a: C5['A] with {a: 'a}} +//│ 'A0 :> (C5['A] with {a: 'a}) | C5['A] //│ <: C5['A] //│ <: c: //│ 'a -> C5['a] @@ -168,24 +167,24 @@ def c: 'a -> C6['a] //│ c: 'a -> C6['a] rec def c6 a = C6{ a = c5 (c6 a) } -//│ c6: anything -> (C6['A] with {a: forall 'a 'A0 'A1. 'a}) +//│ c6: anything -> (C6['A] with {a: forall 'A0 'a 'A1. C5['A0] with {a: 'a}}) //│ where -//│ 'a :> C5['A0] with {a: C2['A1] with {a: 'a}} -//│ 'A1 :> C5['A0] | 'a +//│ 'a :> C2['A1] with {a: C5['A0] with {a: 'a}} +//│ 'A1 :> (C5['A0] with {a: 'a}) | C5['A0] //│ <: C5['A0] :stats c = c6 -//│ anything -> (C6['A] with {a: forall 'a 'A0 'A1. 'a}) +//│ anything -> (C6['A] with {a: forall 'A0 'a 'A1. C5['A0] with {a: 'a}}) //│ where -//│ 'a :> C5['A0] with {a: C2['A1] with {a: 'a}} -//│ 'A1 :> C5['A0] | 'a +//│ 'a :> C2['A1] with {a: C5['A0] with {a: 'a}} +//│ 'A1 :> (C5['A0] with {a: 'a}) | C5['A0] //│ <: C5['A0] //│ <: c: //│ 'a -> C6['a] //│ constrain calls : 70 //│ annoying calls : 34 -//│ subtyping calls : 400 +//│ subtyping calls : 476 // Reproduction of an issue found while trying out TypeRef ctor typing: @@ -256,23 +255,23 @@ s2 = S{v=S{v=1}}:O[O['_]] L{h=error;t=s1} L{h=error;t=s2} //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.256: L{h=error;t=s1} +//│ ║ l.255: L{h=error;t=s1} //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── integer literal of type `1` is not an instance of type `L` -//│ ║ l.246: s1 = S{v=1}:O['_] +//│ ║ l.245: s1 = S{v=1}:O['_] //│ ║ ^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.234: class L[T]: { h: T; t: O[L[T]] } +//│ ║ l.233: class L[T]: { h: T; t: O[L[T]] } //│ ╙── ^^^^ //│ res: error //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.257: L{h=error;t=s2} +//│ ║ l.256: L{h=error;t=s2} //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── type `S['_]` is not an instance of type `L` -//│ ║ l.233: type O[T] = S[T] | N +//│ ║ l.232: type O[T] = S[T] | N //│ ║ ^^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.234: class L[T]: { h: T; t: O[L[T]] } +//│ ║ l.233: class L[T]: { h: T; t: O[L[T]] } //│ ╙── ^^^^ //│ res: error @@ -291,16 +290,16 @@ def append ls elem = L { h = elem; t = S { v = ls } } :ns append -//│ res: forall 'h 'a 'b 'T 't 'v 'T0 'c. 'c -> 'a -> 'b +//│ res: forall 'v 'T 'h 'a 'b 'T0 't 'c. 'b -> 'c -> 'a //│ where -//│ 'b :> #L & {h: 'h, t: 't, L#T = 'T0} -//│ 't :> #S & {v: 'v, S#T = 'T} -//│ <: O[L['T0]] -//│ 'a <: 'h -//│ 'h <: 'T0 -//│ 'c <: 'v -//│ 'v <: L['T0] & 'T -//│ 'T := L['T0] +//│ 'a :> #L & {h: 'h, t: 't, L#T = 'T} +//│ 't :> #S & {v: 'v, S#T = 'T0} +//│ <: O[L['T]] +//│ 'c <: 'h +//│ 'h <: 'T +//│ 'b <: 'v +//│ 'v <: L['T] & 'T0 +//│ 'T0 := L['T] append error //│ res: ('h & 'T) -> (L['T] with {h: 'h, t: S[L['T]] & {v: nothing}}) @@ -332,16 +331,16 @@ append_ty_2 = append //│ <: append_ty_2: //│ (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] with {h: 'h, t: S['T0] with {v: 'v}}) //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.330: append_ty_2 = append +//│ ║ l.329: append_ty_2 = append //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `'T0` is not an instance of type `L` -//│ ║ l.323: def append_ty_2: (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] & {h: 'h; t: S['T0] & {v: 'v}}) +//│ ║ l.322: def append_ty_2: (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] & {h: 'h; t: S['T0] & {v: 'v}}) //│ ║ ^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.234: class L[T]: { h: T; t: O[L[T]] } +//│ ║ l.233: class L[T]: { h: T; t: O[L[T]] } //│ ║ ^^^^ //│ ╟── Note: class type parameter T is defined at: -//│ ║ l.230: class S[T]: { v: T } +//│ ║ l.229: class S[T]: { v: T } //│ ╙── ^ append_ty = append_ty_2 @@ -355,13 +354,13 @@ append_ty_2 = append_ty //│ <: append_ty_2: //│ (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] with {h: 'h, t: S['T0] with {v: 'v}}) //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.353: append_ty_2 = append_ty +//│ ║ l.352: append_ty_2 = append_ty //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `'T0` is not an instance of type `L` -//│ ║ l.323: def append_ty_2: (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] & {h: 'h; t: S['T0] & {v: 'v}}) +//│ ║ l.322: def append_ty_2: (L['T] & 'v & 'T0) -> ('T & 'h) -> (L['T] & {h: 'h; t: S['T0] & {v: 'v}}) //│ ║ ^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.309: def append_ty: (L['T] & 'v) -> ('T & 'h) -> (L['T] & {h: 'h; t: S[L['T]] & {v: 'v}}) +//│ ║ l.308: def append_ty: (L['T] & 'v) -> ('T & 'h) -> (L['T] & {h: 'h; t: S[L['T]] & {v: 'v}}) //│ ╙── ^^^^^ diff --git a/shared/src/test/diff/mlscript/NestedClassArgs_Co.mls b/shared/src/test/diff/mlscript/NestedClassArgs_Co.mls index d7bf10c75..0afb617bd 100644 --- a/shared/src/test/diff/mlscript/NestedClassArgs_Co.mls +++ b/shared/src/test/diff/mlscript/NestedClassArgs_Co.mls @@ -68,9 +68,9 @@ rec def rc = mkC(rc) //│ 'a :> C2['a] rec def rc = mkC'(rc) -//│ rc: 'A +//│ rc: 'a //│ where -//│ 'A :> C2['A] +//│ 'a :> C2[forall 'a. 'a] @@ -130,14 +130,14 @@ def c: 'a -> C5['a] //│ c: 'a -> C5['a] rec def c5 a = C5{ a = C2 { a = c5 a } } -//│ c5: anything -> 'A +//│ c5: anything -> (C5[nothing] with {a: 'a}) //│ where -//│ 'A :> C5[nothing] with {a: C2['A]} +//│ 'a :> C2[C5[nothing] with {a: 'a}] c = c5 -//│ anything -> 'A +//│ anything -> (C5[nothing] with {a: 'a}) //│ where -//│ 'A :> C5[nothing] with {a: C2['A]} +//│ 'a :> C2[C5[nothing] with {a: 'a}] //│ <: c: //│ 'a -> C5['a] @@ -157,14 +157,14 @@ def c: 'a -> C6['a] // rec def c a = C6{ a = c5 (c a) } rec def c6 a = C6{ a = c5 (c6 a) } -//│ c6: anything -> (C6[nothing] with {a: forall 'A. 'A}) +//│ c6: anything -> (C6[nothing] with {a: forall 'a. C5[nothing] with {a: 'a}}) //│ where -//│ 'A :> C5[nothing] with {a: C2['A]} +//│ 'a :> C2[C5[nothing] with {a: 'a}] c = c6 -//│ anything -> (C6[nothing] with {a: forall 'A. 'A}) +//│ anything -> (C6[nothing] with {a: forall 'a. C5[nothing] with {a: 'a}}) //│ where -//│ 'A :> C5[nothing] with {a: C2['A]} +//│ 'a :> C2[C5[nothing] with {a: 'a}] //│ <: c: //│ 'a -> C6['a] diff --git a/shared/src/test/diff/mlscript/NestedRecursiveMatch.mls b/shared/src/test/diff/mlscript/NestedRecursiveMatch.mls index 9ab3441bb..432c25b2d 100644 --- a/shared/src/test/diff/mlscript/NestedRecursiveMatch.mls +++ b/shared/src/test/diff/mlscript/NestedRecursiveMatch.mls @@ -34,9 +34,9 @@ rec def f w = case w of Some -> let m = (tmp0).value in Some (m,) -//│ f: 'right -> (None | Some[in 'a out 'a | 0]) +//│ f: (Leaf | Node & 'b) -> (None | Some[in 'a out 'a | 0]) //│ where -//│ 'right <: Leaf | Node & {left: 'right, right: 'right} +//│ 'b <: {left: Leaf | Node & 'b, right: Leaf | Node & 'b} // * Minimizations: @@ -49,9 +49,9 @@ rec def f w = case w of Some -> let m = (tmp0).value in Some (m,) -//│ f: 'b -> Some[in 'a out 'a | 0] +//│ f: 'left -> Some[in 'a out 'a | 0] //│ where -//│ 'b <: Node & {left: 'b} +//│ 'left <: Node & {left: 'left} rec def f w = case w of Node -> @@ -71,7 +71,7 @@ def f w = None -> Some 0, Some -> let m = tmp0.value in Some m -//│ f: {left: 'b} -> Some[in 'a out 0 | 'a] +//│ f: 'b -> Some[in 'a out 0 | 'a] //│ where -//│ 'b <: Node & {left: 'b} +//│ 'b <: {left: Node & 'b} diff --git a/shared/src/test/diff/mlscript/Paper.mls b/shared/src/test/diff/mlscript/Paper.mls index 84f5176b7..d33d5d27d 100644 --- a/shared/src/test/diff/mlscript/Paper.mls +++ b/shared/src/test/diff/mlscript/Paper.mls @@ -114,9 +114,9 @@ type List[A] = Cons[A] | None rec def mapList f ls = case ls of Cons -> Cons{value = f ls.value; tail = mapList f ls.tail}, None -> None{} -//│ mapList: ('value -> 'value0) -> 'a -> 'tail +//│ mapList: ('value -> 'value0) -> 'a -> (None | 'b) //│ where -//│ 'tail :> (Cons['value0] with {tail: 'tail}) | None +//│ 'b :> Cons['value0] with {tail: None | 'b} //│ 'a <: (Cons[?] with {tail: 'a, value: 'value}) | None //│ = [Function: mapList] @@ -134,10 +134,10 @@ rec def unzip xs = case xs of None -> { fst = None; snd = None }, Some -> let tmp = unzip xs.tail in { fst = Cons xs.value.fst tmp.fst ; snd = Cons xs.value.snd tmp.snd } -//│ unzip: 'a -> {fst: 'tail, snd: 'tail0} +//│ unzip: 'a -> {fst: None | 'b, snd: None | 'c} //│ where -//│ 'tail0 :> (Cons['value] with {tail: 'tail0}) | None -//│ 'tail :> (Cons['value0] with {tail: 'tail}) | None +//│ 'c :> Cons['value] with {tail: None | 'c} +//│ 'b :> Cons['value0] with {tail: None | 'b} //│ 'a <: None | Some[?] & {tail: 'a, value: {fst: 'value0, snd: 'value}} //│ = [Function: unzip] @@ -156,10 +156,10 @@ def unzip_ty = unzip //│ <: Cons_ty: //│ 'a -> (List['a] & 'b) -> (Cons['a] with {tail: 'b}) //│ = [Function: Cons_ty] -//│ 'a -> {fst: 'tail, snd: 'tail0} +//│ 'a -> {fst: None | 'b, snd: None | 'c} //│ where -//│ 'tail0 :> (Cons['value] with {tail: 'tail0}) | None -//│ 'tail :> (Cons['value0] with {tail: 'tail}) | None +//│ 'c :> Cons['value] with {tail: None | 'c} +//│ 'b :> Cons['value0] with {tail: None | 'b} //│ 'a <: None | Some[?] & {tail: 'a, value: {fst: 'value0, snd: 'value}} //│ <: unzip_ty: //│ List[{fst: 'a, snd: 'b}] -> {fst: List['a], snd: List['b]} diff --git a/shared/src/test/diff/mlscript/PolyVariant.mls b/shared/src/test/diff/mlscript/PolyVariant.mls index feadc37b2..af5df93f6 100644 --- a/shared/src/test/diff/mlscript/PolyVariant.mls +++ b/shared/src/test/diff/mlscript/PolyVariant.mls @@ -104,16 +104,16 @@ rec def map f l = case l of { | Nil -> l | Cons -> Cons (f l.head) (map f l.tail) } -//│ map: ('head -> ('head0 & 'A)) -> 'a -> 'tail +//│ map: ('head -> ('head0 & 'A)) -> 'a -> 'b //│ where -//│ 'a <: (Cons[?] with {head: 'head, tail: 'a}) | Nil & List['A] & 'tail -//│ 'tail :> Cons['A] with {head: 'head0, tail: 'tail} +//│ 'a <: (Cons[?] with {head: 'head, tail: 'a}) | Nil & List['A] & 'b +//│ 'b :> Cons['A] with {head: 'head0, tail: 'b} //│ = [Function: map] map (fun x -> "lol") (Cons 2 (Cons 3 Nil)) -//│ res: 'tail +//│ res: Nil | 'a //│ where -//│ 'tail :> (Cons["lol"] with {tail: 'tail}) | Nil +//│ 'a :> Cons["lol"] with {tail: Nil | 'a} //│ = Cons { head: 'lol', tail: Cons { head: 'lol', tail: Nil {} } } //************** EXAMPLE 3: ROUGH APPROXIMATIONS ************* diff --git a/shared/src/test/diff/mlscript/PolyVariantCodeReuse.mls b/shared/src/test/diff/mlscript/PolyVariantCodeReuse.mls index 4ea032d6c..10cbaa988 100644 --- a/shared/src/test/diff/mlscript/PolyVariantCodeReuse.mls +++ b/shared/src/test/diff/mlscript/PolyVariantCodeReuse.mls @@ -84,9 +84,9 @@ def eval_var sub v = case v of { | Success -> res.result } } -//│ eval_var: 'a -> (Var & 'result) -> 'result +//│ eval_var: (Cons[?] & 'a | Nil) -> (Var & 'result) -> 'result //│ where -//│ 'a <: (Cons[?] with {head: {_1: string, _2: 'result}, tail: 'a}) | Nil +//│ 'a <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'a | Nil} //│ = //│ list_assoc and eq are not implemented @@ -129,26 +129,31 @@ def eval_lambda eval_rec subst v = case v of { Abs { name = new_name; body = eval_rec (Cons (Tuple v.name (Var { name = new_name })) subst) v.body } } -//│ eval_lambda: (((Cons[('a, Var | 'body,) | 'A] with {head: ('a, Var | 'body,), tail: Nil | 'tail}) | 'tail) -> 'lhs -> ('body & 'result & ((Abs[?] with {body: 'lhs, name: 'a}) | 'lhs0 & ~#Abs))) -> (List['A] & 'b & 'tail) -> ((Abs[?] with {body: 'lhs, name: 'a}) | App[?] & {lhs: 'lhs, rhs: 'lhs} | Var & 'result) -> (Abs['body] | (App['lhs0 | 'body] with {lhs: 'lhs0, rhs: 'body}) | 'result) +//│ eval_lambda: (((Cons[('a, Var | 'body,) | 'A] with {head: ('a, Var | 'body,), tail: Nil | 'tail}) | 'tail) -> 'lhs -> ('body & 'result & ((Abs[?] with {body: 'lhs, name: 'a}) | 'lhs0 & ~#Abs))) -> (List['A] & (Cons[?] & 'b | Nil) & 'tail) -> ((Abs[?] with {body: 'lhs, name: 'a}) | App[?] & {lhs: 'lhs, rhs: 'lhs} | Var & 'result) -> (Abs['body] | (App['lhs0 | 'body] with {lhs: 'lhs0, rhs: 'body}) | 'result) //│ where -//│ 'b <: (Cons[?] with {head: {_1: string, _2: 'result}, tail: 'b}) | Nil +//│ 'b <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'b | Nil} //│ = //│ eval_var, list_assoc and eq are not implemented rec def eval1 subst = eval_lambda eval1 subst -//│ eval1: (List[?] & 'tail) -> 'b -> 'rhs +//│ eval1: ('tail & (Cons[?] & List[?] & 'b | Nil & List[?])) -> 'c -> 'd //│ where -//│ 'tail <: (Cons[?] with {head: {_1: string, _2: 'result}, tail: 'tail}) | Nil -//│ 'result :> 'rhs -//│ <: 'b & (Abs[?] & 'c | 'lhs & ~#Abs) -//│ 'rhs :> 'result | 'd | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Abs['rhs] -//│ 'd :> Var -//│ <: 'b & (Abs[?] & 'c | {name: string} & 'lhs & ~#Abs) -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var -//│ <: 'a & 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'rhs}) | 'rhs -//│ 'c <: {body: 'b, name: string} -//│ 'b <: Abs[?] & {body: 'b} | App[?] & {lhs: 'b, rhs: 'b} | Var & 'd +//│ 'tail <: Cons[?] & 'b | Nil +//│ 'b <: {head: {_1: string, _2: 'result}, tail: 'tail} +//│ 'result :> 'd +//│ <: Abs[?] & 'e & 'f | 'lhs & (Abs[?] & 'f & ~#Abs | App[?] & 'g | Var & 'h) +//│ 'd :> 'result | 'i | App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Abs['d] +//│ 'i :> Var +//│ <: Abs[?] & 'e & 'f | 'lhs & (Abs[?] & 'f & ~#Abs | App[?] & {name: string} & 'g | Var & 'h) +//│ 'lhs :> App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Var +//│ <: 'a & 'c +//│ 'a :> App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | 'd +//│ 'rhs :> 'd +//│ 'e <: {body: 'c, name: string} +//│ 'c <: Abs[?] & 'f | App[?] & 'g | Var & 'h +//│ 'h <: Var & 'i +//│ 'g <: {lhs: 'c, rhs: 'c} +//│ 'f <: {body: 'c, name: string} //│ = //│ eval_lambda, eval_var, list_assoc and eq are not implemented @@ -206,18 +211,18 @@ rec def eval_expr eval_rec subst v = } | Numb -> vv // _ -> vv } -//│ eval_expr: ('a -> 'rhs -> 'rhs0) -> ('a & 'b) -> (Add[?] & {lhs: 'rhs, rhs: 'rhs} | Mul[?] & {lhs: 'rhs, rhs: 'rhs} | Numb & 'result | Var & 'result) -> (Add['rhs0] | Mul['rhs0] | Numb | 'result) +//│ eval_expr: ('a -> 'rhs -> 'rhs0) -> ('a & (Cons[?] & 'b | Nil)) -> (Add[?] & {lhs: 'rhs, rhs: 'rhs} | Mul[?] & {lhs: 'rhs, rhs: 'rhs} | Numb & 'result | Var & 'result) -> (Add['rhs0] | Mul['rhs0] | Numb | 'result) //│ where -//│ 'b <: (Cons[?] with {head: {_1: string, _2: 'result}, tail: 'b}) | Nil +//│ 'b <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'b | Nil} //│ = //│ eval_var, list_assoc and eq are not implemented rec def eval2 subst = eval_expr eval2 subst -//│ eval2: 'a -> 'b -> 'result +//│ eval2: (Cons[?] & 'a | Nil) -> 'b -> (Numb | 'result) //│ where //│ 'b <: Add[?] & {lhs: 'b, rhs: 'b} | Mul[?] & {lhs: 'b, rhs: 'b} | Numb & 'result | Var & 'result -//│ 'a <: (Cons[?] with {head: {_1: string, _2: 'result & (Numb | ~#Numb)}, tail: 'a}) | Nil -//│ 'result :> Numb | Add['result] | Mul['result] +//│ 'a <: {head: {_1: string, _2: 'result & (Numb | ~#Numb)}, tail: Cons[?] & 'a | Nil} +//│ 'result :> Mul[Numb | 'result] | Add[Numb | 'result] //│ = //│ eval_expr, eval_var, list_assoc and eq are not implemented @@ -254,30 +259,34 @@ def eval_lexpr eval_rec subst v = case v of { | Lambda -> eval_lambda eval_rec subst v | Expr -> eval_expr eval_rec subst v } -//│ eval_lexpr: ((Cons[('a, Var | 'body,) | 'A]\head\tail & {head: ('a, Var | 'body,), tail: Nil | 'tail} | 'tail) -> 'lhs -> ('body & 'result & (Abs[?]\body\name & {body: 'lhs, name: 'a} | 'lhs0 & ~#Abs))) -> (List['A] & 'b & 'c & 'tail) -> (Abs[?]\body\name & {body: 'lhs, name: 'a} | Add[?] & {lhs: 'lhs, rhs: 'lhs} | App[?] & {lhs: 'lhs, rhs: 'lhs} | Mul[?] & {lhs: 'lhs, rhs: 'lhs} | Numb & 'result | Var & 'result) -> (Abs['body] | Add['body] | App['lhs0 | 'body]\lhs\rhs & {lhs: 'lhs0, rhs: 'body} | Mul['body] | Numb | 'result) +//│ eval_lexpr: ((Cons[('a, Var | 'body,) | 'A]\head\tail & {head: ('a, Var | 'body,), tail: Nil | 'tail} | 'tail) -> 'lhs -> ('body & 'result & (Abs[?]\body\name & {body: 'lhs, name: 'a} | 'lhs0 & ~#Abs))) -> (List['A] & (Cons[?] & 'b | Nil) & (Cons[?] & 'c | Nil) & 'tail) -> (Abs[?]\body\name & {body: 'lhs, name: 'a} | Add[?] & {lhs: 'lhs, rhs: 'lhs} | App[?] & {lhs: 'lhs, rhs: 'lhs} | Mul[?] & {lhs: 'lhs, rhs: 'lhs} | Numb & 'result | Var & 'result) -> (Abs['body] | Add['body] | App['lhs0 | 'body]\lhs\rhs & {lhs: 'lhs0, rhs: 'body} | Mul['body] | Numb | 'result) //│ where -//│ 'c <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'c} | Nil -//│ 'b <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'b} | Nil +//│ 'c <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'c | Nil} +//│ 'b <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'b | Nil} //│ = //│ eval_lambda, eval_var, list_assoc and eq are not implemented rec def eval3 subst = eval_lexpr eval3 subst -//│ eval3: (List[?] & 'tail & 'tail0) -> 'b -> 'rhs +//│ eval3: ('tail & 'tail0 & (Cons[?] & List[?] & 'b & 'c | Nil & List[?])) -> 'd -> 'e //│ where -//│ 'tail0 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail0} | Nil -//│ 'tail <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail} | Nil -//│ 'result :> Var | 'rhs | Numb -//│ <: 'b & (Abs[?] & 'c | 'lhs & (Numb | ~#Abs & ~#Numb)) -//│ 'rhs :> Abs['rhs] | App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | 'result | 'd | 'e -//│ 'a :> Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | 'rhs -//│ 'lhs :> Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | App['a]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Numb | Var -//│ <: 'b & 'a -//│ 'b <: Abs[?] & {body: 'b} | Add[?] & {lhs: 'b, rhs: 'b} | App[?] & {lhs: 'b, rhs: 'b} | Mul[?] & {lhs: 'b, rhs: 'b} | Numb & (Add[?] & 'e | Mul[?] & 'e | Numb & 'result | Var & 'd) | Var & 'd -//│ 'd :> Var -//│ <: 'b & (Abs[?] & 'c | 'lhs & (Numb & {name: string} | {name: string} & ~#Abs & ~#Numb)) -//│ 'e :> Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} -//│ <: 'b & (Abs[?] & {lhs: anything, rhs: anything} & 'c | 'lhs & (Numb & {lhs: anything, rhs: anything} | {lhs: anything, rhs: anything} & ~#Abs & ~#Numb)) -//│ 'c <: {body: 'b, name: string} +//│ 'tail0 <: Cons[?] & 'c | Nil +//│ 'c <: {head: {_1: string, _2: 'result}, tail: 'tail0} +//│ 'tail <: Cons[?] & 'b | Nil +//│ 'b <: {head: {_1: string, _2: 'result}, tail: 'tail} +//│ 'result :> Var | 'e | Numb +//│ <: Abs[?] & 'f & 'g | 'lhs & (Lambda & 'f & ~#Abs | 'h & (Expr & ~#Numb | Numb)) +//│ 'e :> Abs['e] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | 'result | 'i | 'j | (Add['e] with {lhs: 'e, rhs: 'e}) | (Mul['e] with {lhs: 'e, rhs: 'e}) +//│ 'a :> (Add['e] with {lhs: 'e, rhs: 'e}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['e] with {lhs: 'e, rhs: 'e}) | Var | 'e +//│ 'lhs :> (Add['e] with {lhs: 'e, rhs: 'e}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['e] with {lhs: 'e, rhs: 'e}) | Numb | Var +//│ <: 'd & 'a +//│ 'd <: Expr & 'h | Lambda & 'f +//│ 'h <: Add[?] & {lhs: 'd, rhs: 'd} | Mul[?] & {lhs: 'd, rhs: 'd} | Numb & 'result | Var & 'j +//│ 'j <: Var & (Abs[?] & 'f & 'g | 'lhs & (Lambda & {name: string} & 'f & ~#Abs | 'h & (Expr & {name: string} & ~#Numb | Numb & {name: string}))) +//│ 'f <: Abs[?] & {body: 'd} | App[?] & {lhs: 'd, rhs: 'd} | Var & 'i +//│ 'i :> Var +//│ <: Abs[?] & 'f & 'g | 'lhs & (Lambda & {name: string} & 'f & ~#Abs | 'h & (Expr & {name: string} & ~#Numb | Numb & {name: string})) +//│ 'g <: {body: 'd, name: string} +//│ 'rhs :> 'e //│ = //│ eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented @@ -314,12 +323,12 @@ rec def eval3 subst = eval_lexpr eval3 subst // ************************** Tests ******************************* eval3 Nil (Var { name = "s" }) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) | (Mul['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval3, eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented // ------------- OCaml's type ------------- @@ -333,49 +342,49 @@ eval3 Nil (Var { name = "s" }) eval3 Nil (Abs { name = "s"; body = Var { name = "s" } }) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval3, eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented eval2 Nil (Numb { num = 1 }) -//│ res: 'rhs +//│ res: Numb | 'a //│ where -//│ 'rhs :> Numb | Add['rhs] | Mul['rhs] +//│ 'a :> Add[Numb | 'a] | Mul[Numb | 'a] //│ = //│ eval2, eval_expr, eval_var, list_assoc and eq are not implemented eval3 Nil (Numb { num = 1 }) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval3, eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented eval3 Nil (App { lhs = Numb {num = 0}; rhs = Numb {num = 0}}) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) | (Mul['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval3, eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented eval3 Nil (Abs { name = "s"; body = Add { lhs = Var { name = "s" }; rhs = Numb { num = 1 } } }) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Var | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval3, eval_lexpr, eval_lambda, eval_var, list_assoc and eq are not implemented @@ -394,42 +403,70 @@ def eval_lexpr' eval_rec subst v = case v of { | Add -> eval_expr eval_rec subst v | Mul -> eval_expr eval_rec subst v } -//│ eval_lexpr': ((Cons[('b, Var | 'body,) | 'A]\head\tail & {head: ('b, Var | 'body,), tail: Nil | 'tail} | 'tail) -> 'body0 -> ('body & 'result & (Abs[?]\body\name & {body: 'body0, name: 'b} | 'lhs & 'a & (Abs[?]\body\name & {body: 'body0, name: 'b} & ~#Abs | 'lhs & 'a & ~#Abs)))) -> (List['A] & 'c & 'd & 'e & 'f & 'g & 'tail & 'h) -> (Abs[?]\body\name & {body: 'body0, name: 'b} | Add[?] & {lhs: 'body0, rhs: 'body0} | App[?] & {lhs: 'body0, rhs: 'body0} | Mul[?] & {lhs: 'body0, rhs: 'body0} | Numb & 'result | Var & 'result) -> (Abs['body] | Add['body] | App['a | 'body]\lhs\rhs & {lhs: 'lhs, rhs: 'body} | Mul['body] | Numb | 'result) +//│ eval_lexpr': ((Cons[('b, Var | 'body,) | 'A]\head\tail & {head: ('b, Var | 'body,), tail: Nil | 'tail} | 'tail) -> 'body0 -> ('body & 'result & (Abs[?]\body\name & {body: 'body0, name: 'b} | 'lhs & 'a & (Abs[?]\body\name & {body: 'body0, name: 'b} & ~#Abs | 'lhs & 'a & ~#Abs)))) -> (List['A] & (Cons[?] & 'c | Nil) & (Cons[?] & 'd | Nil) & (Cons[?] & 'e | Nil) & (Cons[?] & 'f | Nil) & (Cons[?] & 'g | Nil) & 'tail & (Cons[?] & 'h | Nil)) -> (Abs[?]\body\name & {body: 'body0, name: 'b} | Add[?] & {lhs: 'body0, rhs: 'body0} | App[?] & {lhs: 'body0, rhs: 'body0} | Mul[?] & {lhs: 'body0, rhs: 'body0} | Numb & 'result | Var & 'result) -> (Abs['body] | Add['body] | App['a | 'body]\lhs\rhs & {lhs: 'lhs, rhs: 'body} | Mul['body] | Numb | 'result) //│ where -//│ 'h <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'h} | Nil -//│ 'g <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'g} | Nil -//│ 'f <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'f} | Nil -//│ 'e <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'e} | Nil -//│ 'd <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'd} | Nil -//│ 'c <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'c} | Nil +//│ 'h <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'h | Nil} +//│ 'g <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'g | Nil} +//│ 'f <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'f | Nil} +//│ 'e <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'e | Nil} +//│ 'd <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'd | Nil} +//│ 'c <: {head: {_1: string, _2: 'result}, tail: Cons[?] & 'c | Nil} //│ = //│ eval_var, list_assoc and eq are not implemented :e rec def eval4 subst = eval_lexpr' eval4 subst //│ ╔══[ERROR] Subtyping constraint of the form `?a -> ?b <: ?eval4` took too many steps and ran out of fuel (10000) -//│ ║ l.409: rec def eval4 subst = eval_lexpr' eval4 subst +//│ ║ l.418: rec def eval4 subst = eval_lexpr' eval4 subst //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ eval4: (List[?] & 'tail & 'tail0 & 'tail1 & 'tail2 & 'tail3 & 'tail4) -> 'a -> 'result +//│ eval4: ('tail & 'tail0 & 'tail1 & 'tail2 & 'tail3 & 'tail4 & (Cons[?] & List[?] & 'a & 'b & 'c & 'd & 'e & 'f | Nil & List[?])) -> 'g -> (App[nothing] | 'result | 'h) //│ where -//│ 'tail4 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result0}, tail: 'tail4} | Nil -//│ 'tail3 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result0}, tail: 'tail3} | Nil -//│ 'tail2 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result & (Numb | ~#Numb)}, tail: 'tail2} | Nil -//│ 'tail1 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result & 'a & (Abs[?] & 'b | 'lhs & (Numb | ~#Abs & ~#Numb))}, tail: 'tail1} | Nil -//│ 'tail0 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result & 'a & (Abs[?] & 'b | 'lhs & (Numb | ~#Abs & ~#Numb))}, tail: 'tail0} | Nil -//│ 'tail <: Cons[?]\head\tail & {head: {_1: string, _2: 'result & 'a & (Abs[?] & 'b | 'lhs & (Numb | ~#Abs & ~#Numb))}, tail: 'tail} | Nil -//│ 'result :> Mul['result] | Add['result] | Abs['result] | App['lhs] & {lhs: 'lhs, rhs: nothing} | 'result0 | 'c | 'd | 'e -//│ 'result0 :> Var | Numb -//│ <: 'a & (Numb | ~#Numb) -//│ 'a <: Abs[?] | Add[?] & {lhs: 'a, rhs: 'a} | App[?] & {rhs: 'a} | Mul[?] & {lhs: 'a, rhs: 'a} | Numb & (Add[?] & 'e | Mul[?] & 'e | Numb & 'result0 | Var & 'd) | Var & 'c -//│ 'c :> Var -//│ <: 'a & (Abs[?] & 'b | 'lhs & (Numb & {name: string} | {name: string} & ~#Abs & ~#Numb)) -//│ 'b <: {body: 'a, name: string} -//│ 'd <: 'a & (Numb & {name: string} | {name: string} & ~#Numb) -//│ 'e :> 'result -//│ <: 'a & (Numb & {lhs: anything, rhs: anything} | {lhs: anything, rhs: anything} & ~#Numb) +//│ 'tail4 <: Cons[?] & 'f | Nil +//│ 'f <: {head: {_1: string, _2: 'result0}, tail: 'tail4} +//│ 'tail3 <: Cons[?] & 'e | Nil +//│ 'e <: {head: {_1: string, _2: 'result0}, tail: 'tail3} +//│ 'tail2 <: Cons[?] & 'd | Nil +//│ 'd <: {head: {_1: string, _2: 'result & (Numb | ~#Numb)}, tail: 'tail2} +//│ 'tail1 <: Cons[?] & 'c | Nil +//│ 'c <: { +//│ head: { +//│ _1: string, +//│ _2: 'result & (Abs[?] & 'i & 'j | 'lhs & (Abs[?] & 'j & ~#Abs | Add[?] & 'k | App[?] & 'l | Mul[?] & 'm | Var & 'n | 'o & (Numb | Numb & ~#Numb))) +//│ }, +//│ tail: 'tail1 +//│ } +//│ 'tail0 <: Cons[?] & 'b | Nil +//│ 'b <: { +//│ head: { +//│ _1: string, +//│ _2: 'result & (Abs[?] & 'i & 'j | 'lhs & (Abs[?] & 'j & ~#Abs | Add[?] & 'k | App[?] & 'l | Mul[?] & 'm | Var & 'n | 'o & (Numb | Numb & ~#Numb))) +//│ }, +//│ tail: 'tail0 +//│ } +//│ 'tail <: Cons[?] & 'a | Nil +//│ 'a <: { +//│ head: { +//│ _1: string, +//│ _2: 'result & (Abs[?] & 'i & 'j | 'lhs & (Abs[?] & 'j & ~#Abs | Add[?] & 'k | App[?] & 'l | Mul[?] & 'm | Var & 'n | 'o & (Numb | Numb & ~#Numb))) +//│ }, +//│ tail: 'tail +//│ } +//│ 'result :> Abs[Abs[nothing] | App[nothing] | 'result | 'h] | App['lhs] & {lhs: 'lhs, rhs: nothing} | 'h | Numb | Var | Add[Abs[nothing] | App[nothing] | 'result | 'h] | Mul[Abs[nothing] | App[nothing] | 'result | 'h] | 'result0 | 'p +//│ 'h :> Var +//│ <: Abs[?] & 'i & 'j | 'lhs & (Abs[?] & 'j & ~#Abs | Add[?] & {name: string} & 'k | App[?] & {name: string} & 'l | Mul[?] & {name: string} & 'm | Var & 'n | 'o & (Numb & {name: string} | Numb & {name: string} & ~#Numb)) //│ 'lhs :> App['lhs] & {lhs: 'lhs, rhs: nothing} | Var +//│ 'i <: {body: 'g, name: string} +//│ 'g <: Abs[?] & 'j | Add[?] & 'k | App[?] & 'l | Mul[?] & 'm | Numb & 'o | Var & 'n +//│ 'k <: Add[?] & {lhs: 'g, rhs: 'g} | Mul[?] & {lhs: 'g, rhs: 'g} | Numb & 'result | Var & 'p +//│ 'p <: Var & (Abs[?] & 'j | Add[?] & {name: string} & 'k | App[?] & {name: string} & 'l | Mul[?] & {name: string} & 'm | Var & 'n | 'o & (Numb & {name: string} | Numb & {name: string} & ~#Numb)) +//│ 'o <: Add[?] & {lhs: 'g, rhs: 'g} | Mul[?] & {lhs: 'g, rhs: 'g} | Numb & 'result0 | Var & 'p +//│ 'result0 :> Var | Numb +//│ <: Abs[?] & 'j | Add[?] & 'k | App[?] & 'l | Mul[?] & 'm | Var & 'n | 'o & (Numb | Numb & ~#Numb) +//│ 'n <: Var & 'h +//│ 'm <: Add[?] & {lhs: 'g, rhs: 'g} | Mul[?] & {lhs: 'g, rhs: 'g} | Numb & 'result | Var +//│ 'l <: Abs[?] & {body: 'g} | App[?] & {rhs: 'g} | Var & 'h +//│ 'j <: Abs[?] | App[?] | Var & 'h //│ = //│ eval_lexpr', eval_var, list_assoc and eq are not implemented @@ -437,43 +474,60 @@ rec def eval4 subst = eval_lexpr' eval4 subst :stats rec def eval4 subst = eval_lexpr' eval4 subst -//│ eval4: (List[?] & 'tail & 'tail0 & 'tail1 & 'tail2 & 'tail3 & 'tail4) -> 'b -> 'rhs +//│ eval4: ('tail & 'tail0 & 'tail1 & 'tail2 & 'tail3 & 'tail4 & (Cons[?] & List[?] & 'b & 'c & 'd & 'e & 'f & 'g | Nil & List[?])) -> 'h -> 'i //│ where -//│ 'tail4 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail4} | Nil -//│ 'tail3 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail3} | Nil -//│ 'tail2 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail2} | Nil -//│ 'tail1 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail1} | Nil -//│ 'tail0 <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail0} | Nil -//│ 'tail <: Cons[?]\head\tail & {head: {_1: string, _2: 'result}, tail: 'tail} | Nil -//│ 'result :> Var | 'rhs | Numb -//│ <: 'b & (Abs[?] & 'c | 'lhs & (Abs[?] & 'c & ~#Abs | 'lhs0 & (Numb | ~#Abs & ~#Numb))) -//│ 'rhs :> Abs['rhs] | App['a]\lhs\rhs & {lhs: 'lhs | 'lhs0, rhs: 'rhs} | 'result | 'd | 'e | Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} -//│ 'a :> Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | App['a]\lhs\rhs & {lhs: 'lhs | 'lhs0, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | 'rhs -//│ 'lhs :> Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | App['a]\lhs\rhs & {lhs: 'lhs | 'lhs0, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Numb | Var -//│ <: 'b & 'a -//│ 'lhs0 :> Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | App['a]\lhs\rhs & {lhs: 'lhs | 'lhs0, rhs: 'rhs} | Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Numb | Var -//│ <: 'b & 'a -//│ 'b <: Abs[?] & {body: 'b} | Add[?] & {lhs: 'b, rhs: 'b} | App[?] & {lhs: 'b, rhs: 'b} | Mul[?] & {lhs: 'b, rhs: 'b} | Numb & (Add[?] & 'e | Mul[?] & 'e | Numb & 'result | Var & 'd) | Var & 'd -//│ 'd :> Var -//│ <: 'b & (Abs[?] & 'c | 'lhs & (Abs[?] & 'c & ~#Abs | 'lhs0 & (Numb & {name: string} | {name: string} & ~#Abs & ~#Numb))) -//│ 'e :> Mul['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} | Add['rhs]\lhs\rhs & {lhs: 'rhs, rhs: 'rhs} -//│ <: 'b & (Abs[?] & {lhs: anything, rhs: anything} & 'c | 'lhs & (Abs[?] & {lhs: anything, rhs: anything} & 'c & ~#Abs | 'lhs0 & (Numb & {lhs: anything, rhs: anything} | {lhs: anything, rhs: anything} & ~#Abs & ~#Numb))) -//│ 'c <: {body: 'b, name: string} +//│ 'tail4 <: Cons[?] & 'd | Nil +//│ 'd <: {head: {_1: string, _2: 'result}, tail: 'tail4} +//│ 'tail3 <: Cons[?] & 'c | Nil +//│ 'c <: {head: {_1: string, _2: 'result0}, tail: 'tail3} +//│ 'tail2 <: Cons[?] & 'b | Nil +//│ 'b <: {head: {_1: string, _2: 'result0}, tail: 'tail2} +//│ 'tail1 <: Cons[?] & 'g | Nil +//│ 'g <: {head: {_1: string, _2: 'result0}, tail: 'tail1} +//│ 'tail0 <: Cons[?] & 'f | Nil +//│ 'f <: {head: {_1: string, _2: 'result}, tail: 'tail0} +//│ 'tail <: Cons[?] & 'e | Nil +//│ 'e <: {head: {_1: string, _2: 'result}, tail: 'tail} +//│ 'result :> Var | 'i | Numb +//│ <: Abs[?] & 'j & 'k & 'l | 'lhs & 'lhs0 & (Add[?] & 'm | App[?] & 'n | Mul[?] & 'o | Var & 'p | 'q & (Numb | Numb & ~#Numb)) +//│ 'i :> 'result0 | 'r | Abs['i] | App['a]\lhs\rhs & {lhs: 'lhs0, rhs: 'rhs} | 'result | 's | Add['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | Mul['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | App['a0]\lhs\rhs & {lhs: 'lhs, rhs: 'rhs0} +//│ 'result0 :> 'i +//│ <: Abs[?] & 'j & 'k & 'l | 'lhs0 & (Abs[?] & 'k & 'l & ~#Abs | 'lhs & (Add[?] & 'm | App[?] & 'n | Mul[?] & 'o | Var & 'p | 'q & (Numb | Numb & ~#Numb))) +//│ 'j <: {body: 'h, name: string} +//│ 'h <: Abs[?] & 'k | Add[?] & 'm | App[?] & 'n | Mul[?] & 'o | Numb & 'q | Var & 'p +//│ 'k <: Abs[?] & {body: 'h} | App[?] & {lhs: 'h, rhs: 'h} | Var & 'r +//│ 'r :> Var +//│ <: Abs[?] & 'j & 'k & 'l | 'lhs0 & (Abs[?] & 'k & 'l & ~#Abs | 'lhs & (Add[?] & {name: string} & 'm | App[?] & {name: string} & 'n | Mul[?] & {name: string} & 'o | Var & 'p | 'q & (Numb & {name: string} | Numb & {name: string} & ~#Numb))) +//│ 'm <: Add[?] & {lhs: 'h, rhs: 'h} | Mul[?] & {lhs: 'h, rhs: 'h} | Numb & 'result | Var & 's +//│ 's <: Var & (Abs[?] & 'j & 'k & 'l | 'lhs & 'lhs0 & (Add[?] & {name: string} & 'm | App[?] & {name: string} & 'n | Mul[?] & {name: string} & 'o | Var & 'p | 'q & (Numb & {name: string} | Numb & {name: string} & ~#Numb))) +//│ 'q <: Add[?] & {lhs: 'h, rhs: 'h} | Mul[?] & {lhs: 'h, rhs: 'h} | Numb & 'result | Var & 's +//│ 'p <: Var & 'r +//│ 'o <: Add[?] & {lhs: 'h, rhs: 'h} | Mul[?] & {lhs: 'h, rhs: 'h} | Numb & 'result | Var & 's +//│ 'n <: Abs[?] & {body: 'h} | App[?] & {lhs: 'h, rhs: 'h} | Var & 'r +//│ 'lhs0 :> Add['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | App['a0 | 'a]\lhs\rhs & {lhs: 'lhs0 | 'lhs, rhs: 'rhs0 | 'rhs} | Mul['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | Numb | Var +//│ <: 'h & 'a +//│ 'a0 :> Add['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | App['a0 | 'a]\lhs\rhs & {lhs: 'lhs0 | 'lhs, rhs: 'rhs0 | 'rhs} | Mul['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | 'i +//│ 'a :> Add['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | App['a0 | 'a]\lhs\rhs & {lhs: 'lhs0 | 'lhs, rhs: 'rhs0 | 'rhs} | Mul['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | 'i +//│ 'lhs :> Add['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | App['a0 | 'a]\lhs\rhs & {lhs: 'lhs0 | 'lhs, rhs: 'rhs0 | 'rhs} | Mul['i]\lhs\rhs & {lhs: 'i, rhs: 'i} | Numb | Var +//│ <: 'h & 'a0 +//│ 'rhs :> 'i +//│ 'rhs0 :> 'i +//│ 'l <: {body: 'h, name: string} //│ = //│ eval_lexpr', eval_var, list_assoc and eq are not implemented //│ constrain calls : 16185 //│ annoying calls : 2300 -//│ subtyping calls : 587191 +//│ subtyping calls : 602211 :ResetFuel eval4 Nil (Abs { name = "s"; body = Add { lhs = Var { name = "s" }; rhs = Numb { num = 1 } } }) -//│ res: 'result +//│ res: 'b //│ where -//│ 'result :> Var | Abs['result] | (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | 'b -//│ 'a :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'result | 'b -//│ 'lhs :> (App['a] with {lhs: 'lhs, rhs: 'result}) | Numb | Var | 'b -//│ 'b :> Add['result] | Mul['result] +//│ 'b :> Var | Abs['b] | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | Numb | (Add['b] with {lhs: 'b, rhs: 'b}) | (Mul['b] with {lhs: 'b, rhs: 'b}) +//│ 'a :> 'lhs | 'b +//│ 'lhs :> (Add['b] with {lhs: 'b, rhs: 'b}) | (App['a] with {lhs: 'lhs, rhs: 'rhs}) | (Mul['b] with {lhs: 'b, rhs: 'b}) | Numb | Var +//│ 'rhs :> 'b //│ = //│ eval4, eval_lexpr', eval_var, list_assoc and eq are not implemented diff --git a/shared/src/test/diff/mlscript/RecErrors.mls b/shared/src/test/diff/mlscript/RecErrors.mls index 8e5bd7244..06849f7e7 100644 --- a/shared/src/test/diff/mlscript/RecErrors.mls +++ b/shared/src/test/diff/mlscript/RecErrors.mls @@ -57,7 +57,7 @@ rec def lefts() = //│ ╙── ^^^^^^^ //│ lefts: () -> 'a //│ where -//│ 'a :> Left with {v: 'a} +//│ 'a :> Left & {v: forall 'a. 'a} diff --git a/shared/src/test/diff/mlscript/RecursiveTypes.mls b/shared/src/test/diff/mlscript/RecursiveTypes.mls index 4a8abfc9d..6bcef07a2 100644 --- a/shared/src/test/diff/mlscript/RecursiveTypes.mls +++ b/shared/src/test/diff/mlscript/RecursiveTypes.mls @@ -141,33 +141,27 @@ if true then l else r rec def l (a: int) b = if true then l else b rec def r (a: int) b c = if true then r else if true then b else c -//│ l: 'l +//│ l: int -> 'a -> 'a //│ where -//│ 'l :> int -> 'a -> 'a -//│ 'a :> 'l +//│ 'a :> int -> 'a -> 'a //│ = [Function: l4] -//│ r: 'r +//│ r: int -> 'a -> 'a -> 'a //│ where -//│ 'r :> int -> 'a -> 'a -> 'a -//│ 'a :> 'r +//│ 'a :> int -> 'a -> 'a -> 'a //│ = [Function: r5] if true then l else r -//│ res: 'l | 'r +//│ res: int -> ('a & 'b) -> ('a -> 'a | 'b) //│ where -//│ 'r :> int -> 'a -> 'a -> 'a -//│ 'a :> 'r -//│ 'l :> int -> 'b -> 'b -//│ 'b :> 'l +//│ 'b :> int -> 'b -> 'b +//│ 'a :> int -> 'a -> 'a -> 'a //│ = [Function: l4] if true then l else r -//│ res: 'l | 'r +//│ res: int -> ('a & 'b) -> ('a -> 'a | 'b) //│ where -//│ 'r :> int -> 'a -> 'a -> 'a -//│ 'a :> 'r -//│ 'l :> int -> 'b -> 'b -//│ 'b :> 'l +//│ 'b :> int -> 'b -> 'b +//│ 'a :> int -> 'a -> 'a -> 'a //│ = [Function: l4] @@ -206,11 +200,11 @@ class C[A]: { a: A } :ns rec def foo (c: C['a]) = foo (c.a) -//│ foo: forall 'a 'b 'foo 'a0. 'foo +//│ foo: forall 'foo 'a 'a0 'b. 'foo //│ where -//│ 'foo := C['a0] -> 'b -//│ 'a0 <: 'a -//│ 'a <: C['a0] +//│ 'foo := C['a] -> 'b +//│ 'a <: 'a0 +//│ 'a0 <: C['a] foo //│ res: 'a -> nothing @@ -358,16 +352,16 @@ bar2_ty2 = bar_ty2 //│ where //│ 'r :> {x: 'r} //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.352: bar2_ty2 = bar_ty2 +//│ ║ l.346: bar2_ty2 = bar_ty2 //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── type `forall 'r. 'r` does not match type `{x: 'r0}` -//│ ║ l.285: def bar_ty2: C['r] as 'r +//│ ║ l.279: def bar_ty2: C['r] as 'r //│ ║ ^^^^^ //│ ╟── but it flows into reference with expected type `{x: 'r1}` -//│ ║ l.352: bar2_ty2 = bar_ty2 +//│ ║ l.346: bar2_ty2 = bar_ty2 //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from record type: -//│ ║ l.332: def bar2_ty2: { x: 'r } as 'r +//│ ║ l.326: def bar2_ty2: { x: 'r } as 'r //│ ╙── ^^^^^^^^^ :e @@ -380,16 +374,16 @@ bar_ty2 = bar2_ty2 //│ where //│ 'r :> C['r] //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.374: bar_ty2 = bar2_ty2 +//│ ║ l.368: bar_ty2 = bar2_ty2 //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── type `{x: 'r}` is not an instance of type `C` -//│ ║ l.332: def bar2_ty2: { x: 'r } as 'r +//│ ║ l.326: def bar2_ty2: { x: 'r } as 'r //│ ║ ^^^^^^^^^ //│ ╟── but it flows into reference with expected type `C[?]` -//│ ║ l.374: bar_ty2 = bar2_ty2 +//│ ║ l.368: bar_ty2 = bar2_ty2 //│ ║ ^^^^^^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.285: def bar_ty2: C['r] as 'r +//│ ║ l.279: def bar_ty2: C['r] as 'r //│ ╙── ^^^^^ @@ -411,17 +405,17 @@ f 1 :ns rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x -//│ f: forall 'a 'b 'c 'f 'd 'e 'g. 'f +//│ f: forall 'b 'a 'c 'd 'e 'g 'f. 'f //│ where -//│ 'f := 'b -> 'c +//│ 'f := 'b -> 'd //│ 'b :> 'b\a & {a: 'e} -//│ <: ({a: 'a} | ~{a: 'e} | ~{})\a & ({a: 'a} | ~{a: 'e})\a & (number | ~{a: 'e} | ~{})\a & (number | ~{a: 'e})\a & (int | ~{a: 'e} | ~{})\a & (int | ~{a: 'e})\a & 'd & int & number -//│ 'a <: 'd +//│ <: ({a: 'a} | ~{a: 'e} | ~{})\a & ({a: 'a} | ~{a: 'e})\a & (number | ~{a: 'e} | ~{})\a & (number | ~{a: 'e})\a & (int | ~{a: 'e} | ~{})\a & (int | ~{a: 'e})\a & 'g & int & number +//│ 'a <: 'g +//│ 'g :> 'b\a & {a: 'e} +//│ <: 'd //│ 'd :> 'b\a & {a: 'e} //│ <: 'c //│ 'c :> 'b\a & {a: 'e} -//│ <: 'g -//│ 'g :> 'b\a & {a: 'e} //│ <: {a: 'a} //│ 'e :> int @@ -429,10 +423,9 @@ f //│ res: 'a -> 'b //│ where //│ 'a :> 'a\a & {a: int} -//│ <: int & (int | ~{a: int})\a & (number | ~{a: int})\a & ('c | ~{a: int})\a & 'b -//│ 'c <: {a: 'b} +//│ <: int & (int | ~{a: int})\a & (number | ~{a: int})\a & ({a: 'b} | ~{a: int})\a & 'b //│ 'b :> 'a\a & {a: int} -//│ <: 'c +//│ <: {a: 'b} // Notice how what is most likely an the error is reported in call sites, // due to the delaying effect of the field removal type... @@ -442,13 +435,13 @@ f :e f 1 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.443: f 1 +//│ ║ l.436: f 1 //│ ║ ^^^ //│ ╟── operator application of type `int` does not have field 'a' -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ║ ^^^^^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: error | int | 'a\a & {a: int} //│ where @@ -457,13 +450,13 @@ f 1 :e f { a = 1 } //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.458: f { a = 1 } +//│ ║ l.451: f { a = 1 } //│ ║ ^^^^^^^^^^^ //│ ╟── operator application of type `int` does not have field 'a' -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ║ ^^^^^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: error @@ -480,13 +473,13 @@ f ainf //│ where //│ 'ainf :> {a: 'ainf} //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.478: f ainf +//│ ║ l.471: f ainf //│ ║ ^^^^^^ //│ ╟── operator application of type `int` does not have field 'a' -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ║ ^^^^^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: error @@ -497,13 +490,13 @@ f infina //│ where //│ 'infina :> 0 & {a: 'infina} //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.495: f infina +//│ ║ l.488: f infina //│ ║ ^^^^^^^^ //│ ╟── operator application of type `int` does not have field 'a' -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ║ ^^^^^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.413: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x +//│ ║ l.407: rec def f x = if x > 0 then (f (x with { a = x - 1 })).a else x //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: error | int | 'infina | 'a\a & {a: int} //│ where @@ -520,16 +513,16 @@ def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as :e f_manual 1 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.521: f_manual 1 +//│ ║ l.514: f_manual 1 //│ ║ ^^^^^^^^^^ //│ ╟── integer literal of type `1` does not have field 'a' -//│ ║ l.521: f_manual 1 +//│ ║ l.514: f_manual 1 //│ ║ ^ //│ ╟── Note: constraint arises from record type: -//│ ║ l.514: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) +//│ ║ l.507: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) //│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── from intersection type: -//│ ║ l.514: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) +//│ ║ l.507: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: error | 'e //│ where @@ -538,16 +531,16 @@ f_manual 1 :e f_manual { a = 1 } //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.539: f_manual { a = 1 } +//│ ║ l.532: f_manual { a = 1 } //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── integer literal of type `1` does not have field 'a' -//│ ║ l.539: f_manual { a = 1 } +//│ ║ l.532: f_manual { a = 1 } //│ ║ ^ //│ ╟── Note: constraint arises from record type: -//│ ║ l.514: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) +//│ ║ l.507: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) //│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── from intersection type: -//│ ║ l.514: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) +//│ ║ l.507: def f_manual: (({a: 'b & 'a & 'c} as 'a) & 'd) -> ('c | ('d | 'e\a & {a: int} as 'e)) //│ ╙── ^^^^^^^^^^^^ //│ res: 1 | error | 'e //│ where @@ -570,26 +563,26 @@ f_manual ainf // Notice the simplified type is NOT the same as that of `f`... def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) -//│ f_manual_ns: in forall 'd 'c 'b 'f 'c0. ('f & 'b & (int & ~{a: int} | (int & 'c)\a & 'c0\a & int)) -> ('b | 'd) out forall 'd 'c 'b 'f 'c0. ((int & 'c & 'c0 | ~{a: int})\a & int & 'b & 'f) -> ('b | 'd) +//│ f_manual_ns: in forall 'd 'b 'c 'c0 'f. ('b & 'f & (int & ~{a: int} | (int & 'c0)\a & 'c\a & int)) -> ('b | 'd) out forall 'd 'b 'c 'c0 'f. ((int & 'c0 & 'c | ~{a: int})\a & int & 'b & 'f) -> ('b | 'd) //│ where -//│ 'c0 <: {a: 'd & 'c0} -//│ 'c <: {a: 'c & 'd} -//│ 'b :> 'b\a & {a: int} +//│ 'c <: {a: 'd & 'c} +//│ 'c0 <: {a: 'c0 & 'd} //│ 'f <: {a: 'f} +//│ 'b :> 'b\a & {a: int} :e f_manual_ns ainf //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.581: f_manual_ns ainf +//│ ║ l.574: f_manual_ns ainf //│ ║ ^^^^^^^^^^^^^^^^ //│ ╟── type `int` does not have field 'a' -//│ ║ l.572: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) +//│ ║ l.565: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) //│ ║ ^^^ //│ ╟── Note: constraint arises from record type: -//│ ║ l.572: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) +//│ ║ l.565: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) //│ ║ ^^^^^^^^^^^^ //│ ╟── from local type binding: -//│ ║ l.572: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) +//│ ║ l.565: def f_manual_ns: 'a | ('b & (({a: 'd & 'c} as 'c) | ~{a: 'e | int} | ~{})\a & (({a: 'd & 'c} as 'c) | ~{a: 'e | int})\a & (({a: 'f} as 'c) as 'f) & (int | ~{a: 'e | int} | ~{})\a & (int | ~{a: 'e | int})\a & int & int) -> ('g | 'd | ('b | 'h\a & {a: 'e | int} as 'h)) //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ res: error @@ -630,13 +623,13 @@ r + 1 :e r.a //│ ╔══[ERROR] Type mismatch in field selection: -//│ ║ l.631: r.a +//│ ║ l.624: r.a //│ ║ ^^^ //│ ╟── integer literal of type `1` does not have field 'a' -//│ ║ l.622: r = f 1 +//│ ║ l.615: r = f 1 //│ ║ ^ //│ ╟── but it flows into reference with expected type `{a: ?a}` -//│ ║ l.631: r.a +//│ ║ l.624: r.a //│ ╙── ^ //│ res: error | int diff --git a/shared/src/test/diff/mlscript/Repro.mls b/shared/src/test/diff/mlscript/Repro.mls index e69de29bb..539c23787 100644 --- a/shared/src/test/diff/mlscript/Repro.mls +++ b/shared/src/test/diff/mlscript/Repro.mls @@ -0,0 +1,3 @@ +:NewDefs + + diff --git a/shared/src/test/diff/mlscript/RigidVariables.mls b/shared/src/test/diff/mlscript/RigidVariables.mls new file mode 100644 index 000000000..ad93234d2 --- /dev/null +++ b/shared/src/test/diff/mlscript/RigidVariables.mls @@ -0,0 +1,71 @@ + + +:e +def foo[AAA]: AAA -> AAA +def foo(x) = x.a +//│ foo: 'a -> 'a +//│ = +//│ {a: 'a} -> 'a +//│ <: foo: +//│ 'a -> 'a +//│ ╔══[ERROR] Type mismatch in def definition: +//│ ║ l.5: def foo(x) = x.a +//│ ║ ^^^^^^^^^^^^^^^^ +//│ ╟── expression of type `?a` does not have field 'a' +//│ ╟── Note: constraint arises from field selection: +//│ ║ l.5: def foo(x) = x.a +//│ ║ ^^^ +//│ ╟── from reference: +//│ ║ l.5: def foo(x) = x.a +//│ ╙── ^ +//│ = [Function: foo] + +:e +class Test0 + method Foo0[AAA]: AAA -> AAA + method Foo0(x) = x.a +//│ ╔══[ERROR] Type mismatch in method definition: +//│ ║ l.26: method Foo0(x) = x.a +//│ ║ ^^^^^^^^^^^^^ +//│ ╟── type `AAA` does not have field 'a' +//│ ║ l.25: method Foo0[AAA]: AAA -> AAA +//│ ║ ^^^ +//│ ╟── Note: constraint arises from field selection: +//│ ║ l.26: method Foo0(x) = x.a +//│ ║ ^^^ +//│ ╟── from reference: +//│ ║ l.26: method Foo0(x) = x.a +//│ ╙── ^ +//│ Defined class Test0 +//│ Declared Test0.Foo0: Test0 -> 'AAA -> 'AAA +//│ Defined Test0.Foo0: Test0 -> {a: 'a} -> 'a + +class Test1 + method Foo1[AAA]: (AAA & {a: int}) -> int + method Foo1(x) = x.a +//│ Defined class Test1 +//│ Declared Test1.Foo1: Test1 -> {a: int} -> int +//│ Defined Test1.Foo1: Test1 -> {a: 'a} -> 'a + +:e +(Test1{}).Foo1({x=1}) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.51: (Test1{}).Foo1({x=1}) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── record literal of type `{x: 1}` does not have field 'a' +//│ ║ l.51: (Test1{}).Foo1({x=1}) +//│ ║ ^^^^^ +//│ ╟── Note: constraint arises from record type: +//│ ║ l.44: method Foo1[AAA]: (AAA & {a: int}) -> int +//│ ║ ^^^^^^^^ +//│ ╟── from intersection type: +//│ ║ l.44: method Foo1[AAA]: (AAA & {a: int}) -> int +//│ ╙── ^^^^^^^^^^^^^^^^ +//│ res: error | int +//│ = undefined + +(Test1{}).Foo1({a=1}) +//│ res: int +//│ = 1 + + diff --git a/shared/src/test/diff/mlscript/Sequence.mls b/shared/src/test/diff/mlscript/Sequence.mls new file mode 100644 index 000000000..919c7251b --- /dev/null +++ b/shared/src/test/diff/mlscript/Sequence.mls @@ -0,0 +1,26 @@ +:NewDefs + + +let test(x) = log(x); x + 1 +//│ let test: Int -> Int +//│ test +//│ = [Function: test] + +test(log("here we go"); 123) +//│ Int +//│ res +//│ = 124 +//│ // Output +//│ here we go +//│ 123 + + +let a = 1;; let b = a + 1 +//│ let a: 1 +//│ let b: Int +//│ a +//│ = 1 +//│ b +//│ = 2 + + diff --git a/shared/src/test/diff/mlscript/Yicong.mls b/shared/src/test/diff/mlscript/Yicong.mls index 29ffa70c4..a1b4e2a76 100644 --- a/shared/src/test/diff/mlscript/Yicong.mls +++ b/shared/src/test/diff/mlscript/Yicong.mls @@ -151,7 +151,9 @@ gwx.x with {y = gwx} //│ = [ 6, 6, 6 ] //│ gwx: Array["hello" | 1 | 2 | 3 | 4 | 6 | false | true] & {_1: 1 | 6 | true, _2: 2 | 4 | 6, _3: 3 | 6 | false, x: 123} //│ = [ 6, 6, 6, x: 123 ] -//│ res: 123 & {y: Array["hello" | 1 | 2 | 3 | 4 | 6 | false | true] & {_1: 1 | 6 | true, _2: 2 | 4 | 6, _3: 3 | 6 | false, x: 123}} +//│ res: 123 & { +//│ y: Array["hello" | 1 | 2 | 3 | 4 | 6 | false | true] & {_1: 1 | 6 | true, _2: 2 | 4 | 6, _3: 3 | 6 | false, x: 123} +//│ } //│ = [Number: 123] { y: [ 6, 6, 6, x: 123 ] } def f: (int, bool) -> int @@ -183,10 +185,10 @@ def h f = (f (1,2,false), f (1,true)) :e h (fun x -> x[0]) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.184: h (fun x -> x[0]) +//│ ║ l.186: h (fun x -> x[0]) //│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── argument list of type `(1, true,)` does not match type `(?a,)` -//│ ║ l.179: def h f = (f (1,2,false), f (1,true)) +//│ ║ l.181: def h f = (f (1,2,false), f (1,true)) //│ ╙── ^^^^^^^^ //│ res: error | (undefined, undefined,) //│ = [ undefined, undefined ] @@ -194,13 +196,13 @@ h (fun x -> x[0]) :e h (fun (x, y) -> x) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.195: h (fun (x, y) -> x) +//│ ║ l.197: h (fun (x, y) -> x) //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── argument list of type `(1, 2, false,)` does not match type `(?a, ?b,)` -//│ ║ l.179: def h f = (f (1,2,false), f (1,true)) +//│ ║ l.181: def h f = (f (1,2,false), f (1,true)) //│ ║ ^^^^^^^^^^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.195: h (fun (x, y) -> x) +//│ ║ l.197: h (fun (x, y) -> x) //│ ╙── ^^^^^^ //│ res: error | (nothing, 1,) //│ = [ 1, 1 ] @@ -231,30 +233,30 @@ fx ((a,b,c)) = a + b + c fx q1 fx q2 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.231: fx q1 +//│ ║ l.233: fx q1 //│ ║ ^^^^^ //│ ╟── tuple literal of type `(1, 1, 1, 1,)` does not match type `(?a, ?b, ?c,)` -//│ ║ l.220: q1 = (1,1,1,1) +//│ ║ l.222: q1 = (1,1,1,1) //│ ║ ^^^^^^^^^ //│ ╟── but it flows into reference with expected type `(?d, ?e, ?f,)` -//│ ║ l.231: fx q1 +//│ ║ l.233: fx q1 //│ ║ ^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.222: fx ((a,b,c)) = a + b + c +//│ ║ l.224: fx ((a,b,c)) = a + b + c //│ ╙── ^^^^^^^ //│ res: error | int //│ = 3 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.232: fx q2 +//│ ║ l.234: fx q2 //│ ║ ^^^^^ //│ ╟── tuple literal of type `(1, 1,)` does not match type `(?a, ?b, ?c,)` -//│ ║ l.221: q2 = (1,1) +//│ ║ l.223: q2 = (1,1) //│ ║ ^^^^^ //│ ╟── but it flows into reference with expected type `(?d, ?e, ?f,)` -//│ ║ l.232: fx q2 +//│ ║ l.234: fx q2 //│ ║ ^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.222: fx ((a,b,c)) = a + b + c +//│ ║ l.224: fx ((a,b,c)) = a + b + c //│ ╙── ^^^^^^^ //│ res: error | int //│ = NaN @@ -284,13 +286,13 @@ sum t2 //│ t2: (1, 1, 2, true,) //│ = [ 1, 1, 2, true ] //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.283: sum t2 +//│ ║ l.285: sum t2 //│ ║ ^^^^^^ //│ ╟── reference of type `true` is not an instance of type `int` -//│ ║ l.282: t2 = (1,1,2,true) +//│ ║ l.284: t2 = (1,1,2,true) //│ ║ ^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.270: def sum: Array[int] -> int +//│ ║ l.272: def sum: Array[int] -> int //│ ╙── ^^^ //│ res: error | int //│ = @@ -337,23 +339,23 @@ a1._2 //│ <: a1: //│ Array[int] //│ ╔══[ERROR] Type mismatch in def definition: -//│ ║ l.332: a1 = (1,2,true,'hello') +//│ ║ l.334: a1 = (1,2,true,'hello') //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `true` is not an instance of type `int` -//│ ║ l.332: a1 = (1,2,true,'hello') +//│ ║ l.334: a1 = (1,2,true,'hello') //│ ║ ^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.331: def a1: Array[int] +//│ ║ l.333: def a1: Array[int] //│ ╙── ^^^ //│ = [ 1, 2, true, 'hello' ] //│ ╔══[ERROR] Type mismatch in field selection: -//│ ║ l.333: a1._2 +//│ ║ l.335: a1._2 //│ ║ ^^^^^ //│ ╟── type `Array[int]` does not have field '_2' -//│ ║ l.331: def a1: Array[int] +//│ ║ l.333: def a1: Array[int] //│ ║ ^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `{_2: ?a}` -//│ ║ l.333: a1._2 +//│ ║ l.335: a1._2 //│ ╙── ^^ //│ res: error //│ = undefined @@ -400,13 +402,13 @@ append2 ((mut 1, mut 2, mut false)) ((mut (), mut 'hi')) :e append2 ((mut 1, mut 2, mut false)) ((mut (), 'hi')) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.401: append2 ((mut 1, mut 2, mut false)) ((mut (), 'hi')) +//│ ║ l.403: append2 ((mut 1, mut 2, mut false)) ((mut (), 'hi')) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── tuple literal of type `(mut ?a, "hi",)` does not match type `MutArray['bb]` -//│ ║ l.401: append2 ((mut 1, mut 2, mut false)) ((mut (), 'hi')) +//│ ║ l.403: append2 ((mut 1, mut 2, mut false)) ((mut (), 'hi')) //│ ║ ^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.384: def append2: MutArray['aa] -> MutArray['bb] -> MutArray['aa | 'bb] +//│ ║ l.386: def append2: MutArray['aa] -> MutArray['bb] -> MutArray['aa | 'bb] //│ ╙── ^^^^^^^^^^^^^ //│ res: error | MutArray['aa | 'bb] //│ where @@ -513,31 +515,31 @@ iarr = intersect ((1,2,3,false)) ((1,5,true,'hi',false)) fst iarr snd (T1 ((1,2,3))) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.513: fst iarr +//│ ║ l.515: fst iarr //│ ║ ^^^^^^^^ //│ ╟── type `Array['a & 'b]` is not a 2-element tuple -//│ ║ l.504: def intersect: Array['a] -> Array['b] -> Array['a & 'b] +//│ ║ l.506: def intersect: Array['a] -> Array['b] -> Array['a & 'b] //│ ║ ^^^^^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `(?a, ?b,)` -//│ ║ l.513: fst iarr +//│ ║ l.515: fst iarr //│ ║ ^^^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.483: def fst ((a, b)) = a +//│ ║ l.485: def fst ((a, b)) = a //│ ╙── ^^^^^^ //│ res: error //│ = //│ iarr and intersect are not implemented //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.514: snd (T1 ((1,2,3))) +//│ ║ l.516: snd (T1 ((1,2,3))) //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── tuple literal of type `(1, 2, 3,)` does not match type `(?a, ?b,) | ~#T1` -//│ ║ l.514: snd (T1 ((1,2,3))) +//│ ║ l.516: snd (T1 ((1,2,3))) //│ ║ ^^^^^^^ //│ ╟── but it flows into application with expected type `(?a, ?b,) | ~#T1` -//│ ║ l.514: snd (T1 ((1,2,3))) +//│ ║ l.516: snd (T1 ((1,2,3))) //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.484: def snd ((a, b)) = b +//│ ║ l.486: def snd ((a, b)) = b //│ ╙── ^^^^^^ //│ res: error //│ = 2 @@ -587,28 +589,28 @@ inn2 (T2 r1) inn (T1 v3) inn2 v1 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.587: inn (T1 v3) +//│ ║ l.589: inn (T1 v3) //│ ║ ^^^^^^^^^^^ //│ ╟── type `Array[Array[(int, true,)]]` does not match type `#T2 | ~#T1` -//│ ║ l.551: def v3: Array[Array[(int, true)]] +//│ ║ l.553: def v3: Array[Array[(int, true)]] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `#T2 | ~#T1` -//│ ║ l.587: inn (T1 v3) +//│ ║ l.589: inn (T1 v3) //│ ║ ^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.547: def inn: (T1 & T2 & Array['a]) -> 'a +//│ ║ l.549: def inn: (T1 & T2 & Array['a]) -> 'a //│ ║ ^^ //│ ╟── from intersection type: -//│ ║ l.547: def inn: (T1 & T2 & Array['a]) -> 'a +//│ ║ l.549: def inn: (T1 & T2 & Array['a]) -> 'a //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ res: error | Array[(int, true,)] //│ = //│ inn is not implemented //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.588: inn2 v1 +//│ ║ l.590: inn2 v1 //│ ║ ^^^^^^^ //│ ╟── integer literal of type `1` does not match type `Array['a]` -//│ ║ l.545: v1 = T1 (T2 ((1,2,true))) +//│ ║ l.547: v1 = T1 (T2 ((1,2,true))) //│ ╙── ^ //│ res: error | Array[nothing] //│ = @@ -642,16 +644,16 @@ ra: (Array['a], Array['a]) as 'a ra: ('a, 'a, 'a) as 'a ra: (Array['a], Array['a], Array['a]) as 'a //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.642: ra: ('a, 'a, 'a) as 'a +//│ ║ l.644: ra: ('a, 'a, 'a) as 'a //│ ║ ^^ //│ ╟── type `('a, 'a,)` does not match type `('a0, 'a0, 'a0,)` -//│ ║ l.617: def ra: ('a, 'a) as 'a +//│ ║ l.619: def ra: ('a, 'a) as 'a //│ ║ ^^^^^^^^ //│ ╟── but it flows into reference with expected type `('a1, 'a1, 'a1,)` -//│ ║ l.642: ra: ('a, 'a, 'a) as 'a +//│ ║ l.644: ra: ('a, 'a, 'a) as 'a //│ ║ ^^ //│ ╟── Note: constraint arises from tuple type: -//│ ║ l.642: ra: ('a, 'a, 'a) as 'a +//│ ║ l.644: ra: ('a, 'a, 'a) as 'a //│ ╙── ^^^^^^^^^^^^ //│ res: 'a //│ where @@ -659,16 +661,16 @@ ra: (Array['a], Array['a], Array['a]) as 'a //│ = //│ ra is not implemented //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.643: ra: (Array['a], Array['a], Array['a]) as 'a +//│ ║ l.645: ra: (Array['a], Array['a], Array['a]) as 'a //│ ║ ^^ //│ ╟── type `('a, 'a,)` does not match type `(Array['a0], Array['a0], Array['a0],)` -//│ ║ l.617: def ra: ('a, 'a) as 'a +//│ ║ l.619: def ra: ('a, 'a) as 'a //│ ║ ^^^^^^^^ //│ ╟── but it flows into reference with expected type `(Array['a1], Array['a1], Array['a1],)` -//│ ║ l.643: ra: (Array['a], Array['a], Array['a]) as 'a +//│ ║ l.645: ra: (Array['a], Array['a], Array['a]) as 'a //│ ║ ^^ //│ ╟── Note: constraint arises from tuple type: -//│ ║ l.643: ra: (Array['a], Array['a], Array['a]) as 'a +//│ ║ l.645: ra: (Array['a], Array['a], Array['a]) as 'a //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ res: 'a //│ where @@ -686,19 +688,19 @@ tktup ((1,2,3,true)) :e tktup a123 //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.687: tktup a123 +//│ ║ l.689: tktup a123 //│ ║ ^^^^^^^^^^ //│ ╟── type `Array[int]` does not have field '_3' -//│ ║ l.362: def a123: Array[int] +//│ ║ l.364: def a123: Array[int] //│ ║ ^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `{_3: ?a}` -//│ ║ l.687: tktup a123 +//│ ║ l.689: tktup a123 //│ ║ ^^^^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.679: def tktup t = (t._2, t._3) +//│ ║ l.681: def tktup t = (t._2, t._3) //│ ║ ^^^^ //│ ╟── from reference: -//│ ║ l.679: def tktup t = (t._2, t._3) +//│ ║ l.681: def tktup t = (t._2, t._3) //│ ╙── ^ //│ res: error | (nothing, nothing,) //│ = [ undefined, undefined ] @@ -749,10 +751,10 @@ ta3[1-2] :e ((defined ta2[0])[1+4], ta[1])[0] //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.750: ((defined ta2[0])[1+4], ta[1])[0] +//│ ║ l.752: ((defined ta2[0])[1+4], ta[1])[0] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── possibly-undefined array access of type `undefined` does not match type `~undefined` -//│ ║ l.750: ((defined ta2[0])[1+4], ta[1])[0] +//│ ║ l.752: ((defined ta2[0])[1+4], ta[1])[0] //│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ res: error | false | int | true | undefined //│ = undefined @@ -766,53 +768,53 @@ ge[2] //│ ge: int -> int //│ = [Function: ge] //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.762: ta3[ge 3][ge (1+2)] +//│ ║ l.764: ta3[ge 3][ge (1+2)] //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── string literal of type `"hello"` does not match type `Array[?a]` -//│ ║ l.731: ta3 = ((1,2,3), "hello", false) +//│ ║ l.733: ta3 = ((1,2,3), "hello", false) //│ ║ ^^^^^^^ //│ ╟── but it flows into array access with expected type `Array[?b]` -//│ ║ l.762: ta3[ge 3][ge (1+2)] +//│ ║ l.764: ta3[ge 3][ge (1+2)] //│ ╙── ^^^^^^^^^ //│ res: 1 | 2 | 3 | error | undefined //│ Runtime error: //│ TypeError: Cannot read properties of undefined (reading '4') //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.763: true[false] +//│ ║ l.765: true[false] //│ ║ ^^^^^^^^^^^ //│ ╟── reference of type `false` is not an instance of type `int` -//│ ║ l.763: true[false] +//│ ║ l.765: true[false] //│ ╙── ^^^^^ //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.763: true[false] +//│ ║ l.765: true[false] //│ ║ ^^^^^^^^^^^ //│ ╟── reference of type `true` does not match type `Array[?a]` -//│ ║ l.763: true[false] +//│ ║ l.765: true[false] //│ ╙── ^^^^ //│ res: error | undefined //│ = undefined //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.764: 4["hello"] +//│ ║ l.766: 4["hello"] //│ ║ ^^^^^^^^^^ //│ ╟── string literal of type `"hello"` is not an instance of type `int` -//│ ║ l.764: 4["hello"] +//│ ║ l.766: 4["hello"] //│ ╙── ^^^^^^^ //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.764: 4["hello"] +//│ ║ l.766: 4["hello"] //│ ║ ^^^^^^^^^^ //│ ╟── integer literal of type `4` does not match type `Array[?a]` -//│ ║ l.764: 4["hello"] +//│ ║ l.766: 4["hello"] //│ ╙── ^ //│ res: error | undefined //│ = undefined //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.765: ge[2] +//│ ║ l.767: ge[2] //│ ║ ^^^^^ //│ ╟── function of type `?a -> (forall ?b. ?b)` does not match type `Array[?c]` -//│ ║ l.761: def ge x = x + 1 +//│ ║ l.763: def ge x = x + 1 //│ ║ ^^^^^^^^^ //│ ╟── but it flows into reference with expected type `Array[?d]` -//│ ║ l.765: ge[2] +//│ ║ l.767: ge[2] //│ ╙── ^^ //│ res: error | undefined //│ = undefined @@ -839,21 +841,21 @@ mkarr (1,true,"hi")[0] mkarr 3 [ 1] mk1[2 ] //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.839: mkarr 3 [ 1] +//│ ║ l.841: mkarr 3 [ 1] //│ ║ ^^^^^^^ //│ ╟── integer literal of type `3` does not match type `Array[?a]` -//│ ║ l.839: mkarr 3 [ 1] +//│ ║ l.841: mkarr 3 [ 1] //│ ╙── ^ //│ res: Array[error | undefined] //│ = [ undefined, undefined, undefined, undefined, undefined ] //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.840: mk1[2 ] +//│ ║ l.842: mk1[2 ] //│ ║ ^^^^^^^^ //│ ╟── integer literal of type `6` does not match type `Array[?a]` -//│ ║ l.822: mk1 = defined (mkarr 6)[ 0] +//│ ║ l.824: mk1 = defined (mkarr 6)[ 0] //│ ║ ^ //│ ╟── but it flows into reference with expected type `Array[?b]` -//│ ║ l.840: mk1[2 ] +//│ ║ l.842: mk1[2 ] //│ ╙── ^^^ //│ res: error | undefined //│ = undefined @@ -903,13 +905,13 @@ dup (defined ara[1])._1 (defined (defined arb[10])[8])._2 + 1 :e (1,2,3)._1[1] //│ ╔══[ERROR] Type mismatch in array access: -//│ ║ l.904: (1,2,3)._1[1] +//│ ║ l.906: (1,2,3)._1[1] //│ ║ ^^^^^^^^^^^^^ //│ ╟── integer literal of type `1` does not match type `Array[?a]` -//│ ║ l.904: (1,2,3)._1[1] +//│ ║ l.906: (1,2,3)._1[1] //│ ║ ^ //│ ╟── but it flows into field selection with expected type `Array[?b]` -//│ ║ l.904: (1,2,3)._1[1] +//│ ║ l.906: (1,2,3)._1[1] //│ ╙── ^^^^^^^^^^ //│ res: error | undefined //│ Runtime error: diff --git a/shared/src/test/diff/mlscript/Yuheng.mls b/shared/src/test/diff/mlscript/Yuheng.mls index 37faccc86..d3d8d9f9b 100644 --- a/shared/src/test/diff/mlscript/Yuheng.mls +++ b/shared/src/test/diff/mlscript/Yuheng.mls @@ -153,7 +153,10 @@ p = Pair { rhs = Pair { lhs = IntLit { value = 2 }; rhs = IntLit { value = 3 } } } -//│ p: Pair[?, ?] with {lhs: IntLit & {value: 1}, rhs: Pair[?, ?] with {lhs: IntLit & {value: 2}, rhs: IntLit & {value: 3}}} +//│ p: Pair[?, ?] with { +//│ lhs: IntLit & {value: 1}, +//│ rhs: Pair[?, ?] with {lhs: IntLit & {value: 2}, rhs: IntLit & {value: 3}} +//│ } //│ = Pair { //│ lhs: IntLit { value: 1 }, //│ rhs: Pair { lhs: IntLit { value: 2 }, rhs: IntLit { value: 3 } } @@ -191,13 +194,13 @@ ep = eval p class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } //│ Defined class Pair2[±A, ±B] //│ ╔══[WARNING] Type definition Pair2 has bivariant type parameters: -//│ ║ l.191: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } +//│ ║ l.194: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } //│ ║ ^^^^^ //│ ╟── A is irrelevant and may be removed -//│ ║ l.191: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } +//│ ║ l.194: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } //│ ║ ^ //│ ╟── B is irrelevant and may be removed -//│ ║ l.191: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } +//│ ║ l.194: class Pair2[A, B]: Expr[(A, B)] & { lhs: Expr[A]; rhs: Expr[A] } //│ ╙── ^ @@ -266,7 +269,10 @@ p = Pair2 { rhs = Pair2 { lhs = IntLit { value = 2 }; rhs = IntLit { value = 3 } } } -//│ p: Pair2[?, ?] with {lhs: IntLit & {value: 1}, rhs: Pair2[?, ?] with {lhs: IntLit & {value: 2}, rhs: IntLit & {value: 3}}} +//│ p: Pair2[?, ?] with { +//│ lhs: IntLit & {value: 1}, +//│ rhs: Pair2[?, ?] with {lhs: IntLit & {value: 2}, rhs: IntLit & {value: 3}} +//│ } @@ -293,7 +299,7 @@ rec def eval(e) = case e of //│ ║ l.+4: } //│ ║ ^^^ //│ ╟── type `Expr[?]` does not match type `IntLit & ?a | Pair[?, ?] & ?b` -//│ ║ l.273: def eval: Expr['a] -> 'a +//│ ║ l.279: def eval: Expr['a] -> 'a //│ ║ ^^^^^^^^ //│ ╟── Note: constraint arises from reference: //│ ║ l.+1: rec def eval(e) = case e of diff --git a/shared/src/test/diff/nu/AbstractClasses.mls b/shared/src/test/diff/nu/AbstractClasses.mls index 51fc3eb1c..6c78fa993 100644 --- a/shared/src/test/diff/nu/AbstractClasses.mls +++ b/shared/src/test/diff/nu/AbstractClasses.mls @@ -22,7 +22,7 @@ Foo(1) new Foo(1) //│ ╔══[ERROR] Class Foo is abstract and cannot be instantiated //│ ║ l.22: new Foo(1) -//│ ╙── ^^^^^^ +//│ ╙── ^^^^^^^^^^ //│ Foo //│ res //│ = Foo {} @@ -62,12 +62,12 @@ abstract class Bar extends Foo(1) :e module Baz extends Bar Baz.f(1) -//│ ╔══[ERROR] Member `f` is declared in parent but not implemented in `Baz` +//│ ╔══[ERROR] Member `f` is declared (or its declaration is inherited) but is not implemented in `Baz` //│ ║ l.63: module Baz extends Bar //│ ║ ^^^ //│ ╟── Declared here: //│ ║ l.32: fun f: Int -> Int -//│ ╙── ^^^^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^^^^ //│ module Baz extends Bar, Foo { //│ fun f: Int -> Int //│ } @@ -101,18 +101,20 @@ trait T1 { fun x: Int | Bool } :e class C2 extends C1, T1 -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `C2` +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C2` //│ ║ l.103: class C2 extends C1, T1 //│ ║ ^^ //│ ╟── Declared here: //│ ║ l.92: abstract class C1 { fun x: Int | Str } //│ ╙── ^^^^^^^^^^^^ //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: Int //│ } class C2 extends C1, T1 { fun x = 1 } //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: 1 //│ } @@ -123,18 +125,20 @@ abstract class C2 extends C1, T1 :e class C3 extends C2 -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `C3` -//│ ║ l.125: class C3 extends C2 +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C3` +//│ ║ l.127: class C3 extends C2 //│ ║ ^^ //│ ╟── Declared here: //│ ║ l.92: abstract class C1 { fun x: Int | Str } //│ ╙── ^^^^^^^^^^^^ //│ class C3 extends C1, C2, T1 { +//│ constructor() //│ fun x: Int //│ } class C3 extends C2 { fun x = 1 } //│ class C3 extends C1, C2, T1 { +//│ constructor() //│ fun x: 1 //│ } @@ -147,11 +151,11 @@ abstract class C { fun foo1 = this.x } //│ ╔══[ERROR] Unqualified access to virtual member x -//│ ║ l.146: fun foo0 = x +//│ ║ l.150: fun foo0 = x //│ ║ ^^^^^^^^ //│ ╟── Declared here: -//│ ║ l.145: fun x : Int -//│ ╙── ^^^^^^^ +//│ ║ l.149: fun x : Int +//│ ╙── ^^^^^^^^^^^ //│ abstract class C { //│ fun foo0: Int //│ fun foo1: Int @@ -159,21 +163,21 @@ abstract class C { //│ } :e -class C { +abstract class C { val x : Int fun foo0 = x fun foo1 = this.x } //│ ╔══[ERROR] Unqualified access to virtual member x -//│ ║ l.164: fun foo0 = x +//│ ║ l.168: fun foo0 = x //│ ║ ^^^^^^^^ //│ ╟── Declared here: -//│ ║ l.163: val x : Int -//│ ╙── ^^^^^^^ -//│ class C { +//│ ║ l.167: val x : Int +//│ ╙── ^^^^^^^^^^^ +//│ abstract class C { //│ fun foo0: Int //│ fun foo1: Int -//│ let x: Int +//│ val x: Int //│ } diff --git a/shared/src/test/diff/nu/ArrayProg.mls b/shared/src/test/diff/nu/ArrayProg.mls index ee0263af7..b33cb35fa 100644 --- a/shared/src/test/diff/nu/ArrayProg.mls +++ b/shared/src/test/diff/nu/ArrayProg.mls @@ -33,12 +33,12 @@ fun zip(xs, ys) = mapi of xs, (x, i) => if ys.[i] is undefined then error y then [x, y] -//│ fun zip: forall 'c 'd. (Array['c], Array[Object & 'd & ~undefined]) -> Array[['c, 'd]] -//│ fun zip: forall 'a 'b. (Array['a], Array[Object & 'b & ~undefined]) -> Array[['a, 'b]] +//│ fun zip: forall 'c 'd. (Array['c], Array[Object & 'd & ~()]) -> Array[['c, 'd]] +//│ fun zip: forall 'a 'b. (Array['a], Array[Object & 'b & ~()]) -> Array[['a, 'b]] zip -//│ forall 'a 'b. (Array['a], Array[Object & 'b & ~undefined]) -> Array[['a, 'b]] +//│ forall 'a 'b. (Array['a], Array[Object & 'b & ~()]) -> Array[['a, 'b]] //│ res //│ = [Function: zip1] @@ -56,9 +56,9 @@ class Pair[A, B](a: A, b: B) fun unbox(x) = if x is Numbr(n) then n Vectr(xs) then map of xs, unbox -//│ fun unbox: forall 'a. (Numbr | Vectr) -> 'a +//│ fun unbox: forall 'a. (Numbr | Vectr) -> (Int | 'a) //│ where -//│ 'a :> Int | Array['a] +//│ 'a :> Array[Int | 'a] fun add(e) = if e is @@ -88,9 +88,9 @@ let v = Vectr of [Numbr(10), Numbr(20), Numbr(30)] //│ = Vectr {} unbox(v) -//│ forall 'a. 'a +//│ forall 'a. Int | 'a //│ where -//│ 'a :> Int | Array['a] +//│ 'a :> Array[Int | 'a] //│ res //│ = [ 10, 20, 30 ] @@ -101,9 +101,9 @@ let res = add of Pair of (Vectr of [Numbr(1), Numbr(2)]), (Vectr of [Numbr(3), v //│ = Vectr {} unbox(res) -//│ forall 'a. 'a +//│ forall 'a. Int | 'a //│ where -//│ 'a :> Int | Array['a] +//│ 'a :> Array[Int | 'a] //│ res //│ = [ 4, [ 12, 22, 32 ] ] @@ -154,6 +154,11 @@ module A { //│ fun g: Int -> Int & Str -> Str //│ } +A.g(0) +//│ Int | Str +//│ res +//│ = 0 + @@ -176,17 +181,7 @@ s([Numbr(0),Numbr(0)]) //│ ║ l.136: fun s: ([Numbr,Numbr] -> Int) & ([Vectr,Vectr] -> Int) //│ ╙── ^^^^^^^^^^^^^ //│ Int | error - -:e -A.g(0) // g <: 0 -> 'a -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.+1: A.g(0) -//│ ║ ^^^^^^ -//│ ╟── integer literal of type `0` is not an instance of type `Str` -//│ ║ l.+1: A.g(0) -//│ ╙── ^ -//│ Int | Str | error :e fun add(e) = diff --git a/shared/src/test/diff/nu/Ascription.mls b/shared/src/test/diff/nu/Ascription.mls index 5306d74f5..ff022d5c0 100644 --- a/shared/src/test/diff/nu/Ascription.mls +++ b/shared/src/test/diff/nu/Ascription.mls @@ -13,7 +13,7 @@ // TODO? :e 1 : Int : Int -//│ ╔══[ERROR] not a recognized type +//│ ╔══[ERROR] Not a recognized type //│ ║ l.15: 1 : Int : Int //│ ╙── ^^^ //│ anything diff --git a/shared/src/test/diff/nu/AuxCtors.mls b/shared/src/test/diff/nu/AuxCtors.mls new file mode 100644 index 000000000..36c516912 --- /dev/null +++ b/shared/src/test/diff/nu/AuxCtors.mls @@ -0,0 +1,180 @@ +:NewDefs + + +class C(val x: Int) { constructor(y: Int) { x = y } } +C(123).x +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Int +//│ res +//│ = 123 + +class C(val x: Int) { constructor(y) { x = y } } +C(123).x +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Int +//│ res +//│ = 123 + +class C(val x: Int) { constructor(y: Int) { log(y);; x = y;; log(x) } } +C(123).x +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Int +//│ res +//│ = 123 +//│ // Output +//│ 123 +//│ 123 + +:e +class C(val x: Int) { constructor(y: Int) { x = y;; log(x);; x = y + 1;; log(x) } } +C(123).x +//│ ╔══[ERROR] Class parameter 'x' was already set +//│ ║ l.35: class C(val x: Int) { constructor(y: Int) { x = y;; log(x);; x = y + 1;; log(x) } } +//│ ╙── ^ +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Int +//│ res +//│ = 124 +//│ // Output +//│ 123 +//│ 124 + +:e +class C(val x: Int) { constructor(y: Int) { log(x);; x = y } } +//│ ╔══[ERROR] identifier not found: x +//│ ║ l.51: class C(val x: Int) { constructor(y: Int) { log(x);; x = y } } +//│ ╙── ^ +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Code generation encountered an error: +//│ unresolved symbol x + +:e +class C(val x: Int) { constructor(y: Str) { x = y } } +//│ ╔══[ERROR] Type mismatch in auxiliary class constructor: +//│ ║ l.62: class C(val x: Int) { constructor(y: Str) { x = y } } +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type `Str` is not an instance of `Int` +//│ ║ l.62: class C(val x: Int) { constructor(y: Str) { x = y } } +//│ ║ ^^^ +//│ ╟── but it flows into reference with expected type `Int` +//│ ║ l.62: class C(val x: Int) { constructor(y: Str) { x = y } } +//│ ║ ^ +//│ ╟── Note: constraint arises from type reference: +//│ ║ l.62: class C(val x: Int) { constructor(y: Str) { x = y } } +//│ ╙── ^^^ +//│ class C(x: Int) { +//│ constructor(y: Str) +//│ } + +:e +class C(val x: Int) { constructor(y: Int) { z = y } } +//│ ╔══[ERROR] Unknown class parameter 'z' +//│ ║ l.80: class C(val x: Int) { constructor(y: Int) { z = y } } +//│ ╙── ^ +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } +//│ Syntax error: +//│ Private field '#z' must be declared in an enclosing class + +:e +class C(val x: Int) { constructor(val y: Int) { x = y } } +//│ ╔══[ERROR] Cannot use `val` in constructor parameters +//│ ║ l.91: class C(val x: Int) { constructor(val y: Int) { x = y } } +//│ ╙── ^ +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } + +:e +class C(val x: Int) { constructor(val y) { x = y } } +//│ ╔══[ERROR] Cannot use `val` in constructor parameters +//│ ║ l.100: class C(val x: Int) { constructor(val y) { x = y } } +//│ ╙── ^ +//│ class C(x: Int) { +//│ constructor(y: Int) +//│ } + +:e +class C(val x: Int) { constructor(2 + 2) { x = 0 } } +//│ ╔══[ERROR] Unsupported constructor parameter shape +//│ ║ l.109: class C(val x: Int) { constructor(2 + 2) { x = 0 } } +//│ ╙── ^^^^^ +//│ class C(x: Int) { +//│ constructor(: error) +//│ } +//│ Code generation encountered an error: +//│ Unexpected constructor parameters in C. + + +class C(val x: Int, y: Int) { + constructor(z: Int) { x = z;; y = z } + log([x, y]) +} +//│ class C(x: Int, y: Int) { +//│ constructor(z: Int) +//│ } + +:e +C(11) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.129: C(11) +//│ ║ ^^^^^ +//│ ╟── argument of type `[11]` does not match type `[x: Int, y: Int]` +//│ ║ l.129: C(11) +//│ ╙── ^^^^ +//│ C | error +//│ res +//│ = C {} +//│ // Output +//│ [ 11, 11 ] + +C(1, 2) +//│ C +//│ res +//│ = C {} +//│ // Output +//│ [ 1, 1 ] + +new C(11) +//│ C +//│ res +//│ = C {} +//│ // Output +//│ [ 11, 11 ] + +:e +new C(1, 2) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.157: new C(1, 2) +//│ ║ ^^^^^^^^^^^ +//│ ╟── argument list of type `[1, 2]` does not match type `[z: Int]` +//│ ║ l.157: new C(1, 2) +//│ ╙── ^^^^^^ +//│ C | error +//│ res +//│ = C {} +//│ // Output +//│ [ 1, 1 ] + +:pe +class C { constructor(x: Int);; constructor(y: Int) } +//│ ╔══[PARSE ERROR] Unexpected ';;' here +//│ ║ l.171: class C { constructor(x: Int);; constructor(y: Int) } +//│ ╙── ^^ +//│ class C { +//│ constructor(x: Int) +//│ } + + + diff --git a/shared/src/test/diff/nu/BadAliases.mls b/shared/src/test/diff/nu/BadAliases.mls index 70615699f..18d8e11ef 100644 --- a/shared/src/test/diff/nu/BadAliases.mls +++ b/shared/src/test/diff/nu/BadAliases.mls @@ -13,7 +13,7 @@ type A = A | Int // TODO check regularity // :e -type Foo[A] = { x: A, y: Foo[(A, A)] } +type Foo[A] = { x: A, y: Foo[[A, A]] } //│ type Foo[A] = {x: A, y: Foo[[A, A]]} @@ -36,16 +36,18 @@ type Test(n: Int) = n //│ type Test = error class Base -//│ class Base +//│ class Base { +//│ constructor() +//│ } :pe :e type Test: Base //│ ╔══[PARSE ERROR] Expected end of input; found ':' instead -//│ ║ l.43: type Test: Base +//│ ║ l.45: type Test: Base //│ ╙── ^ //│ ╔══[ERROR] Type alias definition requires a right-hand side -//│ ║ l.43: type Test: Base +//│ ║ l.45: type Test: Base //│ ╙── ^^^^^^^^^ //│ type Test = error @@ -53,20 +55,20 @@ type Test: Base :e type Test: Base = Int //│ ╔══[PARSE ERROR] Expected end of input; found ':' instead -//│ ║ l.54: type Test: Base = Int +//│ ║ l.56: type Test: Base = Int //│ ╙── ^ //│ ╔══[ERROR] Type alias definition requires a right-hand side -//│ ║ l.54: type Test: Base = Int +//│ ║ l.56: type Test: Base = Int //│ ╙── ^^^^^^^^^ //│ type Test = error :e type Test extends Base //│ ╔══[ERROR] Type alias definitions cannot extend parents -//│ ║ l.64: type Test extends Base +//│ ║ l.66: type Test extends Base //│ ╙── ^^^^ //│ ╔══[ERROR] Type alias definition requires a right-hand side -//│ ║ l.64: type Test extends Base +//│ ║ l.66: type Test extends Base //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ type Test = error @@ -74,20 +76,20 @@ type Test extends Base :e type Test extends Base = Int //│ ╔══[PARSE ERROR] Expected end of input; found '=' instead -//│ ║ l.75: type Test extends Base = Int +//│ ║ l.77: type Test extends Base = Int //│ ╙── ^ //│ ╔══[ERROR] Type alias definitions cannot extend parents -//│ ║ l.75: type Test extends Base = Int +//│ ║ l.77: type Test extends Base = Int //│ ╙── ^^^^ //│ ╔══[ERROR] Type alias definition requires a right-hand side -//│ ║ l.75: type Test extends Base = Int +//│ ║ l.77: type Test extends Base = Int //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ //│ type Test = error :e type Test = Int extends Base //│ ╔══[ERROR] Type alias definitions cannot extend parents -//│ ║ l.88: type Test = Int extends Base +//│ ║ l.90: type Test = Int extends Base //│ ╙── ^^^^ //│ type Test = Int @@ -95,14 +97,14 @@ type Test = Int extends Base :pe type Poly[mut A] = A //│ ╔══[PARSE ERROR] Unexpected 'mut' keyword here -//│ ║ l.96: type Poly[mut A] = A +//│ ║ l.98: type Poly[mut A] = A //│ ╙── ^^^ //│ type Poly = A :pe type Poly[#A] = A //│ ╔══[PARSE ERROR] Unexpected '#' here -//│ ║ l.103: type Poly[#A] = A +//│ ║ l.105: type Poly[#A] = A //│ ╙── ^ //│ type Poly = A diff --git a/shared/src/test/diff/nu/BadBlocks.mls b/shared/src/test/diff/nu/BadBlocks.mls new file mode 100644 index 000000000..cc6e4cc86 --- /dev/null +++ b/shared/src/test/diff/nu/BadBlocks.mls @@ -0,0 +1,178 @@ +:NewDefs + + +:e +fun test = + fun lol = log("ok") + [lol, lol] +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.6: fun lol = log("ok") +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ fun test: [(), ()] + +test +//│ [(), ()] +//│ res +//│ = [ undefined, undefined ] +//│ // Output +//│ ok + +:e +fun test = + fun lol = log("ok") + [] +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.22: fun lol = log("ok") +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ fun test: [] + +test +//│ [] +//│ res +//│ = [] +//│ // Output +//│ ok + +fun test = + let a = 0 + a +//│ fun test: 0 + +:e +fun test = + fun a = b + fun b = 1 + a +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.43: fun a = b +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Cannot use `val` or `fun` in local block; use `let` instead. +//│ ║ l.44: fun b = 1 +//│ ╙── ^^^^^^^^^ +//│ fun test: 1 + +// TODO[init-check] reject +fun test = + let a = b + let b = 1 + a +//│ fun test: 1 + +:re +test +//│ 1 +//│ res +//│ Runtime error: +//│ ReferenceError: Cannot access 'b' before initialization + +:js +fun test = + let a() = b + let b = 1 + a() +//│ fun test: 1 +//│ // Prelude +//│ class TypingUnit8 {} +//│ const typing_unit8 = new TypingUnit8; +//│ // Query 1 +//│ globalThis.test5 = function test5() { +//│ return ((() => { +//│ let a = () => b; +//│ let b = 1; +//│ return a(); +//│ })()); +//│ }; +//│ // End of generated code + +test +//│ 1 +//│ res +//│ = 1 + + +// * OK +fun test = + class Foo(x: Int) { fun y = x + 1 } + Foo(1).y +//│ fun test: Int + +// * MAYBE OK +:ge // TODO accept? +fun test = + let r() = Foo(1).y + class Foo(x: Int) { fun y = x + 1 } + r() +//│ fun test: Int +//│ Code generation encountered an error: +//│ unresolved symbol Foo + +// * NOT OK +:ge // :e // TODO[init-check] reject +fun test = + let r = Foo(1).y + class Foo(x: Int) { fun y = x + 1 } + r +//│ fun test: Int +//│ Code generation encountered an error: +//│ unresolved symbol Foo + +:re +test +//│ Int +//│ res +//│ Runtime error: +//│ ReferenceError: test8 is not defined + + +:pe +:ge +fun test = { + fun a = 1 +} +//│ ╔══[PARSE ERROR] Unexpected 'fun' keyword in expression position +//│ ║ l.130: fun a = 1 +//│ ╙── ^^^ +//│ ╔══[PARSE ERROR] Unexpected '=' here +//│ ║ l.130: fun a = 1 +//│ ╙── ^ +//│ fun test: {a: () -> 1} +//│ Code generation encountered an error: +//│ unresolved symbol a + +:pe +:e +fun test = { + val res = a + 1 + fun a = 123 +}.res +//│ ╔══[PARSE ERROR] Unexpected '=' here +//│ ║ l.145: val res = a + 1 +//│ ╙── ^ +//│ ╔══[ERROR] identifier not found: res +//│ ║ l.145: val res = a + 1 +//│ ╙── ^^^ +//│ fun test: error + +:pe // TODO support +:e +fun test = (new { + val res = a + 1 + fun a = 123 +}).res +//│ ╔══[PARSE ERROR] Unexpected '=' here +//│ ║ l.159: val res = a + 1 +//│ ╙── ^ +//│ ╔══[PARSE ERROR] Unexpected record after `new` keyword +//│ ║ l.158: fun test = (new { +//│ ║ ^ +//│ ║ l.159: val res = a + 1 +//│ ║ ^^^^^^^^^^^^^^^^^ +//│ ║ l.160: fun a = 123 +//│ ║ ^^^^^^^^^^^^^ +//│ ║ l.161: }).res +//│ ╙── ^ +//│ ╔══[ERROR] Currently unsupported `new` syntax +//│ ║ l.158: fun test = (new { +//│ ╙── ^^^ +//│ fun test: error + diff --git a/shared/src/test/diff/nu/BadClassInherit.mls b/shared/src/test/diff/nu/BadClassInherit.mls index 78243b9d5..0d1240eb5 100644 --- a/shared/src/test/diff/nu/BadClassInherit.mls +++ b/shared/src/test/diff/nu/BadClassInherit.mls @@ -12,33 +12,33 @@ class C2(x: Int) extends C1(y) { //│ ║ l.8: class C2(x: Int) extends C1(y) { //│ ╙── ^ //│ class C2(x: Int) extends C1 { -//│ let y: Int +//│ val y: Int //│ } //│ Code generation encountered an error: //│ unresolved symbol y :e -class C2 extends C1(y) { +abstract class C2 extends C1(y) { val y: Int } //│ ╔══[ERROR] identifier not found: y -//│ ║ l.21: class C2 extends C1(y) { -//│ ╙── ^ -//│ class C2 extends C1 { -//│ let y: Int +//│ ║ l.21: abstract class C2 extends C1(y) { +//│ ╙── ^ +//│ abstract class C2 extends C1 { +//│ val y: Int //│ } //│ Code generation encountered an error: //│ unresolved symbol y :e -class C2 extends C1(this.y) { +abstract class C2 extends C1(this.y) { val y: Int } //│ ╔══[ERROR] identifier not found: this -//│ ║ l.34: class C2 extends C1(this.y) { -//│ ╙── ^^^^ -//│ class C2 extends C1 { -//│ let y: Int +//│ ║ l.34: abstract class C2 extends C1(this.y) { +//│ ╙── ^^^^ +//│ abstract class C2 extends C1 { +//│ val y: Int //│ } @@ -50,32 +50,36 @@ class C2 extends C1(this) //│ ╔══[ERROR] identifier not found: this //│ ║ l.49: class C2 extends C1(this) //│ ╙── ^^^^ -//│ class C2 extends C1 +//│ class C2 extends C1 { +//│ constructor() +//│ } class Foo { virtual fun x: Int = 1 } //│ class Foo { +//│ constructor() //│ fun x: Int //│ } :e class Bar extends Foo { fun x = false } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.62: class Bar extends Foo { fun x = false } +//│ ║ l.65: class Bar extends Foo { fun x = false } //│ ║ ^^^^^^^^^ //│ ╟── reference of type `false` is not an instance of type `Int` -//│ ║ l.62: class Bar extends Foo { fun x = false } +//│ ║ l.65: class Bar extends Foo { fun x = false } //│ ║ ^^^^^ //│ ╟── but it flows into definition of method x with expected type `Int` -//│ ║ l.62: class Bar extends Foo { fun x = false } +//│ ║ l.65: class Bar extends Foo { fun x = false } //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ║ ^^^ //│ ╟── from definition of method x: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ╙── ^^^^^^^^^^ //│ class Bar extends Foo { +//│ constructor() //│ fun x: false //│ } @@ -85,21 +89,22 @@ class Bar extends Foo { fun x = false } //│ ╔══[ERROR] Type mismatch in signature of member `x`: -//│ ║ l.84: fun x: Bool +//│ ║ l.88: fun x: Bool //│ ║ ^^^^^^^ //│ ╟── type `Bool` is not an instance of `Int` -//│ ║ l.84: fun x: Bool +//│ ║ l.88: fun x: Bool //│ ║ ^^^^ //│ ╟── but it flows into signature of member `x` with expected type `Int` -//│ ║ l.84: fun x: Bool +//│ ║ l.88: fun x: Bool //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ║ ^^^ //│ ╟── from definition of method x: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ╙── ^^^^^^^^^^ //│ class Bar extends Foo { +//│ constructor() //│ fun x: Bool //│ } @@ -111,21 +116,22 @@ mixin M { fun x = false } :e class Bar extends Foo, M //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.106: mixin M { fun x = false } +//│ ║ l.111: mixin M { fun x = false } //│ ║ ^^^^^^^^^ //│ ╟── reference of type `false` is not an instance of type `Int` -//│ ║ l.106: mixin M { fun x = false } +//│ ║ l.111: mixin M { fun x = false } //│ ║ ^^^^^ //│ ╟── but it flows into definition of method x with expected type `Int` -//│ ║ l.106: mixin M { fun x = false } +//│ ║ l.111: mixin M { fun x = false } //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ║ ^^^ //│ ╟── from definition of method x: -//│ ║ l.56: class Foo { virtual fun x: Int = 1 } +//│ ║ l.58: class Foo { virtual fun x: Int = 1 } //│ ╙── ^^^^^^^^^^ //│ class Bar extends Foo { +//│ constructor() //│ fun x: false //│ } @@ -134,12 +140,15 @@ class Bar extends Foo, M class A { class X { fun f = 1 } } trait B { class X { fun g = 1 } } //│ class A { +//│ constructor() //│ class X { +//│ constructor() //│ fun f: 1 //│ } //│ } //│ trait B { //│ class X { +//│ constructor() //│ fun g: 1 //│ } //│ } @@ -147,22 +156,24 @@ trait B { class X { fun g = 1 } } :e class C extends A, B //│ ╔══[ERROR] Class member `X` cannot override class member of the same name declared in parent -//│ ║ l.148: class C extends A, B +//│ ║ l.157: class C extends A, B //│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ╟── Declared here: -//│ ║ l.135: trait B { class X { fun g = 1 } } -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╟── Originally declared here: +//│ ║ l.141: trait B { class X { fun g = 1 } } +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Intersection of class member and class members currently unsupported -//│ ║ l.148: class C extends A, B +//│ ║ l.157: class C extends A, B //│ ║ ^^^^^^^^^^^^^^^^^^^^ //│ ╟── The class member is defined here: -//│ ║ l.134: class A { class X { fun f = 1 } } -//│ ║ ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.140: class A { class X { fun f = 1 } } +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ╟── The class member is defined here: -//│ ║ l.135: trait B { class X { fun g = 1 } } -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.141: trait B { class X { fun g = 1 } } +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ class C extends A, B { +//│ constructor() //│ class X { +//│ constructor() //│ fun f: 1 //│ } //│ } @@ -172,18 +183,35 @@ class C extends A { class X { fun g = 1 } } //│ ╔══[ERROR] Class member `X` cannot override class member of the same name declared in parent -//│ ║ l.171: class C extends A { +//│ ║ l.182: class C extends A { //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.172: class X { fun g = 1 } -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── Declared here: -//│ ║ l.134: class A { class X { fun f = 1 } } -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.183: class X { fun g = 1 } +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.184: } +//│ ║ ^ +//│ ╟── Originally declared here: +//│ ║ l.140: class A { class X { fun f = 1 } } +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ class C extends A { +//│ constructor() //│ class X { +//│ constructor() //│ fun g: 1 //│ } //│ } +:e +class Foo2 extends Foo2 +//│ ╔══[ERROR] Unhandled cyclic definition +//│ ║ l.206: class Foo2 extends Foo2 +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ class Foo2 extends Foo2 { +//│ constructor() +//│ } +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + + + diff --git a/shared/src/test/diff/nu/BadClasses.mls b/shared/src/test/diff/nu/BadClasses.mls index 30237c7f4..2fc62489c 100644 --- a/shared/src/test/diff/nu/BadClasses.mls +++ b/shared/src/test/diff/nu/BadClasses.mls @@ -10,48 +10,61 @@ class C0 extends M0 //│ ╔══[ERROR] mixin M0 expects 1 parameter(s); got 0 //│ ║ l.9: class C0 extends M0 //│ ╙── ^^ -//│ class C0 +//│ class C0 { +//│ constructor() +//│ } :e class C0 extends M0(1, 2) //│ ╔══[ERROR] mixin M0 expects 1 parameter(s); got 2 -//│ ║ l.16: class C0 extends M0(1, 2) +//│ ║ l.18: class C0 extends M0(1, 2) //│ ╙── ^^^^^^^ -//│ class C0 +//│ class C0 { +//│ constructor() +//│ } :e class C0 extends M0(true) //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.23: class C0 extends M0(true) +//│ ║ l.27: class C0 extends M0(true) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `true` is not an instance of type `Int` -//│ ║ l.23: class C0 extends M0(true) +//│ ║ l.27: class C0 extends M0(true) //│ ║ ^^^^ //│ ╟── Note: constraint arises from type reference: //│ ║ l.5: mixin M0(x: Int) //│ ╙── ^^^ -//│ class C0 +//│ class C0 { +//│ constructor() +//│ } -// TODO catch this at typing (lack of `this`) -class Foo { +module Foo { fun foo = 0 fun bar = foo } -//│ class Foo { +[Foo.foo, Foo.bar] +//│ module Foo { //│ fun bar: 0 //│ fun foo: 0 //│ } +//│ [0, 0] +//│ res +//│ = [ 0, 0 ] -// FIXME -class Foo { +// * FIXME add initialization checking for non-lazy fields +module Foo { let foo = 0 fun bar = foo } -//│ class Foo { +[Foo.foo, Foo.bar] +//│ module Foo { //│ fun bar: 0 //│ let foo: 0 //│ } +//│ [0, 0] +//│ res +//│ = [ undefined, 0 ] module Bar { @@ -66,7 +79,7 @@ module Bar { :e hello //│ ╔══[ERROR] identifier not found: hello -//│ ║ l.67: hello +//│ ║ l.80: hello //│ ╙── ^^^^^ //│ error //│ Code generation encountered an error: @@ -75,7 +88,7 @@ hello :e 1 : I //│ ╔══[ERROR] type identifier not found: I -//│ ║ l.76: 1 : I +//│ ║ l.89: 1 : I //│ ╙── ^ //│ error //│ res @@ -83,44 +96,64 @@ hello :e +:w class Foo[A] { 42: A } //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.86: class Foo[A] { 42: A } -//│ ║ ^^ +//│ ║ l.100: class Foo[A] { 42: A } +//│ ║ ^^ //│ ╟── integer literal of type `42` does not match type `A` //│ ╟── Note: constraint arises from type parameter: -//│ ║ l.86: class Foo[A] { 42: A } -//│ ╙── ^ -//│ class Foo[A] +//│ ║ l.100: class Foo[A] { 42: A } +//│ ╙── ^ +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.100: class Foo[A] { 42: A } +//│ ║ ^^ +//│ ╟── expression in statement position of type `A` does not match type `()` +//│ ╟── Note: type parameter A is defined at: +//│ ║ l.100: class Foo[A] { 42: A } +//│ ╙── ^ +//│ class Foo[A] { +//│ constructor() +//│ } :e class C1 { fun oops = this.x } //│ ╔══[ERROR] Type `#C1` does not contain member `x` -//│ ║ l.98: class C1 { fun oops = this.x } -//│ ╙── ^^ +//│ ║ l.123: class C1 { fun oops = this.x } +//│ ╙── ^^ //│ class C1 { +//│ constructor() //│ fun oops: error //│ } :e class C { fun x: Int } -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `C` -//│ ║ l.108: class C { fun x: Int } +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C` +//│ ║ l.134: class C { fun x: Int } //│ ║ ^ //│ ╟── Declared here: -//│ ║ l.108: class C { fun x: Int } -//│ ╙── ^^^^^^ +//│ ║ l.134: class C { fun x: Int } +//│ ╙── ^^^^^^^^^^ //│ class C { +//│ constructor() //│ fun x: Int //│ } -// FIXME should error -// :e +:e class C { val x: Int } +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C` +//│ ║ l.147: class C { val x: Int } +//│ ║ ^ +//│ ╟── Declared here: +//│ ║ l.147: class C { val x: Int } +//│ ╙── ^^^^^^^^^^ //│ class C { -//│ let x: Int +//│ constructor() +//│ val x: Int //│ } diff --git a/shared/src/test/diff/nu/BadFieldInit.mls b/shared/src/test/diff/nu/BadFieldInit.mls new file mode 100644 index 000000000..132ea48f4 --- /dev/null +++ b/shared/src/test/diff/nu/BadFieldInit.mls @@ -0,0 +1,132 @@ +:NewDefs + + + +:js +module A { + val x = y + val y = x +} +//│ module A { +//│ val x: nothing +//│ val y: nothing +//│ } +//│ // Prelude +//│ let res; +//│ class TypingUnit { +//│ #A; +//│ constructor() { +//│ } +//│ get A() { +//│ const qualifier = this; +//│ if (this.#A === undefined) { +//│ class A { +//│ #x; +//│ get x() { return this.#x; } +//│ #y; +//│ get y() { return this.#y; } +//│ constructor() { +//│ const qualifier1 = this; +//│ this.#x = qualifier1.y; +//│ const x = this.#x; +//│ this.#y = x; +//│ const y = this.#y; +//│ } +//│ } +//│ this.#A = new A(); +//│ this.#A.class = A; +//│ } +//│ return this.#A; +//│ } +//│ } +//│ const typing_unit = new TypingUnit; +//│ globalThis.A = typing_unit.A; +//│ // End of generated code + +[A.x, A.y] +//│ [nothing, nothing] +//│ res +//│ = [ undefined, undefined ] + + +:js +module A { + val x = y + val y = 1 +} +//│ module A { +//│ val x: 1 +//│ val y: 1 +//│ } +//│ // Prelude +//│ class TypingUnit2 { +//│ #A; +//│ constructor() { +//│ } +//│ get A() { +//│ const qualifier = this; +//│ if (this.#A === undefined) { +//│ class A { +//│ #x; +//│ get x() { return this.#x; } +//│ #y; +//│ get y() { return this.#y; } +//│ constructor() { +//│ const qualifier1 = this; +//│ this.#x = qualifier1.y; +//│ const x = this.#x; +//│ this.#y = 1; +//│ const y = this.#y; +//│ } +//│ } +//│ this.#A = new A(); +//│ this.#A.class = A; +//│ } +//│ return this.#A; +//│ } +//│ } +//│ const typing_unit2 = new TypingUnit2; +//│ globalThis.A = typing_unit2.A; +//│ // End of generated code + +[A.x, A.y] +//│ [1, 1] +//│ res +//│ = [ undefined, 1 ] + + + +:e +class B(x: Int, y: Int) { + constructor() { + x = y + y = x + } +} +//│ ╔══[ERROR] identifier not found: y +//│ ║ l.102: x = y +//│ ╙── ^ +//│ class B(x: Int, y: Int) { +//│ constructor() +//│ } +//│ Code generation encountered an error: +//│ unresolved symbol y + +:e +class B(x: Int, y: Int) { + constructor() { + x = y + y = 1 + } +} +//│ ╔══[ERROR] identifier not found: y +//│ ║ l.118: x = y +//│ ╙── ^ +//│ class B(x: Int, y: Int) { +//│ constructor() +//│ } +//│ Code generation encountered an error: +//│ unresolved symbol y + + + diff --git a/shared/src/test/diff/nu/BadMixins.mls b/shared/src/test/diff/nu/BadMixins.mls index 34cf7fba4..2cbe31043 100644 --- a/shared/src/test/diff/nu/BadMixins.mls +++ b/shared/src/test/diff/nu/BadMixins.mls @@ -21,3 +21,4 @@ M0 //│ res //│ = [Function (anonymous)] + diff --git a/shared/src/test/diff/nu/BadScopes.mls b/shared/src/test/diff/nu/BadScopes.mls index 515e23bf1..9c66a019a 100644 --- a/shared/src/test/diff/nu/BadScopes.mls +++ b/shared/src/test/diff/nu/BadScopes.mls @@ -26,13 +26,13 @@ x :e -class Foo(x: Int) class Bar { x } //│ ╔══[ERROR] identifier not found: x -//│ ║ l.30: class Bar { x } +//│ ║ l.29: class Bar { x } //│ ╙── ^ -//│ class Foo(x: Int) -//│ class Bar +//│ class Bar { +//│ constructor() +//│ } //│ Code generation encountered an error: //│ unresolved symbol x diff --git a/shared/src/test/diff/nu/BadSignatures.mls b/shared/src/test/diff/nu/BadSignatures.mls index 03440ff9b..22bc0b821 100644 --- a/shared/src/test/diff/nu/BadSignatures.mls +++ b/shared/src/test/diff/nu/BadSignatures.mls @@ -8,7 +8,7 @@ trait T { } //│ ╔══[ERROR] Method implementations in traits are not yet supported //│ ║ l.7: fun x = false -//│ ╙── ^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^ //│ trait T { //│ fun x: Int //│ } @@ -16,6 +16,7 @@ trait T { class A { virtual fun x = 1 } //│ class A { +//│ constructor() //│ fun x: 1 //│ } @@ -24,13 +25,13 @@ class B() extends A { fun x: Int } //│ ╔══[ERROR] Type mismatch in signature of member `x`: -//│ ║ l.24: fun x: Int +//│ ║ l.25: fun x: Int //│ ║ ^^^^^^ //│ ╟── type `Int` does not match type `1` -//│ ║ l.24: fun x: Int +//│ ║ l.25: fun x: Int //│ ║ ^^^ //│ ╟── but it flows into signature of member `x` with expected type `1` -//│ ║ l.24: fun x: Int +//│ ║ l.25: fun x: Int //│ ║ ^^^^^^ //│ ╟── Note: constraint arises from integer literal: //│ ║ l.17: class A { virtual fun x = 1 } @@ -68,13 +69,13 @@ class B() extends A { fun x = 1 } //│ ╔══[ERROR] Type mismatch in signature of member `x`: -//│ ║ l.67: fun x: Int +//│ ║ l.68: fun x: Int //│ ║ ^^^^^^ //│ ╟── type `Int` does not match type `1` -//│ ║ l.67: fun x: Int +//│ ║ l.68: fun x: Int //│ ║ ^^^ //│ ╟── but it flows into signature of member `x` with expected type `1` -//│ ║ l.67: fun x: Int +//│ ║ l.68: fun x: Int //│ ║ ^^^^^^ //│ ╟── Note: constraint arises from integer literal: //│ ║ l.17: class A { virtual fun x = 1 } @@ -89,12 +90,12 @@ class B() extends A { :e mixin M { fun x : Int } -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `M` -//│ ║ l.91: mixin M { fun x : Int } +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `M` +//│ ║ l.92: mixin M { fun x : Int } //│ ║ ^ //│ ╟── Declared here: -//│ ║ l.91: mixin M { fun x : Int } -//│ ╙── ^^^^^^^ +//│ ║ l.92: mixin M { fun x : Int } +//│ ╙── ^^^^^^^^^^^ //│ mixin M() { //│ fun x: Int //│ } diff --git a/shared/src/test/diff/nu/BadSuper.mls b/shared/src/test/diff/nu/BadSuper.mls index 8b5c47dbf..cbd0eab92 100644 --- a/shared/src/test/diff/nu/BadSuper.mls +++ b/shared/src/test/diff/nu/BadSuper.mls @@ -43,6 +43,7 @@ class Foo { //│ ║ l.40: fun f = super //│ ╙── ^^^^^ //│ class Foo { +//│ constructor() //│ fun f: Foo //│ } //│ Syntax error: diff --git a/shared/src/test/diff/nu/BadUCS.mls b/shared/src/test/diff/nu/BadUCS.mls index 05d521093..b0eda308c 100644 --- a/shared/src/test/diff/nu/BadUCS.mls +++ b/shared/src/test/diff/nu/BadUCS.mls @@ -2,7 +2,9 @@ class Foo -//│ class Foo +//│ class Foo { +//│ constructor() +//│ } fun foo(x) = if x is Foo then 0 //│ fun foo: Foo -> 0 @@ -12,7 +14,9 @@ module Bar { class Foo0 } //│ module Bar { -//│ class Foo0 +//│ class Foo0 { +//│ constructor() +//│ } //│ } fun foo(x) = if x is Bar then 0 @@ -21,7 +25,7 @@ fun foo(x) = if x is Bar then 0 :e fun foo(x) = if x is Foo0 then 0 //│ ╔══[ERROR] Cannot find constructor `Foo0` in scope -//│ ║ l.22: fun foo(x) = if x is Foo0 then 0 +//│ ║ l.26: fun foo(x) = if x is Foo0 then 0 //│ ╙── ^^^^ //│ fun foo: anything -> error //│ Code generation encountered an error: @@ -34,7 +38,7 @@ type F = Foo :e fun foo(x) = if x is F then 0 //│ ╔══[ERROR] Cannot find constructor `F` in scope -//│ ║ l.35: fun foo(x) = if x is F then 0 +//│ ║ l.39: fun foo(x) = if x is F then 0 //│ ╙── ^ //│ fun foo: anything -> error //│ Code generation encountered an error: @@ -43,7 +47,7 @@ fun foo(x) = if x is F then 0 :e fun foo(x) = if x is F() then 0 //│ ╔══[ERROR] Illegal pattern `F` -//│ ║ l.44: fun foo(x) = if x is F() then 0 +//│ ║ l.48: fun foo(x) = if x is F() then 0 //│ ╙── ^ //│ fun foo: anything -> error //│ Code generation encountered an error: @@ -56,7 +60,7 @@ mixin M :e fun foo(x) = if x is M then 0 //│ ╔══[ERROR] Cannot find constructor `M` in scope -//│ ║ l.57: fun foo(x) = if x is M then 0 +//│ ║ l.61: fun foo(x) = if x is M then 0 //│ ╙── ^ //│ fun foo: anything -> error //│ Code generation encountered an error: @@ -65,7 +69,7 @@ fun foo(x) = if x is M then 0 :e fun foo(x) = if x is M() then 0 //│ ╔══[ERROR] Illegal pattern `M` -//│ ║ l.66: fun foo(x) = if x is M() then 0 +//│ ║ l.70: fun foo(x) = if x is M() then 0 //│ ╙── ^ //│ fun foo: anything -> error //│ Code generation encountered an error: @@ -82,7 +86,7 @@ fun foo = 0 :e fun foo0(x) = if x is foo() then 0 //│ ╔══[ERROR] Illegal pattern `foo` -//│ ║ l.83: fun foo0(x) = if x is foo() then 0 +//│ ║ l.87: fun foo0(x) = if x is foo() then 0 //│ ╙── ^^^ //│ fun foo0: anything -> error //│ Code generation encountered an error: @@ -91,7 +95,7 @@ fun foo0(x) = if x is foo() then 0 :e fun foo(x) = if x is foo() then 0 //│ ╔══[ERROR] Illegal pattern `foo` -//│ ║ l.92: fun foo(x) = if x is foo() then 0 +//│ ║ l.96: fun foo(x) = if x is foo() then 0 //│ ╙── ^^^ //│ fun foo: anything -> error //│ Code generation encountered an error: diff --git a/shared/src/test/diff/nu/BasicClassInheritance.mls b/shared/src/test/diff/nu/BasicClassInheritance.mls index 3d083b3d2..f9a0743f4 100644 --- a/shared/src/test/diff/nu/BasicClassInheritance.mls +++ b/shared/src/test/diff/nu/BasicClassInheritance.mls @@ -2,7 +2,9 @@ class A -//│ class A +//│ class A { +//│ constructor() +//│ } class B(m: Int) extends A //│ class B(m: Int) extends A @@ -21,12 +23,14 @@ class A { fun a2 = 2 } //│ class A { +//│ constructor() //│ fun a1: Int //│ fun a2: 2 //│ } class B extends A //│ class B extends A { +//│ constructor() //│ fun a1: Int //│ fun a2: 2 //│ } @@ -50,3 +54,120 @@ D().test //│ = 0 +class E(val m: Int) extends A { + constructor(a: Int, b: Int) { + m = a + b + log of concat("Here's m: ")(toString of m) + } +} +//│ class E(m: Int) extends A { +//│ constructor(a: Int, b: Int) +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +// * FIXME codegen +E(1).m +//│ Int +//│ res +//│ = NaN +//│ // Output +//│ Here's m: NaN + +(new E(1, 2)).m +//│ Int +//│ res +//│ = 3 +//│ // Output +//│ Here's m: 3 + +if new E(1, 2) is E(x) then x +//│ Int +//│ res +//│ = 3 +//│ // Output +//│ Here's m: 3 + +:e +module F extends E +//│ ╔══[ERROR] class E expects 2 parameter(s); got 0 +//│ ║ l.92: module F extends E +//│ ╙── ^ +//│ module F extends A, E { +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +:e +module F extends E(123) +//│ ╔══[ERROR] class E expects 2 parameter(s); got 1 +//│ ║ l.102: module F extends E(123) +//│ ╙── ^^^^^ +//│ module F extends A, E { +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +module F extends E(123, 456) +//│ module F extends A, E { +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +// * Note: strangely, we see here the ctor output from the previous definitions of the F module 🤔 +F.m +//│ Int +//│ res +//│ = 579 +//│ // Output +//│ Here's m: NaN +//│ Here's m: NaN +//│ Here's m: 579 + + +class G(x: Int) extends E(x, x + 1) +//│ class G(x: Int) extends A, E { +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +G(123).m +//│ Int +//│ res +//│ = 247 +//│ // Output +//│ Here's m: 247 + + +:e // TODO support +class H extends E { + constructor(a: Int, b: Int) { + super(a, b) + } +} +//│ ╔══[ERROR] class E expects 2 parameter(s); got 0 +//│ ║ l.143: class H extends E { +//│ ╙── ^ +//│ ╔══[ERROR] Illegal use of `super` +//│ ║ l.145: super(a, b) +//│ ╙── ^^^^^ +//│ ╔══[ERROR] identifier not found: super +//│ ║ l.145: super(a, b) +//│ ╙── ^^^^^ +//│ class H extends A, E { +//│ constructor(a: Int, b: Int) +//│ fun a1: Int +//│ fun a2: 2 +//│ } + +:re +new H(111, 222) +//│ H +//│ res +//│ Runtime error: +//│ ReferenceError: Super constructor may only be called once +//│ // Output +//│ Here's m: NaN +//│ Here's m: 333 + + diff --git a/shared/src/test/diff/nu/BasicClasses.mls b/shared/src/test/diff/nu/BasicClasses.mls index f629d0972..0fc43083b 100644 --- a/shared/src/test/diff/nu/BasicClasses.mls +++ b/shared/src/test/diff/nu/BasicClasses.mls @@ -64,6 +64,7 @@ class C { fun const(x) = id } //│ class C { +//│ constructor() //│ fun const: anything -> (forall 'a. 'a -> 'a) //│ fun id: forall 'a. 'a -> 'a //│ } @@ -77,10 +78,10 @@ class Base0(val n) { fun oops = this.my } //│ ╔══[ERROR] Class parameters currently need type annotations -//│ ║ l.73: class Base0(val n) { +//│ ║ l.74: class Base0(val n) { //│ ╙── ^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.77: fun oops = this.my +//│ ║ l.78: fun oops = this.my //│ ╙── ^^^ //│ class Base0(n: error) { //│ fun me: Base0 & {n: error} @@ -120,7 +121,7 @@ let n2 = b2.n -class Base1(base: Int) { +class Base1(val base: Int) { fun getBase1 = base fun getBase2 = this.base fun foo(x) = this.base + x @@ -174,7 +175,7 @@ b.me :e b.getBaseTypo //│ ╔══[ERROR] Type `Base1` does not contain member `getBaseTypo` -//│ ║ l.175: b.getBaseTypo +//│ ║ l.176: b.getBaseTypo //│ ╙── ^^^^^^^^^^^^ //│ error //│ res @@ -216,6 +217,17 @@ class Annots(base: 0 | 1) { a: Int fun a = base } +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.217: a: Int +//│ ║ ^ +//│ ╟── type `Int` does not match type `()` +//│ ║ l.217: a: Int +//│ ║ ^^^ +//│ ╟── but it flows into expression in statement position with expected type `()` +//│ ║ l.217: a: Int +//│ ╙── ^ //│ class Annots(base: 0 | 1) { //│ fun a: 0 | 1 //│ } diff --git a/shared/src/test/diff/nu/BasicMixins.mls b/shared/src/test/diff/nu/BasicMixins.mls index d76d5f17f..31de48af8 100644 --- a/shared/src/test/diff/nu/BasicMixins.mls +++ b/shared/src/test/diff/nu/BasicMixins.mls @@ -5,7 +5,7 @@ mixin Base { val base = 42 } //│ mixin Base() { -//│ let base: 42 +//│ val base: 42 //│ } mixin BaseTest { @@ -19,7 +19,7 @@ mixin BaseTest { module Base0 extends Base, BaseTest //│ module Base0 { -//│ let base: 42 +//│ val base: 42 //│ fun test: 42 //│ } @@ -35,17 +35,19 @@ Base0.test :e -class Base1(base: Int) extends BaseTest { +class Base1(val base: Int) extends BaseTest { fun test2 = [base, this.base] } //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.38: class Base1(base: Int) extends BaseTest { -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.38: class Base1(val base: Int) extends BaseTest { +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.39: fun test2 = [base, this.base] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.40: } +//│ ║ ^ //│ ╟── Object of type `anything` does not have field 'base' -//│ ║ l.38: class Base1(base: Int) extends BaseTest { -//│ ║ ^ +//│ ║ l.38: class Base1(val base: Int) extends BaseTest { +//│ ║ ^ //│ ╟── Note: constraint arises from field selection: //│ ║ l.12: fun test = super.base //│ ║ ^^^^^^^^^^ @@ -113,7 +115,7 @@ Base2(11).test2 // TODO class Base2(x) extends BaseOf(x + 1), BaseTest //│ ╔══[ERROR] Class parameters currently need type annotations -//│ ║ l.114: class Base2(x) extends BaseOf(x + 1), BaseTest +//│ ║ l.116: class Base2(x) extends BaseOf(x + 1), BaseTest //│ ╙── ^ //│ class Base2(x: error) { //│ fun original: Int @@ -123,7 +125,7 @@ class Base2(x) extends BaseOf(x + 1), BaseTest :e class Base1(x: Int): BaseTest //│ ╔══[ERROR] mixin BaseTest cannot be used as a type -//│ ║ l.124: class Base1(x: Int): BaseTest +//│ ║ l.126: class Base1(x: Int): BaseTest //│ ╙── ^^^^^^^^ //│ class Base1(x: Int): BaseTest @@ -138,7 +140,7 @@ Base1 :e 1 : BaseTest //│ ╔══[ERROR] mixin BaseTest cannot be used as a type -//│ ║ l.139: 1 : BaseTest +//│ ║ l.141: 1 : BaseTest //│ ╙── ^^^^^^^^ //│ BaseTest //│ res @@ -147,7 +149,7 @@ Base1 :e error : BaseTest //│ ╔══[ERROR] mixin BaseTest cannot be used as a type -//│ ║ l.148: error : BaseTest +//│ ║ l.150: error : BaseTest //│ ╙── ^^^^^^^^ //│ BaseTest //│ res @@ -166,39 +168,49 @@ mixin Foo { :e module Base1(base: Int, misc: string) extends Foo -//│ ╔══[ERROR] module parameters are not supported -//│ ║ l.168: module Base1(base: Int, misc: string) extends Foo +//│ ╔══[ERROR] Module parameters are not supported +//│ ║ l.170: module Base1(base: Int, misc: string) extends Foo //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.168: module Base1(base: Int, misc: string) extends Foo +//│ ║ l.170: module Base1(base: Int, misc: string) extends Foo //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Object of type `anything` does not have field 'misc' -//│ ║ l.168: module Base1(base: Int, misc: string) extends Foo +//│ ║ l.170: module Base1(base: Int, misc: string) extends Foo //│ ║ ^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.160: fun test(x) = [super.base + x, x, super.misc] +//│ ║ l.162: fun test(x) = [super.base + x, x, super.misc] //│ ║ ^^^^^^^^^^ //│ ╟── from reference: -//│ ║ l.160: fun test(x) = [super.base + x, x, super.misc] +//│ ║ l.162: fun test(x) = [super.base + x, x, super.misc] //│ ╙── ^^^^^ //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.168: module Base1(base: Int, misc: string) extends Foo +//│ ║ l.170: module Base1(base: Int, misc: string) extends Foo //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── Object of type `anything` does not have field 'base' -//│ ║ l.168: module Base1(base: Int, misc: string) extends Foo +//│ ║ l.170: module Base1(base: Int, misc: string) extends Foo //│ ║ ^ //│ ╟── Note: constraint arises from field selection: -//│ ║ l.160: fun test(x) = [super.base + x, x, super.misc] +//│ ║ l.162: fun test(x) = [super.base + x, x, super.misc] //│ ║ ^^^^^^^^^^ //│ ╟── from reference: -//│ ║ l.160: fun test(x) = [super.base + x, x, super.misc] +//│ ║ l.162: fun test(x) = [super.base + x, x, super.misc] //│ ╙── ^^^^^ //│ module Base1(base: Int, misc: string) { //│ fun test: forall 'a. (Int & 'a) -> [Int, 'a, nothing] //│ } +:e Base1.test -//│ forall 'a. (Int & 'a) -> [Int, 'a, nothing] +//│ ╔══[ERROR] Parameterized modules are not supported +//│ ║ l.203: Base1.test +//│ ╙── ^^^^^ +//│ ╔══[ERROR] Type mismatch in field selection: +//│ ║ l.203: Base1.test +//│ ║ ^^^^^^^^^^ +//│ ╟── reference of type `(base: Int, misc: string) -> Base1` does not have field 'test' +//│ ║ l.203: Base1.test +//│ ╙── ^^^^^ +//│ error //│ res //│ = [Function: test] @@ -274,13 +286,13 @@ WrapBase1.wrapA(1) :e WrapBase1.wrapA("ok") //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.275: WrapBase1.wrapA("ok") +//│ ║ l.287: WrapBase1.wrapA("ok") //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ╟── string literal of type `"ok"` is not an instance of type `Int` -//│ ║ l.275: WrapBase1.wrapA("ok") +//│ ║ l.287: WrapBase1.wrapA("ok") //│ ║ ^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.219: fun wrapA(x) = [super.wrapA(x)] +//│ ║ l.231: fun wrapA(x) = [super.wrapA(x)] //│ ╙── ^ //│ error | [Int] //│ res diff --git a/shared/src/test/diff/nu/CallByName.mls b/shared/src/test/diff/nu/CallByName.mls new file mode 100644 index 000000000..6258b1952 --- /dev/null +++ b/shared/src/test/diff/nu/CallByName.mls @@ -0,0 +1,39 @@ +:NewDefs + + +let x = log("ok") +//│ let x: () +//│ x +//│ = undefined +//│ // Output +//│ ok + +x +//│ () +//│ res +//│ = undefined + +x +//│ () +//│ res +//│ = undefined + + +fun x = log("ok") +//│ fun x: () + +x +//│ () +//│ res +//│ = undefined +//│ // Output +//│ ok + +x +//│ () +//│ res +//│ = undefined +//│ // Output +//│ ok + + diff --git a/shared/src/test/diff/nu/CaseExpr.mls b/shared/src/test/diff/nu/CaseExpr.mls new file mode 100644 index 000000000..59407e65c --- /dev/null +++ b/shared/src/test/diff/nu/CaseExpr.mls @@ -0,0 +1,168 @@ +:NewDefs + + +case 0 then true +//│ 0 -> true +//│ res +//│ = [Function: res] + +:pe // TODO support +case 0 then true, 1 then false +//│ ╔══[PARSE ERROR] Expected end of input; found comma instead +//│ ║ l.10: case 0 then true, 1 then false +//│ ╙── ^ +//│ 0 -> true +//│ res +//│ = [Function: res] + +case + 0 then true + 1 then false +//│ (0 | 1) -> Bool +//│ res +//│ = [Function: res] + + +fun foo = case + 0 then true + 1 then false +//│ fun foo: (0 | 1) -> Bool + +[foo(0), foo(1)] +//│ [Bool, Bool] +//│ res +//│ = [ true, false ] + + + +abstract class Option[out A] +class Some[out A](val value: A) extends Option[A] +module None extends Option[nothing] +//│ abstract class Option[A] +//│ class Some[A](value: A) extends Option +//│ module None extends Option + + +fun map(f) = case + Some(x) then Some(f(x)) + None then None +//│ fun map: forall 'a 'A. ('a -> 'A) -> (None | Some['a]) -> (None | Some['A]) + +map(succ) of Some of 123 +//│ None | Some[Int] +//│ res +//│ = Some {} + +map(succ) of None +//│ None | Some[Int] +//│ res +//│ = None { class: [class None extends Option] } + + +:e // TODO support +fun map(f) = case + Some(x) then Some(f(x)) + None as n then n +//│ ╔══[ERROR] Illegal pattern `as` +//│ ║ l.65: None as n then n +//│ ╙── ^^ +//│ fun map: anything -> anything -> error +//│ Code generation encountered an error: +//│ if expression was not desugared + + +:pe +case 1 +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'case'; found integer literal instead +//│ ║ l.75: case 1 +//│ ║ ^ +//│ ╟── Note: 'case' expression starts here: +//│ ║ l.75: case 1 +//│ ╙── ^^^^ +//│ anything -> 1 +//│ res +//│ = [Function: res] + +:pe +case (1 then true) +//│ ╔══[PARSE ERROR] Unexpected 'then' keyword here +//│ ║ l.87: case (1 then true) +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'case'; found integer literal instead +//│ ║ l.87: case (1 then true) +//│ ║ ^^^^^^^^^^^^^ +//│ ╟── Note: 'case' expression starts here: +//│ ║ l.87: case (1 then true) +//│ ╙── ^^^^ +//│ anything -> 1 +//│ res +//│ = [Function: res] + +case else 0 +//│ anything -> 0 +//│ res +//│ = [Function: res] + +:pe +case then 1 else 0 +//│ ╔══[PARSE ERROR] Unexpected 'then' keyword in expression position +//│ ║ l.107: case then 1 else 0 +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'case'; found integer literal instead +//│ ║ l.107: case then 1 else 0 +//│ ║ ^ +//│ ╟── Note: 'case' expression starts here: +//│ ║ l.107: case then 1 else 0 +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Expected end of input; found 'else' keyword instead +//│ ║ l.107: case then 1 else 0 +//│ ╙── ^^^^ +//│ anything -> 1 +//│ res +//│ = [Function: res] + + + +// TODO: + +:pe +:e +case x, y then x + y +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'case'; found reference instead +//│ ║ l.130: case x, y then x + y +//│ ║ ^ +//│ ╟── Note: 'case' expression starts here: +//│ ║ l.130: case x, y then x + y +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Expected end of input; found comma instead +//│ ║ l.130: case x, y then x + y +//│ ╙── ^ +//│ ╔══[ERROR] identifier not found: x +//│ ║ l.130: case x, y then x + y +//│ ╙── ^ +//│ anything -> error +//│ Code generation encountered an error: +//│ unresolved symbol x + +:pe +:e +case (x, y) then x + y +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.149: case (x, y) then x + y +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] type identifier not found: Tuple#2 +//│ ╙── +//│ nothing -> error +//│ Code generation encountered an error: +//│ unknown match case: Tuple#2 + +:e // * FIXME[UCS] +case [x, y] then x + y +//│ ╔══[ERROR] type identifier not found: Tuple#2 +//│ ╙── +//│ nothing -> error +//│ Code generation encountered an error: +//│ unknown match case: Tuple#2 + + + diff --git a/shared/src/test/diff/nu/ClassInstantiation.mls b/shared/src/test/diff/nu/ClassInstantiation.mls new file mode 100644 index 000000000..31b1a6066 --- /dev/null +++ b/shared/src/test/diff/nu/ClassInstantiation.mls @@ -0,0 +1,61 @@ +// *** Class instantiation tests *** // + +:NewDefs + + +class C +//│ class C { +//│ constructor() +//│ } + +new C +//│ C +//│ res +//│ = C {} + +// * TODO decide: forbid? +new C() +//│ C +//│ res +//│ = C {} + +:e +C() +//│ ╔══[ERROR] Construction of unparameterized class C should use the `new` keyword +//│ ║ l.23: C() +//│ ╙── ^ +//│ C +//│ res +//│ Runtime error: +//│ TypeError: Class constructor C cannot be invoked without 'new' + + +class D(x: Int) +//│ class D(x: Int) + +:js +D(0) +//│ D +//│ // Prelude +//│ class TypingUnit5 {} +//│ const typing_unit5 = new TypingUnit5; +//│ // Query 1 +//│ res = D(0); +//│ // End of generated code +//│ res +//│ = D {} + +// * TODO decide: reject or accept? +:js +new D(0) +//│ D +//│ // Prelude +//│ class TypingUnit6 {} +//│ const typing_unit6 = new TypingUnit6; +//│ // Query 1 +//│ res = new D.class(0); +//│ // End of generated code +//│ res +//│ = D {} + + diff --git a/shared/src/test/diff/nu/ClassesInMixins.mls b/shared/src/test/diff/nu/ClassesInMixins.mls index 1d4d2569c..eb7628414 100644 --- a/shared/src/test/diff/nu/ClassesInMixins.mls +++ b/shared/src/test/diff/nu/ClassesInMixins.mls @@ -8,13 +8,13 @@ mixin Test { } //│ mixin Test() { //│ class Foo(n: Int) -//│ let f: Foo +//│ val f: Foo //│ } module M extends Test //│ module M { //│ class Foo(n: Int) -//│ let f: Foo +//│ val f: Foo //│ } M.f @@ -29,7 +29,7 @@ M.f.n :e M.Foo -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.31: M.Foo //│ ╙── ^^^^ //│ error @@ -72,21 +72,29 @@ mixin Test3 { fun f(x) = if x is Foo then 1 } +:e mixin Test { class Lit(n: Int) class Add(lhs: A, rhs: A) { + // Should be a lazy val only forceable when A has the right shape (constrained types?): fun cached = size(this) } fun size(x) = if x is Add(l, r) then this.size(l) + this.size(r) } +//│ ╔══[ERROR] Type error in application +//│ ║ l.80: fun cached = size(this) +//│ ║ ^^^^^^^^^^ +//│ ╟── type variable `A` leaks out of its scope +//│ ║ l.78: class Add(lhs: A, rhs: A) { +//│ ╙── ^ //│ mixin Test() { -//│ this: {size: 'A -> Int} +//│ this: {size: (??A | 'a) -> Int} //│ class Add[A](lhs: A, rhs: A) { -//│ fun cached: Int +//│ fun cached: Int | error //│ } //│ class Lit(n: Int) -//│ fun size: Add['A] -> Int +//│ fun size: Add[??A0 & 'a] -> Int //│ } diff --git a/shared/src/test/diff/nu/CtorStatements.mls b/shared/src/test/diff/nu/CtorStatements.mls deleted file mode 100644 index e131cca82..000000000 --- a/shared/src/test/diff/nu/CtorStatements.mls +++ /dev/null @@ -1,24 +0,0 @@ -:NewDefs - - -log("Hello!") -//│ undefined -//│ res -//│ = undefined -//│ // Output -//│ Hello! - - -module Test0 { - log("Hello!") -} -//│ module Test0 - -Test0 -//│ Test0 -//│ res -//│ = Test0 { class: [class Test0] } -//│ // Output -//│ Hello! - - diff --git a/shared/src/test/diff/nu/CtorSubtraction.mls b/shared/src/test/diff/nu/CtorSubtraction.mls new file mode 100644 index 000000000..38d37eaaa --- /dev/null +++ b/shared/src/test/diff/nu/CtorSubtraction.mls @@ -0,0 +1,37 @@ +:NewDefs + + +class Cls +//│ class Cls { +//│ constructor() +//│ } + +fun x: ('a & Object) -> ('a \ Cls) +fun x = case + Cls then error + y then y +//│ fun x: forall 'b. (Cls | Object & 'b & ~#Cls) -> 'b +//│ fun x: forall 'a. (Object & 'a) -> ('a & ~Cls) + +x : Int -> Int +//│ Int -> Int +//│ res +//│ = [Function: x1] + +x : Cls -> nothing +//│ Cls -> nothing +//│ res +//│ = [Function: x1] + + +fun x: (Int | Str | Cls) \ Cls +fun x = 42 +//│ fun x: 42 +//│ fun x: Int & ~Cls | Str & ~Cls + +x : Int | Str +//│ Int | Str +//│ res +//│ = 42 + + diff --git a/shared/src/test/diff/nu/Dates.mls b/shared/src/test/diff/nu/Dates.mls index 6509a203e..dd5a5fc15 100644 --- a/shared/src/test/diff/nu/Dates.mls +++ b/shared/src/test/diff/nu/Dates.mls @@ -7,24 +7,19 @@ declare class Date { fun toLocaleString(locales: Str | Array[Str], options: anything): Str } //│ declare class Date { +//│ constructor(date: Num) //│ fun toLocaleString: (locales: Str | Array[Str], options: anything) -> Str //│ fun toString: () -> Str //│ } -:e // TODO ctor typing let date1 = new Date(12345678) -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.15: let date1 = new Date(12345678) -//│ ║ ^^^^^^^^^^^^^^ -//│ ╟── argument of type `[12345678]` does not match type `[]` -//│ ║ l.15: let date1 = new Date(12345678) -//│ ╙── ^^^^^^^^^^ -//│ let date1: Date | error +//│ let date1: Date //│ date1 //│ = 1970-01-01T03:25:45.678Z date1.toLocaleString("en-US", { timeZone: "America/New_York" }) -//│ Str | error +//│ Str //│ res //│ = '12/31/1969, 10:25:45 PM' + diff --git a/shared/src/test/diff/nu/Declarations.mls b/shared/src/test/diff/nu/Declarations.mls index 8f42b5d87..8f0c1e015 100644 --- a/shared/src/test/diff/nu/Declarations.mls +++ b/shared/src/test/diff/nu/Declarations.mls @@ -71,11 +71,12 @@ declare class Sanitizer { fun sanitizeFor(element: Str, input: Str): Str } //│ declare class Sanitizer { +//│ constructor() //│ fun sanitizeFor: (element: Str, input: Str) -> Str //│ } :re -let s = Sanitizer() +let s = new Sanitizer //│ let s: Sanitizer //│ s //│ Runtime error: @@ -86,7 +87,7 @@ let s = Sanitizer() // * TODO allow Buffer2 to be named Buffer... // :d declare module Buffer { - class Buffer2 { + abstract class Buffer2 { val length: Int } fun bar: Int @@ -95,8 +96,8 @@ declare module Buffer { // fun from2(a: Array[Int]): Buffer.Buffer2 = from2(a) // FIXME } //│ declare module Buffer { -//│ class Buffer2 { -//│ let length: Int +//│ abstract class Buffer2 { +//│ val length: Int //│ } //│ fun bar: Int //│ fun from: (a: Array[Int]) -> Buffer2 @@ -118,10 +119,10 @@ b.length :pe declare 42 //│ ╔══[PARSE ERROR] Unexpected literal token after modifier -//│ ║ l.119: declare 42 +//│ ║ l.120: declare 42 //│ ╙── ^^ //│ ╔══[PARSE ERROR] Unexpected literal token after modifier -//│ ║ l.119: declare 42 +//│ ║ l.120: declare 42 //│ ╙── ^^ //│ 42 //│ res diff --git a/shared/src/test/diff/nu/DeclaredMembers.mls b/shared/src/test/diff/nu/DeclaredMembers.mls index 0047151d5..f3d1a6ffd 100644 --- a/shared/src/test/diff/nu/DeclaredMembers.mls +++ b/shared/src/test/diff/nu/DeclaredMembers.mls @@ -4,9 +4,11 @@ declare class Parent { declare fun foo: () -> Str // there's an implementation, trust me! } //│ declare class Parent { +//│ constructor() //│ fun foo: () -> Str //│ } + :re class Child() extends Parent //│ class Child() extends Parent { diff --git a/shared/src/test/diff/nu/DiamondInherit.mls b/shared/src/test/diff/nu/DiamondInherit.mls index bfbb4def0..b65d6e0b1 100644 --- a/shared/src/test/diff/nu/DiamondInherit.mls +++ b/shared/src/test/diff/nu/DiamondInherit.mls @@ -33,7 +33,7 @@ Bar : Foo['X] //│ = 123 -trait Foo[A] { fun foo: A; fun bar: A -> A } +trait Foo[A] { fun foo: A;; fun bar: A -> A } //│ trait Foo[A] { //│ fun bar: A -> A //│ fun foo: A @@ -131,9 +131,9 @@ module Bar extends T1, Foo[Int | Str] { //│ } -trait Base[A] { fun foo: A; fun bar: A -> A } +trait Base[A] { fun foo: A;; fun bar: A -> A } trait Derived1[A] extends Base[A] -trait Derived2 extends Base[(Int | Str, Int | Str)] +trait Derived2 extends Base[[Int | Str, Int | Str]] //│ trait Base[A] { //│ fun bar: A -> A //│ fun foo: A @@ -150,20 +150,22 @@ trait Derived2 extends Base[(Int | Str, Int | Str)] //│ 'A0 := [Int | Str, Int | Str] //│ 'A := A -class Final extends Derived1[(Int, Int)], Derived2 { - fun foo = (123, 456) +class Final extends Derived1[[Int, Int]], Derived2 { + fun foo = [123, 456] fun bar([x, y]) = [error, error] } //│ class Final extends Base, Derived1, Derived2 { +//│ constructor() //│ fun bar: ([anything, anything]) -> [nothing, nothing] //│ fun foo: [123, 456] //│ } -class Final extends Derived1[(Int, Int)], Derived2 { - fun foo = (123, 456) +class Final extends Derived1[[Int, Int]], Derived2 { + fun foo = [123, 456] fun bar([x, y]) = [y, x] } //│ class Final extends Base, Derived1, Derived2 { +//│ constructor() //│ fun bar: forall 'a 'b. (['a, 'b]) -> ['b, 'a] //│ fun foo: [123, 456] //│ } diff --git a/shared/src/test/diff/nu/DidierNu.mls b/shared/src/test/diff/nu/DidierNu.mls index d1ad03961..5f5cf12d7 100644 --- a/shared/src/test/diff/nu/DidierNu.mls +++ b/shared/src/test/diff/nu/DidierNu.mls @@ -21,7 +21,7 @@ fun unify = x => y => z => k of z => k(z(x), y => k of z(y), y), z //│ fun unify: forall 'a. anything -> anything -> 'a -> 'a -fun a0 = (z => z) (id : forall 'A; 'A -> 'A) of 1 +fun a0 = (z => z) (id : forall 'A: 'A -> 'A) of 1 //│ fun a0: 1 fun fst([a, _]) = a @@ -29,7 +29,7 @@ fun snd([_, b]) = b //│ fun fst: forall 'a. (['a, anything]) -> 'a //│ fun snd: forall 'b. ([anything, 'b]) -> 'b -fun a1(x) = (z => unify(x)(fst of z)(snd of z))([id, (id : forall 'A; 'A -> 'A)]) of 1 +fun a1(x) = (z => unify(x)(fst of z)(snd of z))([id, (id : forall 'A: 'A -> 'A)]) of 1 //│ fun a1: anything -> 1 diff --git a/shared/src/test/diff/nu/EncodedLists.mls b/shared/src/test/diff/nu/EncodedLists.mls index a7d17efa4..8d12d0a75 100644 --- a/shared/src/test/diff/nu/EncodedLists.mls +++ b/shared/src/test/diff/nu/EncodedLists.mls @@ -3,12 +3,13 @@ class List { - fun match: forall 'res; (ifNil: () => 'res, ifCons: ('res, List[A]) => 'res) => 'res + fun match: forall 'res: (ifNil: () => 'res, ifCons: ('res, List[A]) => 'res) => 'res fun match = error // TODO use self-type... } let Nil: List let Cons: (head: 'a, tail: List<'a>) => List<'a> //│ class List[A] { +//│ constructor() //│ fun match: forall 'res. (ifNil: () -> 'res, ifCons: ('res, List[A]) -> 'res) -> 'res //│ } //│ let Nil: List[nothing] @@ -20,7 +21,7 @@ let x: List // FIXME x: List //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.21: x: List +//│ ║ l.22: x: List //│ ║ ^ //│ ╙── expression of type `anything` is not an instance of type `Int` //│ List[anything] diff --git a/shared/src/test/diff/nu/EqlClasses.mls b/shared/src/test/diff/nu/EqlClasses.mls index 82be4b683..0b3382c62 100644 --- a/shared/src/test/diff/nu/EqlClasses.mls +++ b/shared/src/test/diff/nu/EqlClasses.mls @@ -5,8 +5,12 @@ module Mod //│ module Mod +:e Mod === Mod -//│ Bool +//│ ╔══[ERROR] Module 'Mod' does not support equality comparison because it does not have a parameter list +//│ ║ l.9: Mod === Mod +//│ ╙── ^^^^^^^^^^^ +//│ error | false | true //│ res //│ = true @@ -23,6 +27,22 @@ Cls1() === Cls1() class Cls2(x: Int) //│ class Cls2(x: Int) +:e // TODO better error – or actually only support data classes +Cls2(0) === Cls2(1) +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.27: class Cls2(x: Int) +//│ ║ ^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.27: class Cls2(x: Int) +//│ ╙── ^ +//│ error | false | true +//│ res +//│ = false + + +class Cls2(val x: Int) +//│ class Cls2(x: Int) + Cls2(0) === Cls2(1) //│ Bool //│ res @@ -30,7 +50,7 @@ Cls2(0) === Cls2(1) -class Pair[A](fst: A, snd: A) +class Pair[A](val fst: A, val snd: A) // extends (A <: Eql[A]) => Eql[Pair[A]] //│ class Pair[A](fst: A, snd: A) @@ -63,10 +83,10 @@ p === { fst: 1, snd: 2 } :e { fst: 1, snd: 2 } === p //│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.64: { fst: 1, snd: 2 } === p +//│ ║ l.84: { fst: 1, snd: 2 } === p //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── record literal of type `{fst: 1, snd: 2}` is not an instance of type `Eql` -//│ ║ l.64: { fst: 1, snd: 2 } === p +//│ ║ l.84: { fst: 1, snd: 2 } === p //│ ╙── ^^^^^^^^^ //│ error | false | true //│ res @@ -86,11 +106,11 @@ r : {x: Int} :e x => { a: 0 } === x //│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.87: x => { a: 0 } === x -//│ ║ ^^^^^^^^^^^^^^ +//│ ║ l.107: x => { a: 0 } === x +//│ ║ ^^^^^^^^^^^^^^ //│ ╟── record literal of type `{a: 0}` is not an instance of type `Eql` -//│ ║ l.87: x => { a: 0 } === x -//│ ╙── ^ +//│ ║ l.107: x => { a: 0 } === x +//│ ╙── ^ //│ anything -> (error | false | true) //│ res //│ Syntax error: @@ -111,17 +131,17 @@ let q = Pair(1, "oops") :e q === q //│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.112: q === q +//│ ║ l.132: q === q //│ ║ ^^^^^^^ //│ ╟── integer literal of type `1` is not an instance of type `Str` -//│ ║ l.106: let q = Pair(1, "oops") +//│ ║ l.126: let q = Pair(1, "oops") //│ ╙── ^ //│ error | false | true //│ res //│ = true -class Pair2[A, B](fst: A, snd: B) +class Pair2[A, B](val fst: A, val snd: B) //│ class Pair2[A, B](fst: A, snd: B) let q = Pair2(1, "oops") @@ -136,6 +156,45 @@ q === q +class MP[Col](val color: Col) +//│ class MP[Col](color: Col) + +val mp = MP(1) +//│ val mp: MP[1] +//│ mp +//│ = MP {} + +mp === mp +//│ Bool +//│ res +//│ = true + +fun cmp(lhs, rhs) = lhs.color === rhs.color +//│ fun cmp: forall 'a. ({color: Eql['a]}, {color: 'a}) -> Bool + +cmp(mp, mp) +//│ Bool +//│ res +//│ = true + +module Mix { + fun compare(lhs, rhs) = (lhs.color === rhs.color) +} +module Comp extends Mix +//│ module Mix { +//│ fun compare: forall 'a. ({color: Eql['a]}, {color: 'a}) -> Bool +//│ } +//│ module Comp extends Mix { +//│ fun compare: forall 'b. ({color: Eql['b]}, {color: 'b}) -> Bool +//│ } + +Comp.compare(mp, mp) +//│ Bool +//│ res +//│ = true + + + // *** NOTES *** diff --git a/shared/src/test/diff/nu/Eval.mls b/shared/src/test/diff/nu/Eval.mls new file mode 100644 index 000000000..2e0961e10 --- /dev/null +++ b/shared/src/test/diff/nu/Eval.mls @@ -0,0 +1,256 @@ +:NewDefs + + + +// * Standard definitions: + + +declare fun String: anything -> Str +//│ fun String: anything -> Str + +fun (++) stringConcat(a, b) = concat(a)(b) +//│ fun (++) stringConcat: (Str, Str) -> Str + +fun (|>) pipe(x, f) = f(x) +fun (<|) pepi(f, x) = f(x) +//│ fun (|>) pipe: forall 'a 'b. ('a, 'a -> 'b) -> 'b +//│ fun (<|) pepi: forall 'c 'd. ('c -> 'd, 'c) -> 'd + + +// * Hack to throw exceptions +declare class throw(arg: anything): nothing +//│ declare class throw(arg: anything): nothing + +:w // * Due to current limitations of self types +:re +throw(1); 0 +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in application: +//│ ║ l.26: throw(1); 0 +//│ ║ ^^^^^^^^ +//│ ╙── application of type `throw` does not match type `()` +//│ 0 +//│ res +//│ Runtime error: +//│ 1 + +:w +fun test = throw(1); 0 +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in application: +//│ ║ l.39: fun test = throw(1); 0 +//│ ║ ^^^^^^^^ +//│ ╙── application of type `throw` does not match type `()` +//│ fun test: 0 + +:re +test +//│ 0 +//│ res +//│ Runtime error: +//│ 1 + +:w +fun test = + throw(1) + error +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in application: +//│ ║ l.57: throw(1) +//│ ║ ^^^^^^^^ +//│ ╙── application of type `throw` does not match type `()` +//│ fun test: nothing + +:re +test +//│ nothing +//│ res +//│ Runtime error: +//│ 1 + + +abstract class Option[out A] +class Some[out A](val value: A) extends Option[A] +module None extends Option[nothing] +//│ abstract class Option[A] +//│ class Some[A](value: A) extends Option +//│ module None extends Option + +abstract class List[out A]: Cons[A] | Nil { virtual val length: Int } +class Cons[out A](val head: A, val tail: List[A]) extends List[A] { + val length: Int + val length = tail.length + 1 + fun toString() = "Cons(" ++ String(head) ++ ", " ++ String(tail) ++ ")" +} +module Nil extends List[nothing] { + val length = 0 + fun toString() = "Nil" +} +//│ abstract class List[A]: Cons[A] | Nil { +//│ val length: Int +//│ } +//│ class Cons[A](head: A, tail: List[A]) extends List { +//│ val length: Int +//│ fun toString: () -> Str +//│ } +//│ module Nil extends List { +//│ val length: 0 +//│ fun toString: () -> "Nil" +//│ } + +fun (::) cons(x, xs) = Cons(x, xs) +fun (:::) concatList(xs, ys) = if xs is + Nil then ys + Cons(x, xs) then x :: xs ::: ys +//│ fun (::) cons: forall 'A. ('A, List['A]) -> Cons['A] +//│ fun (:::) concatList: forall 'A0 'a. (Cons['A0] | Nil, List['A0] & 'a) -> (Cons['A0] | 'a) + +module Lists { // TODO use name List when module overloading is supported: + + fun map(f) = case + Nil then Nil + Cons(x, xs) then f(x) :: map(f)(xs) + + fun zip(xs, ys) = if xs is + Nil then Nil + Cons(x, xs) then if ys is + Nil then Nil + Cons(y, ys) then + [x, y] :: zip(xs, ys) + + fun assoc(e) = case + Cons(kv, rest) then + if kv.key === e then Some(kv.value) + else assoc(e)(rest) + Nil then None + +} +//│ module Lists { +//│ fun assoc: forall 'a 'A. 'a -> (Cons[{key: Eql['a], value: 'A}] | Nil) -> (None | Some['A]) +//│ fun map: forall 'b 'A0. ('b -> 'A0) -> (Cons['b] | Nil) -> (Cons['A0] | Nil) +//│ fun zip: forall 'c 'd. (Cons['c] | Nil, Cons['d] | Nil) -> (Cons[['c, 'd]] | Nil) +//│ } + +let xs = 1 :: 2 :: 3 :: Nil +//│ let xs: Cons[1 | 2 | 3] +//│ xs +//│ = Cons {} + +String of xs ::: 4 :: 5 :: Nil +//│ Str +//│ res +//│ = 'Cons(1, Cons(2, Cons(3, Cons(4, Cons(5, Nil)))))' + + +let ls = {key: "a", value: 0} :: Nil +//│ let ls: Cons[{key: "a", value: 0}] +//│ ls +//│ = Cons {} + +ls |> Lists.assoc("a") +//│ None | Some[0] +//│ res +//│ = Some {} + + + +// * Our little language: + + +abstract class Term: Var | App | Lam | Sel | Rcd[Term] +class Var(val name: Str) extends Term +class App(val lhs: Term, val args: List[Term]) extends Term +class Lam(val params: List[Str], val body: Term) extends Term +class Rcd[out Sub](val fields: List[{key: Str, value: Sub}]) extends Term +class Sel(val prefix: Term, val fieldName: Str) extends Term +abstract class Lit[out A](val value: A): IntLit | StrLit extends Term +class IntLit(v: Int) extends Lit[Int](v) +class StrLit(v: Str) extends Lit[Str](v) +//│ abstract class Term: App | Lam | Rcd[Term] | Sel | Var +//│ class Var(name: Str) extends Term +//│ class App(lhs: Term, args: List[Term]) extends Term +//│ class Lam(params: List[Str], body: Term) extends Term +//│ class Rcd[Sub](fields: List[{key: Str, value: Sub}]) extends Term +//│ class Sel(prefix: Term, fieldName: Str) extends Term +//│ abstract class Lit[A](value: A): IntLit | StrLit extends Term +//│ class IntLit(v: Int) extends Lit, Term +//│ class StrLit(v: Str) extends Lit, Term + +type Value = Lam | Lit | Rcd[Value] +//│ type Value = Lam | Lit[anything] | Rcd[Value] + + +:w +fun err(msg) = + throw(concat("Evaluation error: " ++ msg)) + error +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in application: +//│ ║ l.188: throw(concat("Evaluation error: " ++ msg)) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╙── application of type `throw` does not match type `()` +//│ fun err: Str -> nothing + +fun eval(t, env) = if t is + Var(nme) then if env |> Lists.assoc(nme) is Some(v) + then v + else err("variable not found: " ++ nme) + Lit then t + Lam then t + App(f, args) then + let fe = eval(f, env) + if fe is Lam(ps, bod) then + val argse = args |> Lists.map(a => eval(a, env)) + if ps.length === argse.length then () else err("wrong number of arguments") + let envp = Lists.zip(ps, argse) |> Lists.map of ([key, value]) => {key, value} + eval(bod, envp ::: env) + else err(String(fe) ++ " cannot be applied") + Sel(pre, nme) then + let pree = eval(pre, env) + if pree is Rcd(xs) and xs |> Lists.assoc(nme) is Some(v) then v + else err(String(pree) ++ " does not have field " ++ nme) + Rcd(fs) then + Rcd of fs |> Lists.map of {key, value} => {key, value: eval(value, env)} +//│ fun eval: forall 'a 'b 'c. ('b, Cons[{key: Eql[Str], value: 'c}] & {List#A <: {key: Eql[Str], value: 'c}} & List[{key: Eql[Str], value: 'c}] | Nil & {List#A <: {key: Eql[Str], value: 'c}} & List[{key: Eql[Str], value: 'c}]) -> 'a +//│ where +//│ 'c :> 'a +//│ <: Object & ~#Rcd | Rcd['c] +//│ 'a :> 'c | Rcd[Lam | Lit[nothing] | 'a] | Lam | Lit[nothing] +//│ 'b <: App | Lam | Lit[anything] | Rcd['b] | Sel | Var + +eval : (Term, List[{key: Str, value: Value}]) -> Value +//│ (Term, List[{key: Str, value: Value}]) -> Value +//│ res +//│ = [Function: eval] + +let rcd = Rcd({key: "a", value: IntLit(0)} :: Nil) +//│ let rcd: Rcd[IntLit] +//│ rcd +//│ = Rcd {} + +eval of rcd, Nil +//│ 'a +//│ where +//│ 'a :> Lam | Lit[Int] | Rcd[Lam | Lit[Int] | 'a] +//│ res +//│ = Rcd {} + +eval of Sel(rcd, "a"), Nil +//│ 'a +//│ where +//│ 'a :> Lam | Lit[nothing] | Rcd[Lam | Lit[nothing] | 'a] +//│ res +//│ = IntLit {} + +eval of App(Lam("x" :: Nil, Sel(Var("x"), "a")), rcd :: Nil), Nil +//│ 'a +//│ where +//│ 'a :> Lam | Lit[nothing] | Rcd[Lam | Lit[nothing] | 'a] +//│ res +//│ = IntLit {} + + diff --git a/shared/src/test/diff/nu/EvalNegNeg.mls b/shared/src/test/diff/nu/EvalNegNeg.mls index 81cab6f15..e9e90e00d 100644 --- a/shared/src/test/diff/nu/EvalNegNeg.mls +++ b/shared/src/test/diff/nu/EvalNegNeg.mls @@ -49,21 +49,21 @@ mixin EvalNegNeg { module TestLang extends EvalBase, EvalNeg, EvalNegNeg //│ module TestLang { -//│ fun eval: 'a -> Int +//│ fun eval: (Neg['A] | Object & 'a & ~#Neg) -> Int //│ } //│ where -//│ 'a <: Neg['A] | Object & 'b & ~#Neg -//│ 'A <: Neg['a & 'A] | Neg['A] & ~#Neg | Object & 'b & ~#Neg -//│ 'b <: Add['a] | Lit | Neg['a] +//│ 'A <: Neg['A & 'b] | Neg['A] & ~#Neg | Object & 'a & ~#Neg +//│ 'b <: Neg['A] | Object & 'a & ~#Neg +//│ 'a <: Add['b] | Lit | Neg['b] fun mk(n) = if n is 0 then Lit(3) 1 then Neg(mk(n - 1)) _ then Add(mk(n - 1), mk(n - 1)) -//│ fun mk: forall 'E. (0 | 1 | Int & ~0 & ~1) -> 'E +//│ fun mk: forall 'a. (0 | 1 | Int & ~0 & ~1) -> (Lit | 'a) //│ where -//│ 'E :> Add['E] | Lit | Neg['E] +//│ 'a :> Neg[Lit | 'a] | Add[Lit | 'a] TestLang.eval(mk(0)) //│ Int diff --git a/shared/src/test/diff/nu/ExpressionProblem_repro.mls b/shared/src/test/diff/nu/ExpressionProblem_repro.mls index b6d6141e3..193b5f103 100644 --- a/shared/src/test/diff/nu/ExpressionProblem_repro.mls +++ b/shared/src/test/diff/nu/ExpressionProblem_repro.mls @@ -12,7 +12,7 @@ fun eval(e) = if e is Add0(l) then eval(l) class Add(lhs: E, rhs: E) -class Lit(value: Int) +class Lit(val value: Int) //│ class Add[E](lhs: E, rhs: E) //│ class Lit(value: Int) diff --git a/shared/src/test/diff/nu/Extrusion.mls b/shared/src/test/diff/nu/Extrusion.mls new file mode 100644 index 000000000..1642e4d89 --- /dev/null +++ b/shared/src/test/diff/nu/Extrusion.mls @@ -0,0 +1,43 @@ +:NewDefs + + +fun f(y) = + let local = forall 'A: (x: 'A) => + discard of y(x) + 1 + x + y +//│ fun f: forall 'a. (??A -> Int & 'a) -> 'a + +:e +f(id) +//│ ╔══[ERROR] Type error in application +//│ ║ l.12: f(id) +//│ ║ ^^^^^ +//│ ╟── type variable `'A` leaks out of its scope +//│ ║ l.5: let local = forall 'A: (x: 'A) => +//│ ║ ^^ +//│ ╟── into application of type `Int` +//│ ║ l.6: discard of y(x) + 1 +//│ ║ ^^^^ +//│ ╟── adding a type annotation to any of the following terms may help resolve the problem +//│ ╟── • this reference: +//│ ║ l.6: discard of y(x) + 1 +//│ ╙── ^ +//│ forall 'a. error | 'a -> 'a +//│ res +//│ = [Function: id] + + +fun f(y) = + let local = forall 'A: (x: 'A) => + discard of (y : forall 'a: 'a -> 'a)(x) + x + y +//│ fun f: forall 'b. (forall 'a. 'a -> 'a & 'b) -> 'b + +f(id) +//│ forall 'a. 'a -> 'a +//│ res +//│ = [Function: id] + + diff --git a/shared/src/test/diff/nu/FieldRefinement.mls b/shared/src/test/diff/nu/FieldRefinement.mls index 03eaaa297..b3c478940 100644 --- a/shared/src/test/diff/nu/FieldRefinement.mls +++ b/shared/src/test/diff/nu/FieldRefinement.mls @@ -2,7 +2,7 @@ :NoJS -class Foo(x: Int) { +class Foo(val x: Int) { fun bar = x fun baz: 1 | 2 = 1 } diff --git a/shared/src/test/diff/nu/FlatMonads.mls b/shared/src/test/diff/nu/FlatMonads.mls index afd9bb3c3..452bd802a 100644 --- a/shared/src/test/diff/nu/FlatMonads.mls +++ b/shared/src/test/diff/nu/FlatMonads.mls @@ -1,6 +1,10 @@ :NewDefs +declare fun String: anything -> Str +//│ fun String: anything -> Str + + abstract class IO[A] { fun bind(f) = Bind(this, f) fun run: A @@ -16,39 +20,34 @@ class Bind[A, B](underlying: IO[A], f: A -> IO[B]) extends IO[B] { //│ fun run: A //│ } //│ class Pure[A](value: A) extends IO { -//│ fun bind: forall 'A 'B0. ('A -> IO['B0]) -> Bind['A, 'B0] +//│ fun bind: forall 'B0. (A -> IO['B0]) -> Bind[in A & 'A out A, 'B0] //│ fun run: A //│ } //│ class Bind[A, B](underlying: IO[A], f: A -> IO[B]) extends IO { -//│ fun bind: forall 'B1 'A0. ('A0 -> IO['B1]) -> Bind['A0, 'B1] +//│ fun bind: forall 'B1. (B -> IO['B1]) -> Bind[in B & 'A0 out B, 'B1] //│ fun run: B //│ } //│ where -//│ 'A0 <: 'A1 -//│ 'A1 := B -//│ 'A <: 'A2 -//│ 'A2 := A +//│ 'A0 := B +//│ 'A := A -module readInt extends IO[Int] { fun run = 42 } +module readInt extends IO[Int] { fun run: Int = 42 } class printLine(str: Str) extends IO[undefined] { fun run = log(str) } -declare fun String: anything -> Str //│ module readInt extends IO { -//│ fun bind: forall 'A 'B. ('A -> IO['B]) -> Bind['A, 'B] -//│ fun run: 42 +//│ fun bind: forall 'B. ('A -> IO['B]) -> Bind[Int & 'A, 'B] +//│ fun run: Int //│ } //│ class printLine(str: Str) extends IO { -//│ fun bind: forall 'A0 'B0. ('A0 -> IO['B0]) -> Bind['A0, 'B0] -//│ fun run: undefined +//│ fun bind: forall 'B0. ('A0 -> IO['B0]) -> Bind[() & 'A0, 'B0] +//│ fun run: () //│ } -//│ fun String: anything -> Str //│ where -//│ 'A0 <: 'A1 -//│ 'A1 := undefined -//│ 'A <: 'A2 -//│ 'A2 := Int +//│ 'A0 := () +//│ 'A := Int // * Nested indent: + val main = printLine("Hi! Input two numbers: ").bind of _ => readInt.bind of n => @@ -56,10 +55,9 @@ val main = val sum = n + m printLine(concat("The sum is: ")(String of sum)).bind of _ => Pure(sum) -//│ let main: Bind['A, 'B] +//│ val main: Bind[(), 'B] //│ where //│ 'B :> Int -//│ 'A <: undefined //│ main //│ = Bind {} @@ -73,6 +71,7 @@ main.run // * Flat indent: + val main = printLine("Hi! Input two numbers: ").bind of _ => readInt.bind of n => @@ -80,10 +79,9 @@ val main = val sum = n + m printLine(concat("The sum is: ")(String of sum)).bind of _ => Pure(sum) -//│ let main: Bind['A, 'B] +//│ val main: Bind[(), 'B] //│ where //│ 'B :> Int -//│ 'A <: undefined //│ main //│ = Bind {} @@ -96,111 +94,118 @@ main.run //│ The sum is: 84 -// * TODO improve this error +// * TODO improve this error – missing provenance for '0-element tuple' :e printLine("").bind of [] => error //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.101: printLine("").bind of [] => error -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.99: printLine("").bind of [] => error +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type `()` is not a 0-element tuple +//│ ║ l.35: class printLine(str: Str) extends IO[undefined] { fun run = log(str) } +//│ ╙── ^^^^^^^^^ +//│ Bind[out (), 'B] | error +//│ res +//│ = Bind {} + +// * TODO improve this error (parameter list repr.) +:e +printLine("").bind of () => error +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.112: printLine("").bind of () => error +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type `[?A]` does not match type `[]` -//│ ║ l.11: class Bind[A, B](underlying: IO[A], f: A -> IO[B]) extends IO[B] { +//│ ║ l.15: class Bind[A, B](underlying: IO[A], f: A -> IO[B]) extends IO[B] { //│ ╙── ^ -//│ Bind['A, 'B] | error -//│ where -//│ 'A <: undefined +//│ Bind[(), 'B] | error //│ res //│ = Bind {} +printLine("").bind of (()) => error +//│ Bind[(), 'B] +//│ res +//│ = Bind {} -// * Using a shortand operator for `bind` -fun (|>=) bindOp[A, B](x: IO[A], f: A -> IO[B]): IO[B] = x.bind(f) -//│ fun (|>=) bindOp: forall 'A 'B. (x: IO['A], f: 'A -> IO['B]) -> IO['B] +// * Using a shortand operator for `bind`... What's the use of a `do` notation?! :^) + +fun (#>>) bind[A, B](x: IO[A], f: A -> IO[B]): IO[B] = x.bind(f) +//│ fun (#>>) bind: forall 'A 'B. (x: IO['A], f: 'A -> IO['B]) -> IO['B] -:e // FIXME why the errors? val main = - printLine("Hi! Input two numbers: ") |>= _ => - readInt |>= n => - readInt |>= m => + printLine("Hi! Input two numbers: ") #>> _ => + readInt #>> n => + readInt #>> m => val sum = n + m - printLine(concat("The sum is: ")(String of sum)) |>= _ => + printLine(concat("The sum is: ")(String of sum)) #>> _ => Pure(sum) -//│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.124: readInt |>= m => -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.125: val sum = n + m -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.126: printLine(concat("The sum is: ")(String of sum)) |>= _ => -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.127: Pure(sum) -//│ ║ ^^^^^^^^^^^ -//│ ╟── type `Int` does not match type `undefined` -//│ ║ l.32: module readInt extends IO[Int] { fun run = 42 } -//│ ║ ^^^ -//│ ╟── Note: constraint arises from literal type: -//│ ║ l.33: class printLine(str: Str) extends IO[undefined] { fun run = log(str) } -//│ ║ ^^^^^^^^^ -//│ ╟── Note: method type parameter A is defined at: -//│ ║ l.117: fun (|>=) bindOp[A, B](x: IO[A], f: A -> IO[B]): IO[B] = x.bind(f) -//│ ╙── ^ -//│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.123: readInt |>= n => -//│ ║ ^^^^^^^^^^^^^^^^ -//│ ║ l.124: readInt |>= m => -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.125: val sum = n + m -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.126: printLine(concat("The sum is: ")(String of sum)) |>= _ => -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.127: Pure(sum) -//│ ║ ^^^^^^^^^^^ -//│ ╟── type `Int` does not match type `undefined` -//│ ║ l.32: module readInt extends IO[Int] { fun run = 42 } -//│ ║ ^^^ -//│ ╟── Note: constraint arises from literal type: -//│ ║ l.33: class printLine(str: Str) extends IO[undefined] { fun run = log(str) } -//│ ║ ^^^^^^^^^ -//│ ╟── Note: method type parameter A is defined at: -//│ ║ l.117: fun (|>=) bindOp[A, B](x: IO[A], f: A -> IO[B]): IO[B] = x.bind(f) -//│ ╙── ^ -//│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.122: printLine("Hi! Input two numbers: ") |>= _ => -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.123: readInt |>= n => -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.124: readInt |>= m => -//│ ║ ^^^^^^^^^^^^^^^^^^ -//│ ║ l.125: val sum = n + m -//│ ║ ^^^^^^^^^^^^^^^^^ -//│ ║ l.126: printLine(concat("The sum is: ")(String of sum)) |>= _ => -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.127: Pure(sum) -//│ ║ ^^^^^^^^^^^ -//│ ╟── type `undefined` is not an instance of type `Int` -//│ ║ l.33: class printLine(str: Str) extends IO[undefined] { fun run = log(str) } -//│ ║ ^^^^^^^^^ -//│ ╟── Note: constraint arises from reference: -//│ ║ l.125: val sum = n + m -//│ ╙── ^ -//│ let main: IO['B] | error +//│ val main: IO['B] +//│ where +//│ 'B :> Int +//│ main +//│ = Bind {} + +main.run +//│ Int +//│ res +//│ = 84 +//│ // Output +//│ Hi! Input two numbers: +//│ The sum is: 84 + +fun loop = + printLine("Input a positive number: ") #>> _ => + readInt #>> n => + if n < 0 then loop else Pure(n) +//│ fun loop: forall 'B. IO['B] +//│ where +//│ 'B :> Int + +let r = loop.run +//│ let r: Int +//│ r +//│ = 42 +//│ // Output +//│ Input a positive number: + + +// * Using another shortand operator for `map` + +fun (>>) compose[A, B, C](f: A -> B, g: B -> C): A -> C = x => g(f(x)) +fun (#>) map[A, B](x: IO[A], f: A -> B): IO[B] = x.bind(f >> Pure) +//│ fun (>>) compose: forall 'A 'B 'C. (f: 'A -> 'B, g: 'B -> 'C) -> 'A -> 'C +//│ fun (#>) map: forall 'A0 'B0. (x: IO['A0], f: 'A0 -> 'B0) -> IO['B0] + +val main = + printLine("Hi! Input two numbers: ") #>> _ => + readInt #>> n => + readInt #>> m => + val sum = n + m + printLine(concat("The sum is: ")(String of sum)) #> _ => + sum +//│ val main: IO['B] +//│ where +//│ 'B :> Int //│ main //│ = Bind {} // * With no type annotations: -fun (|>=) bindOp(x, f) = x.bind(f) -//│ fun (|>=) bindOp: forall 'a 'b. ({bind: 'a -> 'b}, 'a) -> 'b +fun (>>) compose(f, g) = x => g(f(x)) +fun (#>>) bind(x, f) = x.bind(f) +fun (#>) map(x, f) = x.bind(f >> Pure) +//│ fun (>>) compose: forall 'a 'b 'c. ('a -> 'b, 'b -> 'c) -> 'a -> 'c +//│ fun (#>>) bind: forall 'd 'e. ({bind: 'd -> 'e}, 'd) -> 'e +//│ fun (#>) map: forall 'f 'g 'A. ({bind: ('g -> Pure['A]) -> 'f}, 'g -> 'A) -> 'f -// FIXME why `nothing`? val main = - printLine("Hi! Input two numbers: ") |>= _ => - readInt |>= n => - readInt |>= m => + printLine("Hi! Input two numbers: ") #>> _ => + readInt #>> n => + readInt #>> m => val sum = n + m - printLine(concat("The sum is: ")(String of sum)) |>= _ => - Pure(sum) -//│ let main: Bind[nothing, 'B] + printLine(concat("The sum is: ")(String of sum)) #> _ => + sum +//│ val main: Bind[(), 'B] //│ where //│ 'B :> Int //│ main @@ -214,23 +219,43 @@ main.run //│ Hi! Input two numbers: //│ The sum is: 84 +fun loop = + printLine("Input a positive number: ") #>> _ => + readInt #>> n => + if n < 0 then loop else Pure(n) +//│ fun loop: forall 'B. Bind[(), 'B] +//│ where +//│ 'B :> Int + +let r = loop.run +//│ let r: Int +//│ r +//│ = 42 +//│ // Output +//│ Input a positive number: -// * Abstracting over the monad: -fun (|>=) bindOp(x, f) = x.bind(f) -//│ fun (|>=) bindOp: forall 'a 'b. ({bind: 'a -> 'b}, 'a) -> 'b +// * Abstracting over the monad: fun main(ctx) = - ctx.printLine("Hi! Input two numbers: ") |>= _ => - ctx.readInt |>= n => - ctx.readInt |>= m => + ctx.printLine("Hi! Input two numbers: ") #>> _ => + ctx.readInt #>> n => + ctx.readInt #>> m => val sum = n + m - ctx.printLine(concat("The sum is: ")(String of sum)) |>= _ => + ctx.printLine(concat("The sum is: ")(String of sum)) #>> _ => ctx.pure(sum) -//│ fun main: forall 'a 'b. {printLine: Str -> {bind: (Int -> ('a | 'b)) -> 'a}, pure: Int -> 'b, readInt: {bind: (Int -> ('a | 'b)) -> 'a}} -> 'a +//│ fun main: forall 'a 'b 'c 'd 'e. { +//│ printLine: "Hi! Input two numbers: " -> {bind: (anything -> 'd) -> 'e} & Str -> {bind: (anything -> 'a) -> 'b}, +//│ pure: Int -> 'a, +//│ readInt: {bind: (Int -> 'c) -> 'd & (Int -> 'b) -> 'c} +//│ } -> 'e val defaultCtx = {printLine, readInt, pure: Pure} -//│ let defaultCtx: {printLine: (str: Str) -> printLine, pure: forall 'A. (value: 'A) -> Pure['A], readInt: readInt} +//│ val defaultCtx: { +//│ printLine: (str: Str) -> printLine, +//│ pure: forall 'A. (value: 'A) -> Pure['A], +//│ readInt: readInt +//│ } //│ defaultCtx //│ = { //│ printLine: [Function (anonymous)] { @@ -253,44 +278,60 @@ main(defaultCtx).run //│ The sum is: 84 fun loop(ctx) = - ctx.printLine("Input a positive number: ") |>= _ => - ctx.readInt |>= n => + ctx.printLine("Input a positive number: ") #>> _ => + ctx.readInt #>> n => if n < 0 then loop(ctx) else ctx.pure(n) -//│ fun loop: forall 'a 'b 'c. {printLine: "Input a positive number: " -> {bind: ((Int & 'a) -> ('b | 'c)) -> 'b}, pure: 'a -> 'c, readInt: {bind: ((Int & 'a) -> ('b | 'c)) -> 'b}} -> 'b +//│ fun loop: forall 'a 'b 'c 'd. { +//│ printLine: "Input a positive number: " -> {bind: (anything -> 'a) -> 'b}, +//│ pure: 'c -> 'd, +//│ readInt: {bind: ((Num & 'c) -> ('d | 'b)) -> 'a} +//│ } -> 'b + +let r = loop(defaultCtx) +//│ let r: Bind[(), 'B] +//│ where +//│ 'B :> Int +//│ r +//│ = Bind {} -// FIXME why `nothing`? let r = loop(defaultCtx).run -//│ let r: nothing +//│ let r: Int //│ r //│ = 42 //│ // Output //│ Input a positive number: +:e not(r) -//│ Bool +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.305: not(r) +//│ ║ ^^^^^^ +//│ ╟── type `Int` is not an instance of type `Bool` +//│ ║ l.34: module readInt extends IO[Int] { fun run: Int = 42 } +//│ ║ ^^^ +//│ ╟── but it flows into reference with expected type `Bool` +//│ ║ l.305: not(r) +//│ ╙── ^ +//│ error | false | true //│ res //│ = false -// * Note: using inferred type parent arguments +// * Note: using inferred parent type arguments module readInt extends IO { fun run = 42 } class printLine(str: Str) extends IO { fun run = log(str) } -declare fun String: anything -> Str //│ module readInt extends IO { -//│ fun bind: forall 'A 'B. ('A -> IO['B]) -> Bind['A, 'B] +//│ fun bind: forall 'B. ('A -> IO['B]) -> Bind['A, 'B] //│ fun run: 42 //│ } //│ class printLine(str: Str) extends IO { -//│ fun bind: forall 'A0 'B0. ('A0 -> IO['B0]) -> Bind['A0, 'B0] -//│ fun run: undefined +//│ fun bind: forall 'B0. ('A0 -> IO['B0]) -> Bind['A0, 'B0] +//│ fun run: () //│ } -//│ fun String: anything -> Str //│ where -//│ 'A0 <: 'A1 -//│ 'A1 :> undefined -//│ 'A <: 'A2 -//│ 'A2 :> 42 +//│ 'A0 :> () +//│ 'A :> 42 val main = printLine("Hi! Input two numbers: ").bind of _ => @@ -299,55 +340,77 @@ val main = val sum = n + m printLine(concat("The sum is: ")(String of sum)).bind of _ => Pure(sum) -//│ let main: Bind['A, 'B] +//│ val main: Bind[in 'A out () | 'A, 'B] //│ where //│ 'B :> Int //│ main //│ = Bind {} main -//│ Bind['A, 'B] +//│ Bind[in 'A out () | 'A, 'B] //│ where //│ 'B :> Int //│ res //│ = Bind {} -// :e // * FIXME this should be an error +:e let r = printLine("").bind of 0 => Pure(1) -//│ let r: Bind['A, 'B] +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.358: let r = printLine("").bind of 0 => Pure(1) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── application of type `()` does not match type `0` +//│ ║ l.323: class printLine(str: Str) extends IO { fun run = log(str) } +//│ ║ ^^^^^^^^ +//│ ╟── Note: constraint arises from integer literal: +//│ ║ l.358: let r = printLine("").bind of 0 => Pure(1) +//│ ╙── ^ +//│ let r: Bind[in 0 & 'A out () | 'A, 'B] | error //│ where //│ 'B :> 1 -//│ 'A <: 0 //│ r //│ = Bind {} -// :e // * FIXME this should be an error +:e let r = printLine("").bind of x => log(x.a) Pure(1) -//│ let r: Bind['A, 'B] +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.375: let r = printLine("").bind of x => +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.376: log(x.a) +//│ ║ ^^^^^^^^^ +//│ ║ l.377: Pure(1) +//│ ║ ^^^^^^^ +//│ ╟── application of type `()` does not have field 'a' +//│ ║ l.323: class printLine(str: Str) extends IO { fun run = log(str) } +//│ ║ ^^^^^^^^ +//│ ╟── Note: constraint arises from field selection: +//│ ║ l.376: log(x.a) +//│ ║ ^^^ +//│ ╟── from reference: +//│ ║ l.376: log(x.a) +//│ ╙── ^ +//│ let r: Bind[in {a: anything} & 'A out () | 'A, 'B] | error //│ where //│ 'B :> 1 -//│ 'A <: {a: anything} //│ r //│ = Bind {} :re r.run -//│ 1 +//│ 1 | error //│ res //│ Runtime error: //│ TypeError: Cannot read properties of undefined (reading 'a') - -// * We can even have the following syntax... what's the use of a `do` notation?! +// * We can even technically support the following syntax... :NoJS // * TODO We'll need to support functions extended with fields // * An interface that describes monadic functions with a field `run` -declare trait IO[A]: forall 'b; (A -> IO['b]) -> IO['b] { +declare trait IO[A]: forall 'b: (A -> IO['b]) -> IO['b] { fun run: A } declare fun pure: 'a -> IO['a] @@ -356,7 +419,7 @@ declare fun printLine: Str -> IO[()] //│ declare trait IO[A]: forall 'b. (A -> IO['b]) -> IO['b] { //│ fun run: A //│ } -//│ fun printLine: Str -> IO[[]] +//│ fun printLine: Str -> IO[()] //│ fun pure: forall 'a. 'a -> IO['a] //│ fun readInt: IO[Int] @@ -367,7 +430,7 @@ val main = val sum = n + m printLine(concat("The sum is: ")(String of sum)) of _ => pure(sum) -//│ let main: IO['b] +//│ val main: IO['b] //│ where //│ 'b :> Int diff --git a/shared/src/test/diff/nu/FlatMonads_repro.mls b/shared/src/test/diff/nu/FlatMonads_repro.mls new file mode 100644 index 000000000..938516f49 --- /dev/null +++ b/shared/src/test/diff/nu/FlatMonads_repro.mls @@ -0,0 +1,219 @@ +:NewDefs + + +abstract class IO[A] { + fun bind(f) = Bind(this, f) + fun hey = this + fun run: A +} +class Bind[CC, AA](underlying: IO[CC], f: CC -> IO[AA]) extends IO[AA] { + fun run = f(underlying.run).run +} +class Pure[A](value: A) extends IO[A] { + fun run = value +} +//│ abstract class IO[A] { +//│ fun bind: forall 'AA. (A -> IO['AA]) -> Bind[A, 'AA] +//│ fun hey: IO[A] +//│ fun run: A +//│ } +//│ class Bind[CC, AA](underlying: IO[CC], f: CC -> IO[AA]) extends IO { +//│ fun bind: forall 'AA0. ('A -> IO['AA0]) -> Bind['A, 'AA0] +//│ fun hey: IO['A] +//│ fun run: AA +//│ } +//│ class Pure[A](value: A) extends IO { +//│ fun bind: forall 'AA1. (A -> IO['AA1]) -> Bind[in A & 'A0 out A, 'AA1] +//│ fun hey: IO['A0] +//│ fun run: A +//│ } +//│ where +//│ 'A0 := A +//│ 'A := AA + +module readInt extends IO[Int] { fun run: Int = 42 } +//│ module readInt extends IO { +//│ fun bind: forall 'AA. ('A -> IO['AA]) -> Bind[Int & 'A, 'AA] +//│ fun hey: IO['A] +//│ fun run: Int +//│ } +//│ where +//│ 'A := Int + + +let ri(f) = Bind(Pure(42), f) +// let ri(f) = Bind(Pure(42) : IO[Int], f) +// let ri(f) = Bind(error : IO[Int], f) +//│ let ri: forall 'CC 'AA. ('CC -> IO['AA]) -> Bind['CC, 'AA] +//│ where +//│ 'CC :> 42 +//│ ri +//│ = [Function: ri] + +ri(Pure) +//│ Bind['CC, 'AA] +//│ where +//│ 'CC :> 42 +//│ <: 'AA +//│ 'AA :> 42 +//│ res +//│ = Bind {} + +readInt.bind +//│ forall 'AA. (Int -> IO['AA]) -> Bind[Int, 'AA] +//│ res +//│ = [Function: bind] + +Bind(readInt, Pure) +//│ Bind[Int & 'AA, 'AA] +//│ where +//│ 'AA :> Int +//│ res +//│ = Bind {} + + +// TODO prevent JS method extrusion; force explicit use of eta epxansion + +let b = readInt.bind : (Int -> IO['B]) -> Bind[Int, 'B] +//│ let b: (Int -> IO['B]) -> Bind[Int, 'B] +//│ b +//│ = [Function: bind] + +let b = readInt.bind : ('A -> IO['B]) -> Bind['A, 'B] where 'A : Int +//│ let b: (Int -> IO['B]) -> Bind[Int, 'B] +//│ b +//│ = [Function: bind] + +let b = readInt.bind : ('A -> IO['B]) -> Bind['A, 'B] where Int : 'A +//│ let b: (Int -> IO['B]) -> Bind[Int, 'B] +//│ b +//│ = [Function: bind] + + +let r = b of Pure +//│ let r: Bind[in Int & 'B out Int, 'B] +//│ where +//│ 'B :> Int +//│ r +//│ = Bind {} + +:re // FIXME `undefined` due to JS method extrusion +r.run +//│ Int +//│ res +//│ Runtime error: +//│ TypeError: Cannot read properties of undefined (reading 'run') + + +let r = readInt.bind of Pure +//│ let r: Bind[in Int & 'AA out Int, 'AA] +//│ where +//│ 'AA :> Int +//│ r +//│ = Bind {} + +r.run +//│ Int +//│ res +//│ = 42 + +x => readInt.bind of x +//│ forall 'AA. (Int -> IO['AA]) -> Bind[Int, 'AA] +//│ res +//│ = [Function: res] + +readInt.bind of Pure +//│ Bind[in Int & 'AA out Int, 'AA] +//│ where +//│ 'AA :> Int +//│ res +//│ = Bind {} + +readInt: IO['a] +//│ IO[Int] +//│ res +//│ = readInt { class: [class readInt extends IO] } + +(readInt : IO[Int]).bind +//│ forall 'AA. (Int -> IO['AA]) -> Bind[Int, 'AA] +//│ res +//│ = [Function: bind] + +readInt.run +//│ Int +//│ res +//│ = 42 + +x => Pure(x).run +//│ forall 'run. 'run -> 'run +//│ res +//│ = [Function: res] + + +fun loop0 = readInt.bind of Pure +fun loop1 = readInt.bind of (Pure : Int => IO[Int]) +fun loop2 = readInt.bind of ((x: Int) => Pure(x)) +fun loop3 = readInt.bind of (x => Pure(x) : IO[Int]) +//│ fun loop0: forall 'AA. Bind[in Int & 'AA out Int, 'AA] +//│ fun loop1: Bind[Int, Int] +//│ fun loop2: forall 'AA0. Bind[Int, 'AA0] +//│ fun loop3: Bind[Int, Int] +//│ where +//│ 'AA0 :> Int +//│ 'AA :> Int + +fun (#>>) bindOp(x, f) = x.bind(f) +//│ fun (#>>) bindOp: forall 'a 'b. ({bind: 'a -> 'b}, 'a) -> 'b + +fun loop = + readInt #>> n => + Pure(n) +//│ fun loop: forall 'AA. Bind[in Int & 'AA out Int, 'AA] +//│ where +//│ 'AA :> Int + + + +val x: Bind['A, 'B] where undefined : 'A;; 'A : 'B +//│ val x: forall 'A 'B. Bind['A, 'B] +//│ where +//│ 'A :> () +//│ <: 'B +//│ 'B :> () +//│ x +//│ = + +x.run +//│ () +//│ res +//│ = +//│ x is not implemented + +val x: Bind['A, 'B] where 'A : undefined;; 'A : 'B +//│ val x: forall 'A 'B. Bind['A, 'B] +//│ where +//│ 'A <: () & 'B +//│ x +//│ = + +x.run +//│ nothing +//│ res +//│ = +//│ x is not implemented + +val x: Bind[Int, Bool] +//│ val x: Bind[Int, Bool] +//│ x +//│ = + +// :d +x.run +//│ Bool +//│ res +//│ = +//│ x is not implemented + + + + diff --git a/shared/src/test/diff/nu/FunPatterns.mls b/shared/src/test/diff/nu/FunPatterns.mls index ff752832b..dc160060f 100644 --- a/shared/src/test/diff/nu/FunPatterns.mls +++ b/shared/src/test/diff/nu/FunPatterns.mls @@ -8,25 +8,32 @@ fun f(x, y) = x + y // FIXME array pattern...?! fun f1([x, y]) = x + y fun f2([x, y],) = x + y -fun f3([(x, y,),],) = x + y +fun f3([[x, y,],],) = x + y //│ fun f1: ([Int, Int]) -> Int //│ fun f2: ([Int, Int]) -> Int //│ fun f3: ([[Int, Int]]) -> Int +:pe +fun f3([(x, y,),],) = x + y +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.17: fun f3([(x, y,),],) = x + y +//│ ╙── ^^^^^^^ +//│ fun f3: ([[Int, Int]]) -> Int + class Pair(lhs: Int, rhs: Int) //│ class Pair(lhs: Int, rhs: Int) -// TODO +:e // * TODO fun f(Pair(x, y)) = x + y //│ ╔══[ERROR] Unsupported pattern shape: -//│ ║ l.21: fun f(Pair(x, y)) = x + y +//│ ║ l.28: fun f(Pair(x, y)) = x + y //│ ╙── ^^^^^^^^^^ //│ ╔══[ERROR] identifier not found: x -//│ ║ l.21: fun f(Pair(x, y)) = x + y +//│ ║ l.28: fun f(Pair(x, y)) = x + y //│ ╙── ^ //│ ╔══[ERROR] identifier not found: y -//│ ║ l.21: fun f(Pair(x, y)) = x + y +//│ ║ l.28: fun f(Pair(x, y)) = x + y //│ ╙── ^ //│ fun f: error -> Int diff --git a/shared/src/test/diff/nu/FunPoly.mls b/shared/src/test/diff/nu/FunPoly.mls index 8a9a5d593..9919df042 100644 --- a/shared/src/test/diff/nu/FunPoly.mls +++ b/shared/src/test/diff/nu/FunPoly.mls @@ -22,7 +22,7 @@ fun id(x) = x //│ fun id: forall 'a. 'a -> 'a //│ [1, true] //│ res -//│ = [Function: id1] +//│ = [ 1, true ] diff --git a/shared/src/test/diff/nu/FunSigs.mls b/shared/src/test/diff/nu/FunSigs.mls index 9e8614a49..ebe09b852 100644 --- a/shared/src/test/diff/nu/FunSigs.mls +++ b/shared/src/test/diff/nu/FunSigs.mls @@ -2,8 +2,8 @@ -fun log(msg: Str): unit -//│ fun log: (msg: Str) -> unit +fun log(msg: Str): () +//│ fun log: (msg: Str) -> () let f = log("ok") diff --git a/shared/src/test/diff/nu/GADTMono.mls b/shared/src/test/diff/nu/GADTMono.mls index 15a5d8993..83317fcbf 100644 --- a/shared/src/test/diff/nu/GADTMono.mls +++ b/shared/src/test/diff/nu/GADTMono.mls @@ -5,9 +5,9 @@ class LitInt(n: Int) extends Expr[Int] class LitBool(b: Bool) extends Expr[Bool] class Add(x: Expr[Int], y: Expr[Int]) extends Expr[Int] class Cond[T](p: Expr[Bool], t: Expr[T], e: Expr[T]) extends Expr[T] -class Pair[S, T](a: Expr[S], b: Expr[T]) extends Expr[(S, T)] -class Fst[S, T](p: Expr[(S, T)]) extends Expr[S] -class Snd[S, T](p: Expr[(S, T)]) extends Expr[T] +class Pair[S, T](a: Expr[S], b: Expr[T]) extends Expr[[S, T]] +class Fst[S, T](p: Expr[[S, T]]) extends Expr[S] +class Snd[S, T](p: Expr[[S, T]]) extends Expr[T] //│ trait Expr[A]: Add | Cond[?] | Fst[?, ?] | LitBool | LitInt | Pair[?, ?] | Snd[?, ?] //│ class LitInt(n: Int) extends Expr //│ class LitBool(b: Bool) extends Expr @@ -27,7 +27,9 @@ class Exp[type A] //│ ╔══[PARSE ERROR] Unexpected 'type' keyword here //│ ║ l.26: class Exp[type A] //│ ╙── ^^^^ -//│ class Exp +//│ class Exp { +//│ constructor() +//│ } l1: Expr[Int] //│ Expr[Int] @@ -37,13 +39,13 @@ l1: Expr[Int] :e l1: Expr[Bool] //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.38: l1: Expr[Bool] +//│ ║ l.40: l1: Expr[Bool] //│ ║ ^^ //│ ╟── type `Int` is not an instance of `Bool` //│ ║ l.4: class LitInt(n: Int) extends Expr[Int] //│ ║ ^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.38: l1: Expr[Bool] +//│ ║ l.40: l1: Expr[Bool] //│ ╙── ^^^^ //│ Expr[Bool] //│ res @@ -56,37 +58,67 @@ fun eval[A](e: Expr[A]): A = e is LitBool(b) then b e is Add(x, y) then eval(x) + eval(y) //│ ╔══[ERROR] Type mismatch in `case` expression: -//│ ║ l.55: e is LitInt(n) then n +//│ ║ l.57: e is LitInt(n) then n //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.56: e is LitBool(b) then b +//│ ║ l.58: e is LitBool(b) then b //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.57: e is Add(x, y) then eval(x) + eval(y) +//│ ║ l.59: e is Add(x, y) then eval(x) + eval(y) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── type `#Expr & (Add & {Expr#A = ?A} | Cond[?] & {Expr#A = ?A} | Fst[?, ?] & {Expr#A = ?A} | LitBool & {Expr#A = ?A} | LitInt & {Expr#A = ?A} | Pair[?, ?] & {Expr#A = ?A} | Snd[?, ?] & {Expr#A = ?A})` does not match type `Add | LitBool | LitInt` -//│ ║ l.53: fun eval[A](e: Expr[A]): A = +//│ ╟── type `#Expr & (Add & {Expr#A = A} | Cond[?] & {Expr#A = A} | Fst[?, ?] & {Expr#A = A} | LitBool & {Expr#A = A} | LitInt & {Expr#A = A} | Pair[?, ?] & {Expr#A = A} | Snd[?, ?] & {Expr#A = A})` does not match type `Add | LitBool | LitInt` +//│ ║ l.55: fun eval[A](e: Expr[A]): A = //│ ║ ^^^^^^^ //│ ╟── but it flows into reference with expected type `Add | LitBool | LitInt` -//│ ║ l.55: e is LitInt(n) then n +//│ ║ l.57: e is LitInt(n) then n //│ ╙── ^ +//│ ╔══[ERROR] Type mismatch in type ascription: +//│ ║ l.57: e is LitInt(n) then n +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.58: e is LitBool(b) then b +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.59: e is Add(x, y) then eval(x) + eval(y) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type `Int` does not match type `A` +//│ ║ l.4: class LitInt(n: Int) extends Expr[Int] +//│ ║ ^^^ +//│ ╟── but it flows into reference with expected type `A` +//│ ║ l.57: e is LitInt(n) then n +//│ ║ ^ +//│ ╟── Note: constraint arises from method type parameter: +//│ ║ l.55: fun eval[A](e: Expr[A]): A = +//│ ╙── ^ +//│ ╔══[ERROR] Type mismatch in definition: +//│ ║ l.55: fun eval[A](e: Expr[A]): A = +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.56: if +//│ ║ ^^^^^^^ +//│ ║ l.57: e is LitInt(n) then n +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.58: e is LitBool(b) then b +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.59: e is Add(x, y) then eval(x) + eval(y) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── type `Int` does not match type `A` +//│ ║ l.6: class Add(x: Expr[Int], y: Expr[Int]) extends Expr[Int] +//│ ║ ^^^ +//│ ╟── Note: constraint arises from method type parameter: +//│ ║ l.55: fun eval[A](e: Expr[A]): A = +//│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition: -//│ ║ l.53: fun eval[A](e: Expr[A]): A = +//│ ║ l.55: fun eval[A](e: Expr[A]): A = //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.54: if +//│ ║ l.56: if //│ ║ ^^^^^^^ -//│ ║ l.55: e is LitInt(n) then n +//│ ║ l.57: e is LitInt(n) then n //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.56: e is LitBool(b) then b +//│ ║ l.58: e is LitBool(b) then b //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.57: e is Add(x, y) then eval(x) + eval(y) +//│ ║ l.59: e is Add(x, y) then eval(x) + eval(y) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── type `Bool` is not an instance of `Int` -//│ ║ l.5: class LitBool(b: Bool) extends Expr[Bool] -//│ ║ ^^^^ -//│ ╟── but it flows into reference with expected type `Int` -//│ ║ l.56: e is LitBool(b) then b -//│ ║ ^ +//│ ╟── type `A` is not an instance of type `Int` +//│ ║ l.55: fun eval[A](e: Expr[A]): A = +//│ ║ ^ //│ ╟── Note: constraint arises from type reference: //│ ║ l.6: class Add(x: Expr[Int], y: Expr[Int]) extends Expr[Int] //│ ╙── ^^^ -//│ fun eval: (e: Expr[in Int out Int | false | true]) -> (Int | false | true) +//│ fun eval: forall 'A. (e: Expr['A]) -> 'A diff --git a/shared/src/test/diff/nu/GenericClassInheritance.mls b/shared/src/test/diff/nu/GenericClassInheritance.mls index 8b3242518..dda26819b 100644 --- a/shared/src/test/diff/nu/GenericClassInheritance.mls +++ b/shared/src/test/diff/nu/GenericClassInheritance.mls @@ -9,6 +9,7 @@ class Room[A](name: Str) { class BigRoom extends Room[Bool]("big") //│ class BigRoom extends Room { +//│ constructor() //│ fun foo: (x: 'A) -> 'A //│ } //│ where @@ -19,6 +20,7 @@ class InferredRoom extends Room("infer") { fun foo(x) = x && true } //│ class InferredRoom extends Room { +//│ constructor() //│ fun foo: Bool -> Bool //│ } @@ -32,9 +34,10 @@ class InferredRoom extends Room("infer") { :e class TooManyRoom extends Room[Int, Str]("too many") //│ ╔══[ERROR] class Room expects 1 type parameter(s); got 2 -//│ ║ l.33: class TooManyRoom extends Room[Int, Str]("too many") +//│ ║ l.35: class TooManyRoom extends Room[Int, Str]("too many") //│ ╙── ^^^^^^^^^^^^^ //│ class TooManyRoom extends Room { +//│ constructor() //│ fun foo: (x: 'A) -> 'A //│ } //│ where @@ -45,53 +48,47 @@ class WrongRoom extends Room[Bool]("wrong") { fun foo(x) = x + 1 } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.45: fun foo(x) = x + 1 +//│ ║ l.48: fun foo(x) = x + 1 //│ ║ ^^^^^^^^^^^^^^ //│ ╟── type `Bool` is not an instance of `Int` -//│ ║ l.44: class WrongRoom extends Room[Bool]("wrong") { +//│ ║ l.47: class WrongRoom extends Room[Bool]("wrong") { //│ ║ ^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.45: fun foo(x) = x + 1 +//│ ║ l.48: fun foo(x) = x + 1 //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.45: fun foo(x) = x + 1 +//│ ║ l.48: fun foo(x) = x + 1 //│ ║ ^^^^^^^^^^^^^^ //│ ╟── operator application of type `Int` is not an instance of type `Bool` -//│ ║ l.45: fun foo(x) = x + 1 +//│ ║ l.48: fun foo(x) = x + 1 //│ ║ ^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.44: class WrongRoom extends Room[Bool]("wrong") { +//│ ║ l.47: class WrongRoom extends Room[Bool]("wrong") { //│ ║ ^^^^ //│ ╟── from reference: //│ ║ l.4: virtual fun foo(x: A) = x //│ ╙── ^ //│ class WrongRoom extends Room { +//│ constructor() //│ fun foo: Int -> Int //│ } -class C0[A] { val a: A } -//│ class C0[A] { -//│ let a: A +abstract class C0[A] { val a: A } +//│ abstract class C0[A] { +//│ val a: A //│ } class C1[A] extends C0[A] { val a = a } //│ class C1[A] extends C0 { -//│ let a: nothing +//│ constructor() +//│ val a: nothing //│ } -:pe -:e new C1 : C1[Int] -//│ ╔══[PARSE ERROR] Unexpected type ascription after `new` keyword -//│ ║ l.85: new C1 : C1[Int] -//│ ╙── ^^ -//│ ╔══[ERROR] Currently unsupported `new` syntax -//│ ║ l.85: new C1 : C1[Int] -//│ ╙── ^^^ -//│ error +//│ C1[Int] //│ res -//│ = {} +//│ = C1 {} ((new C1) : C1[Int]) : C0['X] //│ C0[Int] @@ -106,7 +103,7 @@ new C1 : C1[Int] mixin M1[A] { fun f1(x: A): A = x - fun f2(x: A): (A, A) = (x, x) + fun f2(x: A): [A, A] = [x, x] } //│ mixin M1[A]() { //│ fun f1: (x: A) -> A @@ -117,12 +114,14 @@ class A1 extends M1 { fun f1(x: Int) = x } //│ class A1 { +//│ constructor() //│ fun f1: (x: Int) -> Int //│ fun f2: (x: 'A) -> ['A, 'A] //│ } -class A2[S, T] extends M1[(S, T)] +class A2[S, T] extends M1[[S, T]] //│ class A2[S, T] { +//│ constructor() //│ fun f1: (x: [S, T]) -> [S, T] //│ fun f2: (x: [S, T]) -> [[S, T], [S, T]] //│ } @@ -141,27 +140,27 @@ mixin M2[A] { //│ fun m: A //│ } -class B1(a: Int) extends M2[Int] +class B1(val a: Int) extends M2[Int] //│ class B1(a: Int) { //│ fun m: Int //│ } -class B2[A](a: Int => A) extends M2 +class B2[A](val a: Int => A) extends M2 //│ class B2[A](a: Int -> A) { //│ fun m: Int -> A //│ } :e -class E1(a: Int) extends M2[Bool] +class E1(val a: Int) extends M2[Bool] //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.155: class E1(a: Int) extends M2[Bool] -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.154: class E1(val a: Int) extends M2[Bool] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── expression of type `Int` is not an instance of type `Bool` //│ ╟── Note: constraint arises from type reference: -//│ ║ l.155: class E1(a: Int) extends M2[Bool] -//│ ║ ^^^^ +//│ ║ l.154: class E1(val a: Int) extends M2[Bool] +//│ ║ ^^^^ //│ ╟── from field selection: -//│ ║ l.137: fun m: A = this.a +//│ ║ l.136: fun m: A = this.a //│ ╙── ^^^^^^ //│ class E1(a: Int) { //│ fun m: Bool diff --git a/shared/src/test/diff/nu/GenericClasses.mls b/shared/src/test/diff/nu/GenericClasses.mls index a6a57f35a..4d71d0c01 100644 --- a/shared/src/test/diff/nu/GenericClasses.mls +++ b/shared/src/test/diff/nu/GenericClasses.mls @@ -2,7 +2,9 @@ class C -//│ class C[A] +//│ class C[A] { +//│ constructor() +//│ } fun f(x) = if x is C then x //│ fun f: forall 'A. C['A] -> C['A] @@ -33,7 +35,7 @@ f(c) //│ = 1 -class C[A](n: A) { +class C[A](val n: A) { fun f = this.n fun g = C(12).n } @@ -189,7 +191,7 @@ class Test(n) { fun bar = n } //│ ╔══[ERROR] Class parameters currently need type annotations -//│ ║ l.187: class Test(n) { +//│ ║ l.189: class Test(n) { //│ ╙── ^ //│ class Test(n: error) { //│ fun bar: error @@ -213,13 +215,13 @@ class Test(n: A) { fun foo = n + 1 } //│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.213: fun foo = n + 1 +//│ ║ l.215: fun foo = n + 1 //│ ║ ^^^^^ //│ ╟── reference of type `A` is not an instance of type `Int` -//│ ║ l.213: fun foo = n + 1 +//│ ║ l.215: fun foo = n + 1 //│ ║ ^ //│ ╟── Note: type parameter A is defined at: -//│ ║ l.212: class Test(n: A) { +//│ ║ l.214: class Test(n: A) { //│ ╙── ^ //│ class Test[A](n: A) { //│ fun foo: Int | error @@ -248,7 +250,9 @@ class Test(n: A) { //│ } Test(1) -//│ Test[1] +//│ Test['A] +//│ where +//│ 'A :> 1 //│ res //│ = Test {} @@ -263,7 +267,9 @@ Test("ok").foo //│ = 'ok' let t = Test(1) -//│ let t: Test[1] +//│ let t: Test['A] +//│ where +//│ 'A :> 1 //│ t //│ = Test {} @@ -296,13 +302,13 @@ class TestBad() { fun foo2(x: A) = x + 1 } //│ ╔══[ERROR] Type mismatch in operator application: -//│ ║ l.296: fun foo2(x: A) = x + 1 +//│ ║ l.302: fun foo2(x: A) = x + 1 //│ ║ ^^^^^ //│ ╟── reference of type `A` is not an instance of type `Int` -//│ ║ l.296: fun foo2(x: A) = x + 1 +//│ ║ l.302: fun foo2(x: A) = x + 1 //│ ║ ^ //│ ╟── Note: type parameter A is defined at: -//│ ║ l.294: class TestBad() { +//│ ║ l.300: class TestBad() { //│ ╙── ^ //│ class TestBad[A]() { //│ fun foo1: (x: A) -> A @@ -320,7 +326,7 @@ TestBad().foo1(1) //│ = 1 x => TestBad().foo1(x) -//│ 'a -> 'a +//│ forall 'a. 'a -> 'a //│ res //│ = [Function: res] @@ -393,7 +399,7 @@ not(w.x.n) :e not(w.x.a) //│ ╔══[ERROR] Type `C['a]` does not contain member `a` -//│ ║ l.394: not(w.x.a) +//│ ║ l.400: not(w.x.a) //│ ╙── ^^ //│ Bool //│ res @@ -401,3 +407,36 @@ not(w.x.a) +abstract class Cls[A](val x: A) { fun g: A -> Int } +//│ abstract class Cls[A](x: A) { +//│ fun g: A -> Int +//│ } + +module M extends Cls(123) { fun g = id } +//│ module M extends Cls { +//│ fun g: forall 'a. 'a -> 'a +//│ } + +M: Cls['a] +//│ Cls['a] +//│ where +//│ 'a :> 123 +//│ <: Int +//│ res +//│ = M { class: [class M extends Cls] } + + +class Cls[A](val x: A) { fun g: A -> Int;; fun g(x) = 42 } +//│ class Cls[A](x: A) { +//│ fun g: A -> Int +//│ } + +Cls(123) +//│ Cls['A] +//│ where +//│ 'A :> 123 +//│ res +//│ = Cls {} + + + diff --git a/shared/src/test/diff/nu/GenericMethods.mls b/shared/src/test/diff/nu/GenericMethods.mls index 04115b3d8..a0d7466a8 100644 --- a/shared/src/test/diff/nu/GenericMethods.mls +++ b/shared/src/test/diff/nu/GenericMethods.mls @@ -1,7 +1,7 @@ :NewDefs -fun foo1 = forall 'A; (x: 'A) => x +fun foo1 = forall 'A: (x: 'A) => x //│ fun foo1: forall 'A. (x: 'A) -> 'A foo1(42) @@ -14,7 +14,7 @@ foo1[Int](42) //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.13: foo1[Int](42) //│ ╙── ^^^^^^^^^ -//│ error +//│ 42 //│ res //│ = 42 @@ -32,7 +32,7 @@ foo2(42) //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.31: foo2(42) //│ ╙── ^^^^^^^^^ -//│ error +//│ 42 //│ res //│ = 42 @@ -50,12 +50,12 @@ foo3[Int](42) //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.49: foo3[Int](42) //│ ╙── ^^^^^^^^^ -//│ error +//│ 42 //│ res //│ = 42 -fun bar: forall 'A; 'A => 'A +fun bar: forall 'A: 'A => 'A //│ fun bar: forall 'A. 'A -> 'A :e @@ -63,39 +63,33 @@ fun bar : A => A //│ ╔══[ERROR] Type parameters are not yet supported in this position //│ ║ l.62: fun bar : A => A //│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.62: fun bar : A => A -//│ ╙── ^ -//│ ╔══[ERROR] type identifier not found: A -//│ ║ l.62: fun bar : A => A -//│ ╙── ^ -//│ fun bar: error -> error +//│ fun bar: forall 'A. 'A -> 'A :pe :e :w fun bar: A => A //│ ╔══[PARSE ERROR] Unmatched opening angle bracket -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ║ ^ //│ ╙── Note that `<` without spaces around it is considered as an angle bracket and not as an operator //│ ╔══[PARSE ERROR] Unexpected 'fun' keyword in expression position -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^^^^^^^^^^^^^^ //│ ╔══[ERROR] identifier not found: >: -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^^ //│ ╔══[ERROR] identifier not found: A -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^ //│ ╔══[ERROR] identifier not found: A -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^ //│ ╔══[ERROR] identifier not found: A -//│ ║ l.77: fun bar: A => A +//│ ║ l.71: fun bar: A => A //│ ╙── ^ //│ error //│ Code generation encountered an error: @@ -108,18 +102,18 @@ module Test { fun bar: 'A fun test(x: A) = x } -//│ ╔══[ERROR] Member `foo` is declared in parent but not implemented in `Test` -//│ ║ l.106: module Test { +//│ ╔══[ERROR] Member `foo` is declared (or its declaration is inherited) but is not implemented in `Test` +//│ ║ l.100: module Test { //│ ║ ^^^^ //│ ╟── Declared here: -//│ ║ l.107: fun foo: 'A => 'A -//│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member `bar` is declared in parent but not implemented in `Test` -//│ ║ l.106: module Test { +//│ ║ l.101: fun foo: 'A => 'A +//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member `bar` is declared (or its declaration is inherited) but is not implemented in `Test` +//│ ║ l.100: module Test { //│ ║ ^^^^ //│ ╟── Declared here: -//│ ║ l.108: fun bar: 'A -//│ ╙── ^^^^^^^ +//│ ║ l.102: fun bar: 'A +//│ ╙── ^^^^^^^^^^^ //│ module Test { //│ fun bar: nothing //│ fun foo: forall 'A. 'A -> 'A diff --git a/shared/src/test/diff/nu/GenericMixins.mls b/shared/src/test/diff/nu/GenericMixins.mls index cc5348ea0..ecf62c179 100644 --- a/shared/src/test/diff/nu/GenericMixins.mls +++ b/shared/src/test/diff/nu/GenericMixins.mls @@ -100,6 +100,7 @@ class C[A] extends Test[Array[A]] { fun baz2 = this.bar(this.foo) } //│ class C[A] { +//│ constructor() //│ fun bar: (Array[A] -> Array[A]) -> Array[A] -> Array[A] //│ fun baz1: Array[A] //│ fun baz2: Array[A] -> Array[A] @@ -111,8 +112,8 @@ class C[A] extends Test[Array[A]] { mixin Test[A] { fun foo: A -> A fun foo = id - fun bar: (A, A) - fun bar = (this.arg, this.arg) + fun bar: [A, A] + fun bar = [this.arg, this.arg] fun baz = foo(this.arg) } //│ mixin Test[A]() { @@ -143,10 +144,10 @@ module D extends C(0) { this.foo(false) } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.143: this.foo(false) +//│ ║ l.144: this.foo(false) //│ ╙── ^^^^ //│ ╔══[ERROR] Cannot access `this` during object initialization -//│ ║ l.143: this.foo(false) +//│ ║ l.144: this.foo(false) //│ ╙── ^^^^ //│ module D extends C { //│ fun bar: forall 'A. [Int | 'A, Int | 'A] @@ -158,19 +159,18 @@ module D extends C(0) { class C extends Test { // it also fails with Test[Int]... fun arg = 123 } -//│ ╔══[ERROR] Type `#C & {bar: [?A, ?A], baz: ?a, foo: ?A -> ?A}` does not contain member `arg` -//│ ║ l.116: fun baz = foo(this.arg) +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.117: fun baz = foo(this.arg) //│ ╙── ^^^^ -//│ ╔══[ERROR] Type `#C & {bar: [?A, ?A], baz: ?a, foo: ?A -> ?A}` does not contain member `arg` -//│ ║ l.115: fun bar = (this.arg, this.arg) +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.116: fun bar = [this.arg, this.arg] //│ ╙── ^^^^ -//│ ╔══[ERROR] Type `#C & {bar: [?A, ?A], baz: ?a, foo: ?A -> ?A}` does not contain member `arg` -//│ ║ l.115: fun bar = (this.arg, this.arg) +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.116: fun bar = [this.arg, this.arg] //│ ╙── ^^^^ -//│ ╔══[ERROR] Illegal position for this definition statement. -//│ ║ l.159: fun arg = 123 -//│ ╙── ^^^^^^^^^ //│ class C { +//│ constructor() +//│ fun arg: 123 //│ fun bar: [error | 'A, error | 'A] //│ fun baz: error //│ fun foo: 'A -> (error | 'A) @@ -181,6 +181,7 @@ class C extends Test { fun arg = 123 } //│ class C { +//│ constructor() //│ fun arg: Int //│ fun bar: [Int | 'A, Int | 'A] //│ fun baz: Int diff --git a/shared/src/test/diff/nu/GenericModules.mls b/shared/src/test/diff/nu/GenericModules.mls index 6ec4a734f..ae49e4872 100644 --- a/shared/src/test/diff/nu/GenericModules.mls +++ b/shared/src/test/diff/nu/GenericModules.mls @@ -7,27 +7,27 @@ module Test { fun bar: A => A = id fun baz(x: A) = x fun poly0: 'a -> 'a - fun poly1: forall 'a; 'a -> 'a + fun poly1: forall 'a: 'a -> 'a fun poly2: 'a -> 'a = id } -//│ ╔══[ERROR] Member `foo` is declared in parent but not implemented in `Test` +//│ ╔══[ERROR] Member `foo` is declared (or its declaration is inherited) but is not implemented in `Test` //│ ║ l.5: module Test { //│ ║ ^^^^ //│ ╟── Declared here: //│ ║ l.6: fun foo: A => A -//│ ╙── ^^^^^^^^^^^ -//│ ╔══[ERROR] Member `poly0` is declared in parent but not implemented in `Test` +//│ ╙── ^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member `poly0` is declared (or its declaration is inherited) but is not implemented in `Test` //│ ║ l.5: module Test { //│ ║ ^^^^ //│ ╟── Declared here: //│ ║ l.9: fun poly0: 'a -> 'a -//│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member `poly1` is declared in parent but not implemented in `Test` +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member `poly1` is declared (or its declaration is inherited) but is not implemented in `Test` //│ ║ l.5: module Test { //│ ║ ^^^^ //│ ╟── Declared here: -//│ ║ l.10: fun poly1: forall 'a; 'a -> 'a -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.10: fun poly1: forall 'a: 'a -> 'a +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ module Test[A] { //│ fun bar: A -> A //│ fun baz: (x: A) -> A @@ -99,7 +99,7 @@ Test .foo //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.98: Test .foo //│ ╙── ^^^^^^^^^ -//│ error +//│ ??A -> ??A0 //│ res //│ = undefined @@ -108,7 +108,7 @@ Test .foo //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.107: (Test).foo //│ ╙── ^^^^^^^^^ -//│ error +//│ ??A -> ??A0 //│ res //│ = undefined diff --git a/shared/src/test/diff/nu/HeungTung.mls b/shared/src/test/diff/nu/HeungTung.mls new file mode 100644 index 000000000..091301565 --- /dev/null +++ b/shared/src/test/diff/nu/HeungTung.mls @@ -0,0 +1,316 @@ +:NewDefs + + + +trait A +trait B +//│ trait A +//│ trait B + +module AA extends A, B +//│ module AA extends A, B + +fun x: A & B +fun x = AA +//│ fun x: AA +//│ fun x: A & B + +x : A +//│ A +//│ res +//│ = AA { class: [class AA extends Object] } + + + +abstract class Foo[A, B] { fun x: A & B } +//│ abstract class Foo[A, B] { +//│ fun x: A & B +//│ } + +module Bar extends Foo[Int, Bool] { fun x = x } +//│ module Bar extends Foo { +//│ fun x: nothing +//│ } + +module Bar extends Foo { fun x = () } +//│ module Bar extends Foo { +//│ fun x: () +//│ } + +Bar : Foo['a, 'b] +//│ Foo['a, 'b] +//│ where +//│ 'b :> () +//│ 'a :> () +//│ res +//│ = Bar { class: [class Bar extends Foo] } + + +// * An overloaded function type +fun f: (Int -> Int) & (Bool -> Bool) +fun f = id +//│ fun f: forall 'a. 'a -> 'a +//│ fun f: Int -> Int & Bool -> Bool + + +// * Widen the results +fun h: (Int -> (Int | Bool)) & (Bool -> (Int | Bool)) +fun h = f +//│ fun h: Int -> Int & Bool -> Bool +//│ fun h: (Bool | Int) -> (Int | false | true) + +// * Merge intersected functions with same domain +fun g: (Int | Bool) -> (Int | Bool) +fun g = h +//│ fun g: (Bool | Int) -> (Int | false | true) +//│ fun g: (Bool | Int) -> (Int | false | true) + +// * In one step +fun g: (Int | Bool) -> (Int | Bool) +fun g = f +//│ fun g: Int -> Int & Bool -> Bool +//│ fun g: (Bool | Int) -> (Int | false | true) + + +// * Can also widen into intersection +fun i: ((Int & Bool) -> Int) & ((Int & Bool) -> Bool) +fun i = f +//│ fun i: Int -> Int & Bool -> Bool +//│ fun i: nothing -> nothing + +// * Merge intersected functions with same codomain +fun j: (Int & Bool) -> (Int & Bool) +fun j = i +//│ fun j: nothing -> nothing +//│ fun j: nothing -> nothing + +:e // * Note: currently it doesn't work when done in a single step +fun j: (Int & Bool) -> (Int & Bool) +fun j = f +//│ ╔══[ERROR] Type mismatch in definition: +//│ ║ l.89: fun j = f +//│ ║ ^^^^^ +//│ ╙── expression of type `Int` does not match type `nothing` +//│ fun j: Int -> Int & Bool -> Bool +//│ fun j: nothing -> nothing + + +// * Or widen even further with both an intersection and a union, into this +fun g: (Int & Bool) -> (Int | Bool) +fun g = f +//│ fun g: Int -> Int & Bool -> Bool +//│ fun g: nothing -> (Int | false | true) + + +// * Note: we currently approximate uses of overloaded function types! +// * With match-type-based constraint solving, we could return Int here + +f(0) +//│ Int | false | true +//│ res +//│ = 0 + +// f(0) : case 0 of { Int => Int; Bool => Bool } == Int + + +x => f(x) +//│ (Bool | Int) -> (Int | false | true) +//│ res +//│ = [Function: res] + +// : forall 'a: 'a -> case 'a of { Int => Int; Bool => Bool } where 'a <: Int | Bool + + +f(if true then 0 else false) +//│ Int | false | true +//│ res +//│ = 0 + +// * With match-type-based constraint solving, we could *also* return Int here + +:e // TODO implement this syntax +:w +f(refined if true then 0 else false) // this one can be precise again! +//│ ╔══[WARNING] Paren-less applications should use the 'of' keyword +//│ ║ l.133: f(refined if true then 0 else false) // this one can be precise again! +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] identifier not found: refined +//│ ║ l.133: f(refined if true then 0 else false) // this one can be precise again! +//│ ╙── ^^^^^^^ +//│ Int | false | true +//│ Code generation encountered an error: +//│ unresolved symbol refined + + + +// * Notes on constraint solving + + +// * Easy: + +// ?a -> ?b <: (Int -> Int) & (Bool -> Bool) +// to: +// ?a -> ?b <: (Int -> Int) AND ?a -> ?b <: (Bool -> Bool) + +// * Hard; but can solve with match types: + +// (Int -> Int) & (Bool -> Bool) <: ?a -> ?b +// to: +// ?a <: Int | Bool AND (case ?a of { Int => Int; Bool => Bool }) <: ?b + +// We can still widen if needed; consider: +// ?a := Int | Bool +// then: +// (case (Int | Bool) of { Int => Int; Bool => Bool }) <: ?b +// to: +// Int <: ?b AND Bool <: ?b + +// An simple match-type constraint example: +// (case ?a of { Int => Int; Bool => Bool }) <: Int +// to: +// ?a <: Int + +// A more complicated match-type constraint example: +// (case ?a of { Int => ?b; Bool => ?c }) <: T +// to: +// ?b <: (case ?a of { Int => T; Bool => Top }) AND ?c <: (case ?a of { Int => Top; Bool => T }) + + + +class List[A] +//│ class List[A] { +//│ constructor() +//│ } + +// * Note: match type `T match { case List[t] => ... t ... }` could be encoded as: + +type M = (forall 't: List['t] => 't) +//│ type M = forall 't. List['t] -> 't + +type T = List[Int] +//│ type T = List[Int] + +:e // TODO application types +type Res = M(T) +//│ ╔══[ERROR] Wrong number of type arguments – expected 0, found 1 +//│ ║ l.194: type Res = M(T) +//│ ╙── ^^^^ +//│ type Res = M + + + +let f = x => [x, x] +//│ let f: forall 'a. 'a -> ['a, 'a] +//│ f +//│ = [Function: f2] + +[f(1), f(true)] +//│ [[1, 1], [true, true]] +//│ res +//│ = [ [ 1, 1 ], [ true, true ] ] + + + +:e // TODO support +fun f: Int -> Int +fun f: Bool -> Bool +fun f = id +//│ ╔══[ERROR] A type signature for 'f' was already given +//│ ║ l.216: fun f: Bool -> Bool +//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ fun f: forall 'a. 'a -> 'a +//│ fun f: Int -> Int + +:e // TODO support +f: (Int -> Int) & (Bool -> Bool) +//│ ╔══[ERROR] Type mismatch in type ascription: +//│ ║ l.225: f: (Int -> Int) & (Bool -> Bool) +//│ ║ ^ +//│ ╟── type `Bool` is not an instance of `Int` +//│ ║ l.225: f: (Int -> Int) & (Bool -> Bool) +//│ ║ ^^^^ +//│ ╟── Note: constraint arises from type reference: +//│ ║ l.215: fun f: Int -> Int +//│ ╙── ^^^ +//│ Int -> Int & Bool -> Bool +//│ res +//│ = [Function: id] + +// t: S t: T +// ------------- +// t: S & T + + + +// * Weird MLstruct rule (only sound when we don't have FCP): +// forall 'a: 'a -> 'a <: (Int -> Int) & (Bool -> Bool) == (Int | Bool) -> (Int & Bool) +// ~{ a: Int } <: Str -> Str + +// * Notice: in positive position, this is equivalent to Bottom +fun x: ~{ a: Int } +//│ fun x: nothing + + +class A() +class B() +//│ class A() +//│ class B() + +A() : ~B +//│ ~B +//│ res +//│ = A {} + +// A <: ~B +// <=> +// A <: ~B | Bot +// <=> +// A & B <: Bot + +fun x: A & B +//│ fun x: nothing + + +fun test(x) = if x is + A then 0 + _ then x +//│ fun test: forall 'a. (A | Object & 'a & ~#A) -> (0 | 'a) + +test(B()) +//│ 0 | B +//│ res +//│ = B {} + +test(A()) +//│ 0 +//│ res +//│ = 0 + +// A <: A | Object & 'a & ~A +// A & ~A <: Object & 'a & ~A +// Bot <: Object & 'a & ~A + + +:e // TODO implement this syntax +:w +fun test(x) = refined if x is + A then 0 + B then 1 +//│ ╔══[WARNING] Paren-less applications should use the 'of' keyword +//│ ║ l.296: fun test(x) = refined if x is +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.297: A then 0 +//│ ║ ^^^^^^^^^^ +//│ ║ l.298: B then 1 +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] identifier not found: refined +//│ ║ l.296: fun test(x) = refined if x is +//│ ╙── ^^^^^^^ +//│ fun test: (A | B) -> error +//│ Code generation encountered an error: +//│ unresolved symbol refined + +// forall 'a: 'a -> (case 'a of A -> 0, B & ~A -> 1) + + + diff --git a/shared/src/test/diff/nu/Huawei1.mls b/shared/src/test/diff/nu/Huawei1.mls index a74d30fdb..bf50ba68d 100644 --- a/shared/src/test/diff/nu/Huawei1.mls +++ b/shared/src/test/diff/nu/Huawei1.mls @@ -14,7 +14,9 @@ let c = C(123) //│ = C {} class B -//│ class B +//│ class B { +//│ constructor() +//│ } fun bar(c) = if c is C(y) then y @@ -40,13 +42,13 @@ bar(c) :e bar(C(true)) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.41: bar(C(true)) +//│ ║ l.43: bar(C(true)) //│ ║ ^^^^^^^^^^^^ //│ ╟── reference of type `true` is not an instance of type `Int` -//│ ║ l.41: bar(C(true)) +//│ ║ l.43: bar(C(true)) //│ ║ ^^^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.30: C(y) then y + 1 +//│ ║ l.32: C(y) then y + 1 //│ ║ ^ //│ ╟── from field selection: //│ ║ l.4: class C[A](x: A) { diff --git a/shared/src/test/diff/nu/IdentEscape.mls b/shared/src/test/diff/nu/IdentEscape.mls index b329c5684..11b167544 100644 --- a/shared/src/test/diff/nu/IdentEscape.mls +++ b/shared/src/test/diff/nu/IdentEscape.mls @@ -47,7 +47,7 @@ id"" //│ ╔══[PARSE ERROR] empty identifier escaped. //│ ║ l.46: id"" //│ ╙── ^^^^ -//│ undefined +//│ () //│ res //│ = undefined @@ -62,16 +62,20 @@ id"id //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here //│ ║ l.55: id"id //│ ╙── ^ -//│ undefined +//│ () //│ res //│ = undefined class id"of" -//│ class of +//│ class of { +//│ constructor() +//│ } :ge class id"class" -//│ class class +//│ class class { +//│ constructor() +//│ } //│ Code generation encountered an error: //│ class is a reserved keyword in ECMAScript and can not be used as type name. diff --git a/shared/src/test/diff/nu/ImplicitMethodPolym.mls b/shared/src/test/diff/nu/ImplicitMethodPolym.mls index 5ee370436..94642a1a7 100644 --- a/shared/src/test/diff/nu/ImplicitMethodPolym.mls +++ b/shared/src/test/diff/nu/ImplicitMethodPolym.mls @@ -26,9 +26,10 @@ M.id1(0) module M { fun id1(x) = x - id1(0) + let _ = id1(0) } //│ module M { +//│ let _: 0 //│ fun id1: forall 'a. 'a -> 'a //│ } @@ -53,7 +54,7 @@ module M extends Mx { } //│ module M { //│ fun id1: forall 'a. ('b & 'a) -> (0 | 'a) -//│ let r: 0 | 'b +//│ val r: 0 | 'b //│ } mixin Mx { @@ -69,7 +70,7 @@ module M extends Mx { this.id1(0) } //│ ╔══[ERROR] Type `#M & {id1: ?a -> ?b}` does not contain member `id2` -//│ ║ l.60: fun id1(x) = this.id2(x) +//│ ║ l.61: fun id1(x) = this.id2(x) //│ ╙── ^^^^ //│ module M { //│ fun id1: anything -> error @@ -79,11 +80,11 @@ module M extends Mx { :e module M extends Mx { - fun id2(x) = (x, x) + fun id2(x) = [x, x] this.id1(0) } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.60: fun id1(x) = this.id2(x) +//│ ║ l.61: fun id1(x) = this.id2(x) //│ ╙── ^^^^ //│ module M { //│ fun id1: anything -> error @@ -92,11 +93,12 @@ module M extends Mx { // * Notice that `id1` is no longer generalized! module M extends Mx { - fun id2: 'a => ('a, 'a) - fun id2(x) = (x, x) - this.id1(0) + fun id2: 'a => ['a, 'a] + fun id2(x) = [x, x] + let _ = this.id1(0) } //│ module M { +//│ let _: [0 | 'a, 0 | 'a] //│ fun id1: 'a -> [0 | 'a, 0 | 'a] //│ fun id2: forall 'a0. 'a0 -> ['a0, 'a0] //│ } @@ -106,16 +108,17 @@ module M extends Mx { :e // FIXME class C { virtual fun id1(x) = x - fun f = (this.id1(true), this.id1(0)) + fun f = [this.id1(true), this.id1(0)] fun id2(x) = x } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.109: fun f = (this.id1(true), this.id1(0)) +//│ ║ l.111: fun f = [this.id1(true), this.id1(0)] //│ ╙── ^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.109: fun f = (this.id1(true), this.id1(0)) +//│ ║ l.111: fun f = [this.id1(true), this.id1(0)] //│ ╙── ^^^^ //│ class C { +//│ constructor() //│ fun f: [error, error] //│ fun id1: forall 'a. 'a -> 'a //│ fun id2: forall 'b. 'b -> 'b @@ -127,10 +130,10 @@ module M extends C { this.id2(true) } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.127: this.id2(true) +//│ ║ l.130: this.id2(true) //│ ╙── ^^^^ //│ ╔══[ERROR] Cannot access `this` during object initialization -//│ ║ l.127: this.id2(true) +//│ ║ l.130: this.id2(true) //│ ╙── ^^^^ //│ module M extends C { //│ fun f: [error, error] @@ -142,11 +145,14 @@ module M extends C { module M extends C { fun g = (this.id2(true), this.id2(0)) } +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.146: fun g = (this.id2(true), this.id2(0)) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.143: fun g = (this.id2(true), this.id2(0)) +//│ ║ l.146: fun g = (this.id2(true), this.id2(0)) //│ ╙── ^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.143: fun g = (this.id2(true), this.id2(0)) +//│ ║ l.146: fun g = (this.id2(true), this.id2(0)) //│ ╙── ^^^^ //│ module M extends C { //│ fun f: [error, error] @@ -181,15 +187,15 @@ module M extends C { fun id1 = succ } //│ ╔══[ERROR] Type mismatch in definition of method id1: -//│ ║ l.181: fun id1 = succ +//│ ║ l.187: fun id1 = succ //│ ║ ^^^^^^^^^^ //│ ╙── variable of type `?a` is not an instance of type `Int` //│ ╔══[ERROR] Type mismatch in definition of method id1: -//│ ║ l.181: fun id1 = succ +//│ ║ l.187: fun id1 = succ //│ ║ ^^^^^^^^^^ //│ ╟── expression of type `Int` does not match type `?a` //│ ╟── Note: constraint arises from reference: -//│ ║ l.108: virtual fun id1(x) = x +//│ ║ l.110: virtual fun id1(x) = x //│ ╙── ^ //│ module M extends C { //│ fun f: [error, error] @@ -211,6 +217,12 @@ M.id1 // FIXME? parsing/semantics of this, currently treated as a named tuple... (M: C) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.219: (M: C) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Construction of unparameterized class C should use the `new` keyword +//│ ║ l.219: (M: C) +//│ ╙── ^ //│ [M: () -> C] //│ res //│ = [ [class C] ] @@ -229,19 +241,19 @@ module M { fun oops(x) = m := x } //│ ╔══[PARSE ERROR] Unexpected 'mut' keyword in expression position -//│ ║ l.228: mut val m = None +//│ ║ l.240: mut val m = None //│ ╙── ^^^ //│ ╔══[PARSE ERROR] Unexpected 'val' keyword in expression position -//│ ║ l.228: mut val m = None +//│ ║ l.240: mut val m = None //│ ╙── ^^^ //│ ╔══[ERROR] identifier not found: := -//│ ║ l.229: fun oops(x) = m := x +//│ ║ l.241: fun oops(x) = m := x //│ ╙── ^^ //│ ╔══[ERROR] identifier not found: m -//│ ║ l.229: fun oops(x) = m := x +//│ ║ l.241: fun oops(x) = m := x //│ ╙── ^ //│ ╔══[ERROR] Unexpected equation in this position -//│ ║ l.228: mut val m = None +//│ ║ l.240: mut val m = None //│ ╙── ^^^^^^^^ //│ module M { //│ fun oops: anything -> error diff --git a/shared/src/test/diff/nu/InferredInheritanceTypeArgs.mls b/shared/src/test/diff/nu/InferredInheritanceTypeArgs.mls index cb9302a89..9bbf4abec 100644 --- a/shared/src/test/diff/nu/InferredInheritanceTypeArgs.mls +++ b/shared/src/test/diff/nu/InferredInheritanceTypeArgs.mls @@ -2,24 +2,36 @@ mixin Test[A] { - fun bar: (A, A) - fun bar = (this.a, this.a) + fun bar: [A, A] + fun bar = [this.a, this.a] } //│ mixin Test[A]() { //│ this: {a: A} //│ fun bar: [A, A] //│ } +class A(val a: Int) extends Test +//│ class A(a: Int) { +//│ fun bar: [Int, Int] +//│ } + +:e class A(a: Int) extends Test +//│ ╔══[ERROR] Parameter 'a' cannot tbe accessed as a field +//│ ║ l.6: fun bar = [this.a, this.a] +//│ ╙── ^^ +//│ ╔══[ERROR] Parameter 'a' cannot tbe accessed as a field +//│ ║ l.6: fun bar = [this.a, this.a] +//│ ╙── ^^ //│ class A(a: Int) { //│ fun bar: [Int, Int] //│ } mixin Test2[S, T] { - fun x: (S, T) - fun x = (this.s, this.t) - fun fb: S => (S, S) - fun fb(h: S) = (this.s, h) + fun x: [S, T] + fun x = [this.s, this.t] + fun fb: S => [S, S] + fun fb(h: S) = [this.s, h] } //│ mixin Test2[S, T]() { //│ this: {s: S, t: T} @@ -27,50 +39,50 @@ mixin Test2[S, T] { //│ fun x: [S, T] //│ } -class A1[B](s: Bool, t: B) extends Test2[Bool, B] +class A1[B](val s: Bool, val t: B) extends Test2[Bool, B] //│ class A1[B](s: Bool, t: B) { //│ fun fb: (Bool & 'S) -> [Bool | 'S, Bool | 'S] //│ fun x: [Bool | 'S, B] //│ } -// TODO: Investigate type of fb -class A2[A](s: A, t: Int) extends Test2 +// * TODO: Investigate type of fb +class A2[A](val s: A, val t: Int) extends Test2 //│ class A2[A](s: A, t: Int) { //│ fun fb: 'S -> [A | 'S, A | 'S] //│ fun x: [A | 'S, Int] //│ } -// TODO: Investigate type of fb -class A3(s: Int, t: Bool) extends Test2 +// * TODO: Investigate type of fb +class A3(val s: Int, val t: Bool) extends Test2 //│ class A3(s: Int, t: Bool) { //│ fun fb: 'S -> [Int | 'S, Int | 'S] //│ fun x: [Int | 'S, Bool] //│ } class P(val p: Int) { - virtual fun foo(x) = x + p + virtual fun foo(x) = x + p } //│ class P(p: Int) { //│ fun foo: Int -> Int //│ } -:e // FIXME +:e // TODO improve type checking class C1(a: Int) extends P(a) { fun bar = this.foo(0) } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.58: class C1(a: Int) extends P(a) { fun bar = this.foo(0) } +//│ ║ l.70: class C1(a: Int) extends P(a) { fun bar = this.foo(0) } //│ ╙── ^^^^ //│ class C1(a: Int) extends P { //│ fun bar: error //│ fun foo: Int -> Int //│ } -:e // FIXME +:e // TODO improve type checking class C2(a: Int, b: Int) extends P(a + b) { - fun foo(x) = x * this.p + a * b + fun foo(x) = x * this.p + a * b } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.69: fun foo(x) = x * this.p + a * b -//│ ╙── ^^ +//│ ║ l.81: fun foo(x) = x * this.p + a * b +//│ ╙── ^^ //│ class C2(a: Int, b: Int) extends P { //│ fun foo: Int -> Int //│ } @@ -165,14 +177,14 @@ B.foo :pe trait Foo[type A] { fun foo(x: A): A } //│ ╔══[PARSE ERROR] Unexpected 'type' keyword here -//│ ║ l.166: trait Foo[type A] { fun foo(x: A): A } +//│ ║ l.178: trait Foo[type A] { fun foo(x: A): A } //│ ╙── ^^^^ //│ trait Foo { //│ fun foo: (x: A) -> A //│ } -trait Foo[A] { fun a: A; fun foo(x: A): A } +trait Foo[A] { fun a: A;; fun foo(x: A): A } //│ trait Foo[A] { //│ fun a: A //│ fun foo: (x: A) -> A @@ -209,30 +221,32 @@ trait Foo[A] { fun foo[A](x: A): A } class B extends Foo { fun foo(x) = x } //│ class B extends Foo { +//│ constructor() //│ fun foo: forall 'a. 'a -> 'a //│ } :e class B extends Foo { fun foo(x) = x + 1 } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.216: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.229: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^^^^^^^^^^ //│ ╟── type `A` is not an instance of type `Int` -//│ ║ l.205: trait Foo[A] { fun foo[A](x: A): A } +//│ ║ l.217: trait Foo[A] { fun foo[A](x: A): A } //│ ║ ^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.216: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.229: class B extends Foo { fun foo(x) = x + 1 } //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.216: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.229: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^^^^^^^^^^ //│ ╟── operator application of type `Int` does not match type `A` -//│ ║ l.216: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.229: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^ //│ ╟── Note: constraint arises from method type parameter: -//│ ║ l.205: trait Foo[A] { fun foo[A](x: A): A } +//│ ║ l.217: trait Foo[A] { fun foo[A](x: A): A } //│ ╙── ^ //│ class B extends Foo { +//│ constructor() //│ fun foo: Int -> Int //│ } diff --git a/shared/src/test/diff/nu/InheritanceLevelMismatches.mls b/shared/src/test/diff/nu/InheritanceLevelMismatches.mls index 1dcc93235..f637d0991 100644 --- a/shared/src/test/diff/nu/InheritanceLevelMismatches.mls +++ b/shared/src/test/diff/nu/InheritanceLevelMismatches.mls @@ -14,6 +14,7 @@ module Foo { } //│ module Foo { //│ class C extends T1, T2 { +//│ constructor() //│ fun x: 1 //│ } //│ trait T2 { @@ -29,7 +30,7 @@ mixin Foo { fun f = this.x } //│ } module Bar { - class C(x: Int) extends Foo + class C(val x: Int) extends Foo } //│ module Bar { //│ class C(x: Int) { diff --git a/shared/src/test/diff/nu/InterfaceGeneric.mls b/shared/src/test/diff/nu/InterfaceGeneric.mls index d486aee96..a3e0aff6c 100644 --- a/shared/src/test/diff/nu/InterfaceGeneric.mls +++ b/shared/src/test/diff/nu/InterfaceGeneric.mls @@ -16,7 +16,7 @@ trait Nat extends Into[Int] //│ 'T := Int trait Product[A, B] extends Into[A] { - let pair: (A, B) + let pair: [A, B] } //│ trait Product[A, B] extends Into { //│ fun Into: 'T @@ -25,14 +25,14 @@ trait Product[A, B] extends Into[A] { //│ where //│ 'T := A -class TwoInts(pair: (Int, Int)) extends Product[Int, Int] { +class TwoInts(val pair: [Int, Int]) extends Product[Int, Int] { fun Into = pair._1 + pair._2 } //│ class TwoInts(pair: [Int, Int]) extends Into, Product { //│ fun Into: Int //│ } -let i2 = TwoInts((1,2)) +let i2 = TwoInts([1, 2]) //│ let i2: TwoInts i2: Product[Int, Int] diff --git a/shared/src/test/diff/nu/InterfaceMono.mls b/shared/src/test/diff/nu/InterfaceMono.mls index 70b5f51b4..be9f30ddb 100644 --- a/shared/src/test/diff/nu/InterfaceMono.mls +++ b/shared/src/test/diff/nu/InterfaceMono.mls @@ -40,12 +40,12 @@ class ErrC2 extends Showable { fun toString = 114 } class ErrC3(toString: Str -> Str) extends Showable -//│ ╔══[ERROR] Member `toString` is declared in parent but not implemented in `ErrC1` +//│ ╔══[ERROR] Member `toString` is declared (or its declaration is inherited) but is not implemented in `ErrC1` //│ ║ l.38: class ErrC1 extends Showable //│ ║ ^^^^^ //│ ╟── Declared here: //│ ║ l.5: fun toString: Str -//│ ╙── ^^^^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in definition of method toString: //│ ║ l.40: fun toString = 114 //│ ║ ^^^^^^^^^^^^^^ @@ -72,9 +72,11 @@ class ErrC3(toString: Str -> Str) extends Showable //│ ║ l.5: fun toString: Str //│ ╙── ^^^^^^^^^^^^^ //│ class ErrC1 extends Showable { +//│ constructor() //│ fun toString: Str //│ } //│ class ErrC2 extends Showable { +//│ constructor() //│ fun toString: 114 //│ } //│ class ErrC3(toString: Str -> Str) extends Showable @@ -123,42 +125,42 @@ class Errcity(size: Int) extends SizedStadt { fun bar = "hahaha" } //│ ╔══[ERROR] Type mismatch in definition of method bar: -//│ ║ l.123: fun bar = "hahaha" +//│ ║ l.125: fun bar = "hahaha" //│ ║ ^^^^^^^^^^^^^^ //│ ╟── string literal of type `"hahaha"` is not a function -//│ ║ l.123: fun bar = "hahaha" +//│ ║ l.125: fun bar = "hahaha" //│ ║ ^^^^^^^^ //│ ╟── but it flows into definition of method bar with expected type `Int -> Int` -//│ ║ l.123: fun bar = "hahaha" +//│ ║ l.125: fun bar = "hahaha" //│ ║ ^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from function type: -//│ ║ l.101: fun bar: Int -> Int +//│ ║ l.103: fun bar: Int -> Int //│ ║ ^^^^^^^^^^ //│ ╟── from signature of member `bar`: -//│ ║ l.101: fun bar: Int -> Int +//│ ║ l.103: fun bar: Int -> Int //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.122: class Errcity(size: Int) extends SizedStadt { +//│ ║ l.124: class Errcity(size: Int) extends SizedStadt { //│ ║ ^^^ //│ ╟── type `Int` does not match type `1 | 2 | 3` //│ ╟── Note: constraint arises from union type: -//│ ║ l.100: let size: 1 | 2 | 3 +//│ ║ l.102: let size: 1 | 2 | 3 //│ ║ ^^^^^^^^^ //│ ╟── from signature of member `size`: -//│ ║ l.100: let size: 1 | 2 | 3 +//│ ║ l.102: let size: 1 | 2 | 3 //│ ╙── ^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member `name` is declared in parent but not implemented in `Errcity` -//│ ║ l.122: class Errcity(size: Int) extends SizedStadt { +//│ ╔══[ERROR] Member `name` is declared (or its declaration is inherited) but is not implemented in `Errcity` +//│ ║ l.124: class Errcity(size: Int) extends SizedStadt { //│ ║ ^^^^^^^ //│ ╟── Declared here: -//│ ║ l.83: let name: Str -//│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member `foo` is declared in parent but not implemented in `Errcity` -//│ ║ l.122: class Errcity(size: Int) extends SizedStadt { +//│ ║ l.85: let name: Str +//│ ╙── ^^^^^^^^^^^^^ +//│ ╔══[ERROR] Member `foo` is declared (or its declaration is inherited) but is not implemented in `Errcity` +//│ ║ l.124: class Errcity(size: Int) extends SizedStadt { //│ ║ ^^^^^^^ //│ ╟── Declared here: -//│ ║ l.91: fun foo: Bool -> Int -//│ ╙── ^^^^^^^^^^^^^^^^ +//│ ║ l.93: fun foo: Bool -> Int +//│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ class Errcity(size: Int) extends RefinedStadt, SizedStadt, Stadt { //│ fun bar: "hahaha" //│ fun foo: Bool -> Int @@ -206,21 +208,22 @@ class Dirtberg extends More, SizedStadt, Fooo { fun size = 4 // this should not check } //│ ╔══[ERROR] Type mismatch in definition of method size: -//│ ║ l.206: fun size = 4 // this should not check +//│ ║ l.208: fun size = 4 // this should not check //│ ║ ^^^^^^^^ //│ ╟── integer literal of type `4` does not match type `1 | 2 | 3` -//│ ║ l.206: fun size = 4 // this should not check +//│ ║ l.208: fun size = 4 // this should not check //│ ║ ^ //│ ╟── but it flows into definition of method size with expected type `1 | 2 | 3` -//│ ║ l.206: fun size = 4 // this should not check +//│ ║ l.208: fun size = 4 // this should not check //│ ║ ^^^^^^^^ //│ ╟── Note: constraint arises from union type: -//│ ║ l.100: let size: 1 | 2 | 3 +//│ ║ l.102: let size: 1 | 2 | 3 //│ ║ ^^^^^^^^^ //│ ╟── from signature of member `size`: -//│ ║ l.100: let size: 1 | 2 | 3 +//│ ║ l.102: let size: 1 | 2 | 3 //│ ╙── ^^^^^^^^^^^^^^^ //│ class Dirtberg extends RefinedStadt, SizedStadt, Stadt { +//│ constructor() //│ fun bar: forall 'a. 'a -> 'a //│ fun foo: anything -> 0 //│ fun more: Num -> Bool @@ -238,41 +241,45 @@ class Iceburg(name: Str) extends RefinedStadt, More, Fooo class A { virtual fun x: Int = 1 } //│ class A { +//│ constructor() //│ fun x: Int //│ } :e class B extends A { fun x = "A" } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.245: class B extends A { fun x = "A" } +//│ ║ l.249: class B extends A { fun x = "A" } //│ ║ ^^^^^^^ //│ ╟── string literal of type `"A"` is not an instance of type `Int` -//│ ║ l.245: class B extends A { fun x = "A" } +//│ ║ l.249: class B extends A { fun x = "A" } //│ ║ ^^^ //│ ╟── but it flows into definition of method x with expected type `Int` -//│ ║ l.245: class B extends A { fun x = "A" } +//│ ║ l.249: class B extends A { fun x = "A" } //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.239: class A { virtual fun x: Int = 1 } +//│ ║ l.242: class A { virtual fun x: Int = 1 } //│ ║ ^^^ //│ ╟── from definition of method x: -//│ ║ l.239: class A { virtual fun x: Int = 1 } +//│ ║ l.242: class A { virtual fun x: Int = 1 } //│ ╙── ^^^^^^^^^^ //│ class B extends A { +//│ constructor() //│ fun x: "A" //│ } :e class C1[A] { virtual fun a: A = this.a } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.266: class C1[A] { virtual fun a: A = this.a } +//│ ║ l.271: class C1[A] { virtual fun a: A = this.a } //│ ╙── ^^ //│ class C1[A] { +//│ constructor() //│ fun a: A //│ } class C2 extends C1[Int] { fun a = 1 } //│ class C2 extends C1 { +//│ constructor() //│ fun a: 1 //│ } @@ -290,27 +297,29 @@ trait MyTrait[A] { fun a: A } // :ds class C extends MyTrait[Int] { fun a = 1 } //│ class C extends MyTrait { +//│ constructor() //│ fun a: 1 //│ } :e class C extends MyTrait[Int] { fun a = false } //│ ╔══[ERROR] Type mismatch in definition of method a: -//│ ║ l.297: class C extends MyTrait[Int] { fun a = false } +//│ ║ l.305: class C extends MyTrait[Int] { fun a = false } //│ ║ ^^^^^^^^^ //│ ╟── reference of type `false` is not an instance of type `Int` -//│ ║ l.297: class C extends MyTrait[Int] { fun a = false } +//│ ║ l.305: class C extends MyTrait[Int] { fun a = false } //│ ║ ^^^^^ //│ ╟── but it flows into definition of method a with expected type `Int` -//│ ║ l.297: class C extends MyTrait[Int] { fun a = false } +//│ ║ l.305: class C extends MyTrait[Int] { fun a = false } //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.297: class C extends MyTrait[Int] { fun a = false } +//│ ║ l.305: class C extends MyTrait[Int] { fun a = false } //│ ║ ^^^ //│ ╟── from signature of member `a`: -//│ ║ l.283: trait MyTrait[A] { fun a: A } +//│ ║ l.290: trait MyTrait[A] { fun a: A } //│ ╙── ^^^^ //│ class C extends MyTrait { +//│ constructor() //│ fun a: false //│ } @@ -349,21 +358,22 @@ class C3 extends T4{ fun bar = false } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.348: fun foo = 3 +//│ ║ l.357: fun foo = 3 //│ ║ ^^^^^^^ //│ ╟── integer literal of type `3` does not match type `2` -//│ ║ l.348: fun foo = 3 +//│ ║ l.357: fun foo = 3 //│ ║ ^ //│ ╟── but it flows into definition of method foo with expected type `2` -//│ ║ l.348: fun foo = 3 +//│ ║ l.357: fun foo = 3 //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from literal type: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ║ ^ //│ ╟── from signature of member `foo`: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ╙── ^^^^^^ //│ class C3 extends T1, T2, T4 { +//│ constructor() //│ fun bar: false //│ fun foo: 3 //│ } @@ -371,24 +381,24 @@ class C3 extends T4{ :e class C2(foo: Int, bar: Str) extends T4 //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.372: class C2(foo: Int, bar: Str) extends T4 +//│ ║ l.382: class C2(foo: Int, bar: Str) extends T4 //│ ║ ^^^ //│ ╟── type `Int` does not match type `2` //│ ╟── Note: constraint arises from literal type: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ║ ^ //│ ╟── from signature of member `foo`: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ╙── ^^^^^^ //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.372: class C2(foo: Int, bar: Str) extends T4 +//│ ║ l.382: class C2(foo: Int, bar: Str) extends T4 //│ ║ ^^^ //│ ╟── type `Str` does not match type `Bool | Int` //│ ╟── Note: constraint arises from union type: -//│ ║ l.324: let bar : Int | Bool +//│ ║ l.333: let bar : Int | Bool //│ ║ ^^^^^^^^^^ //│ ╟── from signature of member `bar`: -//│ ║ l.324: let bar : Int | Bool +//│ ║ l.333: let bar : Int | Bool //│ ╙── ^^^^^^^^^^^^^^^^ //│ class C2(foo: Int, bar: Str) extends T1, T2, T4 @@ -397,19 +407,19 @@ trait T5 extends T4 { let foo: 4 } //│ ╔══[ERROR] Type mismatch in signature of member `foo`: -//│ ║ l.397: let foo: 4 +//│ ║ l.407: let foo: 4 //│ ║ ^^^^^^ //│ ╟── type `4` does not match type `2` -//│ ║ l.397: let foo: 4 +//│ ║ l.407: let foo: 4 //│ ║ ^ //│ ╟── but it flows into signature of member `foo` with expected type `2` -//│ ║ l.397: let foo: 4 +//│ ║ l.407: let foo: 4 //│ ║ ^^^^^^ //│ ╟── Note: constraint arises from literal type: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ║ ^ //│ ╟── from signature of member `foo`: -//│ ║ l.336: fun foo: 2 +//│ ║ l.345: fun foo: 2 //│ ╙── ^^^^^^ //│ trait T5 extends T1, T2, T4 { //│ fun bar: Bool @@ -421,34 +431,34 @@ trait T3 extends T1, T2 { let foo: true } //│ ╔══[ERROR] Type mismatch in signature of member `foo`: -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^^^^^^ //│ ╟── type `true` does not match type `1 | 2 | 3` -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^ //│ ╟── but it flows into signature of member `foo` with expected type `1 | 2 | 3` -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from union type: -//│ ║ l.319: let foo : 1 | 2 | 3 +//│ ║ l.328: let foo : 1 | 2 | 3 //│ ║ ^^^^^^^^^ //│ ╟── from signature of member `foo`: -//│ ║ l.319: let foo : 1 | 2 | 3 +//│ ║ l.328: let foo : 1 | 2 | 3 //│ ╙── ^^^^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in signature of member `foo`: -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^^^^^^ //│ ╟── type `true` does not match type `2 | 3 | 4` -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^ //│ ╟── but it flows into signature of member `foo` with expected type `2 | 3 | 4` -//│ ║ l.421: let foo: true +//│ ║ l.431: let foo: true //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from union type: -//│ ║ l.323: let foo : 2 | 3 | 4 +//│ ║ l.332: let foo : 2 | 3 | 4 //│ ║ ^^^^^^^^^ //│ ╟── from signature of member `foo`: -//│ ║ l.323: let foo : 2 | 3 | 4 +//│ ║ l.332: let foo : 2 | 3 | 4 //│ ╙── ^^^^^^^^^^^^^^^ //│ trait T3 extends T1, T2 { //│ fun bar: Bool diff --git a/shared/src/test/diff/nu/Interfaces.mls b/shared/src/test/diff/nu/Interfaces.mls index 085cb20a9..34ab4936b 100644 --- a/shared/src/test/diff/nu/Interfaces.mls +++ b/shared/src/test/diff/nu/Interfaces.mls @@ -292,10 +292,10 @@ fc(c) fun fts['a](x: 'a & Test) = x.foo fts(c) -//│ fun fts: forall 'foo. (x: Test & {foo: 'foo} | Test & ~#Test) -> 'foo -//│ 1 +//│ fun fts: (x: Test) -> Int +//│ Int //│ res -//│ = [Function: fts] +//│ = 1 fts(oth1) //│ Int @@ -337,6 +337,7 @@ class Ea1 extends A1, A2 { //│ ║ l.311: trait A1 { fun a1: 1 | 2 | 3 } //│ ╙── ^^^^^^^^^^^^^ //│ class Ea1 extends A1, A2 { +//│ constructor() //│ fun a1: 4 //│ } @@ -351,6 +352,7 @@ class CE extends Ele { fun ce(x) = x } //│ class CE extends Ele { +//│ constructor() //│ fun ce: forall 'a. 'a -> 'a //│ } @@ -358,13 +360,14 @@ class CE extends Ele { class E1 extends Test { fun foo = 2 } -//│ ╔══[ERROR] Member `bar` is declared in parent but not implemented in `E1` -//│ ║ l.358: class E1 extends Test { +//│ ╔══[ERROR] Member `bar` is declared (or its declaration is inherited) but is not implemented in `E1` +//│ ║ l.360: class E1 extends Test { //│ ║ ^^ //│ ╟── Declared here: //│ ║ l.6: fun bar: Bool -> Bool -//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ class E1 extends Test { +//│ constructor() //│ fun bar: Bool -> Bool //│ fun foo: 2 //│ } @@ -373,10 +376,10 @@ class E1 extends Test { trait TE1 extends C trait TE2 extends M, Test //│ ╔══[ERROR] A trait can only inherit from other traits -//│ ║ l.373: trait TE1 extends C +//│ ║ l.376: trait TE1 extends C //│ ╙── ^ //│ ╔══[ERROR] A trait can only inherit from other traits -//│ ║ l.374: trait TE2 extends M, Test +//│ ║ l.377: trait TE2 extends M, Test //│ ╙── ^ //│ trait TE1 extends C, Test //│ trait TE2 extends Test { @@ -390,13 +393,13 @@ class E2 extends Test { fun bar(x) = x } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.389: fun foo = true +//│ ║ l.392: fun foo = true //│ ║ ^^^^^^^^^^ //│ ╟── reference of type `true` is not an instance of type `Int` -//│ ║ l.389: fun foo = true +//│ ║ l.392: fun foo = true //│ ║ ^^^^ //│ ╟── but it flows into definition of method foo with expected type `Int` -//│ ║ l.389: fun foo = true +//│ ║ l.392: fun foo = true //│ ║ ^^^^^^^^^^ //│ ╟── Note: constraint arises from type reference: //│ ║ l.5: fun foo: Int @@ -405,6 +408,7 @@ class E2 extends Test { //│ ║ l.5: fun foo: Int //│ ╙── ^^^^^^^^ //│ class E2 extends Test { +//│ constructor() //│ fun bar: forall 'a. 'a -> 'a //│ fun foo: true //│ } @@ -412,24 +416,25 @@ class E2 extends Test { :e class D extends Test[Int], Test[Bool] //│ ╔══[ERROR] trait Test expects 0 type parameter(s); got 1 -//│ ║ l.413: class D extends Test[Int], Test[Bool] +//│ ║ l.417: class D extends Test[Int], Test[Bool] //│ ╙── ^^^^^^^^ //│ ╔══[ERROR] trait Test expects 0 type parameter(s); got 1 -//│ ║ l.413: class D extends Test[Int], Test[Bool] +//│ ║ l.417: class D extends Test[Int], Test[Bool] //│ ╙── ^^^^^^^^^ -//│ ╔══[ERROR] Member `foo` is declared in parent but not implemented in `D` -//│ ║ l.413: class D extends Test[Int], Test[Bool] +//│ ╔══[ERROR] Member `foo` is declared (or its declaration is inherited) but is not implemented in `D` +//│ ║ l.417: class D extends Test[Int], Test[Bool] //│ ║ ^ //│ ╟── Declared here: //│ ║ l.5: fun foo: Int //│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member `bar` is declared in parent but not implemented in `D` -//│ ║ l.413: class D extends Test[Int], Test[Bool] +//│ ╔══[ERROR] Member `bar` is declared (or its declaration is inherited) but is not implemented in `D` +//│ ║ l.417: class D extends Test[Int], Test[Bool] //│ ║ ^ //│ ╟── Declared here: //│ ║ l.6: fun bar: Bool -> Bool //│ ╙── ^^^^^^^^^^^^^^^^^ //│ class D extends Test { +//│ constructor() //│ fun bar: Bool -> Bool //│ fun foo: Int //│ } @@ -468,13 +473,13 @@ fun f(x: Base) = if x is //│ fun f: (x: Base) -> (0 | 1) trait Base: Foo | Bar -class Foo[A](val aa: (A, A)) extends Base +class Foo[A](val aa: [A, A]) extends Base class Bar[B](f: B => B) extends Base //│ trait Base: Bar[?] | Foo[anything] //│ class Foo[A](aa: [A, A]) extends Base //│ class Bar[B](f: B -> B) extends Base -let f: Foo = Foo((1, 2)) +let f: Foo = Foo([1, 2]) //│ let f: Foo[anything] //│ f //│ = Foo {} @@ -497,10 +502,10 @@ if b is Foo(a) then a else 0 :e // * Note: an error is raised in this case and not above because B is invariant so it can't be widened if b is Bar(f) then f else 0 //│ ╔══[ERROR] Type error in `case` expression -//│ ║ l.498: if b is Bar(f) then f else 0 +//│ ║ l.503: if b is Bar(f) then f else 0 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── type variable `B` leaks out of its scope -//│ ║ l.472: class Bar[B](f: B => B) extends Base +//│ ║ l.477: class Bar[B](f: B => B) extends Base //│ ╙── ^ //│ 0 | (??B & 'B) -> ('B | ??B0) //│ res @@ -511,14 +516,14 @@ if b is Foo(a) then a Bar(f) then f //│ ╔══[ERROR] Type error in `case` expression -//│ ║ l.510: if b is +//│ ║ l.515: if b is //│ ║ ^^^^ -//│ ║ l.511: Foo(a) then a +//│ ║ l.516: Foo(a) then a //│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.512: Bar(f) then f +//│ ║ l.517: Bar(f) then f //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── type variable `B` leaks out of its scope -//│ ║ l.472: class Bar[B](f: B => B) extends Base +//│ ║ l.477: class Bar[B](f: B => B) extends Base //│ ╙── ^ //│ anything //│ res @@ -527,7 +532,7 @@ if b is :e let tt1 = Test //│ ╔══[ERROR] trait Test cannot be used in term position -//│ ║ l.528: let tt1 = Test +//│ ║ l.533: let tt1 = Test //│ ╙── ^^^^ //│ let tt1: error //│ tt1 @@ -537,7 +542,7 @@ let tt1 = Test :e fun mt(x) = if x is Test then 1 else 0 //│ ╔══[ERROR] Cannot match on trait `Test` -//│ ║ l.538: fun mt(x) = if x is Test then 1 else 0 +//│ ║ l.543: fun mt(x) = if x is Test then 1 else 0 //│ ╙── ^^^^ //│ fun mt: anything -> error //│ Code generation encountered an error: @@ -558,10 +563,10 @@ let g: Geo let z: ZL let w: WP let e: EM +//│ let e: EM //│ let g: Geo -//│ let z: ZL //│ let w: WP -//│ let e: EM +//│ let z: ZL //│ g //│ = //│ z @@ -582,10 +587,6 @@ e: ZL & Geo //│ fun fit: (x: EM) -> WP //│ Geo & ZL //│ res -//│ = [Function: fot] -//│ res -//│ = [Function: fit] -//│ res //│ = //│ w is not implemented //│ res @@ -594,6 +595,12 @@ e: ZL & Geo //│ res //│ = //│ e is not implemented +//│ res +//│ = +//│ w is not implemented +//│ res +//│ = +//│ e is not implemented :e fun fto(w: WP): EM = w @@ -601,51 +608,52 @@ z: WP g: ZL e: ZL & WP //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.599: fun fto(w: WP): EM = w +//│ ║ l.606: fun fto(w: WP): EM = w //│ ║ ^ //│ ╟── type `#WP` is not an instance of type `EM` -//│ ║ l.599: fun fto(w: WP): EM = w +//│ ║ l.606: fun fto(w: WP): EM = w //│ ║ ^^ //│ ╟── but it flows into reference with expected type `#EM` -//│ ║ l.599: fun fto(w: WP): EM = w +//│ ║ l.606: fun fto(w: WP): EM = w //│ ║ ^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.599: fun fto(w: WP): EM = w +//│ ║ l.606: fun fto(w: WP): EM = w //│ ╙── ^^ //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.600: z: WP +//│ ║ l.607: z: WP //│ ║ ^ //│ ╟── type `#ZL` is not an instance of type `WP` -//│ ║ l.558: let z: ZL +//│ ║ l.563: let z: ZL //│ ║ ^^ //│ ╟── but it flows into reference with expected type `#WP` -//│ ║ l.600: z: WP +//│ ║ l.607: z: WP //│ ║ ^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.600: z: WP +//│ ║ l.607: z: WP //│ ╙── ^^ //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.601: g: ZL +//│ ║ l.608: g: ZL //│ ║ ^ //│ ╟── type `#Geo` is not an instance of type `ZL` -//│ ║ l.557: let g: Geo +//│ ║ l.562: let g: Geo //│ ║ ^^^ //│ ╟── but it flows into reference with expected type `#ZL` -//│ ║ l.601: g: ZL +//│ ║ l.608: g: ZL //│ ║ ^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.601: g: ZL +//│ ║ l.608: g: ZL //│ ╙── ^^ //│ fun fto: (w: WP) -> EM //│ WP & ZL //│ res -//│ = [Function: fto] -//│ res //│ = //│ z is not implemented //│ res //│ = //│ g is not implemented +//│ res +//│ = +//│ e is not implemented class Bs(val a: Bool) { virtual fun foo(x) = x + 1 @@ -689,31 +697,32 @@ class Eh2 extends Bs(true), Ele { fun ce(x) = x } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── expression of type `Int & ?a` is not an instance of type `Bool` //│ ╟── Note: constraint arises from reference: -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `Bool` does not match type `Int | ?a` -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ║ ^^^^^^^^^^ //│ ╟── Note: constraint arises from operator application: -//│ ║ l.651: virtual fun foo(x) = x + 1 +//│ ║ l.659: virtual fun foo(x) = x + 1 //│ ╙── ^^^^^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ║ ^^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `Bool` does not match type `Int | ?a` -//│ ║ l.688: fun foo(x) = x && false +//│ ║ l.696: fun foo(x) = x && false //│ ║ ^^^^^^^^^^ //│ ╟── Note: constraint arises from operator application: -//│ ║ l.651: virtual fun foo(x) = x + 1 +//│ ║ l.659: virtual fun foo(x) = x + 1 //│ ╙── ^^^^^ //│ class Eh2 extends Bs, Ele { +//│ constructor() //│ fun ce: forall 'a. 'a -> 'a //│ fun foo: Bool -> Bool //│ } @@ -723,25 +732,25 @@ class Eh extends Bs(1) class Eh1 extends Bs class Eh3 extends Bs(false), Test //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.722: class Eh extends Bs(1) +//│ ║ l.731: class Eh extends Bs(1) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── integer literal of type `1` is not an instance of type `Bool` -//│ ║ l.722: class Eh extends Bs(1) +//│ ║ l.731: class Eh extends Bs(1) //│ ║ ^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.650: class Bs(val a: Bool) { +//│ ║ l.658: class Bs(val a: Bool) { //│ ╙── ^^^^ //│ ╔══[ERROR] class Bs expects 1 parameter(s); got 0 -//│ ║ l.723: class Eh1 extends Bs +//│ ║ l.732: class Eh1 extends Bs //│ ╙── ^^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.651: virtual fun foo(x) = x + 1 +//│ ║ l.659: virtual fun foo(x) = x + 1 //│ ║ ^^^^^^^^^^^^^^ //│ ╟── function of type `?a -> (forall ?b. ?b)` is not an instance of type `Int` -//│ ║ l.651: virtual fun foo(x) = x + 1 +//│ ║ l.659: virtual fun foo(x) = x + 1 //│ ║ ^^^^^^^^^^^ //│ ╟── but it flows into definition of method foo with expected type `Int` -//│ ║ l.651: virtual fun foo(x) = x + 1 +//│ ║ l.659: virtual fun foo(x) = x + 1 //│ ║ ^^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from type reference: //│ ║ l.5: fun foo: Int @@ -749,19 +758,22 @@ class Eh3 extends Bs(false), Test //│ ╟── from signature of member `foo`: //│ ║ l.5: fun foo: Int //│ ╙── ^^^^^^^^ -//│ ╔══[ERROR] Member `bar` is declared in parent but not implemented in `Eh3` -//│ ║ l.724: class Eh3 extends Bs(false), Test +//│ ╔══[ERROR] Member `bar` is declared (or its declaration is inherited) but is not implemented in `Eh3` +//│ ║ l.733: class Eh3 extends Bs(false), Test //│ ║ ^^^ //│ ╟── Declared here: //│ ║ l.6: fun bar: Bool -> Bool -//│ ╙── ^^^^^^^^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ //│ class Eh extends Bs { +//│ constructor() //│ fun foo: Int -> Int //│ } //│ class Eh1 extends Bs { +//│ constructor() //│ fun foo: Int -> Int //│ } //│ class Eh3 extends Bs, Test { +//│ constructor() //│ fun bar: Bool -> Bool //│ fun foo: Int -> Int //│ } @@ -777,6 +789,13 @@ class Ca(a: Int) extends Oth { //│ fun foo: 1 //│ } +class Cx(a2: 1 | 2, val b: Bool) extends Ca(a2) +//│ class Cx(a2: 1 | 2, b: Bool) extends Ca, Oth, Test { +//│ fun bar: forall 'a. 'a -> 'a +//│ fun cool: anything -> false +//│ fun foo: 1 +//│ } + class Cx(a: 1 | 2, val b: Bool) extends Ca(a) //│ class Cx(a: 1 | 2, b: Bool) extends Ca, Oth, Test { //│ fun bar: forall 'a. 'a -> 'a @@ -806,19 +825,19 @@ cx1: Ca class Bc1(foo: Int) class Bc2(bar: Bool) -class Bc3 { +abstract class Bc3 { let baz : Int } //│ class Bc1(foo: Int) //│ class Bc2(bar: Bool) -//│ class Bc3 { +//│ abstract class Bc3 { //│ let baz: Int //│ } :e class Bc12() extends Bc1(1), Bc2(true) -//│ ╔══[ERROR] cannot inherit from more than one base class: Bc1 and Bc2 -//│ ║ l.819: class Bc12() extends Bc1(1), Bc2(true) +//│ ╔══[ERROR] Cannot inherit from more than one base class: Bc1 and Bc2 +//│ ║ l.838: class Bc12() extends Bc1(1), Bc2(true) //│ ╙── ^^^^^^^^^ //│ class Bc12() extends Bc1, Bc2 //│ Code generation encountered an error: @@ -828,7 +847,7 @@ class Bc02() extends Bc1(1:Int) { val foo = 2 } //│ class Bc02() extends Bc1 { -//│ let foo: 2 +//│ val foo: 2 //│ } Bc02().foo @@ -839,29 +858,22 @@ Bc02().foo :e class Bc31(baz: Bool) extends Bc3 //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.840: class Bc31(baz: Bool) extends Bc3 +//│ ║ l.859: class Bc31(baz: Bool) extends Bc3 //│ ║ ^^^^ //│ ╟── type `Bool` is not an instance of `Int` //│ ╟── Note: constraint arises from type reference: -//│ ║ l.810: let baz : Int +//│ ║ l.829: let baz : Int //│ ║ ^^^ //│ ╟── from signature of member `baz`: -//│ ║ l.810: let baz : Int +//│ ║ l.829: let baz : Int //│ ╙── ^^^^^^^^^ //│ class Bc31(baz: Bool) extends Bc3 -:e class Bc11 extends Bc1(1) { let foo = true } -//│ ╔══[ERROR] Type mismatch in reference: -//│ ║ l.855: let foo = true -//│ ║ ^^^^ -//│ ╟── reference of type `true` does not match type `1` -//│ ╟── Note: constraint arises from integer literal: -//│ ║ l.854: class Bc11 extends Bc1(1) { -//│ ╙── ^ //│ class Bc11 extends Bc1 { +//│ constructor() //│ let foo: true //│ } @@ -873,11 +885,13 @@ trait Base[A] { fun f: A -> A } class Der1 extends Base[Int] { fun f(x) = x + 1 } //│ class Der1 extends Base { +//│ constructor() //│ fun f: Int -> Int //│ } -class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (x, y) } +class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [x, y] } //│ class Der2[A, B] extends Base { +//│ constructor() //│ fun f: forall 'a 'b. (['a, 'b]) -> ['a, 'b] //│ } @@ -886,13 +900,13 @@ trait BInt extends Base[Int] { fun f = error } //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.886: fun f = error -//│ ╙── ^^^^^^^^^ +//│ ║ l.900: fun f = error +//│ ╙── ^^^^^^^^^^^^^ //│ trait BInt extends Base { //│ fun f: nothing //│ } -trait BPar[T] extends Base[(Int,T)] +trait BPar[T] extends Base[[Int, T]] //│ trait BPar[T] extends Base { //│ fun f: 'A -> 'A //│ } @@ -908,16 +922,16 @@ let bp: BPar[Bool] //│ bp //│ = -bp: Base[(Int, Bool)] +bp: Base[[Int, Bool]] //│ Base[[Int, Bool]] //│ res //│ = //│ bp is not implemented :e -bp: Base[(Int, Int)] +bp: Base[[Int, Int]] //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.918: bp: Base[(Int, Int)] +//│ ║ l.932: bp: Base[[Int, Int]] //│ ║ ^^ //│ ╙── expression of type `true` is not an instance of type `Int` //│ Base[[Int, Int]] @@ -937,7 +951,7 @@ bp.f //│ = //│ bp is not implemented -fun fb[T](x: Base[(Int, T)], y: T) = x.f((1, y)) +fun fb[T](x: Base[[Int, T]], y: T) = x.f([1, y]) //│ fun fb: forall 'T. (x: Base[[Int, 'T]], y: 'T) -> [Int, 'T] fb(bp, false) @@ -947,7 +961,7 @@ fb(bp, false) //│ bp is not implemented class CP() extends BPar[Int] { - fun f(x) = (x._2, x._1) + fun f(x) = [x._2, x._1] } //│ class CP() extends BPar, Base { //│ fun f: forall 'a 'b. {_1: 'a, _2: 'b} -> ['b, 'a] @@ -978,47 +992,49 @@ trait BInfer2 extends Base { :e class DerBad1 extends Base[Int, Int] //│ ╔══[ERROR] trait Base expects 1 type parameter(s); got 2 -//│ ║ l.979: class DerBad1 extends Base[Int, Int] +//│ ║ l.993: class DerBad1 extends Base[Int, Int] //│ ╙── ^^^^^^^^^^^^^ -//│ ╔══[ERROR] Member `f` is declared in parent but not implemented in `DerBad1` -//│ ║ l.979: class DerBad1 extends Base[Int, Int] +//│ ╔══[ERROR] Member `f` is declared (or its declaration is inherited) but is not implemented in `DerBad1` +//│ ║ l.993: class DerBad1 extends Base[Int, Int] //│ ║ ^^^^^^^ //│ ╟── Declared here: -//│ ║ l.869: trait Base[A] { fun f: A -> A } -//│ ╙── ^^^^^^^^^ +//│ ║ l.881: trait Base[A] { fun f: A -> A } +//│ ╙── ^^^^^^^^^^^^^ //│ class DerBad1 extends Base { +//│ constructor() //│ fun f: 'A -> 'A //│ } //│ where //│ 'A := Int :e -class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } +class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } //│ ╔══[ERROR] Type mismatch in definition of method f: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `B` does not match type `A` -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^ //│ ╟── Note: constraint arises from type parameter: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^ //│ ╟── Note: type parameter B is defined at: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ╙── ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method f: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^^^^^^^^^^^^^^^^^^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `A` does not match type `B` -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^ //│ ╟── Note: constraint arises from type parameter: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ║ ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ║ ^ //│ ╟── Note: type parameter A is defined at: -//│ ║ l.996: class Der2[A, B] extends Base[(A, B)] { fun f((x, y)) = (y, x) } -//│ ╙── ^ +//│ ║ l.1011: class Der2[A, B] extends Base[[A, B]] { fun f([x, y]) = [y, x] } +//│ ╙── ^ //│ class Der2[A, B] extends Base { +//│ constructor() //│ fun f: forall 'a 'b. (['a, 'b]) -> ['b, 'a] //│ } @@ -1026,10 +1042,10 @@ trait Ta[T] { val p: Bool val g: T } -class K[A](k: Ta[A]) +class K[A](val k: Ta[A]) //│ trait Ta[T] { -//│ let g: T -//│ let p: Bool +//│ val g: T +//│ val p: Bool //│ } //│ class K[A](k: Ta[A]) @@ -1067,11 +1083,11 @@ trait Tb extends Ta[Int] { virtual val p = false } //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.1067: virtual val p = false -//│ ╙── ^^^^^^^^^ +//│ ║ l.1083: virtual val p = false +//│ ╙── ^^^^^^^^^^^^^ //│ trait Tb extends Ta { -//│ let g: 'T -//│ let p: false +//│ val g: 'T +//│ val p: false //│ } //│ where //│ 'T := Int @@ -1081,6 +1097,7 @@ class Ctb extends Tb { let g = 2 } //│ class Ctb extends Ta, Tb { +//│ constructor() //│ let g: 2 //│ let p: false //│ } @@ -1088,8 +1105,8 @@ class Ctb extends Tb { class G1[A](x: A) //│ class G1[A](x: A) -class GI(x: Int) extends G1[Int](x) -//│ class GI(x: Int) extends G1 +class GI(x2: Int) extends G1[Int](x2) +//│ class GI(x2: Int) extends G1 trait Oz { let age: Int @@ -1101,14 +1118,14 @@ trait Oz { :e class Fischl(age: Bool) extends Oz //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.1102: class Fischl(age: Bool) extends Oz +//│ ║ l.1119: class Fischl(age: Bool) extends Oz //│ ║ ^^^^ //│ ╟── type `Bool` is not an instance of `Int` //│ ╟── Note: constraint arises from type reference: -//│ ║ l.1095: let age: Int +//│ ║ l.1112: let age: Int //│ ║ ^^^ //│ ╟── from signature of member `age`: -//│ ║ l.1095: let age: Int +//│ ║ l.1112: let age: Int //│ ╙── ^^^^^^^^ //│ class Fischl(age: Bool) extends Oz @@ -1119,6 +1136,7 @@ class Fate { virtual fun foo(x) = x + 1 } //│ class Fate { +//│ constructor() //│ fun foo: Int -> Int //│ } @@ -1127,37 +1145,39 @@ class Go extends Fate { fun foo(x) = x && true } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── expression of type `Int & ?a` is not an instance of type `Bool` //│ ╟── Note: constraint arises from reference: -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `Bool` does not match type `Int | ?a` -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from operator application: -//│ ║ l.1119: virtual fun foo(x) = x + 1 +//│ ║ l.1136: virtual fun foo(x) = x + 1 //│ ╙── ^^^^^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ╟── operator application of type `Bool` does not match type `Int | ?a` -//│ ║ l.1127: fun foo(x) = x && true +//│ ║ l.1145: fun foo(x) = x && true //│ ║ ^^^^^^^^^ //│ ╟── Note: constraint arises from operator application: -//│ ║ l.1119: virtual fun foo(x) = x + 1 +//│ ║ l.1136: virtual fun foo(x) = x + 1 //│ ╙── ^^^^^ //│ class Go extends Fate { +//│ constructor() //│ fun foo: Bool -> Bool //│ } class Ha { virtual val x: Int = 1 } //│ class Ha { -//│ let x: Int +//│ constructor() +//│ val x: Int //│ } class Haha(x: 1 | 2) extends Ha @@ -1166,11 +1186,11 @@ class Haha(x: 1 | 2) extends Ha :e class Ohhh(x: Bool) extends Ha //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.1167: class Ohhh(x: Bool) extends Ha +//│ ║ l.1187: class Ohhh(x: Bool) extends Ha //│ ║ ^^^^ //│ ╟── type `Bool` is not an instance of `Int` //│ ╟── Note: constraint arises from type reference: -//│ ║ l.1158: class Ha { virtual val x: Int = 1 } +//│ ║ l.1177: class Ha { virtual val x: Int = 1 } //│ ╙── ^^^ //│ class Ohhh(x: Bool) extends Ha diff --git a/shared/src/test/diff/nu/IntraBlockPolymorphism.mls b/shared/src/test/diff/nu/IntraBlockPolymorphism.mls index e0ef8cede..57c3767c5 100644 --- a/shared/src/test/diff/nu/IntraBlockPolymorphism.mls +++ b/shared/src/test/diff/nu/IntraBlockPolymorphism.mls @@ -13,9 +13,9 @@ let b = i(true) //│ let a: 0 //│ let b: true //│ a -//│ = [Function: i] -//│ b //│ = 0 +//│ b +//│ = true :re // FIXME shouldn't be a reference error let a = i(0) @@ -28,7 +28,7 @@ let b = i(true) //│ Runtime error: //│ ReferenceError: i1 is not defined //│ b -//│ = [Function: i1] +//│ = true :re // FIXME shouldn't be a reference error let a = i(0) diff --git a/shared/src/test/diff/nu/Jonathan.mls b/shared/src/test/diff/nu/Jonathan.mls index f5f8ccd1b..076d38e5a 100644 --- a/shared/src/test/diff/nu/Jonathan.mls +++ b/shared/src/test/diff/nu/Jonathan.mls @@ -11,7 +11,7 @@ fun pure[A](a: A): Effectful['a, 'e] = Effectful(a) //│ class Effectful[A, E](value: A) { //│ fun flatMap: forall 'B. (f: A -> Effectful['B, E]) -> Effectful['B, E] //│ } -//│ fun pure: forall 'a. (a: 'a) -> Effectful['a, nothing] +//│ fun pure: forall 'A. (a: 'A) -> Effectful['A, nothing] // * Some effect tags module IO @@ -22,7 +22,7 @@ module Block // * Some example functions fun println(x: anything): Effectful[(), IO] fun readLine: Effectful[Str, IO | Block] -//│ fun println: (x: anything) -> Effectful[[], IO] +//│ fun println: (x: anything) -> Effectful[(), IO] //│ fun readLine: Effectful[Str, Block | IO] @@ -37,14 +37,14 @@ fun f(x) = x : NonBlocking // * the `listener` callback should be non-blocking fun onMousePressed(listener) = - fun l(e) = listener(e) : NonBlocking + let l(e) = listener(e) : NonBlocking l(0).flatMap of a => l(1).flatMap of b => pure of () -//│ fun onMousePressed: forall 'a. ((0 | 1) -> NonBlocking[anything, 'a]) -> Effectful[[], 'a & ~Block] +//│ fun onMousePressed: forall 'a. ((0 | 1) -> NonBlocking[anything, 'a]) -> Effectful[(), 'a & ~Block] // * OK: `println` does not block onMousePressed(event => println("Clicked!")) -//│ Effectful[[], IO & ~Block] +//│ Effectful[(), IO & ~Block] // * NOT OK: `readLine` blocks :e @@ -55,42 +55,46 @@ onMousePressed(event => readLine.flatMap(println)) //│ ╟── type `Block` does not match type `~Block` //│ ║ l.24: fun readLine: Effectful[Str, IO | Block] //│ ╙── ^^^^^ -//│ Effectful[[], IO & ~Block] | error +//│ Effectful[(), IO & ~Block] | error class Event class MouseEvent: Event module Register -//│ class Event -//│ class MouseEvent: Event +//│ class Event { +//│ constructor() +//│ } +//│ class MouseEvent: Event { +//│ constructor() +//│ } //│ module Register fun onMousePressed(listener) = - fun l(e: MouseEvent) = listener(e) : Effectful[(), 'e \ Block \ Register] + let l(e: MouseEvent) = listener(e) : Effectful[(), 'e \ Block \ Register] () -//│ fun onMousePressed: (MouseEvent -> Effectful[[], ~Block & ~Register]) -> [] +//│ fun onMousePressed: (MouseEvent -> Effectful[(), ~Block & ~Register]) -> () // def onMouseClick ( f : Event -> Unit \ { ef - Register }): Unit \ { Register } fun onMouseClick(f: Event -> Effectful[(), 'e \ Register]): Effectful[(), Register] -//│ fun onMouseClick: (f: Event -> Effectful[[], ~Register]) -> Effectful[[], Register] +//│ fun onMouseClick: (f: Event -> Effectful[(), ~Register]) -> Effectful[(), Register] onMouseClick of ev => pure of () -//│ Effectful[[], Register] +//│ Effectful[(), Register] :e onMouseClick of ev => onMouseClick(ev => pure of ()).flatMap of _ => pure of () //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.81: onMouseClick of ev => +//│ ║ l.85: onMouseClick of ev => //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.82: onMouseClick(ev => pure of ()).flatMap of _ => +//│ ║ l.86: onMouseClick(ev => pure of ()).flatMap of _ => //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.83: pure of () +//│ ║ l.87: pure of () //│ ║ ^^^^^^^^^^^^^^ //│ ╟── type `Register` does not match type `~Register` -//│ ║ l.74: fun onMouseClick(f: Event -> Effectful[(), 'e \ Register]): Effectful[(), Register] +//│ ║ l.78: fun onMouseClick(f: Event -> Effectful[(), 'e \ Register]): Effectful[(), Register] //│ ╙── ^^^^^^^^ -//│ Effectful[[], Register] | error +//│ Effectful[(), Register] | error diff --git a/shared/src/test/diff/nu/LetRec.mls b/shared/src/test/diff/nu/LetRec.mls index d7f7adad3..c5e80d777 100644 --- a/shared/src/test/diff/nu/LetRec.mls +++ b/shared/src/test/diff/nu/LetRec.mls @@ -62,7 +62,7 @@ f() //│ Runtime error: //│ RangeError: Maximum call stack size exceeded -// TODO (for later) this should be rejected by the type checker +// :e // TODO this should be rejected by the type checker :ge :js let rec f = @@ -85,6 +85,47 @@ f //│ Runtime error: //│ ReferenceError: f3 is not defined +// :e // TODO this should be rejected by the type checker +:ge +:js +fun test = + let rec f = + f +//│ fun test: () +//│ Code generation encountered an error: +//│ unguarded recursive use of by-value binding f + +:ge // TODO this one should actually be accepted by codegen! +fun test = + let rec f() = f() +//│ fun test: () +//│ Code generation encountered an error: +//│ unguarded recursive use of by-value binding f + +:ge // TODO this one should actually be accepted by codegen! +fun test = + let rec lol = () => lol +//│ fun test: () +//│ Code generation encountered an error: +//│ unguarded recursive use of by-value binding lol + +:ge // TODO this one should actually be accepted by codegen! +fun test = + let rec lol() = lol + lol +//│ fun test: forall 'lol. 'lol +//│ where +//│ 'lol :> () -> 'lol +//│ Code generation encountered an error: +//│ unguarded recursive use of by-value binding lol + +let rec lol = () => lol +//│ let rec lol: forall 'lol. 'lol +//│ where +//│ 'lol :> () -> 'lol +//│ lol +//│ = [Function: lol] + :p let rec f = 1 //│ |#let| |#rec| |f| |#=| |1| diff --git a/shared/src/test/diff/nu/LocalLets.mls b/shared/src/test/diff/nu/LocalLets.mls index e844caebc..51f2653ed 100644 --- a/shared/src/test/diff/nu/LocalLets.mls +++ b/shared/src/test/diff/nu/LocalLets.mls @@ -11,10 +11,24 @@ let f = let x : Int | string let x = 1 -//│ let x: Int | string //│ let x: 1 +//│ let x: Int | string //│ x //│ = //│ x //│ = 1 + +class E(x: Int) +//│ class E(x: Int) + +:e // TODO support (currently parsed as a function definition named E) +let E(x) = new E(1) +//│ ╔══[ERROR] Value E cannot be used in `new` expression +//│ ║ l.26: let E(x) = new E(1) +//│ ╙── ^^^^^^^^ +//│ let E: anything -> error +//│ E +//│ = [Function: E1] + + diff --git a/shared/src/test/diff/nu/MIscPoly.mls b/shared/src/test/diff/nu/MIscPoly.mls new file mode 100644 index 000000000..3d9c94a5a --- /dev/null +++ b/shared/src/test/diff/nu/MIscPoly.mls @@ -0,0 +1,78 @@ +:NewDefs + + + +[(x: 'a) => x] +//│ [forall 'a. (x: 'a) -> 'a] +//│ res +//│ = [ [Function (anonymous)] ] + +[forall 'a: (x: 'a) => x] +//│ [forall 'a. (x: 'a) -> 'a] +//│ res +//│ = [ [Function (anonymous)] ] + + + +abstract class C0[A] { + fun use: forall 'r: [A, 'r -> 'r] +} +//│ abstract class C0[A] { +//│ fun use: forall 'r. [A, 'r -> 'r] +//│ } + +class C1 extends C0[Int] { + fun use = [0, id] +} +//│ class C1 extends C0 { +//│ constructor() +//│ fun use: [0, forall 'a. 'a -> 'a] +//│ } + +class C1[AA](aa: AA) extends C0[AA] { + fun use = [aa, id] +} +//│ class C1[AA](aa: AA) extends C0 { +//│ fun use: [AA, forall 'a. 'a -> 'a] +//│ } + + + +// * FIXME currently we always distribute `forall` types; +// * but this is not sound when distributing into a non-function such as an object type +// * as long as we perform object type intersection merges (which we want to) + +class C[A](){fun f: A -> A = id} +//│ class C[A]() { +//│ fun f: A -> A +//│ } + +let c = C() +//│ let c: forall 'A. C['A] +//│ c +//│ = C {} + +// :e // FIXME +let d = c : C[Int] & C[Str] +//│ let d: C[in Int | Str out nothing] +//│ d +//│ = C {} + +// :e // FIXME +let r = d.f(0) +//│ let r: nothing +//│ r +//│ = 0 + +:re +r() +//│ nothing +//│ res +//│ Runtime error: +//│ TypeError: r is not a function + + + + + + diff --git a/shared/src/test/diff/nu/MemberConfusion.mls b/shared/src/test/diff/nu/MemberConfusion.mls index 6df183ad8..3609783f7 100644 --- a/shared/src/test/diff/nu/MemberConfusion.mls +++ b/shared/src/test/diff/nu/MemberConfusion.mls @@ -13,13 +13,14 @@ class C(a: Int) extends T class B { virtual val a = "hi" } //│ class B { -//│ let a: "hi" +//│ constructor() +//│ val a: "hi" //│ } :e class C(a: Int) extends B //│ ╔══[ERROR] Type mismatch in type reference: -//│ ║ l.20: class C(a: Int) extends B +//│ ║ l.21: class C(a: Int) extends B //│ ║ ^^^ //│ ╟── type `Int` does not match type `"hi"` //│ ╟── Note: constraint arises from string literal: @@ -35,7 +36,8 @@ mixin M { let b = "hi" } class B { virtual val a = 1 : Int } //│ class B { -//│ let a: Int +//│ constructor() +//│ val a: Int //│ } class C(val a: Int, val b: Int) extends B, M @@ -44,7 +46,7 @@ class C(val a: Int, val b: Int) extends B, M //│ } let c = C(2, 3) -(c.a, c.b) +[c.a, c.b] //│ let c: C //│ [Int, "hi"] //│ c diff --git a/shared/src/test/diff/nu/MemberIntersections.mls b/shared/src/test/diff/nu/MemberIntersections.mls index 589688c1c..787e530bb 100644 --- a/shared/src/test/diff/nu/MemberIntersections.mls +++ b/shared/src/test/diff/nu/MemberIntersections.mls @@ -4,7 +4,7 @@ trait T1 { fun f[A]: A -> A } -trait T2 { fun f[B, C]: (B, C) -> (B, C) } +trait T2 { fun f[B, C]: (B, C) -> [B, C] } trait T3 extends T1, T2 //│ trait T1 { //│ fun f: forall 'A. 'A -> 'A @@ -19,17 +19,19 @@ trait T3 extends T1, T2 trait S1 { class f } //│ trait S1 { -//│ class f +//│ class f { +//│ constructor() +//│ } //│ } :e trait S2 extends T1, S1 //│ ╔══[ERROR] Intersection of value member and class members currently unsupported -//│ ║ l.26: trait S2 extends T1, S1 +//│ ║ l.28: trait S2 extends T1, S1 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── The value member is defined here: //│ ║ l.6: trait T1 { fun f[A]: A -> A } -//│ ║ ^^^^^^^^^^^^ +//│ ║ ^^^^^^^^^^^^^^^^ //│ ╟── The class member is defined here: //│ ║ l.20: trait S1 { class f } //│ ╙── ^^^^^^^ @@ -37,26 +39,28 @@ trait S2 extends T1, S1 trait S2 { class f } //│ trait S2 { -//│ class f +//│ class f { +//│ constructor() +//│ } //│ } :e trait S3 extends S1, S2 //│ ╔══[ERROR] Intersection of class member and class members currently unsupported -//│ ║ l.44: trait S3 extends S1, S2 +//│ ║ l.48: trait S3 extends S1, S2 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── The class member is defined here: //│ ║ l.20: trait S1 { class f } //│ ║ ^^^^^^^ //│ ╟── The class member is defined here: -//│ ║ l.38: trait S2 { class f } +//│ ║ l.40: trait S2 { class f } //│ ╙── ^^^^^^^ //│ trait S3 extends S1, S2 trait S1 { val f: Int -> Int } //│ trait S1 { -//│ let f: Int -> Int +//│ val f: Int -> Int //│ } trait S2 extends T1, S1 @@ -70,15 +74,15 @@ trait S3 extends S1, T1 //│ } -class C1(x: Int | Bool) -trait T1 { val x: Int | string } +class C1(val x: Int | Bool) +trait T1 { val x: Int | Str } //│ class C1(x: Int | false | true) //│ trait T1 { -//│ let x: Int | string +//│ val x: Int | Str //│ } -class C2 extends C1(0), T1 -//│ class C2 extends C1, T1 +class C2() extends C1(0), T1 +//│ class C2() extends C1, T1 C2().x : 0 //│ 0 @@ -86,39 +90,33 @@ C2().x : 0 :e class C2 extends C1(false), T1 //│ ╔══[ERROR] Type mismatch in reference: -//│ ║ l.87: class C2 extends C1(false), T1 +//│ ║ l.91: class C2 extends C1(false), T1 //│ ║ ^^^^^ -//│ ╟── reference of type `false` does not match type `Int | string` +//│ ╟── reference of type `false` does not match type `Int | Str` //│ ╟── Note: constraint arises from union type: -//│ ║ l.74: trait T1 { val x: Int | string } -//│ ║ ^^^^^^^^^^^^ +//│ ║ l.78: trait T1 { val x: Int | Str } +//│ ║ ^^^^^^^^^ //│ ╟── from signature of member `x`: -//│ ║ l.74: trait T1 { val x: Int | string } -//│ ╙── ^^^^^^^^^^^^^^^ -//│ class C2 extends C1, T1 +//│ ║ l.78: trait T1 { val x: Int | Str } +//│ ╙── ^^^^^^^^^^^^ +//│ class C2 extends C1, T1 { +//│ constructor() +//│ } :e class C2 extends C1("oops"), T1 //│ ╔══[ERROR] Type mismatch in type declaration: -//│ ║ l.101: class C2 extends C1("oops"), T1 +//│ ║ l.107: class C2 extends C1("oops"), T1 //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── string literal of type `"oops"` does not match type `Bool | Int` -//│ ║ l.101: class C2 extends C1("oops"), T1 -//│ ║ ^^^^^^ -//│ ╟── Note: constraint arises from union type: -//│ ║ l.73: class C1(x: Int | Bool) -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Type mismatch in string literal: -//│ ║ l.101: class C2 extends C1("oops"), T1 +//│ ║ l.107: class C2 extends C1("oops"), T1 //│ ║ ^^^^^^ -//│ ╟── string literal of type `"oops"` does not match type `Int | string` //│ ╟── Note: constraint arises from union type: -//│ ║ l.74: trait T1 { val x: Int | string } -//│ ║ ^^^^^^^^^^^^ -//│ ╟── from signature of member `x`: -//│ ║ l.74: trait T1 { val x: Int | string } -//│ ╙── ^^^^^^^^^^^^^^^ -//│ class C2 extends C1, T1 +//│ ║ l.77: class C1(val x: Int | Bool) +//│ ╙── ^^^^^^^^^^ +//│ class C2 extends C1, T1 { +//│ constructor() +//│ } diff --git a/shared/src/test/diff/nu/MetaWrap.mls b/shared/src/test/diff/nu/MetaWrap.mls index cb1ba9ee0..ac0c22886 100644 --- a/shared/src/test/diff/nu/MetaWrap.mls +++ b/shared/src/test/diff/nu/MetaWrap.mls @@ -24,7 +24,10 @@ mixin WithUid { }) } //│ mixin WithUid() { -//│ super: {rewrap: ('a, forall 'uid. {uid: 'uid, underlying: 'underlying} -> {uid: 'uid, underlying: 'b}) -> 'c & ('d, forall 'underlying0. {underlying: 'underlying0} -> {uid: Int, underlying: 'underlying0}) -> 'e, unwrap: 'f -> {underlying: 'underlying1} & 'g -> {uid: 'uid0}} +//│ super: { +//│ rewrap: ('a, forall 'uid. {uid: 'uid, underlying: 'underlying} -> {uid: 'uid, underlying: 'b}) -> 'c & ('d, forall 'underlying0. {underlying: 'underlying0} -> {uid: Int, underlying: 'underlying0}) -> 'e, +//│ unwrap: 'f -> {underlying: 'underlying1} & 'g -> {uid: 'uid0} +//│ } //│ fun getUid: 'g -> 'uid0 //│ fun rewrap: ('a, 'underlying -> 'b) -> 'c //│ fun setUid: ('d, uid: Int) -> 'e @@ -45,7 +48,10 @@ mixin WithType { }) } //│ mixin WithType() { -//│ super: {rewrap: ('a, forall 'ty. {ty: 'ty, underlying: 'underlying} -> {ty: 'ty, underlying: 'b}) -> 'c & ('d, forall 'underlying0. {underlying: 'underlying0} -> {ty: Type, underlying: 'underlying0}) -> 'e, unwrap: 'f -> {underlying: 'underlying1} & 'g -> {ty: 'ty0}} +//│ super: { +//│ rewrap: ('a, forall 'ty. {ty: 'ty, underlying: 'underlying} -> {ty: 'ty, underlying: 'b}) -> 'c & ('d, forall 'underlying0. {underlying: 'underlying0} -> {ty: Type, underlying: 'underlying0}) -> 'e, +//│ unwrap: 'f -> {underlying: 'underlying1} & 'g -> {ty: 'ty0} +//│ } //│ fun getType: 'g -> 'ty0 //│ fun rewrap: ('a, 'underlying -> 'b) -> 'c //│ fun setType: ('d, ty: Type) -> 'e @@ -64,8 +70,20 @@ module Test0 extends Base, WithUid module Test0 extends Base, WithUid, WithUid //│ module Test0 { //│ fun getUid: {uid: anything, underlying: {uid: 'uid, underlying: 'underlying}} -> 'uid -//│ fun rewrap: ({uid: 'uid0, underlying: {uid: 'uid1, underlying: 'underlying0 & 'underlying1} & 'underlying2}, 'underlying1 -> 'underlying0) -> {uid: Int | 'uid0, underlying: 'underlying2 | {uid: Int | 'uid1, underlying: 'underlying0}} -//│ fun setUid: ({uid: 'uid0, underlying: {uid: 'uid1, underlying: 'underlying0 & 'underlying1} & 'underlying2}, uid: Int) -> {uid: Int | 'uid0, underlying: 'underlying2 | {uid: Int | 'uid1, underlying: 'underlying0}} +//│ fun rewrap: ({ +//│ uid: 'uid0, +//│ underlying: {uid: 'uid1, underlying: 'underlying0 & 'underlying1} & 'underlying2 +//│ }, 'underlying1 -> 'underlying0) -> { +//│ uid: Int | 'uid0, +//│ underlying: 'underlying2 | {uid: Int | 'uid1, underlying: 'underlying0} +//│ } +//│ fun setUid: ({ +//│ uid: 'uid0, +//│ underlying: {uid: 'uid1, underlying: 'underlying0 & 'underlying1} & 'underlying2 +//│ }, uid: Int) -> { +//│ uid: Int | 'uid0, +//│ underlying: 'underlying2 | {uid: Int | 'uid1, underlying: 'underlying0} +//│ } //│ fun unwrap: {uid: anything, underlying: {uid: 'uid, underlying: 'underlying}} -> 'underlying //│ } @@ -74,9 +92,27 @@ module Test1 extends Base, WithUid, WithType //│ module Test1 { //│ fun getType: {uid: 'uid, underlying: {ty: 'ty, underlying: 'underlying}} -> 'ty //│ fun getUid: {uid: 'uid, underlying: {ty: 'ty, underlying: 'underlying}} -> 'uid -//│ fun rewrap: ({uid: 'uid0, underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2}, 'underlying1 -> 'underlying0) -> {uid: Int | 'uid0, underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0}} -//│ fun setType: ({uid: 'uid0, underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2}, ty: Type) -> {uid: Int | 'uid0, underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0}} -//│ fun setUid: ({uid: 'uid0, underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2}, uid: Int) -> {uid: Int | 'uid0, underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0}} +//│ fun rewrap: ({ +//│ uid: 'uid0, +//│ underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2 +//│ }, 'underlying1 -> 'underlying0) -> { +//│ uid: Int | 'uid0, +//│ underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0} +//│ } +//│ fun setType: ({ +//│ uid: 'uid0, +//│ underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2 +//│ }, ty: Type) -> { +//│ uid: Int | 'uid0, +//│ underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0} +//│ } +//│ fun setUid: ({ +//│ uid: 'uid0, +//│ underlying: {ty: 'ty0, underlying: 'underlying0 & 'underlying1} & 'underlying2 +//│ }, uid: Int) -> { +//│ uid: Int | 'uid0, +//│ underlying: 'underlying2 | {ty: Type | 'ty0, underlying: 'underlying0} +//│ } //│ fun unwrap: {uid: 'uid, underlying: {ty: 'ty, underlying: 'underlying}} -> 'underlying //│ } diff --git a/shared/src/test/diff/nu/Metaprog.mls b/shared/src/test/diff/nu/Metaprog.mls new file mode 100644 index 000000000..f099d59e8 --- /dev/null +++ b/shared/src/test/diff/nu/Metaprog.mls @@ -0,0 +1,65 @@ +:NewDefs + + +class Code[out A, out Ctx] +//│ class Code[A, Ctx] { +//│ constructor() +//│ } + +class IntLit(value: Int) extends Code[Int, nothing] +//│ class IntLit(value: Int) extends Code + +class Add[C](lhs: Code[Int, C], rhs: Code[Int, C]) extends Code[Int, C] +//│ class Add[C](lhs: Code[Int, C], rhs: Code[Int, C]) extends Code + +fun bind(x: Code['a, 'c], k: (forall 'cc: Code['a, 'cc] -> Code['b, 'cc])): Code['b, 'c] = k(x) +//│ fun bind: forall 'a 'c 'b. (x: Code['a, 'c], k: forall 'cc. Code['a, 'cc] -> Code['b, 'cc]) -> Code['b, 'c] + + +// * Note: extrusion +fun test(f) = + bind of IntLit(42), n => + f(n) + Add(n, IntLit(1)) +//│ fun test: (Code[Int, ??cc] -> ()) -> Code[Int, nothing] + + +abstract class Test[C] { + // * Represents what happens in "... ${input} ..." when a binding of C is in scope + fun unquote: (input: Code['a, C | 'c]) -> Code[Int, 'c] + fun getVar: Code[Int, C] + fun test0 = this.unquote of IntLit(1) + fun test1 = this.unquote of Add(this.getVar, IntLit(1)) +} +//│ abstract class Test[C] { +//│ fun getVar: Code[Int, C] +//│ fun test0: Code[Int, nothing] +//│ fun test1: Code[Int, nothing] +//│ fun unquote: forall 'c. (input: Code[anything, 'c | C]) -> Code[Int, 'c] +//│ } + + +:NoJS + +fun mkVar(f: forall 'C: Test['C] -> 'a): 'a +//│ fun mkVar: forall 'a. (f: forall 'C. Test['C] -> 'a) -> 'a + +mkVar of t0 => + t0.unquote of Add(t0.getVar, IntLit(1)) +//│ Code[Int, nothing] + +mkVar of t0 => + Add(t0.getVar, IntLit(1)) +//│ Add[??C] + +mkVar of t0 => + mkVar of t1 => + t1.unquote of t0.unquote of Add(t0.getVar, t1.getVar) +//│ Code[Int, nothing] + +mkVar of t0 => + mkVar of t1 => + t0.unquote of t1.unquote of Add(t0.getVar, t1.getVar) +//│ Code[Int, nothing] + + diff --git a/shared/src/test/diff/nu/MethodSignatures.mls b/shared/src/test/diff/nu/MethodSignatures.mls index bd27d455d..da0f694e7 100644 --- a/shared/src/test/diff/nu/MethodSignatures.mls +++ b/shared/src/test/diff/nu/MethodSignatures.mls @@ -14,12 +14,12 @@ module Oops { module Oops { fun a : Int } -//│ ╔══[ERROR] Member `a` is declared in parent but not implemented in `Oops` +//│ ╔══[ERROR] Member `a` is declared (or its declaration is inherited) but is not implemented in `Oops` //│ ║ l.14: module Oops { //│ ║ ^^^^ //│ ╟── Declared here: //│ ║ l.15: fun a : Int -//│ ╙── ^^^^^^^ +//│ ╙── ^^^^^^^^^^^ //│ module Oops { //│ fun a: Int //│ } @@ -32,7 +32,7 @@ module Oops { } //│ ╔══[ERROR] A type signature for 'a' was already given //│ ║ l.30: fun a : string -//│ ╙── ^^^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^^^ //│ module Oops { //│ fun a: string //│ } @@ -86,7 +86,7 @@ module A { // * With a type signature, it is generalized and checked against the signature module A { - fun i: forall 'a; 'a -> 'a + fun i: forall 'a: 'a -> 'a fun i(x) = x fun j: 'b -> 'b @@ -149,7 +149,9 @@ module M { //│ ║ l.133: fun a: A //│ ╙── ^^^^ //│ module M { -//│ class A +//│ class A { +//│ constructor() +//│ } //│ fun a: A //│ } @@ -160,7 +162,7 @@ module M { fun a = 1 } //│ ╔══[ERROR] undeclared `this` -//│ ║ l.159: fun a: this.A +//│ ║ l.161: fun a: this.A //│ ╙── ^^^^ //│ /!!!\ Uncaught error: scala.NotImplementedError: an implementation is missing @@ -171,10 +173,12 @@ module M { fun a = 1 } //│ ╔══[ERROR] Module `M` has a cyclic type dependency that is not supported yet. -//│ ║ l.170: fun a: M.A +//│ ║ l.172: fun a: M.A //│ ╙── ^^ //│ module M { -//│ class A +//│ class A { +//│ constructor() +//│ } //│ fun a: error //│ } diff --git a/shared/src/test/diff/nu/Misc.mls b/shared/src/test/diff/nu/Misc.mls index 80a59069d..821a12d2c 100644 --- a/shared/src/test/diff/nu/Misc.mls +++ b/shared/src/test/diff/nu/Misc.mls @@ -28,7 +28,7 @@ x => x + 1 //│ = [Function: res] { y } => y -//│ {y: 'a} -> 'a +//│ forall 'a. {y: 'a} -> 'a //│ res //│ = [Function: res] @@ -89,7 +89,11 @@ f([1, 2]) +:pe let f = ((x, y)) => x + y +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.93: let f = ((x, y)) => x + y +//│ ╙── ^^^^^^ //│ let f: ([Int, Int]) -> Int //│ f //│ = [Function: f5] @@ -97,19 +101,21 @@ let f = ((x, y)) => x + y :e f(1, 2) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.98: f(1, 2) -//│ ║ ^^^^^^^ +//│ ║ l.102: f(1, 2) +//│ ║ ^^^^^^^ //│ ╟── argument list of type `[1, 2]` does not match type `[[?a, ?b]]` -//│ ║ l.98: f(1, 2) -//│ ╙── ^^^^^^ +//│ ║ l.102: f(1, 2) +//│ ╙── ^^^^^^ //│ Int | error //│ res //│ Runtime error: //│ TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) - - +:pe f((1, 2)) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.115: f((1, 2)) +//│ ╙── ^^^^^^ //│ Int //│ res //│ = 3 @@ -119,27 +125,90 @@ f([1, 2]) //│ res //│ = 3 -// TODO don't parse as tuple arg +:e +f[1, 2] +//│ ╔══[ERROR] Type application syntax is not yet supported +//│ ║ l.129: f[1, 2] +//│ ╙── ^^^^^^^ +//│ ([Int, Int]) -> Int +//│ res +//│ = [Function: f5] + + +:pe let f = (((x, y))) => x + y +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.139: let f = (((x, y))) => x + y +//│ ╙── ^^^^^^ //│ let f: ([Int, Int]) -> Int //│ f //│ = [Function: f6] -// TODO parse as tuple arg! + +// * TODO maybe parse as type lambda? let f = [x, y] => x + y -//│ let f: (Int, Int) -> Int +//│ let f: ([Int, Int]) -> Int //│ f //│ = [Function: f7] +:e f(1, 2) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.155: f(1, 2) +//│ ║ ^^^^^^^ +//│ ╟── argument list of type `[1, 2]` does not match type `[[?a, ?b]]` +//│ ║ l.155: f(1, 2) +//│ ╙── ^^^^^^ +//│ Int | error +//│ res +//│ Runtime error: +//│ TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) + +f([1, 2]) //│ Int //│ res //│ = 3 -// TODO... -let f = [[[x, y]]] => x + y -//│ let f: ([[Int, Int]]) -> Int + +let f = ([x, y]) => x + y +//│ let f: ([Int, Int]) -> Int //│ f //│ = [Function: f8] +f([1, 2]) +//│ Int +//│ res +//│ = 3 + +:e +f(1, 2) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.184: f(1, 2) +//│ ║ ^^^^^^^ +//│ ╟── argument list of type `[1, 2]` does not match type `[[?a, ?b]]` +//│ ║ l.184: f(1, 2) +//│ ╙── ^^^^^^ +//│ Int | error +//│ res +//│ Runtime error: +//│ TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) + + +let f = [[[x, y]]] => x + y +//│ let f: ([[[Int, Int]]]) -> Int +//│ f +//│ = [Function: f9] + +:e +f([[1, 2]]) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.203: f([[1, 2]]) +//│ ║ ^^^^^^^^^^^ +//│ ╟── tuple literal of type `[1, 2]` does not match type `[[?a, ?b]]` +//│ ║ l.203: f([[1, 2]]) +//│ ╙── ^^^^^^ +//│ Int | error +//│ res +//│ Runtime error: +//│ TypeError: number 1 is not iterable (cannot read property Symbol(Symbol.iterator)) diff --git a/shared/src/test/diff/nu/MissingImplBug.mls b/shared/src/test/diff/nu/MissingImplBug.mls index cc81ccebd..5be4551c2 100644 --- a/shared/src/test/diff/nu/MissingImplBug.mls +++ b/shared/src/test/diff/nu/MissingImplBug.mls @@ -22,7 +22,7 @@ let StringInstance: { fromCharCode: Int => Str } = String //│ let StringInstance: {fromCharCode: Int -> Str} //│ fun String: nothing //│ makeString -//│ = +//│ = [Function: String] //│ StringInstance //│ = [Function: String] diff --git a/shared/src/test/diff/nu/MissingTypeArg.mls b/shared/src/test/diff/nu/MissingTypeArg.mls new file mode 100644 index 000000000..f1e4827e7 --- /dev/null +++ b/shared/src/test/diff/nu/MissingTypeArg.mls @@ -0,0 +1,94 @@ +// * This is an example program where the error we get is really not ideal + +:NewDefs + + +// * An example recursive definition: + +fun test(pt1, pt2) = pt1.color === pt1.color and + let p1 = pt1.parent + let p2 = pt2.parent + if p1 is undefined then true + else if p2 is undefined then true + else test(p1, p2) +//│ fun test: forall 'a 'b 'c. ('a, 'c) -> Bool +//│ where +//│ 'c <: {parent: Object & 'c & ~() | ()} +//│ 'a <: {color: Eql['b] & 'b, parent: Object & 'a & ~() | ()} + + +// * This works out fine: + +class MyPoint1[Col](val color: Col, val parent: MyPoint1[Col] | undefined) +//│ class MyPoint1[Col](color: Col, parent: MyPoint1[Col] | ()) + +val p = MyPoint1(0, undefined) +//│ val p: MyPoint1['Col] +//│ where +//│ 'Col :> 0 +//│ p +//│ = MyPoint1 {} + +test(p, p) +//│ Bool +//│ res +//│ = true + + +// * BUT... if we forgot to pass the type argument to MyPoint2 (getting a raw/nominal-tag type), +// * the error is not helpful at all: + +class MyPoint2[Col](val color: Col, val parent: MyPoint2 | undefined) +//│ class MyPoint2[Col](color: Col, parent: MyPoint2[anything] | ()) + +val p = MyPoint2(0, undefined) +//│ val p: MyPoint2[0] +//│ p +//│ = MyPoint2 {} + +:e +test(p, p) +//│ ╔══[ERROR] Type error in application +//│ ║ l.50: test(p, p) +//│ ║ ^^^^^^^^^^ +//│ ╟── type variable `Col` leaks out of its scope +//│ ║ l.41: class MyPoint2[Col](val color: Col, val parent: MyPoint2 | undefined) +//│ ║ ^^^ +//│ ╟── into field selection of type `#Eql` +//│ ║ l.8: fun test(pt1, pt2) = pt1.color === pt1.color and +//│ ╙── ^^^^^^^^^ +//│ error +//│ res +//│ = true + + + +// TODO[ucs] ideally this should work + +fun test(pt1, pt2) = pt1.color === pt1.color and + let p1 = pt1.parent + let p2 = pt2.parent + if p1 is undefined then p2 is undefined + else test(p1, p2) +//│ fun test: forall 'a 'b 'c. ('a, 'c) -> Bool +//│ where +//│ 'c <: {parent: Object & 'c} +//│ 'a <: {color: Eql['b] & 'b, parent: Object & 'a & ~() | ()} + +:e // TODO support +test(p, p) +//│ ╔══[ERROR] Type error in application +//│ ║ l.79: test(p, p) +//│ ║ ^^^^^^^^^^ +//│ ╟── type variable `Col` leaks out of its scope +//│ ║ l.41: class MyPoint2[Col](val color: Col, val parent: MyPoint2 | undefined) +//│ ║ ^^^ +//│ ╟── into field selection of type `#Eql` +//│ ║ l.68: fun test(pt1, pt2) = pt1.color === pt1.color and +//│ ╙── ^^^^^^^^^ +//│ error +//│ res +//│ = true + + + diff --git a/shared/src/test/diff/nu/Mixin42.mls b/shared/src/test/diff/nu/Mixin42.mls index 09e0b9bc9..e5d214bb9 100644 --- a/shared/src/test/diff/nu/Mixin42.mls +++ b/shared/src/test/diff/nu/Mixin42.mls @@ -16,10 +16,10 @@ C1().test //│ fun test: Int //│ } //│ mixin M3() { -//│ let factor: 2 +//│ val factor: 2 //│ } //│ class C1() { -//│ let factor: 2 +//│ val factor: 2 //│ fun test: Int //│ } //│ Int @@ -51,7 +51,7 @@ class C1() extends M1, M2 { val factor = 2 } //│ ║ l.6: mixin M2 { fun test = super.test * this.factor } //│ ╙── ^^^^^^^ //│ class C1() { -//│ let factor: 2 +//│ val factor: 2 //│ fun test: Int //│ } @@ -62,7 +62,7 @@ class C1() extends M1, M2 { val factor: Int = 2 } //│ ║ l.6: mixin M2 { fun test = super.test * this.factor } //│ ╙── ^^^^^^^ //│ class C1() { -//│ let factor: Int +//│ val factor: Int //│ fun test: Int //│ } @@ -71,11 +71,11 @@ abstract class C1 extends M1, M2 { val factor: Int } module C2 extends C1 { val factor = 2 } C2.test //│ abstract class C1 { -//│ let factor: Int +//│ val factor: Int //│ fun test: Int //│ } //│ module C2 extends C1 { -//│ let factor: 2 +//│ val factor: 2 //│ fun test: Int //│ } //│ Int @@ -83,10 +83,10 @@ C2.test //│ = 42 -class C1() extends M1, M2 { val factor: Int; val factor = 2 } +class C1() extends M1, M2 { val factor: Int;; val factor = 2 } C1().test //│ class C1() { -//│ let factor: Int +//│ val factor: Int //│ fun test: Int //│ } //│ Int @@ -96,7 +96,7 @@ C1().test abstract class C0 { val factor = 2 } //│ abstract class C0 { -//│ let factor: 2 +//│ val factor: 2 //│ } :e @@ -105,14 +105,14 @@ class C1() extends C0, M1, M2 //│ ║ l.6: mixin M2 { fun test = super.test * this.factor } //│ ╙── ^^^^^^^ //│ class C1() extends C0 { -//│ let factor: 2 +//│ val factor: 2 //│ fun test: Int //│ } abstract class C0 { val factor: Int } //│ abstract class C0 { -//│ let factor: Int +//│ val factor: Int //│ } :e // * TODO support @@ -121,7 +121,7 @@ class C1() extends C0, M1, M2 { val factor = 2 } //│ ║ l.6: mixin M2 { fun test = super.test * this.factor } //│ ╙── ^^^^^^^ //│ class C1() extends C0 { -//│ let factor: 2 +//│ val factor: 2 //│ fun test: Int //│ } diff --git a/shared/src/test/diff/nu/MixinParameters.mls b/shared/src/test/diff/nu/MixinParameters.mls index 21dbc683b..b0e1a6320 100644 --- a/shared/src/test/diff/nu/MixinParameters.mls +++ b/shared/src/test/diff/nu/MixinParameters.mls @@ -8,12 +8,44 @@ mixin BaseTest(x: Int) { //│ fun test: Int //│ } -// TODO +module Test extends BaseTest(42) +//│ module Test { +//│ fun test: Int +//│ } + +Test.test +//│ Int +//│ res +//│ = 42 + +:e +Test.x +//│ ╔══[ERROR] Type `Test` does not contain member `x` +//│ ║ l.22: Test.x +//│ ╙── ^^ +//│ error +//│ res +//│ = undefined + + +mixin BaseTest(val x: Int -> Int) +//│ mixin BaseTest(x: Int -> Int) + +module Test extends BaseTest(id) +//│ module Test + +Test.x(1) +//│ 1 +//│ res +//│ = 1 + + +:e // TODO support mixin BaseTest(x) { fun test = x } //│ ╔══[ERROR] Mixin parameters currently need type annotations -//│ ║ l.12: mixin BaseTest(x) { +//│ ║ l.44: mixin BaseTest(x) { //│ ╙── ^ //│ mixin BaseTest(x: error) { //│ fun test: error diff --git a/shared/src/test/diff/nu/ModuleParameters.mls b/shared/src/test/diff/nu/ModuleParameters.mls index a005806e5..b7301e33d 100644 --- a/shared/src/test/diff/nu/ModuleParameters.mls +++ b/shared/src/test/diff/nu/ModuleParameters.mls @@ -3,21 +3,59 @@ :e module A(x: Int) { fun y = x } -//│ ╔══[ERROR] module parameters are not supported +//│ ╔══[ERROR] Module parameters are not supported //│ ║ l.5: module A(x: Int) { fun y = x } //│ ╙── ^ //│ module A(x: Int) { //│ fun y: Int //│ } +:e +A +//│ ╔══[ERROR] Parameterized modules are not supported +//│ ║ l.14: A +//│ ╙── ^ +//│ (x: Int) -> A +//│ res +//│ = A { class: [class A] } + +:e +A(123) +//│ ╔══[ERROR] Parameterized modules are not supported +//│ ║ l.23: A(123) +//│ ╙── ^ +//│ A +//│ res +//│ Runtime error: +//│ TypeError: A is not a function + +:e A.x -//│ Int +//│ ╔══[ERROR] Parameterized modules are not supported +//│ ║ l.33: A.x +//│ ╙── ^ +//│ ╔══[ERROR] Type mismatch in field selection: +//│ ║ l.33: A.x +//│ ║ ^^^ +//│ ╟── reference of type `(x: Int) -> A` does not have field 'x' +//│ ║ l.33: A.x +//│ ╙── ^ +//│ error //│ res //│ = undefined +:e A.y -//│ Int +//│ ╔══[ERROR] Parameterized modules are not supported +//│ ║ l.48: A.y +//│ ╙── ^ +//│ ╔══[ERROR] Type mismatch in field selection: +//│ ║ l.48: A.y +//│ ║ ^^^ +//│ ╟── reference of type `(x: Int) -> A` does not have field 'y' +//│ ║ l.48: A.y +//│ ╙── ^ +//│ error //│ res //│ = undefined - diff --git a/shared/src/test/diff/nu/Mut.mls b/shared/src/test/diff/nu/Mut.mls index 6ad699d30..fdb3fe11e 100644 --- a/shared/src/test/diff/nu/Mut.mls +++ b/shared/src/test/diff/nu/Mut.mls @@ -81,38 +81,101 @@ v1.x <- 1 //│ error +:pe let v2: (mut Int) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.85: let v2: (mut Int) +//│ ╙── ^^^^^^^^^ //│ let v2: [mut Int] //│ v2 //│ = +:pe let v2 = (mut 1) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.94: let v2 = (mut 1) +//│ ╙── ^^^^^^^ //│ let v2: [mut 'a] //│ where //│ 'a :> 1 //│ v2 //│ = [ 1 ] +:pe let v2: (mut x: Int) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.105: let v2: (mut x: Int) +//│ ╙── ^^^^^^^^^^^^ //│ let v2: [mut x: Int] //│ v2 //│ = +:pe let v2 = (mut 1) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.114: let v2 = (mut 1) +//│ ╙── ^^^^^^^ //│ let v2: [mut 'a] //│ where //│ 'a :> 1 //│ v2 //│ = [ 1 ] +:pe let v2 = (mut x: 1) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.125: let v2 = (mut x: 1) +//│ ╙── ^^^^^^^^^^ //│ let v2: [mut x: 'x] //│ where //│ 'x :> 1 //│ v2 //│ = [ 1 ] +:pe let v2 = (mut y: 1) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.136: let v2 = (mut y: 1) +//│ ╙── ^^^^^^^^^^ +//│ let v2: [mut y: 'y] +//│ where +//│ 'y :> 1 +//│ v2 +//│ = [ 1 ] + + +let v2: [mut Int] +//│ let v2: [mut Int] +//│ v2 +//│ = + +let v2 = [mut 1] +//│ let v2: [mut 'a] +//│ where +//│ 'a :> 1 +//│ v2 +//│ = [ 1 ] + +let v2: [mut x: Int] +//│ let v2: [mut x: Int] +//│ v2 +//│ = + +let v2 = [mut 1] +//│ let v2: [mut 'a] +//│ where +//│ 'a :> 1 +//│ v2 +//│ = [ 1 ] + +let v2 = [mut x: 1] +//│ let v2: [mut x: 'x] +//│ where +//│ 'x :> 1 +//│ v2 +//│ = [ 1 ] + +let v2 = [mut y: 1] //│ let v2: [mut y: 'y] //│ where //│ 'y :> 1 diff --git a/shared/src/test/diff/nu/MutualRec.mls b/shared/src/test/diff/nu/MutualRec.mls index c10b41ff6..8f4d21c95 100644 --- a/shared/src/test/diff/nu/MutualRec.mls +++ b/shared/src/test/diff/nu/MutualRec.mls @@ -78,9 +78,9 @@ foo :re foo.x -//│ 'x +//│ {y: 'foo} //│ where -//│ 'x :> {y: {x: 'x}} +//│ 'foo :> {x: {y: 'foo}} //│ res //│ Runtime error: //│ RangeError: Maximum call stack size exceeded @@ -115,11 +115,11 @@ foo fun foo(a) = {h1: a, t1: bar(a)} fun bar(b) = {h2: b, t2: foo(b)} -//│ fun foo: forall 'a 'b 'c. 'c -> 'a -//│ fun bar: forall 'b 'c. 'c -> 'b +//│ fun foo: forall 'a 'b 'c. 'c -> {h1: 'c, t1: 'a} +//│ fun bar: forall 'b 'c. 'c -> {h2: 'c, t2: 'b} //│ where -//│ 'a :> {h1: 'c, t1: 'b} -//│ 'b :> {h2: 'c, t2: 'a} +//│ 'a :> {h2: 'c, t2: 'b} +//│ 'b :> {h1: 'c, t1: 'a} @@ -148,6 +148,7 @@ class Test0_2() { fun b = 123 } //│ class Test0_1 { +//│ constructor() //│ fun a: 123 //│ } //│ class Test0_2() { @@ -163,7 +164,7 @@ module Test1_2 { fun b = Test1_1.a } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.163: fun b = Test1_1.a +//│ ║ l.164: fun b = Test1_1.a //│ ╙── ^^ //│ module Test1_1 { //│ fun a: error @@ -187,13 +188,58 @@ class Test1_1 { class Test1_2 { fun b = Test1_1().a } +//│ ╔══[ERROR] Class Test1_2 cannot be instantiated as it exposes no such constructor +//│ ║ l.186: fun a = Test1_2().b +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Class Test1_1 cannot be instantiated as it exposes no such constructor +//│ ║ l.189: fun b = Test1_1().a +//│ ╙── ^^^^^^^ +//│ class Test1_1 { +//│ constructor() +//│ fun a: error +//│ } +//│ class Test1_2 { +//│ constructor() +//│ fun b: error +//│ } + +:e +class Test1_1() { + fun a = Test1_2().b +} +class Test1_2() { + fun b = Test1_1().a +} //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.188: fun b = Test1_1().a +//│ ║ l.211: fun b = Test1_1().a //│ ╙── ^^ +//│ class Test1_1() { +//│ fun a: error +//│ } +//│ class Test1_2() { +//│ fun b: error +//│ } + +:e +class Test1_1 { + fun a = (new Test1_2).b +} +class Test1_2 { + fun b = (new Test1_1).a +} +//│ ╔══[ERROR] Unhandled cyclic definition +//│ ║ l.224: class Test1_1 { +//│ ║ ^^^^^^^^^^^^^^^ +//│ ║ l.225: fun a = (new Test1_2).b +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.226: } +//│ ╙── ^ //│ class Test1_1 { +//│ constructor() //│ fun a: error //│ } //│ class Test1_2 { +//│ constructor() //│ fun b: error //│ } @@ -211,7 +257,7 @@ module Test2_2 { fun e = Test2_1.n } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.210: fun c = Test2_1.a +//│ ║ l.256: fun c = Test2_1.a //│ ╙── ^^ //│ module Test2_1 { //│ fun a: 123 | error @@ -291,7 +337,7 @@ Test2_1.n //│ = 456 -class Test2(n: Int) { +class Test2(val n: Int) { fun inc = Test3.inc(this) } module Test3 { diff --git a/shared/src/test/diff/nu/NamedArgs.mls b/shared/src/test/diff/nu/NamedArgs.mls index 8e5d9e432..8c4d4606f 100644 --- a/shared/src/test/diff/nu/NamedArgs.mls +++ b/shared/src/test/diff/nu/NamedArgs.mls @@ -1,79 +1,433 @@ :NewDefs - fun test(x: 'a) = if x is undefined then 0 else x + 1 -//│ fun test: (x: Int | undefined) -> Int +//│ fun test: (x: Int | ()) -> Int test(x: 0) //│ Int //│ res //│ = 1 +:e +test(x: 0, 1) +//│ ╔══[ERROR] Unnamed arguments should appear first when using named arguments +//│ ║ l.13: test(x: 0, 1) +//│ ╙── ^^^^^^^^^ +//│ error +//│ res +//│ = 1 + :e test(y: 0) -//│ ╔══[ERROR] Wrong tuple field name: found 'y' instead of 'x' -//│ ║ l.14: test(y: 0) +//│ ╔══[ERROR] Argument named 'x' is missing from this function call +//│ ║ l.22: test(y: 0) //│ ╙── ^^^^^^ -//│ Int | error +//│ Int //│ res -//│ = 1 +//│ Runtime error: +//│ Error: an error was thrown -fun test(x) = x + 1 -//│ fun test: Int -> Int +fun test(x: 'a, y: 'b) = [x, y] +//│ fun test: forall 'a 'b. (x: 'a, y: 'b) -> ['a, 'b] + +:e +test(x: 1, 2) +//│ ╔══[ERROR] Unnamed arguments should appear first when using named arguments +//│ ║ l.36: test(x: 1, 2) +//│ ╙── ^^^^^^^^^ +//│ error +//│ res +//│ = [ 1, 2 ] + +:e +test(x: 1, z: 3) +//│ ╔══[ERROR] Argument named 'y' is missing from this function call +//│ ║ l.45: test(x: 1, z: 3) +//│ ╙── ^^^^^^^^^^^^ +//│ [1, nothing] +//│ res +//│ Runtime error: +//│ Error: an error was thrown -// :e // TODO should be an error +:e test(y: 0) +//│ ╔══[ERROR] Number of arguments doesn't match function signature `forall 'a 'b. (x: 'a, y: 'b) -> ['a, 'b]` +//│ ║ l.55: test(y: 0) +//│ ╙── ^^^^^^ +//│ error +//│ res +//│ = [ 0, undefined ] + +:e +test(1, x: 0) +//│ ╔══[ERROR] Argument for parameter 'x' is duplicated +//│ ║ l.64: test(1, x: 0) +//│ ╙── ^^^^^^^^^ +//│ ╔══[ERROR] Argument named 'y' is missing from this function call +//│ ║ l.64: test(1, x: 0) +//│ ╙── ^^^^^^^^^ +//│ [0, nothing] +//│ res +//│ Runtime error: +//│ Error: an error was thrown + +// * Notice no let binding is generated for the first argument +:js +test(0, y: 1) +//│ [0, 1] +//│ // Prelude +//│ class TypingUnit9 {} +//│ const typing_unit9 = new TypingUnit9; +//│ // Query 1 +//│ res = test1(0, 1); +//│ // End of generated code +//│ res +//│ = [ 0, 1 ] + +id(test)(0, y: 1) +//│ [0, 1] +//│ res +//│ = [ 0, 1 ] + +id(if true then test else error)(0, y: 1) +//│ [0, 1] +//│ res +//│ = [ 0, 1 ] + +:e +id(if true then test else id)(0, y: 1) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.100: id(if true then test else id)(0, y: 1) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ error +//│ res +//│ = [ 0, 1 ] + +// * No let binding in that value of argument is a var or literal +:js +let tmp = 2 +test(0, y: tmp) +test(0, y: 200) +//│ let tmp: 2 +//│ [0, 200] +//│ // Prelude +//│ class TypingUnit13 {} +//│ const typing_unit13 = new TypingUnit13; +//│ // Query 1 +//│ globalThis.tmp = 2; +//│ // Query 2 +//│ res = test1(0, tmp); +//│ // Query 3 +//│ res = test1(0, 200); +//│ // End of generated code +//│ tmp +//│ = 2 +//│ res +//│ = [ 0, 2 ] +//│ res +//│ = [ 0, 200 ] + + +:js +test(0, y: 1 + 2) +//│ [0, Int] +//│ // Prelude +//│ class TypingUnit14 {} +//│ const typing_unit14 = new TypingUnit14; +//│ // Query 1 +//│ res = ((y_1) => test1(0, y_1))(1 + 2); +//│ // End of generated code +//│ res +//│ = [ 0, 3 ] + + + +fun fff(x: Int, y: Int, z: Int) = (x - y) * z +//│ fun fff: (x: Int, y: Int, z: Int) -> Int + +// * Testing renaming +:e +fff(y: 2, z: y_1 + 1, x: z_1 - 2) +//│ ╔══[ERROR] identifier not found: y_1 +//│ ║ l.152: fff(y: 2, z: y_1 + 1, x: z_1 - 2) +//│ ╙── ^^^ +//│ ╔══[ERROR] identifier not found: z_1 +//│ ║ l.152: fff(y: 2, z: y_1 + 1, x: z_1 - 2) +//│ ╙── ^^^ +//│ Int +//│ Code generation encountered an error: +//│ unresolved symbol z_1 + +:js +let y_1 = 2 +let z_1 = 3 +fff(y: 2, z: y_1 + 1, x: z_1 - 2) +//│ let y_1: 2 +//│ let z_1: 3 +//│ Int +//│ // Prelude +//│ class TypingUnit17 {} +//│ const typing_unit17 = new TypingUnit17; +//│ // Query 1 +//│ globalThis["y_1"] = 2; +//│ // Query 2 +//│ globalThis["z_1"] = 3; +//│ // Query 3 +//│ res = ((z_2) => ((x_1) => fff(x_1, 2, z_2))(z_1 - 2))(y_1 + 1); +//│ // End of generated code +//│ y_1 +//│ = 2 +//│ z_1 +//│ = 3 +//│ res +//│ = -3 + + +class A() { + fun ma(x: Int, y: Int) = x - y + fun mma(x: Int, y: Int) = y - x +} +//│ class A() { +//│ fun ma: (x: Int, y: Int) -> Int +//│ fun mma: (x: Int, y: Int) -> Int +//│ } + +let x = A() +x.ma(y: 2, x: 1) +//│ let x: A +//│ Int +//│ x +//│ = A {} +//│ res +//│ = -1 + +A().ma(x: 1, y: 2) //│ Int //│ res +//│ = -1 + +id(x).ma(y: 2, x: 1) +//│ Int +//│ res +//│ = -1 + + +fun print(x: Int) = (y: Int, z: Int) => log([x, y, z]) +let p = print(0) +//│ fun print: (x: Int) -> (y: Int, z: Int) -> () +//│ let p: (y: Int, z: Int) -> () +//│ p +//│ = [Function (anonymous)] + +p(z: 1, y: 2) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ [ 0, 2, 1 ] + +:e +fun print(x) = (y, z) => log([x, y, z]) +let p = print(0) +p(z: 1, y: 2) +//│ ╔══[ERROR] Cannot use named arguments as the function type has untyped arguments +//│ ║ l.234: p(z: 1, y: 2) +//│ ╙── ^^^^^^^^^^^^ +//│ fun print: anything -> (anything, anything) -> () +//│ let p: (anything, anything) -> () +//│ error +//│ p +//│ = [Function (anonymous)] +//│ res +//│ = undefined +//│ // Output +//│ [ 0, 1, 2 ] + + +class Baz() { + fun f(x: Int, y: Int) = log([x, y]) +} +Baz().f(y: 1, x: 2) +//│ class Baz() { +//│ fun f: (x: Int, y: Int) -> () +//│ } +//│ () +//│ res +//│ = undefined +//│ // Output +//│ [ 2, 1 ] + +let b = Baz() +b.f(y: 1, x: 2) +//│ let b: Baz +//│ () +//│ b +//│ = Baz {} +//│ res +//│ = undefined +//│ // Output +//│ [ 2, 1 ] + + +class A(val x: Int, val y: Int) +//│ class A(x: Int, y: Int) + +let z = A(y: 2, x: 1) +z.x +z.y +//│ let z: A +//│ Int +//│ z +//│ = A {} +//│ res //│ = 1 +//│ res +//│ = 2 + +:e +(f => f(x: a)) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.290: (f => f(x: a)) +//│ ╙── ^ +//│ anything -> error +//│ Code generation encountered an error: +//│ unresolved symbol a + +:e +(f => f)(error)(x: a) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.299: (f => f)(error)(x: a) +//│ ╙── ^^^^^^^^^^^^^^^ +//│ error +//│ Code generation encountered an error: +//│ unresolved symbol a + +:e +(f => f)(42)(x: a) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.308: (f => f)(42)(x: a) +//│ ╙── ^^^^^^^^^^^^ +//│ error +//│ Code generation encountered an error: +//│ unresolved symbol a +:e +(f => f)(if true then 123 else false)(x: a) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.317: (f => f)(if true then 123 else false)(x: a) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ error +//│ Code generation encountered an error: +//│ unresolved symbol a +(f => f)(if true then (x: Int) => x + 1 else error)(x: 123) +//│ Int +//│ res +//│ = 124 -class Foo(x: Int) -//│ class Foo(x: Int) +:e +(f => if true then f else id)(if true then (x: Int) => x + 1 else id)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.331: (f => if true then f else id)(if true then (x: Int) => x + 1 else id)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ error +//│ res +//│ = 124 -Foo(1) -//│ Foo +:e +(f => if true then f else id)(if true then (x: Int) => x + 1 else (x: Int) => x + 1)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.340: (f => if true then f else id)(if true then (x: Int) => x + 1 else (x: Int) => x + 1)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ error //│ res -//│ = Foo {} +//│ = 124 + -Foo(x: 1) -//│ Foo +fun foo(f: (x: Int) => Int) = f(x: 123) +//│ fun foo: (f: (x: Int) -> Int) -> Int + +fun foo(f: ((x: Int) => Int) & 'a) = [f(x: 123), f] +//│ fun foo: forall 'a 'b. (f: (x: Int) -> Int & 123 -> 'b & 'a) -> ['b, (x: Int) -> Int & 'a] + +foo((x: Int) => 1) +//│ [1, (x: Int) -> 1] //│ res -//│ = Foo {} +//│ = [ 1, [Function (anonymous)] ] + + +:e +fun foo(f: ((x: Int) => Int) | 'a) = f(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `'a | (x: Int) -> Int` for applying named arguments +//│ ║ l.362: fun foo(f: ((x: Int) => Int) | 'a) = f(x: 123) +//│ ╙── ^ +//│ fun foo: (f: anything) -> error + -// :e // TODO should be an error -Foo(y: 1) -//│ Foo +// * the result of the if-then-else is a TV with two LBs: the type of x and the function type +:e +fun foo(x) = (if true then (x: Int) => x + 1 else x)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `(x: Int) -> ?a | ?b` for applying named arguments +//│ ║ l.371: fun foo(x) = (if true then (x: Int) => x + 1 else x)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ fun foo: anything -> error + +foo((y: Int) => y) +//│ error //│ res -//│ = Foo {} +//│ = 124 + +:e // TODO later: this could be made to work... +fun foo(x) = (if true then (x: Int) => x + 1 else (x: Int) => x + 1)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `(x: Int) -> (?a | ?b)` for applying named arguments +//│ ║ l.384: fun foo(x) = (if true then (x: Int) => x + 1 else (x: Int) => x + 1)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ fun foo: anything -> error -:e // TODO: Here `x` is not currently treated as a field name -class Bar(x) -//│ ╔══[ERROR] Class parameters currently need type annotations -//│ ║ l.55: class Bar(x) -//│ ╙── ^ -//│ class Bar(x: error) -Bar(1) -//│ Bar +fun foo(x) = if true then (x: Int) => x + 1 else x +//│ fun foo: forall 'a. 'a -> ((x: Int) -> Int | 'a) + +:e +foo((y: Int) => y)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.395: foo((y: Int) => y)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ error //│ res -//│ = Bar {} +//│ = 124 -Bar(x: 1) -//│ Bar +:e +foo((x: Int) => x - 1)(x: 123) +//│ ╔══[ERROR] Cannot retrieve appropriate function signature from type `?a` for applying named arguments +//│ ║ l.404: foo((x: Int) => x - 1)(x: 123) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^ +//│ error //│ res -//│ = Bar {} +//│ = 124 + + +fun foo1(x) = [x + 1, x] +//│ fun foo1: forall 'a. (Int & 'a) -> [Int, 'a] :e -Bar(y: 1) -//│ ╔══[ERROR] Wrong tuple field name: found 'y' instead of 'x' -//│ ║ l.72: Bar(y: 1) -//│ ╙── ^^^^^^ -//│ Bar | error +foo1(x: 123) +//│ ╔══[ERROR] Cannot use named arguments as the function type has untyped arguments +//│ ║ l.417: foo1(x: 123) +//│ ╙── ^^^^^^^^ +//│ error +//│ res +//│ = [ 124, 123 ] + + +fun foo1(x: Int & 'a) = [x + 1, x] +//│ fun foo1: forall 'a. (x: Int & 'a) -> [Int, Int & 'a] + +foo1(x: 123) +//│ [Int, 123] //│ res -//│ = Bar {} +//│ = [ 124, 123 ] diff --git a/shared/src/test/diff/nu/NestedClasses.mls b/shared/src/test/diff/nu/NestedClasses.mls index b0519077c..d712fc8db 100644 --- a/shared/src/test/diff/nu/NestedClasses.mls +++ b/shared/src/test/diff/nu/NestedClasses.mls @@ -15,7 +15,7 @@ let c = C0() :e c.NC0 -//│ ╔══[ERROR] access to class member not yet supported +//│ ╔══[ERROR] Access to class member not yet supported //│ ║ l.17: c.NC0 //│ ╙── ^^^^ //│ error @@ -30,13 +30,15 @@ module M0 { class NC0 } //│ module M0 { -//│ class NC0 +//│ class NC0 { +//│ constructor() +//│ } //│ } :e M0.NC0 -//│ ╔══[ERROR] access to class member not yet supported -//│ ║ l.37: M0.NC0 +//│ ╔══[ERROR] Access to class member not yet supported +//│ ║ l.39: M0.NC0 //│ ╙── ^^^^ //│ error //│ res @@ -52,8 +54,8 @@ module M1 { :e M1.NM1 -//│ ╔══[ERROR] access to module member not yet supported -//│ ║ l.54: M1.NM1 +//│ ╔══[ERROR] Access to module member not yet supported +//│ ║ l.56: M1.NM1 //│ ╙── ^^^^ //│ error //│ res diff --git a/shared/src/test/diff/nu/NestedRecords.mls b/shared/src/test/diff/nu/NestedRecords.mls new file mode 100644 index 000000000..ebe7bbcbd --- /dev/null +++ b/shared/src/test/diff/nu/NestedRecords.mls @@ -0,0 +1,45 @@ +:NewDefs + + +let f(x) = [x, x] +//│ let f: forall 'a. 'a -> ['a, 'a] +//│ f +//│ = [Function: f] + +let a = { u: f(f(f(1))), v: f(f(f(1))) } +//│ let a: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]} +//│ a +//│ = { +//│ u: [ [ [Array], [Array] ], [ [Array], [Array] ] ], +//│ v: [ [ [Array], [Array] ], [ [Array], [Array] ] ] +//│ } + +{ a } +//│ { +//│ a: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]} +//│ } +//│ res +//│ = { a: { u: [ [Array], [Array] ], v: [ [Array], [Array] ] } } + +{ a, b: a } +//│ { +//│ a: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]}, +//│ b: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]} +//│ } +//│ res +//│ = { +//│ a: { u: [ [Array], [Array] ], v: [ [Array], [Array] ] }, +//│ b: { u: [ [Array], [Array] ], v: [ [Array], [Array] ] } +//│ } + +{ x: { a, b: a } } +//│ { +//│ x: { +//│ a: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]}, +//│ b: {u: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]], v: [[[1, 1], [1, 1]], [[1, 1], [1, 1]]]} +//│ } +//│ } +//│ res +//│ = { x: { a: { u: [Array], v: [Array] }, b: { u: [Array], v: [Array] } } } + + diff --git a/shared/src/test/diff/nu/New.mls b/shared/src/test/diff/nu/New.mls index b29b06ab6..df4bd0f2f 100644 --- a/shared/src/test/diff/nu/New.mls +++ b/shared/src/test/diff/nu/New.mls @@ -48,3 +48,5 @@ class PoInt(x, y) let origin = new PoInt(0, 0) //│ origin: PoInt & {x: 0, y: 0} //│ = PoInt { x: 0, y: 0 } + + diff --git a/shared/src/test/diff/nu/NewNew.mls b/shared/src/test/diff/nu/NewNew.mls index c30d4efe3..1350b5e9b 100644 --- a/shared/src/test/diff/nu/NewNew.mls +++ b/shared/src/test/diff/nu/NewNew.mls @@ -38,7 +38,7 @@ let origin = PoInt[Int](0, 0) //│ ╔══[ERROR] Type application syntax is not yet supported //│ ║ l.37: let origin = PoInt[Int](0, 0) //│ ╙── ^^^^^^^^^^ -//│ let origin: error +//│ let origin: PoInt[0] //│ origin //│ = PoInt {} @@ -94,3 +94,44 @@ new + +fun f(x) = {x} +//│ fun f: forall 'a. 'a -> {x: 'a} + +:e +new f(1) +//│ ╔══[ERROR] Value f cannot be used in `new` expression +//│ ║ l.102: new f(1) +//│ ╙── ^^^^^^^^ +//│ error +//│ res +//│ = { x: 1 } + + +module Oops +//│ module Oops + +:e +new Oops +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.115: new Oops +//│ ║ ^^^^^^^^ +//│ ╙── applied expression of type `Oops` is not a function +//│ error +//│ res +//│ = Oops {} + + +:e +new Oops2 +trait Oops2 +//│ ╔══[ERROR] Trait Oops2 cannot be used in term position +//│ ║ l.126: new Oops2 +//│ ╙── ^^^^^^^^^ +//│ trait Oops2 +//│ error +//│ res +//│ Runtime error: +//│ TypeError: Cannot read properties of undefined (reading 'build') + + diff --git a/shared/src/test/diff/nu/NoThisCtor.mls b/shared/src/test/diff/nu/NoThisCtor.mls index 73d948f97..0493ba15e 100644 --- a/shared/src/test/diff/nu/NoThisCtor.mls +++ b/shared/src/test/diff/nu/NoThisCtor.mls @@ -1,6 +1,6 @@ :NewDefs -class Base(base: Int) { +class Base(val base: Int) { fun getBase1 = base fun getBase2 = this.base fun foo(x) = this.base + x @@ -15,7 +15,7 @@ class Foo() { virtual val foo: Int = 42 } //│ class Foo() { -//│ let foo: Int +//│ val foo: Int //│ } :e @@ -28,18 +28,26 @@ class Foo1() extends Foo() { //│ ║ l.25: log(this.foo) //│ ╙── ^^^^ //│ class Foo1() extends Foo { -//│ let foo: Int +//│ val foo: Int //│ } -// FIXME: type constrcutor +:e class Foo2() extends Foo() { - virtual val foo = 2 + virtual val foo: Int + val foo = 2 constructor() { log(this.foo) } } +//│ ╔══[ERROR] Cannot access `this` during object initialization +//│ ║ l.39: log(this.foo) +//│ ╙── ^^^^ +//│ ╔══[ERROR] identifier not found: this +//│ ║ l.39: log(this.foo) +//│ ╙── ^^^^ //│ class Foo2() extends Foo { -//│ let foo: 2 +//│ constructor() +//│ val foo: Int //│ } :e @@ -49,11 +57,11 @@ class Foo3() extends Foo() { val s = this.foo } //│ ╔══[ERROR] Cannot access `this` while initializing field s -//│ ║ l.49: val s = this.foo +//│ ║ l.57: val s = this.foo //│ ╙── ^^^^ //│ class Foo3() extends Foo { -//│ let foo: Int -//│ let s: Int +//│ val foo: Int +//│ val s: Int //│ } :e @@ -64,15 +72,15 @@ class Foo4() extends Foo() { let bb = bar(0) // call `this` indirectly } //│ ╔══[ERROR] Cannot access `this` while initializing field bb -//│ ║ l.64: let bb = bar(0) // call `this` indirectly +//│ ║ l.72: let bb = bar(0) // call `this` indirectly //│ ║ ^^^^^^^^^^^ //│ ╟── The access to `this` is here -//│ ║ l.63: fun bar(x) = this.foo + x // ok +//│ ║ l.71: fun bar(x) = this.foo + x // ok //│ ╙── ^^^^ //│ class Foo4() extends Foo { //│ fun bar: Int -> Int //│ let bb: Int -//│ let foo: Int +//│ val foo: Int //│ } :e @@ -82,15 +90,15 @@ class Foo5() extends Foo() { fun bar(y: Int) = this.foo + y } //│ ╔══[ERROR] Cannot access `this` while initializing field x -//│ ║ l.81: val x = bar(0) +//│ ║ l.89: val x = bar(0) //│ ║ ^^^^^^^^^^ //│ ╟── The access to `this` is here -//│ ║ l.82: fun bar(y: Int) = this.foo + y +//│ ║ l.90: fun bar(y: Int) = this.foo + y //│ ╙── ^^^^ //│ class Foo5() extends Foo { //│ fun bar: (y: Int) -> Int -//│ let foo: Int -//│ let x: Int +//│ val foo: Int +//│ val x: Int //│ } class Foo6() extends Foo() { @@ -99,9 +107,9 @@ class Foo6() extends Foo() { val y = this.baz // baz is final } //│ class Foo6() extends Foo { -//│ let baz: Int -//│ let foo: Int -//│ let y: Int +//│ val baz: Int +//│ val foo: Int +//│ val y: Int //│ } class Bar() { @@ -111,7 +119,7 @@ class Bar() { } //│ class Bar() { //│ fun add: Int -> Int -//│ let d: Int +//│ val d: Int //│ } :e @@ -119,18 +127,18 @@ class Bar2() extends Bar() { val two = this.add(1) // add is final, but it refers to `this` } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.119: val two = this.add(1) // add is final, but it refers to `this` +//│ ║ l.127: val two = this.add(1) // add is final, but it refers to `this` //│ ╙── ^^^^ //│ ╔══[ERROR] Cannot access `this` while initializing field two -//│ ║ l.119: val two = this.add(1) // add is final, but it refers to `this` +//│ ║ l.127: val two = this.add(1) // add is final, but it refers to `this` //│ ║ ^^^^^^^^^^^^^^^^^ //│ ╟── The access to `this` is here -//│ ║ l.110: fun add(x) = x + this.d +//│ ║ l.118: fun add(x) = x + this.d //│ ╙── ^^^^ //│ class Bar2() extends Bar { //│ fun add: Int -> Int -//│ let d: Int -//│ let two: error +//│ val d: Int +//│ val two: error //│ } // it accesses this in an unusual way! @@ -140,12 +148,12 @@ abstract class Foo: Int -> Int { fun f = this(0) } //│ ╔══[ERROR] Cannot access `this` while initializing field x -//│ ║ l.139: val x = f +//│ ║ l.147: val x = f //│ ║ ^^^^^ //│ ╟── The access to `this` is here -//│ ║ l.140: fun f = this(0) +//│ ║ l.148: fun f = this(0) //│ ╙── ^^^^ //│ abstract class Foo: Int -> Int { //│ fun f: nothing -//│ let x: nothing +//│ val x: nothing //│ } diff --git a/shared/src/test/diff/nu/NuAlexJ.mls b/shared/src/test/diff/nu/NuAlexJ.mls index 726c5c617..d660e2fe9 100644 --- a/shared/src/test/diff/nu/NuAlexJ.mls +++ b/shared/src/test/diff/nu/NuAlexJ.mls @@ -1,7 +1,7 @@ :NewDefs -fun foo(x) = (x, x) +fun foo(x) = [x, x] //│ fun foo: forall 'a. 'a -> ['a, 'a] id diff --git a/shared/src/test/diff/nu/NuForallTerms.mls b/shared/src/test/diff/nu/NuForallTerms.mls index 33f75d4a3..00e5321e4 100644 --- a/shared/src/test/diff/nu/NuForallTerms.mls +++ b/shared/src/test/diff/nu/NuForallTerms.mls @@ -1,13 +1,13 @@ :NewDefs -forall 'a; (x: 'a) => x +forall 'a: (x: 'a) => x //│ forall 'a. (x: 'a) -> 'a //│ res //│ = [Function: res] -forall 'a; +forall 'a: (x: 'a) => x //│ forall 'a. (x: 'a) -> 'a //│ res diff --git a/shared/src/test/diff/nu/NuPolymorphicTypeAliases.mls b/shared/src/test/diff/nu/NuPolymorphicTypeAliases.mls new file mode 100644 index 000000000..649faaad3 --- /dev/null +++ b/shared/src/test/diff/nu/NuPolymorphicTypeAliases.mls @@ -0,0 +1,93 @@ +:NewDefs + + +type F[A] = forall 'a: (A, 'a) -> [A, 'a] +//│ type F[A] = forall 'a. (A, 'a) -> [A, 'a] + + +fun f[B] = + ((x: B, y) => [x, y]) : F[B] +//│ fun f: forall 'B. F['B] + +fun f = forall 'B: + ((x: 'B, y) => [x, y]) : F['B] +//│ fun f: forall 'B. F['B] + + +module A { + type F[A] = forall 'a: (A, 'a) -> [A, 'a] +} +//│ module A { +//│ type F[A] = forall 'a. (A, 'a) -> [A, 'a] +//│ } + +:e // TODO +fun f[B] = + ((x: B, y) => [x, y]) : A.F[B] +//│ ╔══[ERROR] Not a recognized type +//│ ║ l.26: ((x: B, y) => [x, y]) : A.F[B] +//│ ╙── ^^^^^^ +//│ fun f: anything + + +class Test[B] { + fun f(f: F[B]): F[B] = (x, y) => f(x, y) +} +//│ class Test[B] { +//│ constructor() +//│ fun f: (f: F[B]) -> F[B] +//│ } + +class Test[B](f: F[B]) { + fun g: F[B] = (x, y) => f(x, y) +} +//│ class Test[B](f: F[B]) { +//│ fun g: F[B] +//│ } + +class Test[B] { + discard of ((x: B, y) => [x, y]) : F[B] +} +//│ class Test[B] { +//│ constructor() +//│ } + + +type F[A] = (A, 'a) -> [A, 'a] +//│ type F[A] = (A, 'a) -> [A, 'a] + + +fun f[B] = + ((x: B, y) => [x, y]) : F[B] +//│ fun f: forall 'B. F['B] + +fun f = forall 'B: + ((x: 'B, y) => [x, y]) : F['B] +//│ fun f: forall 'B. F['B] + + +class Test[B] { + fun f(f: F[B]): F[B] = (x, y) => f(x, y) +} +//│ class Test[B] { +//│ constructor() +//│ fun f: (f: F[B]) -> F[B] +//│ } + + + +// * Note: NOT polymorphic! +type T = 'a -> 'a +//│ type T = 'a -> 'a + +(id : T)(0) +//│ 0 +//│ res +//│ = 0 + +(id : T)(true) +//│ 0 | true +//│ res +//│ = true + + diff --git a/shared/src/test/diff/nu/Object.mls b/shared/src/test/diff/nu/Object.mls index cd928b710..b8df29c71 100644 --- a/shared/src/test/diff/nu/Object.mls +++ b/shared/src/test/diff/nu/Object.mls @@ -76,28 +76,49 @@ fun foo(x: Object) = if x is A then true else false // TODO make this a rigid type variable! // :e fun foo = forall 'a; (x: 'a) => if x is A then true else false -//│ ╔══[ERROR] Type mismatch in `case` expression: -//│ ║ l.78: fun foo = forall 'a; (x: 'a) => if x is A then true else false -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── rigid type variable of type `'a` is not an instance of type `Object` +//│ ╔══[PARSE ERROR] Expected `:` after `forall` section //│ ║ l.78: fun foo = forall 'a; (x: 'a) => if x is A then true else false -//│ ║ ^^ -//│ ╟── but it flows into reference with expected type `Object` +//│ ╙── ^ +//│ ╔══[PARSE ERROR] Expected end of input; found operator instead //│ ║ l.78: fun foo = forall 'a; (x: 'a) => if x is A then true else false -//│ ╙── ^ -//│ fun foo: (x: anything) -> Bool +//│ ╙── ^ +//│ fun foo: () -:ge +:e Object -//│ () -> Object +//│ ╔══[ERROR] Class Object is abstract and cannot be instantiated +//│ ║ l.90: Object +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Class Object cannot be instantiated as it exposes no such constructor +//│ ║ l.90: Object +//│ ╙── ^^^^^^ +//│ error //│ Code generation encountered an error: //│ unresolved symbol Object -:ge +:e Object() -//│ Object +//│ ╔══[ERROR] Class Object is abstract and cannot be instantiated +//│ ║ l.102: Object() +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Class Object cannot be instantiated as it exposes no such constructor +//│ ║ l.102: Object() +//│ ╙── ^^^^^^ +//│ error +//│ Code generation encountered an error: +//│ unresolved symbol Object + +:e +new Object +//│ ╔══[ERROR] Class Object is abstract and cannot be instantiated +//│ ║ l.114: new Object +//│ ╙── ^^^^^^^^^^ +//│ ╔══[ERROR] Class Object cannot be instantiated as it exposes no such constructor +//│ ║ l.114: new Object +//│ ╙── ^^^^^^^^^^ +//│ error //│ Code generation encountered an error: //│ unresolved symbol Object @@ -109,7 +130,6 @@ class B() extends Object //│ Code generation encountered an error: //│ unresolved parent Object. -// TODO class C() extends A //│ class C() extends A diff --git a/shared/src/test/diff/nu/OpLam.mls b/shared/src/test/diff/nu/OpLam.mls index c481673bc..bcbddb6ae 100644 --- a/shared/src/test/diff/nu/OpLam.mls +++ b/shared/src/test/diff/nu/OpLam.mls @@ -38,7 +38,7 @@ x => x + 2 >> succ //│ ╟── from reference: //│ ║ l.19: fun (>>) compose(f, g) = x => g(f(x)) //│ ╙── ^ -//│ Int -> (error | Int -> Int) +//│ Int -> (error | anything -> Int) //│ res //│ = [Function: res] diff --git a/shared/src/test/diff/nu/ParamImplementing.mls b/shared/src/test/diff/nu/ParamImplementing.mls index f06046af0..ad5ba5319 100644 --- a/shared/src/test/diff/nu/ParamImplementing.mls +++ b/shared/src/test/diff/nu/ParamImplementing.mls @@ -2,18 +2,18 @@ trait T { fun x: Int } +mixin M(val x: Bool) //│ trait T { //│ fun x: Int //│ } - -mixin M(x: Bool) //│ mixin M(x: Bool) :e -class C extends T, M(false) +module C extends T, M(false) +C.x //│ ╔══[ERROR] Type mismatch in reference: -//│ ║ l.13: class C extends T, M(false) -//│ ║ ^^^^^ +//│ ║ l.12: module C extends T, M(false) +//│ ║ ^^^^^ //│ ╟── reference of type `false` is not an instance of type `Int` //│ ╟── Note: constraint arises from type reference: //│ ║ l.4: trait T { fun x: Int } @@ -21,17 +21,48 @@ class C extends T, M(false) //│ ╟── from signature of member `x`: //│ ║ l.4: trait T { fun x: Int } //│ ╙── ^^^^^^ -//│ class C extends T +//│ module C extends T +//│ false +//│ res +//│ = false trait T { fun x: Int } -mixin M(x: Num) +mixin M(val x: Num) //│ trait T { //│ fun x: Int //│ } //│ mixin M(x: Num) -class C extends T, M(0) -//│ class C extends T +module C extends T, M(0) +C.x +//│ module C extends T +//│ 0 +//│ res +//│ = 0 + + +trait T { fun x: Int } +mixin M(x: Bool) +//│ trait T { +//│ fun x: Int +//│ } +//│ mixin M(x: Bool) + +:e +module C extends T, M(false) +C.x +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C` +//│ ║ l.53: module C extends T, M(false) +//│ ║ ^ +//│ ╟── Declared here: +//│ ║ l.45: trait T { fun x: Int } +//│ ╙── ^^^^^^^^^^ +//│ module C extends T { +//│ fun x: Int +//│ } +//│ Int +//│ res +//│ = undefined diff --git a/shared/src/test/diff/nu/ParamPassing.mls b/shared/src/test/diff/nu/ParamPassing.mls index 17735352f..4eacce0f2 100644 --- a/shared/src/test/diff/nu/ParamPassing.mls +++ b/shared/src/test/diff/nu/ParamPassing.mls @@ -4,11 +4,32 @@ class Foo(x: Int) //│ class Foo(x: Int) +class Bar(z: Int, y: Int) extends Foo(z + y) +//│ class Bar(z: Int, y: Int) extends Foo class Bar(x: Int, y: Int) extends Foo(x + y) //│ class Bar(x: Int, y: Int) extends Foo +class Foo(val x: Int) +//│ class Foo(x: Int) + +module Bar extends Foo(11) +Bar.x +//│ module Bar extends Foo +//│ 11 +//│ res +//│ = 11 + +:e // FIXME +module Bar extends Foo(11) { fun get = this.x } +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.25: module Bar extends Foo(11) { fun get = this.x } +//│ ╙── ^^ +//│ module Bar extends Foo { +//│ fun get: error +//│ } + mixin AA(a: Int) { } @@ -28,3 +49,197 @@ class E(x: Int) extends BB, AA(x) //│ class E(x: Int) +class Foo(x: Int) +//│ class Foo(x: Int) + +:e +Foo(1).x +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.56: Foo(1).x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.52: class Foo(x: Int) +//│ ╙── ^ +//│ Int | error +//│ res +//│ = undefined + +:e +Foo(1).#x +//│ ╔══[ERROR] identifier not found: .# +//│ ║ l.68: Foo(1).#x +//│ ╙── ^^ +//│ ╔══[ERROR] identifier not found: x +//│ ║ l.68: Foo(1).#x +//│ ╙── ^ +//│ error +//│ Code generation encountered an error: +//│ unresolved symbol .# + +if Foo(1) is Foo(x) then x +//│ Int +//│ res +//│ = 1 + + +class Foo(val x: Int) +//│ class Foo(x: Int) + +Foo(1).x +//│ Int +//│ res +//│ = 1 + +if Foo(1) is Foo(x) then x +//│ Int +//│ res +//│ = 1 + + +:e +class Bar(x: Int) extends Foo(x) +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.100: class Bar(x: Int) extends Foo(x) +//│ ║ ^ +//│ ╟── Originally declared here: +//│ ║ l.85: class Foo(val x: Int) +//│ ╙── ^ +//│ class Bar(x: Int) extends Foo + +:e +Bar(11).x +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.110: Bar(11).x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.100: class Bar(x: Int) extends Foo(x) +//│ ╙── ^ +//│ Int | error +//│ res +//│ = 11 + + +:e +class Bar(val x: Int) extends Foo(x + 1) +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.123: class Bar(val x: Int) extends Foo(x + 1) +//│ ║ ^ +//│ ╟── Originally declared here: +//│ ║ l.85: class Foo(val x: Int) +//│ ╙── ^ +//│ class Bar(x: Int) extends Foo + +Bar(11).x +//│ Int +//│ res +//│ = 11 + +:e +class Bar extends Foo(1) { val x: 2 } +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.138: class Bar extends Foo(1) { val x: 2 } +//│ ║ ^^^^^^^^ +//│ ╟── Originally declared here: +//│ ║ l.85: class Foo(val x: Int) +//│ ╙── ^ +//│ class Bar extends Foo { +//│ constructor() +//│ val x: 2 +//│ } + +:e +module Bar extends Foo(1) { fun x = 2 } +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.151: module Bar extends Foo(1) { fun x = 2 } +//│ ║ ^^^^^ +//│ ╟── Originally declared here: +//│ ║ l.85: class Foo(val x: Int) +//│ ╙── ^ +//│ module Bar extends Foo { +//│ fun x: 2 +//│ } + + +class A(val x: Int) +//│ class A(x: Int) + +module B extends A(42) +//│ module B extends A + +B.x +//│ 42 +//│ res +//│ = 42 + + +class A(x: Int) +//│ class A(x: Int) + +module B extends A(42) +//│ module B extends A + +:e +B.x +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.182: B.x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.175: class A(x: Int) +//│ ╙── ^ +//│ Int | error +//│ res +//│ = undefined + + + +abstract class Foo[A](val x: A) { fun y = x;; fun i: A -> A } +//│ abstract class Foo[A](x: A) { +//│ fun i: A -> A +//│ fun y: A +//│ } + +abstract class Bar extends Foo(0) +//│ abstract class Bar extends Foo { +//│ fun i: 'A -> 'A +//│ fun y: 'A +//│ } +//│ where +//│ 'A :> 0 + +module Baz extends Foo(0) { fun i = id } +[Baz.x, Baz.i] +//│ module Baz extends Foo { +//│ fun i: forall 'a. 'a -> 'a +//│ fun y: 'A +//│ } +//│ [0, forall 'a. 'a -> 'a] +//│ where +//│ 'A :> 0 +//│ res +//│ = [ 0, [Function: id] ] + +:e +module Bazz extends Foo(0) { + val x: 2 +} +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.223: val x: 2 +//│ ║ ^^^^^^^^ +//│ ╟── Originally declared here: +//│ ║ l.195: abstract class Foo[A](val x: A) { fun y = x;; fun i: A -> A } +//│ ╙── ^ +//│ ╔══[ERROR] Member `i` is declared (or its declaration is inherited) but is not implemented in `Bazz` +//│ ║ l.222: module Bazz extends Foo(0) { +//│ ║ ^^^^ +//│ ╟── Declared here: +//│ ║ l.195: abstract class Foo[A](val x: A) { fun y = x;; fun i: A -> A } +//│ ╙── ^^^^^^^^^^^^^ +//│ module Bazz extends Foo { +//│ fun i: 'A -> 'A +//│ val x: 2 +//│ fun y: 'A +//│ } +//│ where +//│ 'A :> 0 + + diff --git a/shared/src/test/diff/nu/Parens.mls b/shared/src/test/diff/nu/Parens.mls index 63100f80b..e0b769115 100644 --- a/shared/src/test/diff/nu/Parens.mls +++ b/shared/src/test/diff/nu/Parens.mls @@ -2,9 +2,9 @@ () -//│ [] +//│ () //│ res -//│ = [] +//│ = undefined :pe (,) @@ -14,7 +14,7 @@ //│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here //│ ║ l.10: (,) //│ ╙── ^ -//│ undefined +//│ () //│ res //│ = undefined @@ -28,31 +28,39 @@ //│ res //│ = 1 +:pe (1, 2) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.32: (1, 2) +//│ ╙── ^^^^^^ //│ [1, 2] //│ res //│ = [ 1, 2 ] +:pe (1, 2,) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.41: (1, 2,) +//│ ╙── ^^^^^^^ //│ [1, 2] //│ res //│ = [ 1, 2 ] let x: () -//│ let x: [] +//│ let x: () //│ x //│ = :pe let x: (,) //│ ╔══[PARSE ERROR] Unexpected comma in expression position -//│ ║ l.48: let x: (,) +//│ ║ l.56: let x: (,) //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here -//│ ║ l.48: let x: (,) +//│ ║ l.56: let x: (,) //│ ╙── ^ -//│ let x: undefined +//│ let x: () //│ x //│ = @@ -66,12 +74,20 @@ let x: (1,) //│ x //│ = +:pe let x: (1, 2) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.78: let x: (1, 2) +//│ ╙── ^^^^^^ //│ let x: [1, 2] //│ x //│ = +:pe let x: (1, 2,) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.87: let x: (1, 2,) +//│ ╙── ^^^^^^^ //│ let x: [1, 2] //│ x //│ = diff --git a/shared/src/test/diff/nu/PartialApp.mls b/shared/src/test/diff/nu/PartialApp.mls index 8b845f7ea..2311edb37 100644 --- a/shared/src/test/diff/nu/PartialApp.mls +++ b/shared/src/test/diff/nu/PartialApp.mls @@ -27,7 +27,7 @@ _.foo(1) // * ie x => x.foo(1) -//│ {foo: 1 -> 'a} -> 'a +//│ forall 'a. {foo: 1 -> 'a} -> 'a _ + _ diff --git a/shared/src/test/diff/nu/PolymorphicVariants_Alt.mls b/shared/src/test/diff/nu/PolymorphicVariants_Alt.mls index 12a24d49f..c394d2af8 100644 --- a/shared/src/test/diff/nu/PolymorphicVariants_Alt.mls +++ b/shared/src/test/diff/nu/PolymorphicVariants_Alt.mls @@ -12,20 +12,21 @@ class List { - fun match: forall 'res; (ifNil: () => 'res, ifCons: (A, List[A]) => 'res) => 'res + fun match: forall 'res: (ifNil: () => 'res, ifCons: (A, List[A]) => 'res) => 'res fun match = error } let Nil: () => List<'a> let Cons: (head: 'a, tail: List<'a>) => List<'a> //│ class List[A] { +//│ constructor() //│ fun match: forall 'res. (ifNil: () -> 'res, ifCons: (A, List[A]) -> 'res) -> 'res //│ } //│ let Nil: () -> List[nothing] //│ let Cons: forall 'a. (head: 'a, tail: List['a]) -> List['a] -class NotFound +module NotFound class Success(result: A) -//│ class NotFound +//│ module NotFound //│ class Success[A](result: A) fun eq(l: Str, r: Str): Bool @@ -35,7 +36,7 @@ fun eq(l: Str, r: Str): Bool // fun list_assoc(s, l) = fun list_assoc(s, l: List<'a>) = l.match( - ifNil: () => NotFound(), + ifNil: () => NotFound, ifCons: (h, t) => if eq(s, h._1) then Success(h._2) else list_assoc(s, t) @@ -83,53 +84,50 @@ mixin EvalLambda { let l1 = this.eval(sub, t1) let l2 = this.eval(sub, t2) if t1 is - Abs(x, t) then this.eval(Cons((x, l2), Nil()), t) + Abs(x, t) then this.eval(Cons([x, l2], Nil()), t) else App(l1, l2) Abs(x, t) then let s = gensym() - Abs(s, this.eval(Cons((x, Var(s)), sub), t)) + Abs(s, this.eval(Cons([x, Var(s)], sub), t)) else super.eval(sub, v) } //│ mixin EvalLambda() { //│ super: {eval: ('b, 'c) -> 'd} -//│ this: {eval: ('b, 'e) -> 'A & (List[[Str, 'A]], 'f) -> 'd & (List['a | [Str, Var]], 'g) -> 'A0} +//│ this: { +//│ eval: ('b, 'e) -> 'A & (List[[Str, 'A]], 'f) -> 'd & (List['a | [Str, Var]], 'g) -> 'A0 +//│ } //│ fun eval: (List['a] & 'b, Abs['g] | App['e & (Abs['f] | Object & ~#Abs)] | Object & 'c & ~#Abs & ~#App) -> (Abs['A0] | App['A] | 'd) //│ } module Test1 extends EvalVar, EvalLambda //│ module Test1 { -//│ fun eval: forall 'a. (List[{_1: Str, _2: 'A}], 'b) -> ('A | 'a) +//│ fun eval: (List[{_1: Str, _2: 'a}], 'b) -> 'a //│ } //│ where //│ 'b <: Abs['b] | App['b & (Abs['b] | Object & ~#Abs)] | Var -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Var Test1.eval(Nil(), Var("a")) -//│ forall 'a. 'A | 'a +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Var Test1.eval(Nil(), Abs("b", Var("a"))) -//│ forall 'a. 'A | 'a +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Var -Test1.eval(Cons(("c", Var("d")), Nil()), App(Abs("b", Var("b")), Var("c"))) -//│ forall 'a. 'A | 'a +Test1.eval(Cons(["c", Var("d")], Nil()), App(Abs("b", Var("b")), Var("c"))) +//│ 'a //│ where -//│ 'A :> 'a | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Var -Test1.eval(Cons(("c", Abs("d", Var("d"))), Nil()), App(Abs("b", Var("b")), Var("c"))) -//│ forall 'a. 'A | 'a +Test1.eval(Cons(["c", Abs("d", Var("d"))], Nil()), App(Abs("b", Var("b")), Var("c"))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Abs[Var] | Var class Numb(n: Int) class Add(l: A, r: A) @@ -144,11 +142,11 @@ fun map_expr(f, v) = Numb then v Add(l, r) then Add(f(l), f(r)) Mul(l, r) then Mul(f(l), f(r)) -//│ fun map_expr: forall 'a 'A 'b 'A0. ('a -> 'A & 'b -> 'A0, Add['a] | Mul['b] | Numb | Var) -> (Add['A] | Mul['A0] | Numb | Var) +//│ fun map_expr: forall 'a 'A 'b 'A0. ('b -> 'A0 & 'a -> 'A, Add['b] | Mul['a] | Numb | Var) -> (Add['A0] | Mul['A] | Numb | Var) mixin EvalExpr { fun eval(sub, v) = - fun eta(e) = this.eval(sub, e) + let eta(e) = this.eval(sub, e) let vv = map_expr(eta, v) if vv is Var then super.eval(sub, vv) @@ -172,46 +170,43 @@ module Test2 extends EvalVar, EvalExpr Test2.eval(Nil(), Var("a")) //│ Numb | Var -Test2.eval(Cons(("c", Abs("d", Var("d"))), Nil()), Var("a")) +Test2.eval(Cons(["c", Abs("d", Var("d"))], Nil()), Var("a")) //│ Abs[Var] | Numb | Var -Test2.eval(Cons(("a", Numb(1)), Nil()), Var("a")) +Test2.eval(Cons(["a", Numb(1)], Nil()), Var("a")) //│ Numb | Var -Test2.eval(Cons(("a", Abs("d", Var("d"))), Nil()), Add(Numb(1), Var("a"))) +Test2.eval(Cons(["a", Abs("d", Var("d"))], Nil()), Add(Numb(1), Var("a"))) //│ Abs[Var] | Add[Numb | Var] | Numb | Var module Test3 extends EvalVar, EvalExpr, EvalLambda //│ module Test3 { -//│ fun eval: forall 'a. (List[{_1: Str, _2: 'b}], 'c) -> ('A | 'a) +//│ fun eval: (List[{_1: Str, _2: 'a}], 'b) -> 'c //│ } //│ where -//│ 'b :> 'A +//│ 'a :> 'c //│ <: Object -//│ 'A :> 'a | Numb | Var | 'b | 'd -//│ 'd <: Add['c] | Mul['c] | Numb | Var -//│ 'c <: Abs['c] | App['c & (Abs['c] | Object & ~#Abs)] | Object & 'd & ~#Abs & ~#App -//│ 'a :> App['A] | Abs['A] +//│ 'c :> App['c] | Abs['c] | Numb | Var | 'a | 'd +//│ 'd <: Add['b] | Mul['b] | Numb | Var +//│ 'b <: Abs['b] | App['b & (Abs['b] | Object & ~#Abs)] | Object & 'd & ~#Abs & ~#App -Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil()), Abs("a", Var("a"))) -//│ forall 'a. 'A | 'a +Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil()), Abs("a", Var("a"))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Numb | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Abs[Var] | Numb | Var -Test3.eval(Cons(("c", Abs("d", Var("d"))), Nil()), App(Abs("a", Var("a")), Add(Numb(1), Var("c")))) -//│ forall 'a. 'A | 'a +Test3.eval(Cons(["c", Abs("d", Var("d"))], Nil()), App(Abs("a", Var("a")), Add(Numb(1), Var("c")))) +//│ 'a //│ where -//│ 'A :> 'a | Abs[Var] | Add[Numb | Var] | Numb | Var -//│ 'a :> App['A] | Abs['A] +//│ 'a :> App['a] | Abs['a] | Abs[Var] | Add[Numb | Var] | Numb | Var module Test3 extends EvalVar, EvalLambda, EvalExpr //│ module Test3 { -//│ fun eval: (List[{_1: Str, _2: 'a}], 'a & (Add['b] | Mul['b] | Numb | Var)) -> ('A | 'a | 'b) +//│ fun eval: (List[{_1: Str, _2: 'a}], 'a & (Add['b] | Mul['b] | Numb | Var)) -> ('a | 'b | 'c) //│ } //│ where -//│ 'a :> 'b | 'A +//│ 'a :> 'b | 'c //│ <: Object -//│ 'A :> Numb | 'a | Abs['A] | App['A] | Var +//│ 'c :> Abs[Numb | 'a | 'c] | App[Numb | 'a | 'c] | Numb | Var | 'a //│ 'b <: Add['b] | Mul['b] | Numb | Var diff --git a/shared/src/test/diff/nu/PostHocMixinSignature.mls b/shared/src/test/diff/nu/PostHocMixinSignature.mls new file mode 100644 index 000000000..5c23e3c3f --- /dev/null +++ b/shared/src/test/diff/nu/PostHocMixinSignature.mls @@ -0,0 +1,73 @@ +:NewDefs + + +mixin Foo { + fun foo(x) = if x.a then x else foo(x.b) +} +//│ mixin Foo() { +//│ fun foo: 'a -> 'a +//│ } +//│ where +//│ 'a <: {a: Object, b: 'a} + + +module ValA { + val a = false + val b = ValB +} +module ValB { + val a = true + fun b = ValA +} +//│ module ValA { +//│ val a: false +//│ val b: ValB +//│ } +//│ module ValB { +//│ val a: true +//│ fun b: ValA +//│ } + + +module Test extends Foo +//│ module Test { +//│ fun foo: forall 'a. 'a -> 'a +//│ } +//│ where +//│ 'a <: {a: Object, b: 'a} + +[Test.foo(ValA), Test.foo(ValB)] +//│ [ValA | ValB, ValA | ValB] +//│ res +//│ = [ ValB { class: [class ValB] }, ValB { class: [class ValB] } ] + + +type V = {a: Bool, b: V} +//│ type V = {a: Bool, b: V} + +module Test extends Foo { + fun foo: V -> anything +} +//│ module Test { +//│ fun foo: V -> anything +//│ } + +[Test.foo(ValA), Test.foo(ValB)] +//│ [anything, anything] +//│ res +//│ = [ ValB { class: [class ValB] }, ValB { class: [class ValB] } ] + + +module Test extends Foo { + fun foo: V -> V +} +//│ module Test { +//│ fun foo: V -> V +//│ } + +[Test.foo(ValA), Test.foo(ValB)] +//│ [V, V] +//│ res +//│ = [ ValB { class: [class ValB] }, ValB { class: [class ValB] } ] + + diff --git a/shared/src/test/diff/nu/PrivateMemberOverriding.mls b/shared/src/test/diff/nu/PrivateMemberOverriding.mls new file mode 100644 index 000000000..e7977a41d --- /dev/null +++ b/shared/src/test/diff/nu/PrivateMemberOverriding.mls @@ -0,0 +1,57 @@ +:NewDefs + + +class Foo(x: Int) +//│ class Foo(x: Int) + +class Bar() extends Foo(123) { fun x = true } +//│ class Bar() extends Foo { +//│ fun x: true +//│ } + +Bar().x +//│ true +//│ res +//│ = true + +if Bar() is Foo(a) then a +//│ Int +//│ res +//│ = 123 + + +class Bar(val x: Bool) extends Foo(123) +//│ class Bar(x: Bool) extends Foo + +Bar(true).x +//│ Bool +//│ res +//│ = true + +if Bar(true) is Foo(a) then a +//│ Int +//│ res +//│ = 123 + + +class Bar(x: Bool) extends Foo(123) +//│ class Bar(x: Bool) extends Foo + +:e // * Expected +Bar(true).x +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.41: Bar(true).x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.37: class Bar(x: Bool) extends Foo(123) +//│ ╙── ^ +//│ error | false | true +//│ res +//│ = undefined + +if Bar(true) is Foo(a) then a +//│ Int +//│ res +//│ = 123 + + diff --git a/shared/src/test/diff/nu/RawUnionTraitSignatures.mls b/shared/src/test/diff/nu/RawUnionTraitSignatures.mls index a5e6bb6fe..d101afb6a 100644 --- a/shared/src/test/diff/nu/RawUnionTraitSignatures.mls +++ b/shared/src/test/diff/nu/RawUnionTraitSignatures.mls @@ -32,7 +32,7 @@ trait Base1: Foo //│ ╟── back into type variable `A` //│ ║ l.5: trait Foo[A] { fun x: A } //│ ╙── ^ -//│ (b: Base1) -> Foo['X] +//│ forall 'X. (b: Base1) -> Foo['X] //│ where //│ 'X :> ??A //│ <: ??A0 @@ -55,7 +55,7 @@ trait Base1: Foo trait Base1: Foo { val x: Int } //│ trait Base1: #Foo { -//│ let x: Int +//│ val x: Int //│ } (b: Base1) => b.x @@ -66,7 +66,7 @@ trait Base1: Foo { val x: Int } trait Base1: Foo[1 | 2] { val x: 0 | 1 } //│ trait Base1: Foo[1 | 2] { -//│ let x: 0 | 1 +//│ val x: 0 | 1 //│ } (b: Base1) => b.x @@ -90,7 +90,7 @@ trait Base2: Foo['FigureItOut] // :e (b: Base2) => b : Foo['X] -//│ (b: Base2) -> Foo['X] +//│ forall 'X. (b: Base2) -> Foo['X] //│ where //│ 'X :> ??FigureItOut //│ <: ??FigureItOut0 @@ -100,7 +100,9 @@ trait Base2: Foo['FigureItOut] // TODO reject class Impl extends Base2 -//│ class Impl extends Base2 +//│ class Impl extends Base2 { +//│ constructor() +//│ } (x: Impl) => x : Base2 //│ (x: Impl) -> Base2 @@ -109,12 +111,12 @@ class Impl extends Base2 :e class Impl() extends Base2, Foo -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `Impl` -//│ ║ l.111: class Impl() extends Base2, Foo +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `Impl` +//│ ║ l.113: class Impl() extends Base2, Foo //│ ║ ^^^^ //│ ╟── Declared here: //│ ║ l.5: trait Foo[A] { fun x: A } -//│ ╙── ^^^^ +//│ ╙── ^^^^^^^^ //│ class Impl() extends Base2, Foo { //│ fun x: 'A //│ } @@ -156,7 +158,7 @@ class Impl2() extends Base2, Foo[Int] { trait Test1[A] { fun x: A } -trait Test2[A]: Test1[(A, A)] +trait Test2[A]: Test1[[A, A]] //│ trait Test1[A] { //│ fun x: A //│ } diff --git a/shared/src/test/diff/nu/Refinements.mls b/shared/src/test/diff/nu/Refinements.mls index c3363ed0f..5db034cb6 100644 --- a/shared/src/test/diff/nu/Refinements.mls +++ b/shared/src/test/diff/nu/Refinements.mls @@ -27,7 +27,7 @@ c : D & { f: 1 } //│ = D { f: 1 } -class C[A](a: A) extends D() +class C[A](val a: A) extends D() //│ class C[A](a: A) extends D { //│ fun f: 0 //│ } diff --git a/shared/src/test/diff/nu/RightAssocOps.mls b/shared/src/test/diff/nu/RightAssocOps.mls new file mode 100644 index 000000000..15a34aaad --- /dev/null +++ b/shared/src/test/diff/nu/RightAssocOps.mls @@ -0,0 +1,75 @@ +:NewDefs + + +// * Operators that end with `:` are right-associative + + +fun (+:) pre(x: Int, xs) = [[x], xs] +fun (:+) post(xs, x: Int) = [xs, [x]] +fun (++) conc(xs, ys) = [xs, ys] +//│ fun (+:) pre: forall 'a. (x: Int, 'a) -> [[Int], 'a] +//│ fun (:+) post: forall 'b. ('b, x: Int) -> ['b, [Int]] +//│ fun (++) conc: forall 'c 'd. ('c, 'd) -> ['c, 'd] + + +1 +: 2 +: 3 +: [] +//│ [[Int], [[Int], [[Int], []]]] +//│ res +//│ = [ [ 1 ], [ [ 2 ], [ [Array], [] ] ] ] + +[] :+ 1 :+ 2 :+ 3 +//│ [[[[], [Int]], [Int]], [Int]] +//│ res +//│ = [ [ [ [], [Array] ], [ 2 ] ], [ 3 ] ] + +[1, 2, 3] ++ [4, 5, 6] +//│ [[1, 2, 3], [4, 5, 6]] +//│ res +//│ = [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] + +:p +1 +: "a" ++ "b" :+ 2 +//│ |1| |+:| |"a"| |++| |"b"| |:+| |2| +//│ AST: TypingUnit(App(Var(+:), Tup(_: IntLit(1), _: App(Var(:+), Tup(_: App(Var(++), Tup(_: StrLit(a), _: StrLit(b))), _: IntLit(2)))))) +//│ Parsed: +:(1, :+(++("a", "b",), 2,),); +//│ [[Int], [["a", "b"], [Int]]] +//│ res +//│ = [ [ 1 ], [ [ 'a', 'b' ], [ 2 ] ] ] + +:p +1 +: "a" :+ 2 ++ "b" +//│ |1| |+:| |"a"| |:+| |2| |++| |"b"| +//│ AST: TypingUnit(App(Var(+:), Tup(_: IntLit(1), _: App(Var(++), Tup(_: App(Var(:+), Tup(_: StrLit(a), _: IntLit(2))), _: StrLit(b)))))) +//│ Parsed: +:(1, ++(:+("a", 2,), "b",),); +//│ [[Int], [["a", [Int]], "b"]] +//│ res +//│ = [ [ 1 ], [ [ 'a', [Array] ], 'b' ] ] + +:p +:e +1 +: "a" ++ 2 +: "b" +//│ |1| |+:| |"a"| |++| |2| |+:| |"b"| +//│ AST: TypingUnit(App(Var(+:), Tup(_: IntLit(1), _: App(Var(+:), Tup(_: App(Var(++), Tup(_: StrLit(a), _: IntLit(2))), _: StrLit(b)))))) +//│ Parsed: +:(1, +:(++("a", 2,), "b",),); +//│ ╔══[ERROR] Type mismatch in operator application: +//│ ║ l.50: 1 +: "a" ++ 2 +: "b" +//│ ║ ^^^^^^^^^^^^^^^ +//│ ╟── tuple literal of type `[?a, ?b]` is not an instance of type `Int` +//│ ║ l.9: fun (++) conc(xs, ys) = [xs, ys] +//│ ║ ^^^^^^^^ +//│ ╟── but it flows into operator application with expected type `Int` +//│ ║ l.50: 1 +: "a" ++ 2 +: "b" +//│ ║ ^^^^^^^^ +//│ ╟── Note: constraint arises from type reference: +//│ ║ l.7: fun (+:) pre(x: Int, xs) = [[x], xs] +//│ ╙── ^^^ +//│ [[Int], error | [[Int], "b"]] +//│ res +//│ = [ [ 1 ], [ [ [Array] ], 'b' ] ] + +1 +: "a" ++ (2 +: "b") +//│ [[Int], ["a", [[Int], "b"]]] +//│ res +//│ = [ [ 1 ], [ 'a', [ [Array], 'b' ] ] ] + + diff --git a/shared/src/test/diff/nu/RigidVariables.mls b/shared/src/test/diff/nu/RigidVariables.mls new file mode 100644 index 000000000..12f4c4d28 --- /dev/null +++ b/shared/src/test/diff/nu/RigidVariables.mls @@ -0,0 +1,44 @@ +:NewDefs + + +// * Flexible + +fun f(x: 'test) = [x.b, x] +//│ fun f: forall 'b 'test. (x: {b: 'b} & 'test) -> ['b, 'test] + + +// * Rigid + +:e +fun f[A](x: A) = x.b +//│ ╔══[ERROR] Type `A` does not contain member `b` +//│ ║ l.13: fun f[A](x: A) = x.b +//│ ╙── ^^ +//│ fun f: (x: anything) -> error + +fun f[A](x: A & { b: ' }) = x.b +//│ fun f: forall 'b. (x: {b: 'b}) -> 'b + +:e +module Foo { + fun f[A](x: A) = x.b +} +//│ ╔══[ERROR] Type `A` does not contain member `b` +//│ ║ l.24: fun f[A](x: A) = x.b +//│ ╙── ^^ +//│ module Foo { +//│ fun f: (x: anything) -> error +//│ } + +:e +class Foo[A](x: A) { + fun f = x.b +} +//│ ╔══[ERROR] Type `A` does not contain member `b` +//│ ║ l.35: fun f = x.b +//│ ╙── ^^ +//│ class Foo[A](x: A) { +//│ fun f: error +//│ } + + diff --git a/shared/src/test/diff/nu/SelfAppMethods.mls b/shared/src/test/diff/nu/SelfAppMethods.mls index 2e742cd44..3ff6e7888 100644 --- a/shared/src/test/diff/nu/SelfAppMethods.mls +++ b/shared/src/test/diff/nu/SelfAppMethods.mls @@ -10,6 +10,7 @@ class A { } //│ class A { +//│ constructor() //│ fun f: nothing //│ fun g: A //│ } @@ -22,7 +23,7 @@ module A { fun h = g(g) } //│ ╔══[ERROR] Cyclic-looking constraint while typing application; a type annotation may be required -//│ ║ l.22: fun h = g(g) +//│ ║ l.23: fun h = g(g) //│ ║ ^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ module A { diff --git a/shared/src/test/diff/nu/SelfRec.mls b/shared/src/test/diff/nu/SelfRec.mls index f72baecc7..9b4fa8bb8 100644 --- a/shared/src/test/diff/nu/SelfRec.mls +++ b/shared/src/test/diff/nu/SelfRec.mls @@ -2,20 +2,86 @@ -class Foo1(x: Int) { +class Foo1(val x: Int) { fun test = Foo1(1).x } //│ class Foo1(x: Int) { //│ fun test: Int //│ } -class Foo2[A](x: A) { +:e +class Foo1X(x: 0 | 1) extends Foo1(x) { + fun test2 = Foo1X(1).x +} +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.14: fun test2 = Foo1X(1).x +//│ ╙── ^^ +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.13: class Foo1X(x: 0 | 1) extends Foo1(x) { +//│ ║ ^ +//│ ╟── Originally declared here: +//│ ║ l.5: class Foo1(val x: Int) { +//│ ╙── ^ +//│ class Foo1X(x: 0 | 1) extends Foo1 { +//│ fun test: Int +//│ fun test2: error +//│ } + + +class Foo2[A](val x: A) { fun test = Foo2(1).x } //│ class Foo2[A](x: A) { //│ fun test: 1 //│ } +:e +class Foo2X(x: 0 | 1) extends Foo2(x) { + fun test2 = Foo2X(1).x +} +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.40: fun test2 = Foo2X(1).x +//│ ╙── ^^ +//│ ╔══[ERROR] Inherited parameter named `x` is not virtual and cannot be overridden +//│ ║ l.39: class Foo2X(x: 0 | 1) extends Foo2(x) { +//│ ║ ^ +//│ ╟── Originally declared here: +//│ ║ l.31: class Foo2[A](val x: A) { +//│ ╙── ^ +//│ class Foo2X(x: 0 | 1) extends Foo2 { +//│ fun test: 1 +//│ fun test2: error +//│ } + +:e +Foo2X(1).x +//│ ╔══[ERROR] Parameter 'x' cannot tbe accessed as a field +//│ ║ l.57: Foo2X(1).x +//│ ║ ^^ +//│ ╟── Either make the parameter a `val` or access it through destructuring +//│ ║ l.39: class Foo2X(x: 0 | 1) extends Foo2(x) { +//│ ╙── ^ +//│ 0 | 1 | error +//│ res +//│ = 1 + +:e // TODO improve type checking +class Foo2X(a: 0 | 1) extends Foo2(a) { + fun test2 = Foo2X(1).x +} +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.70: fun test2 = Foo2X(1).x +//│ ╙── ^^ +//│ class Foo2X(a: 0 | 1) extends Foo2 { +//│ fun test: 1 +//│ fun test2: error +//│ } + +Foo2X(1).x +//│ 0 | 1 +//│ res +//│ = 1 + class Foo3[A](val x: A) { fun test = Foo3(1) @@ -23,8 +89,10 @@ class Foo3[A](val x: A) { } //│ class Foo3[A](x: A) { //│ fun foo: (x: A) -> Foo3[A] -//│ fun test: Foo3[1] +//│ fun test: forall 'A. Foo3['A] //│ } +//│ where +//│ 'A :> 1 Foo3 //│ forall 'A. (x: 'A) -> Foo3['A] @@ -35,7 +103,9 @@ Foo3 //│ } Foo3(1) -//│ Foo3[1] +//│ Foo3['A] +//│ where +//│ 'A :> 1 //│ res //│ = Foo3 {} @@ -56,13 +126,11 @@ Foo3(1).foo class Foo4 { fun test = [Foo4.test] } -//│ ╔══[ERROR] Type mismatch in field selection: -//│ ║ l.57: fun test = [Foo4.test] -//│ ║ ^^^^^^^^^ -//│ ╟── reference of type `() -> #Foo4` does not have field 'test' -//│ ║ l.57: fun test = [Foo4.test] -//│ ╙── ^^^^ +//│ ╔══[ERROR] Class Foo4 cannot be instantiated as it exposes no such constructor +//│ ║ l.127: fun test = [Foo4.test] +//│ ╙── ^^^^ //│ class Foo4 { +//│ constructor() //│ fun test: [error] //│ } @@ -71,8 +139,8 @@ class Foo5(x: Int) { fun test = [Foo5(5).test] } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.71: fun test = [Foo5(5).test] -//│ ╙── ^^^^^ +//│ ║ l.139: fun test = [Foo5(5).test] +//│ ╙── ^^^^^ //│ class Foo5(x: Int) { //│ fun test: [error] //│ } @@ -84,14 +152,14 @@ class Foo6[A](x: A) { fun test3 = [Foo6([x]).test3] } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.82: fun test1 = [Foo6(x).test1] -//│ ╙── ^^^^^^ +//│ ║ l.150: fun test1 = [Foo6(x).test1] +//│ ╙── ^^^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.83: fun test2 = [Foo6(123).test2] -//│ ╙── ^^^^^^ +//│ ║ l.151: fun test2 = [Foo6(123).test2] +//│ ╙── ^^^^^^ //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.84: fun test3 = [Foo6([x]).test3] -//│ ╙── ^^^^^^ +//│ ║ l.152: fun test3 = [Foo6([x]).test3] +//│ ╙── ^^^^^^ //│ class Foo6[A](x: A) { //│ fun test1: [error] //│ fun test2: [error] @@ -108,7 +176,7 @@ class Foo7[A](head: A, tail: Foo7[A] | N) { _ then tail.test1 } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.108: _ then tail.test1 +//│ ║ l.176: _ then tail.test1 //│ ╙── ^^^^^^ //│ class Foo7[A](head: A, tail: Foo7[A] | N) { //│ fun test1: error | A @@ -149,10 +217,35 @@ class Foo8[A](x: A) { x } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.148: let tmp = Foo8(y).test1(x) +//│ ║ l.216: let tmp = Foo8(y).test1(x) //│ ╙── ^^^^^^ //│ class Foo8[A](x: A) { //│ fun test1: (y: anything) -> A //│ } + + +:e // * FIXME this is caused by the self-annotation... +abstract class List(val length: Int): Cons +class Cons(tail: List) extends List(tail.length + 1) +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.231: class Cons(tail: List) extends List(tail.length + 1) +//│ ╙── ^^^^^^^ +//│ abstract class List(length: Int): Cons +//│ class Cons(tail: List) extends List + +// * Note: full (non-minimized) definitions: + +:e // * FIXME +abstract class List[out A](val length: Int): Cons[A] | Nil +class Cons[out A](val head: A, val tail: List[A]) extends List[A](tail.length + 1) +module Nil extends List[nothing](0) +//│ ╔══[ERROR] Indirectly-recursive member should have type annotation +//│ ║ l.242: class Cons[out A](val head: A, val tail: List[A]) extends List[A](tail.length + 1) +//│ ╙── ^^^^^^^ +//│ abstract class List[A](length: Int): Cons[A] | Nil +//│ class Cons[A](head: A, tail: List[A]) extends List +//│ module Nil extends List + + diff --git a/shared/src/test/diff/nu/SimpleSymbolicOps.mls b/shared/src/test/diff/nu/SimpleSymbolicOps.mls new file mode 100644 index 000000000..6910d6fbf --- /dev/null +++ b/shared/src/test/diff/nu/SimpleSymbolicOps.mls @@ -0,0 +1,20 @@ +:NewDefs + + +fun (-) i(x, y) = x +//│ fun (-) i: forall 'a. ('a, anything) -> 'a + +1 - 1 +//│ 1 +//│ res +//│ = 1 + + +fun (-) i(x, y) = x +[i(1,1), i(2,1), 1 - 1, 2 - 1] +//│ fun (-) i: forall 'a. ('a, anything) -> 'a +//│ [1, 2, 1, 2] +//│ res +//│ = [ 1, 2, 1, 2 ] + + diff --git a/shared/src/test/diff/nu/SimpleTraitImpl.mls b/shared/src/test/diff/nu/SimpleTraitImpl.mls index 1f2972f9f..279248021 100644 --- a/shared/src/test/diff/nu/SimpleTraitImpl.mls +++ b/shared/src/test/diff/nu/SimpleTraitImpl.mls @@ -71,6 +71,7 @@ module M extends C2 { class C1 { virtual fun x: 0 | 2 = 0 } //│ class C1 { +//│ constructor() //│ fun x: 0 | 2 //│ } @@ -123,7 +124,7 @@ module M extends T1, T2, C1 { fun x = this.x } //│ ╔══[ERROR] Indirectly-recursive member should have type annotation -//│ ║ l.123: fun x = this.x +//│ ║ l.124: fun x = this.x //│ ╙── ^^ //│ module M extends C1, T1, T2 { //│ fun x: error @@ -135,13 +136,13 @@ module M extends T1, T2, C1 { fun x = this.x } //│ ╔══[ERROR] Type mismatch in signature of member `x`: -//│ ║ l.134: fun x: 0 +//│ ║ l.135: fun x: 0 //│ ║ ^^^^ //│ ╟── type `0` does not match type `1 | 2` -//│ ║ l.134: fun x: 0 +//│ ║ l.135: fun x: 0 //│ ║ ^ //│ ╟── but it flows into signature of member `x` with expected type `1 | 2` -//│ ║ l.134: fun x: 0 +//│ ║ l.135: fun x: 0 //│ ║ ^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.8: trait T2 { fun x: 1 | 2 } @@ -158,6 +159,7 @@ class C extends C1, T2 { fun x = this.x } //│ class C extends C1, T2 { +//│ constructor() //│ fun x: 2 //│ } @@ -173,13 +175,14 @@ M.x :e class C2 extends T1 -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `C2` -//│ ║ l.175: class C2 extends T1 +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C2` +//│ ║ l.177: class C2 extends T1 //│ ║ ^^ //│ ╟── Declared here: //│ ║ l.7: trait T1 { fun x: 0 | 1 } -//│ ╙── ^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^ //│ class C2 extends T1 { +//│ constructor() //│ fun x: 0 | 1 //│ } @@ -190,13 +193,14 @@ abstract class C2 extends T1 :e class C3 extends C2 -//│ ╔══[ERROR] Member `x` is declared in parent but not implemented in `C3` -//│ ║ l.192: class C3 extends C2 +//│ ╔══[ERROR] Member `x` is declared (or its declaration is inherited) but is not implemented in `C3` +//│ ║ l.195: class C3 extends C2 //│ ║ ^^ //│ ╟── Declared here: //│ ║ l.7: trait T1 { fun x: 0 | 1 } -//│ ╙── ^^^^^^^^ +//│ ╙── ^^^^^^^^^^^^ //│ class C3 extends C2, T1 { +//│ constructor() //│ fun x: 0 | 1 //│ } @@ -207,19 +211,20 @@ abstract class C3 extends C2 class C2 extends T1 { fun x = 1 } //│ class C2 extends T1 { +//│ constructor() //│ fun x: 1 //│ } :e class C2 extends T1, T2 { fun x = 2 } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.214: class C2 extends T1, T2 { fun x = 2 } +//│ ║ l.219: class C2 extends T1, T2 { fun x = 2 } //│ ║ ^^^^^ //│ ╟── integer literal of type `2` does not match type `0 | 1` -//│ ║ l.214: class C2 extends T1, T2 { fun x = 2 } +//│ ║ l.219: class C2 extends T1, T2 { fun x = 2 } //│ ║ ^ //│ ╟── but it flows into definition of method x with expected type `0 | 1` -//│ ║ l.214: class C2 extends T1, T2 { fun x = 2 } +//│ ║ l.219: class C2 extends T1, T2 { fun x = 2 } //│ ║ ^^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.7: trait T1 { fun x: 0 | 1 } @@ -228,60 +233,66 @@ class C2 extends T1, T2 { fun x = 2 } //│ ║ l.7: trait T1 { fun x: 0 | 1 } //│ ╙── ^^^^^^^^ //│ class C2 extends T1, T2 { +//│ constructor() //│ fun x: 2 //│ } class C2 extends T1, T2 { virtual fun x = 1 } //│ class C2 extends T1, T2 { +//│ constructor() //│ fun x: 1 //│ } :e class C3 extends C2 { virtual fun x = 111 } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.240: class C3 extends C2 { virtual fun x = 111 } +//│ ║ l.247: class C3 extends C2 { virtual fun x = 111 } //│ ║ ^^^^^^^ //│ ╟── integer literal of type `111` does not match type `1` -//│ ║ l.240: class C3 extends C2 { virtual fun x = 111 } +//│ ║ l.247: class C3 extends C2 { virtual fun x = 111 } //│ ║ ^^^ //│ ╟── but it flows into definition of method x with expected type `1` -//│ ║ l.240: class C3 extends C2 { virtual fun x = 111 } +//│ ║ l.247: class C3 extends C2 { virtual fun x = 111 } //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from integer literal: -//│ ║ l.234: class C2 extends T1, T2 { virtual fun x = 1 } +//│ ║ l.240: class C2 extends T1, T2 { virtual fun x = 1 } //│ ║ ^ //│ ╟── from definition of method x: -//│ ║ l.234: class C2 extends T1, T2 { virtual fun x = 1 } +//│ ║ l.240: class C2 extends T1, T2 { virtual fun x = 1 } //│ ╙── ^^^^^ //│ class C3 extends C2, T1, T2 { +//│ constructor() //│ fun x: 111 //│ } class C3 extends C2 { fun x = 1 } //│ class C3 extends C2, T1, T2 { +//│ constructor() //│ fun x: 1 //│ } class C2 extends C1, T1 { fun x = 0 } //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: 0 //│ } class C2 extends T1, C1 { fun x = 0 } //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: 0 //│ } :e class C2 extends C1, T1 { fun x = 1 } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.276: class C2 extends C1, T1 { fun x = 1 } +//│ ║ l.287: class C2 extends C1, T1 { fun x = 1 } //│ ║ ^^^^^ //│ ╟── integer literal of type `1` does not match type `0 | 2` -//│ ║ l.276: class C2 extends C1, T1 { fun x = 1 } +//│ ║ l.287: class C2 extends C1, T1 { fun x = 1 } //│ ║ ^ //│ ╟── but it flows into definition of method x with expected type `0 | 2` -//│ ║ l.276: class C2 extends C1, T1 { fun x = 1 } +//│ ║ l.287: class C2 extends C1, T1 { fun x = 1 } //│ ║ ^^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.72: class C1 { virtual fun x: 0 | 2 = 0 } @@ -290,19 +301,20 @@ class C2 extends C1, T1 { fun x = 1 } //│ ║ l.72: class C1 { virtual fun x: 0 | 2 = 0 } //│ ╙── ^^^^^^^^^^^^ //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: 1 //│ } :e class C2 extends T1, C1 { fun x = 1 } //│ ╔══[ERROR] Type mismatch in definition of method x: -//│ ║ l.297: class C2 extends T1, C1 { fun x = 1 } +//│ ║ l.309: class C2 extends T1, C1 { fun x = 1 } //│ ║ ^^^^^ //│ ╟── integer literal of type `1` does not match type `0 | 2` -//│ ║ l.297: class C2 extends T1, C1 { fun x = 1 } +//│ ║ l.309: class C2 extends T1, C1 { fun x = 1 } //│ ║ ^ //│ ╟── but it flows into definition of method x with expected type `0 | 2` -//│ ║ l.297: class C2 extends T1, C1 { fun x = 1 } +//│ ║ l.309: class C2 extends T1, C1 { fun x = 1 } //│ ║ ^^^^^ //│ ╟── Note: constraint arises from union type: //│ ║ l.72: class C1 { virtual fun x: 0 | 2 = 0 } @@ -311,6 +323,7 @@ class C2 extends T1, C1 { fun x = 1 } //│ ║ l.72: class C1 { virtual fun x: 0 | 2 = 0 } //│ ╙── ^^^^^^^^^^^^ //│ class C2 extends C1, T1 { +//│ constructor() //│ fun x: 1 //│ } @@ -319,21 +332,22 @@ class C2 extends T1, C1 { fun x = 1 } :e trait T2 { val r = 1(1) } //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.320: trait T2 { val r = 1(1) } -//│ ╙── ^^^^^^^^ +//│ ║ l.333: trait T2 { val r = 1(1) } +//│ ╙── ^^^^^^^^^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.320: trait T2 { val r = 1(1) } +//│ ║ l.333: trait T2 { val r = 1(1) } //│ ║ ^^^^ //│ ╟── integer literal of type `1` is not a function -//│ ║ l.320: trait T2 { val r = 1(1) } +//│ ║ l.333: trait T2 { val r = 1(1) } //│ ╙── ^ //│ trait T2 { -//│ let r: error +//│ val r: error //│ } class C2 extends T2 //│ class C2 extends T2 { -//│ let r: error +//│ constructor() +//│ val r: error //│ } @@ -343,79 +357,79 @@ trait T3[A] { } class C2 extends T3[Int] //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.342: val r = C2().x -//│ ╙── ^^^^^^^^^^ -//│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.341: trait T3[A] { -//│ ║ ^^^^^^^^^^^^^ -//│ ║ l.342: val r = C2().x -//│ ╙── ^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Type `C2` does not contain member `x` -//│ ║ l.342: val r = C2().x -//│ ╙── ^^ +//│ ║ l.356: val r = C2().x +//│ ╙── ^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Class C2 cannot be instantiated as it exposes no such constructor +//│ ║ l.356: val r = C2().x +//│ ╙── ^^ //│ trait T3[A] { -//│ let r: error +//│ val r: error +//│ } +//│ class C2 extends T3 { +//│ constructor() +//│ val r: error //│ } -//│ class C2 extends T3 :e // * Note: lack of hygiene... happens only if class shadows previous C2 and is part of the error-throwing block C2() : T3['X] -//│ ╔══[ERROR] Type `C2` does not contain member `T3#A` -//│ ║ l.341: trait T3[A] { -//│ ╙── ^ -//│ T3['X] -//│ where -//│ 'X :> error +//│ ╔══[ERROR] Construction of unparameterized class C2 should use the `new` keyword +//│ ║ l.374: C2() : T3['X] +//│ ╙── ^^ +//│ T3[Int] class C3 extends T3[Int] //│ class C3 extends T3 { -//│ let r: error +//│ constructor() +//│ val r: error //│ } -C3() : T3['X] +(new C3) : T3['X] //│ T3[Int] -trait Foo { fun foo: forall 'A; (x: 'A) -> 'A } +trait Foo { fun foo: forall 'A: (x: 'A) -> 'A } //│ trait Foo { //│ fun foo: forall 'A. (x: 'A) -> 'A //│ } class B extends Foo { fun foo = error } //│ class B extends Foo { +//│ constructor() //│ fun foo: nothing //│ } class B extends Foo { fun foo(x) = x } //│ class B extends Foo { +//│ constructor() //│ fun foo: forall 'a. 'a -> 'a //│ } :e class B extends Foo { fun foo(x) = x + 1 } //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.396: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.409: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^^^^^^^^^^ //│ ╟── type `'A` is not an instance of type `Int` -//│ ║ l.380: trait Foo { fun foo: forall 'A; (x: 'A) -> 'A } +//│ ║ l.391: trait Foo { fun foo: forall 'A: (x: 'A) -> 'A } //│ ║ ^^ //│ ╟── Note: constraint arises from reference: -//│ ║ l.396: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.409: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^ //│ ╟── Note: quantified type variable 'A is defined at: -//│ ║ l.380: trait Foo { fun foo: forall 'A; (x: 'A) -> 'A } +//│ ║ l.391: trait Foo { fun foo: forall 'A: (x: 'A) -> 'A } //│ ╙── ^^ //│ ╔══[ERROR] Type mismatch in definition of method foo: -//│ ║ l.396: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.409: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^^^^^^^^^^ //│ ╟── operator application of type `Int` does not match type `'A` -//│ ║ l.396: class B extends Foo { fun foo(x) = x + 1 } +//│ ║ l.409: class B extends Foo { fun foo(x) = x + 1 } //│ ║ ^^^^^ //│ ╟── Note: constraint arises from type variable: -//│ ║ l.380: trait Foo { fun foo: forall 'A; (x: 'A) -> 'A } +//│ ║ l.391: trait Foo { fun foo: forall 'A: (x: 'A) -> 'A } //│ ╙── ^^ //│ class B extends Foo { +//│ constructor() //│ fun foo: Int -> Int //│ } diff --git a/shared/src/test/diff/nu/Subscripts.mls b/shared/src/test/diff/nu/Subscripts.mls index 49c60d008..eb2812dbb 100644 --- a/shared/src/test/diff/nu/Subscripts.mls +++ b/shared/src/test/diff/nu/Subscripts.mls @@ -19,7 +19,7 @@ xs.[0] + 1 //│ ╔══[ERROR] Type mismatch in operator application: //│ ║ l.18: xs.[0] + 1 //│ ║ ^^^^^^^^ -//│ ╟── possibly-undefined array access of type `undefined` is not an instance of type `Int` +//│ ╟── possibly-undefined array access of type `()` is not an instance of type `Int` //│ ║ l.18: xs.[0] + 1 //│ ╙── ^^^^ //│ Int | error diff --git a/shared/src/test/diff/nu/TODO_Classes.mls b/shared/src/test/diff/nu/TODO_Classes.mls index e899bf155..1ebff6886 100644 --- a/shared/src/test/diff/nu/TODO_Classes.mls +++ b/shared/src/test/diff/nu/TODO_Classes.mls @@ -2,167 +2,63 @@ - - -// *** Class instantiation *** // +// *** First-class classes *** // class C -//│ class C - -new C -//│ C -//│ res -//│ = C {} - -// TODO Forbid? -new C() -//│ C -//│ res -//│ = C {} - -// :e // TODO reject -:re -C() -//│ C -//│ res -//│ Runtime error: -//│ TypeError: Class constructor C cannot be invoked without 'new' - - -class D(x: Int) -//│ class D(x: Int) - -:js -D(0) -//│ D -//│ // Prelude -//│ class TypingUnit5 {} -//│ const typing_unit5 = new TypingUnit5; -//│ // Query 1 -//│ res = D(0); -//│ // End of generated code -//│ res -//│ = D {} - -// TODO reject or accept? -:js -new D(0) -//│ D -//│ // Prelude -//│ class TypingUnit6 {} -//│ const typing_unit6 = new TypingUnit6; -//│ // Query 1 -//│ res = new D.class(0); -//│ // End of generated code -//│ res -//│ = D {} - - - -// *** Explicit unapply *** // - - -// function D ... -// D.class = class D { #x; static unapply(self) { return [self.#x] } } -// D.unapply = D.class.unapply - +//│ class C { +//│ constructor() +//│ } class D(x: Int) //│ class D(x: Int) -D.unapply -//│ forall 'x. (D & {x: 'x}) -> ['x] -//│ res -//│ = [Function: unapply] - -D.unapply(D(42)) -//│ [Int] -//│ res -//│ = [ 42 ] - -:e -D.unapply({ x: 42 }) -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.85: D.unapply({ x: 42 }) -//│ ║ ^^^^^^^^^^^^^^^^^^^^ -//│ ╟── record literal of type `{x: 42}` is not an instance of type `D` -//│ ║ l.85: D.unapply({ x: 42 }) -//│ ╙── ^^ -//│ error | [42] -//│ res -//│ Runtime error: -//│ TypeError: Cannot read private member #x from an object whose class did not declare it - -class DT[T](x: T) -DT.unapply -//│ class DT[T](x: T) -//│ forall 'x. (DT[anything] & {x: 'x}) -> ['x] -//│ res -//│ = [Function: unapply] - -DT.unapply(DT(42)) -//│ [42] -//│ res -//│ = [ 42 ] - :e -DT.unapply({ x: 42 }) -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.110: DT.unapply({ x: 42 }) -//│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── record literal of type `{x: 42}` is not an instance of type `DT` -//│ ║ l.110: DT.unapply({ x: 42 }) -//│ ╙── ^^ -//│ error | [42] -//│ res -//│ Runtime error: -//│ TypeError: Cannot read private member #x from an object whose class did not declare it - -// *** First-class classes *** // - - -class C -//│ class C - -// :e // TODO fix type fun foo(c) = new c -//│ fun foo: forall 'a. (() -> 'a) -> 'a +//│ ╔══[ERROR] Cannot use `new` on non-class variable of type ?a +//│ ║ l.17: fun foo(c) = new c +//│ ╙── ^^^^^ +//│ fun foo: anything -> error -// :e // TODO reject :re foo(() => 123) -//│ 123 +//│ error //│ res //│ Runtime error: //│ TypeError: c is not a constructor +:e foo(C) -//│ C +//│ ╔══[ERROR] Construction of unparameterized class C should use the `new` keyword +//│ ║ l.31: foo(C) +//│ ╙── ^ +//│ error //│ res //│ = C {} -// :e // TODO fix type +:e fun bar(c) = new c(123) -//│ fun bar: forall 'a. (123 -> 'a) -> 'a +//│ ╔══[ERROR] Cannot use `new` on non-class variable of type ?a +//│ ║ l.41: fun bar(c) = new c(123) +//│ ╙── ^^^^^^^^^^ +//│ fun bar: anything -> error -// :e // TODO reject :re bar(D) -//│ D +//│ error //│ res //│ Runtime error: //│ TypeError: c is not a constructor -:e // TODO accept +:e // TODO accept when we have first-class classes bar(D.class) //│ ╔══[ERROR] Type mismatch in field selection: -//│ ║ l.159: bar(D.class) -//│ ║ ^^^^^^^ +//│ ║ l.55: bar(D.class) +//│ ║ ^^^^^^^ //│ ╟── reference of type `(x: Int) -> D` does not have field 'class' -//│ ║ l.159: bar(D.class) -//│ ╙── ^ +//│ ║ l.55: bar(D.class) +//│ ╙── ^ //│ error //│ res //│ = D {} @@ -173,13 +69,15 @@ bar(D.class) class C -//│ class C +//│ class C { +//│ constructor() +//│ } :e // TODO new C { val x = 1 } //│ ╔══[ERROR] Currently unsupported `new` syntax -//│ ║ l.179: new C { val x = 1 } -//│ ╙── ^^^^^^^^^^^^^^^^^^^ +//│ ║ l.77: new C { val x = 1 } +//│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ error //│ Code generation encountered an error: //│ custom class body is not supported yet @@ -191,18 +89,19 @@ new C { val x = 1 } class Cls[A] { fun x: A = x } //│ class Cls[A] { +//│ constructor() //│ fun x: A //│ } let c = new Cls -//│ let c: forall 'A. Cls['A] +//│ let c: Cls[nothing] //│ c //│ = Cls {} // FIXME let y: c.A = c.x //│ ╔══[ERROR] type identifier not found: c -//│ ║ l.203: let y: c.A = c.x +//│ ║ l.102: let y: c.A = c.x //│ ╙── ^ //│ /!!!\ Uncaught error: scala.NotImplementedError: an implementation is missing @@ -211,8 +110,9 @@ let y: c.A = c.x // *** GADTs *** // -class Cls[A] { fun x: A = x; fun g: A -> Int; fun g = g } +class Cls[A] { fun x: A = x;; fun g: A -> Int;; fun g = g } //│ class Cls[A] { +//│ constructor() //│ fun g: A -> Int //│ fun x: A //│ } @@ -223,14 +123,14 @@ fun test(a: Object) = if a is Cls then a.x else error //│ ╔══[ERROR] Type error in `case` expression -//│ ║ l.222: fun test(a: Object) = if a is +//│ ║ l.122: fun test(a: Object) = if a is //│ ║ ^^^^ -//│ ║ l.223: Cls then a.x +//│ ║ l.123: Cls then a.x //│ ║ ^^^^^^^^^^^^^^ -//│ ║ l.224: else error +//│ ║ l.124: else error //│ ║ ^^^^^^^^^^^^ //│ ╟── type variable `A` leaks out of its scope -//│ ║ l.214: class Cls[A] { fun x: A = x; fun g: A -> Int; fun g = g } +//│ ║ l.113: class Cls[A] { fun x: A = x;; fun g: A -> Int;; fun g = g } //│ ╙── ^ //│ fun test: (a: Object) -> (error | ??A) @@ -239,20 +139,21 @@ fun test(a: Object) = if a is Cls then a.g(a.x) // a.x : a.A ; a.g : a.A -> a.A else 0 //│ ╔══[ERROR] Type error in `case` expression -//│ ║ l.238: fun test(a: Object) = if a is +//│ ║ l.138: fun test(a: Object) = if a is //│ ║ ^^^^ -//│ ║ l.239: Cls then a.g(a.x) // a.x : a.A ; a.g : a.A -> a.A +//│ ║ l.139: Cls then a.g(a.x) // a.x : a.A ; a.g : a.A -> a.A //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.240: else 0 +//│ ║ l.140: else 0 //│ ║ ^^^^^^^^ //│ ╟── type variable `A` leaks out of its scope -//│ ║ l.214: class Cls[A] { fun x: A = x; fun g: A -> Int; fun g = g } +//│ ║ l.113: class Cls[A] { fun x: A = x;; fun g: A -> Int;; fun g = g } //│ ╙── ^ //│ fun test: (a: Object) -> Int class Cls[out A] { fun x: A = x } //│ class Cls[A] { +//│ constructor() //│ fun x: A //│ } diff --git a/shared/src/test/diff/nu/ThisRefinedClasses.mls b/shared/src/test/diff/nu/ThisRefinedClasses.mls index 871b742a1..dea56120c 100644 --- a/shared/src/test/diff/nu/ThisRefinedClasses.mls +++ b/shared/src/test/diff/nu/ThisRefinedClasses.mls @@ -13,6 +13,7 @@ class Foo { fun test = this.x } //│ ║ l.11: class Foo { fun test = this.x } //│ ╙── ^^ //│ class Foo { +//│ constructor() //│ fun test: error //│ } @@ -20,7 +21,7 @@ class Foo { fun test = this.x } :e class Foo(n: Int) { fun test = this.x } //│ ╔══[ERROR] Type `#Foo & {n: Int}` does not contain member `x` -//│ ║ l.21: class Foo(n: Int) { fun test = this.x } +//│ ║ l.22: class Foo(n: Int) { fun test = this.x } //│ ╙── ^^ //│ class Foo(n: Int) { //│ fun test: error @@ -29,8 +30,8 @@ class Foo(n: Int) { fun test = this.x } :e class Foo(n: A) { fun test = this.x } -//│ ╔══[ERROR] Type `#Foo & {Foo#A = ?A, n: A}` does not contain member `x` -//│ ║ l.31: class Foo(n: A) { fun test = this.x } +//│ ╔══[ERROR] Type `#Foo & {Foo#A = A, n: A}` does not contain member `x` +//│ ║ l.32: class Foo(n: A) { fun test = this.x } //│ ╙── ^^ //│ class Foo[A](n: A) { //│ fun test: error @@ -44,21 +45,46 @@ class Foo { // fun test = this.x } //│ ╔══[ERROR] Type `#Foo` does not contain member `x` -//│ ║ l.43: this: { x: 'a } +//│ ║ l.44: this: { x: 'a } //│ ╙── ^ -//│ class Foo +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.44: this: { x: 'a } +//│ ║ ^^^^ +//│ ╟── type `{x: 'a}` does not match type `()` +//│ ║ l.44: this: { x: 'a } +//│ ║ ^^^^^^^^^ +//│ ╟── but it flows into expression in statement position with expected type `()` +//│ ║ l.44: this: { x: 'a } +//│ ╙── ^^^^ +//│ class Foo { +//│ constructor() +//│ } // TODO // * All on one line: -class Test { this: { x: Int}; fun test = this.x } +class Test { this: { x: Int};; fun test = this.x } //│ ╔══[ERROR] Type `#Test` does not contain member `x` -//│ ║ l.54: class Test { this: { x: Int}; fun test = this.x } -//│ ╙── ^^ +//│ ║ l.68: class Test { this: { x: Int};; fun test = this.x } +//│ ╙── ^^ //│ ╔══[ERROR] Type `#Test` does not contain member `x` -//│ ║ l.54: class Test { this: { x: Int}; fun test = this.x } +//│ ║ l.68: class Test { this: { x: Int};; fun test = this.x } //│ ╙── ^ +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in type ascription: +//│ ║ l.68: class Test { this: { x: Int};; fun test = this.x } +//│ ║ ^^^^ +//│ ╟── type `{x: Int}` does not match type `()` +//│ ║ l.68: class Test { this: { x: Int};; fun test = this.x } +//│ ║ ^^^^^^^^^ +//│ ╟── but it flows into expression in statement position with expected type `()` +//│ ║ l.68: class Test { this: { x: Int};; fun test = this.x } +//│ ╙── ^^^^ //│ class Test { +//│ constructor() //│ fun test: error //│ } diff --git a/shared/src/test/diff/nu/TraitSignatures.mls b/shared/src/test/diff/nu/TraitSignatures.mls index 7cf6b2eab..394cb400e 100644 --- a/shared/src/test/diff/nu/TraitSignatures.mls +++ b/shared/src/test/diff/nu/TraitSignatures.mls @@ -8,7 +8,7 @@ declare trait Foo: (x: Num) => Num { val y: Str } //│ declare trait Foo: (x: Num) -> Num { -//│ let y: Str +//│ val y: Str //│ } (f: Foo) => [f.y, f(0)] @@ -17,7 +17,7 @@ declare trait Foo: (x: Num) => Num { //│ = [Function: res] -declare trait FooPoly: forall 'a; (x: 'a) => 'a +declare trait FooPoly: forall 'a: (x: 'a) => 'a //│ declare trait FooPoly: forall 'a. (x: 'a) -> 'a (f: FooPoly) => [f(0), f(true)] diff --git a/shared/src/test/diff/nu/TrickyGenericInheritance.mls b/shared/src/test/diff/nu/TrickyGenericInheritance.mls index 15d616a77..b63734cda 100644 --- a/shared/src/test/diff/nu/TrickyGenericInheritance.mls +++ b/shared/src/test/diff/nu/TrickyGenericInheritance.mls @@ -13,6 +13,7 @@ class C1 extends T1 { fun f(x: Int) = x } //│ class C1 extends T1 { +//│ constructor() //│ fun f: (x: Int) -> Int //│ } @@ -20,6 +21,7 @@ class C1 extends T1['FigureItOut] { fun f(x: Int) = x } //│ class C1 extends T1 { +//│ constructor() //│ fun f: (x: Int) -> Int //│ } @@ -66,16 +68,16 @@ c1.f :e (c1 : T1['X]).f(false) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.67: (c1 : T1['X]).f(false) +//│ ║ l.69: (c1 : T1['X]).f(false) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── reference of type `false` is not an instance of type `Int` -//│ ║ l.67: (c1 : T1['X]).f(false) +//│ ║ l.69: (c1 : T1['X]).f(false) //│ ║ ^^^^^ //│ ╟── Note: constraint arises from type reference: -//│ ║ l.20: fun f(x: Int) = x +//│ ║ l.21: fun f(x: Int) = x //│ ║ ^^^ //│ ╟── from type variable: -//│ ║ l.67: (c1 : T1['X]).f(false) +//│ ║ l.69: (c1 : T1['X]).f(false) //│ ╙── ^^ //│ Int | error | false //│ res @@ -94,30 +96,19 @@ class C2 extends T2['FigureItOut] { fun f(x: Int) = x } //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.91: val r = C2().f(false) -//│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.89: trait T2[A] { -//│ ║ ^^^^^^^^^^^^^ -//│ ║ l.90: fun f: A -> A -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.91: val r = C2().f(false) -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.91: val r = C2().f(false) -//│ ║ ^^^^^^^^^^^^^ -//│ ╟── reference of type `false` is not an instance of type `Int` -//│ ║ l.91: val r = C2().f(false) -//│ ║ ^^^^^ -//│ ╟── Note: constraint arises from type reference: -//│ ║ l.94: fun f(x: Int) = x -//│ ╙── ^^^ +//│ ║ l.93: val r = C2().f(false) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Class C2 cannot be instantiated as it exposes no such constructor +//│ ║ l.93: val r = C2().f(false) +//│ ╙── ^^ //│ trait T2[A] { //│ fun f: A -> A -//│ let r: Int | error +//│ val r: error //│ } //│ class C2 extends T2 { +//│ constructor() //│ fun f: (x: Int) -> Int +//│ val r: error //│ } :e @@ -129,34 +120,27 @@ class C3 extends T3['FigureItOut] { fun f(x: Int) = x } //│ ╔══[ERROR] Method implementations in traits are not yet supported -//│ ║ l.126: val r = (C3() : T3['X]).f(false) -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.124: trait T3[A] { -//│ ║ ^^^^^^^^^^^^^ -//│ ║ l.125: fun f: A -> A -//│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.126: val r = (C3() : T3['X]).f(false) -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╔══[ERROR] Type `C3` does not contain member `T3#A` -//│ ║ l.124: trait T3[A] { -//│ ╙── ^ +//│ ║ l.117: val r = (C3() : T3['X]).f(false) +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Class C3 cannot be instantiated as it exposes no such constructor +//│ ║ l.117: val r = (C3() : T3['X]).f(false) +//│ ╙── ^^ //│ trait T3[A] { //│ fun f: A -> A -//│ let r: error | false +//│ val r: false //│ } //│ class C3 extends T3 { +//│ constructor() //│ fun f: (x: Int) -> Int +//│ val r: false //│ } :e // FIXME C3() : T3['X] -//│ ╔══[ERROR] Type `C3` does not contain member `T3#A` -//│ ║ l.124: trait T3[A] { -//│ ╙── ^ -//│ T3['X] -//│ where -//│ 'X :> error +//│ ╔══[ERROR] Construction of unparameterized class C3 should use the `new` keyword +//│ ║ l.139: C3() : T3['X] +//│ ╙── ^^ +//│ T3[Int] //│ res //│ Runtime error: //│ TypeError: Class constructor C3 cannot be invoked without 'new' @@ -169,12 +153,14 @@ abstract class IO[A] { } class Bind[A](underlying: IO[A]) extends IO[Int] //│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.167: abstract class IO[A] { +//│ ║ l.151: abstract class IO[A] { //│ ║ ^^^^^^^^^^^^^ -//│ ║ l.168: fun test = Bind(this) : IO[Int] -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.152: fun test = Bind(this) : IO[Int] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.153: } +//│ ╙── ^ //│ ╔══[ERROR] Type `Bind[?A]` does not contain member `IO#A` -//│ ║ l.167: abstract class IO[A] { +//│ ║ l.151: abstract class IO[A] { //│ ╙── ^ //│ abstract class IO[A] { //│ fun test: IO[Int] @@ -191,25 +177,27 @@ class Map[A, B](underlying: IO[A], f: A -> B) extends IO[B] { fun run: B = error } //│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.185: abstract class IO[A] { +//│ ║ l.171: abstract class IO[A] { //│ ║ ^^^^^^^^^^^^^ -//│ ║ l.186: fun map[B]: (A -> B) -> IO[B] // * Removing this works... +//│ ║ l.172: fun map[B]: (A -> B) -> IO[B] // * Removing this works... //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.187: fun map(f) = Map(this, f) +//│ ║ l.173: fun map(f) = Map(this, f) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.188: fun run: A -//│ ╙── ^^^^^^^^^^^^ +//│ ║ l.174: fun run: A +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.175: } +//│ ╙── ^ //│ ╔══[ERROR] Type `Map[?A, ?B]` does not contain member `IO#A` -//│ ║ l.185: abstract class IO[A] { +//│ ║ l.171: abstract class IO[A] { //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method map: -//│ ║ l.187: fun map(f) = Map(this, f) +//│ ║ l.173: fun map(f) = Map(this, f) //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Map[?A, ?B]` does not have field 'IO#A' -//│ ║ l.187: fun map(f) = Map(this, f) +//│ ║ l.173: fun map(f) = Map(this, f) //│ ║ ^^^^^^^^^^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.186: fun map[B]: (A -> B) -> IO[B] // * Removing this works... +//│ ║ l.172: fun map[B]: (A -> B) -> IO[B] // * Removing this works... //│ ╙── ^^^^^ //│ abstract class IO[A] { //│ fun map: forall 'B. (A -> 'B) -> IO['B] @@ -229,25 +217,27 @@ class Bind[A, B](underlying: IO[A], f: A -> IO[B]) extends IO[B] { fun run = f(underlying.run).run } //│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.223: abstract class IO[A] { +//│ ║ l.211: abstract class IO[A] { //│ ║ ^^^^^^^^^^^^^ -//│ ║ l.224: fun bind[B]: (A -> IO[B]) -> IO[B] // * FIXME: causes cycle error +//│ ║ l.212: fun bind[B]: (A -> IO[B]) -> IO[B] // * FIXME: causes cycle error //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.225: fun bind(f) = Bind(this, f) +//│ ║ l.213: fun bind(f) = Bind(this, f) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.226: fun run: A -//│ ╙── ^^^^^^^^^^^^ +//│ ║ l.214: fun run: A +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.215: } +//│ ╙── ^ //│ ╔══[ERROR] Type `Bind[?A, ?B]` does not contain member `IO#A` -//│ ║ l.223: abstract class IO[A] { +//│ ║ l.211: abstract class IO[A] { //│ ╙── ^ //│ ╔══[ERROR] Type mismatch in definition of method bind: -//│ ║ l.225: fun bind(f) = Bind(this, f) +//│ ║ l.213: fun bind(f) = Bind(this, f) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── application of type `Bind[?A, ?B]` does not have field 'IO#A' -//│ ║ l.225: fun bind(f) = Bind(this, f) +//│ ║ l.213: fun bind(f) = Bind(this, f) //│ ║ ^^^^^^^^^^^^^ //│ ╟── Note: constraint arises from applied type reference: -//│ ║ l.224: fun bind[B]: (A -> IO[B]) -> IO[B] // * FIXME: causes cycle error +//│ ║ l.212: fun bind[B]: (A -> IO[B]) -> IO[B] // * FIXME: causes cycle error //│ ╙── ^^^^^ //│ abstract class IO[A] { //│ fun bind: forall 'B. (A -> IO['B]) -> IO['B] @@ -263,10 +253,12 @@ abstract class IO[A] { class Bind[B]() extends IO[B] } //│ ╔══[ERROR] Unhandled cyclic definition -//│ ║ l.262: abstract class IO[A] { +//│ ║ l.252: abstract class IO[A] { //│ ║ ^^^^^^^^^^^^^ -//│ ║ l.263: class Bind[B]() extends IO[B] -//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.253: class Bind[B]() extends IO[B] +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.254: } +//│ ╙── ^ //│ abstract class IO[A] { //│ class Bind[B]() extends IO //│ } diff --git a/shared/src/test/diff/nu/TypeAliases.mls b/shared/src/test/diff/nu/TypeAliases.mls index d7b46e182..e1fc895a1 100644 --- a/shared/src/test/diff/nu/TypeAliases.mls +++ b/shared/src/test/diff/nu/TypeAliases.mls @@ -5,7 +5,9 @@ type I = Int //│ type I = Int class CI1 -//│ class CI1 +//│ class CI1 { +//│ constructor() +//│ } // :e type AI1 = Array[Int] @@ -17,7 +19,7 @@ type AI2 = Array :e type AI3(n) = Array[Int] //│ ╔══[ERROR] Type alias definitions cannot have value parameters -//│ ║ l.18: type AI3(n) = Array[Int] +//│ ║ l.20: type AI3(n) = Array[Int] //│ ╙── ^^^ //│ type AI3 = Array[Int] diff --git a/shared/src/test/diff/nu/TypeVariables.mls b/shared/src/test/diff/nu/TypeVariables.mls index 8a16d6b5d..47ba5aa8b 100644 --- a/shared/src/test/diff/nu/TypeVariables.mls +++ b/shared/src/test/diff/nu/TypeVariables.mls @@ -5,19 +5,19 @@ fun x: 'a -> 'a = succ //│ fun x: Int -> Int :e -fun x: forall 'a; 'a -> 'a = succ +fun x: forall 'a: 'a -> 'a = succ //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.8: fun x: forall 'a; 'a -> 'a = succ +//│ ║ l.8: fun x: forall 'a: 'a -> 'a = succ //│ ║ ^^^^ //│ ╟── type `'a` is not an instance of type `Int` -//│ ║ l.8: fun x: forall 'a; 'a -> 'a = succ +//│ ║ l.8: fun x: forall 'a: 'a -> 'a = succ //│ ║ ^^ //│ ╟── Note: quantified type variable 'a is defined at: -//│ ║ l.8: fun x: forall 'a; 'a -> 'a = succ +//│ ║ l.8: fun x: forall 'a: 'a -> 'a = succ //│ ╙── ^^ //│ fun x: forall 'a. 'a -> 'a -fun x: [Int -> Int,] = [id : forall 'a; 'a -> 'a,] +fun x: [Int -> Int,] = [id : forall 'a: 'a -> 'a,] //│ fun x: [Int -> Int] diff --git a/shared/src/test/diff/nu/TypreMembers.mls b/shared/src/test/diff/nu/TypreMembers.mls index 69ac69344..af6a856b4 100644 --- a/shared/src/test/diff/nu/TypreMembers.mls +++ b/shared/src/test/diff/nu/TypreMembers.mls @@ -3,6 +3,7 @@ class Test { type T = Int } //│ class Test { +//│ constructor() //│ type T = Int //│ } @@ -20,7 +21,7 @@ trait Test { type T = Int } :e 1 : Test.T //│ ╔══[ERROR] Illegal prefix of type selection: Test -//│ ║ l.21: 1 : Test.T +//│ ║ l.22: 1 : Test.T //│ ╙── ^^^^ //│ error //│ res diff --git a/shared/src/test/diff/nu/Unapply.mls b/shared/src/test/diff/nu/Unapply.mls new file mode 100644 index 000000000..9dcc6a93a --- /dev/null +++ b/shared/src/test/diff/nu/Unapply.mls @@ -0,0 +1,108 @@ +// *** Explicit unapply tests *** // + +:NewDefs + + +// * Unapply's current compilation strategy: +// function D ... +// D.class = class D { #x; static unapply(self) { return [self.#x] } } +// D.unapply = D.class.unapply + +class D(x: Int) +//│ class D(x: Int) + +D.unapply +//│ forall '#x. (D & {#x: '#x}) -> ['#x] +//│ res +//│ = [Function: unapply] + +D.unapply(D(42)) +//│ [Int] +//│ res +//│ = [ 42 ] + +:e +D.unapply({ x: 42 }) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.25: D.unapply({ x: 42 }) +//│ ║ ^^^^^^^^^^^^^^^^^^^^ +//│ ╟── record literal of type `{x: 42}` does not have field '#x' +//│ ║ l.25: D.unapply({ x: 42 }) +//│ ║ ^^ +//│ ╟── Note: constraint arises from field selection: +//│ ║ l.11: class D(x: Int) +//│ ╙── ^ +//│ error | [nothing] +//│ res +//│ Runtime error: +//│ TypeError: Cannot read private member #x from an object whose class did not declare it + +class DT[T](x: T) +DT.unapply +//│ class DT[T](x: T) +//│ forall '#x. (DT[anything] & {#x: '#x}) -> ['#x] +//│ res +//│ = [Function: unapply] + +DT.unapply(DT(42)) +//│ [42] +//│ res +//│ = [ 42 ] + +:e +DT.unapply({ x: 42 }) +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.53: DT.unapply({ x: 42 }) +//│ ║ ^^^^^^^^^^^^^^^^^^^^^ +//│ ╟── record literal of type `{x: 42}` does not have field '#x' +//│ ║ l.53: DT.unapply({ x: 42 }) +//│ ║ ^^ +//│ ╟── Note: constraint arises from field selection: +//│ ║ l.40: class DT[T](x: T) +//│ ╙── ^ +//│ error | [nothing] +//│ res +//│ Runtime error: +//│ TypeError: Cannot read private member #x from an object whose class did not declare it + + +// * TODO improve `unapply` logic: currently it picks up shadowing fields/methods + +class Foo(x: Int) { + val x = toString(x) +} +//│ class Foo(x: Int) { +//│ val x: Str +//│ } + +// * Current hack: use `scrut.#x` to access a private field while passing the typer... +Foo.unapply +//│ forall '#x. (Foo & {#x: '#x}) -> ['#x] +//│ res +//│ = [Function: unapply] + +Foo.unapply(Foo(123)) +//│ [Str] +//│ res +//│ = [ '123' ] + +if Foo(123) is Foo(a) then a +//│ Str +//│ res +//│ = '123' + + + +// * Eventually we'll want to support this sort of overloading: +:e +fun D(x: Int) = {x} +module D { fun unapply(a) = [a.x] } +//│ ╔══[ERROR] Refininition of 'D' +//│ ║ l.99: module D { fun unapply(a) = [a.x] } +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ fun D: (x: Int) -> {x: Int} +//│ module D { +//│ fun unapply: forall 'x. {x: 'x} -> ['x] +//│ } + + diff --git a/shared/src/test/diff/nu/UnaryMinus.mls b/shared/src/test/diff/nu/UnaryMinus.mls new file mode 100644 index 000000000..bb0341d0a --- /dev/null +++ b/shared/src/test/diff/nu/UnaryMinus.mls @@ -0,0 +1,93 @@ +:NewDefs + +-1 +//│ -1 +//│ res +//│ = -1 + +- 1 +//│ -1 +//│ res +//│ = -1 + +1+1 +//│ Int +//│ res +//│ = 2 + +1-3 +//│ Int +//│ res +//│ = -2 + +3-1 +//│ Int +//│ res +//│ = 2 + +1 - (3 - 5) +//│ Int +//│ res +//│ = 3 + +3 - 1 +//│ Int +//│ res +//│ = 2 + +1 -1 +//│ Int +//│ res +//│ = 0 + +1-1 +//│ Int +//│ res +//│ = 0 + +1+ -1 +//│ Int +//│ res +//│ = 0 + +1 - (1 - 1) +//│ Int +//│ res +//│ = 1 + +1 - 1 +//│ Int +//│ res +//│ = 0 + +1 - - 1 +//│ Int +//│ res +//│ = 2 + +1 - - - - 1 +//│ Int +//│ res +//│ = 2 + +fun f() = 6 +-f() +//│ fun f: () -> 6 +//│ Int +//│ res +//│ = -6 + +fun inv(x: Int) = -x +inv(15) +inv(inv(15)) +//│ fun inv: (x: Int) -> Int +//│ Int +//│ res +//│ = -15 +//│ res +//│ = 15 + +inv(f()) +//│ Int +//│ res +//│ = -6 diff --git a/shared/src/test/diff/nu/UndefMatching.mls b/shared/src/test/diff/nu/UndefMatching.mls index e0e363c38..57453f5d9 100644 --- a/shared/src/test/diff/nu/UndefMatching.mls +++ b/shared/src/test/diff/nu/UndefMatching.mls @@ -3,7 +3,7 @@ fun foo(x: 'a | undefined) = if x is undefined then error else x -//│ fun foo: forall 'a. (x: Object & 'a & ~undefined | undefined) -> 'a +//│ fun foo: forall 'a. (x: Object & 'a & ~() | ()) -> 'a class Abstract[A] { @@ -21,10 +21,11 @@ class Abstract[A] { fun baz(a: A & Object) = [bar0(a), bar1(a), bar2(a)] } //│ class Abstract[A] { -//│ fun bar0: (x: Object & A | undefined) -> (Object & A & ~undefined) -//│ fun bar1: (x: Object & A | undefined) -> (Object & A & ~undefined) -//│ fun bar2: (x: Object & A | undefined) -> (Object & A & ~undefined | undefined) -//│ fun baz: (a: Object & A) -> [Object & A & ~undefined, Object & A & ~undefined, Object & A & ~undefined | undefined] +//│ constructor() +//│ fun bar0: (x: Object & A | ()) -> (Object & A & ~()) +//│ fun bar1: (x: Object & A | ()) -> (Object & A & ~()) +//│ fun bar2: (x: Object & A | ()) -> (Object & A & ~() | ()) +//│ fun baz: (a: Object & A) -> [Object & A & ~(), Object & A & ~(), Object & A & ~() | ()] //│ } @@ -34,16 +35,17 @@ class Abstract[A] { if x is undefined then error else x } //│ ╔══[ERROR] Type mismatch in `case` expression: -//│ ║ l.34: if x is undefined then error else x +//│ ║ l.35: if x is undefined then error else x //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ╟── type `A & ~undefined` is not an instance of type `Object` -//│ ║ l.33: fun bar(x: A & ~undefined | undefined) = +//│ ╟── type `A & ~()` is not an instance of type `Object` +//│ ║ l.34: fun bar(x: A & ~undefined | undefined) = //│ ║ ^^^^^^^^^^^^^^ //│ ╟── but it flows into reference with expected type `Object` -//│ ║ l.34: if x is undefined then error else x +//│ ║ l.35: if x is undefined then error else x //│ ╙── ^ //│ class Abstract[A] { -//│ fun bar: (x: undefined | A & ~undefined) -> (A & ~undefined) +//│ constructor() +//│ fun bar: (x: () | A & ~()) -> (A & ~()) //│ } diff --git a/shared/src/test/diff/nu/Uninstantiable.mls b/shared/src/test/diff/nu/Uninstantiable.mls index a9a683fab..0ea6cfac1 100644 --- a/shared/src/test/diff/nu/Uninstantiable.mls +++ b/shared/src/test/diff/nu/Uninstantiable.mls @@ -6,25 +6,34 @@ Int //│ ╔══[ERROR] Class Int is abstract and cannot be instantiated //│ ║ l.5: Int //│ ╙── ^^^ -//│ () -> Int +//│ ╔══[ERROR] Class Int cannot be instantiated as it exposes no such constructor +//│ ║ l.5: Int +//│ ╙── ^^^ +//│ error //│ Code generation encountered an error: //│ unresolved symbol Int :e Int() //│ ╔══[ERROR] Class Int is abstract and cannot be instantiated -//│ ║ l.14: Int() +//│ ║ l.17: Int() +//│ ╙── ^^^ +//│ ╔══[ERROR] Class Int cannot be instantiated as it exposes no such constructor +//│ ║ l.17: Int() //│ ╙── ^^^ -//│ Int +//│ error //│ Code generation encountered an error: //│ unresolved symbol Int :e new Int //│ ╔══[ERROR] Class Int is abstract and cannot be instantiated -//│ ║ l.23: new Int -//│ ╙── ^^^ -//│ Int +//│ ║ l.29: new Int +//│ ╙── ^^^^^^^ +//│ ╔══[ERROR] Class Int cannot be instantiated as it exposes no such constructor +//│ ║ l.29: new Int +//│ ╙── ^^^^^^^ +//│ error //│ Code generation encountered an error: //│ unresolved symbol Int diff --git a/shared/src/test/diff/nu/Unit.mls b/shared/src/test/diff/nu/Unit.mls index 9ad961777..9c8b6a46e 100644 --- a/shared/src/test/diff/nu/Unit.mls +++ b/shared/src/test/diff/nu/Unit.mls @@ -2,80 +2,348 @@ () -//│ [] +//│ () //│ res -//│ = [] +//│ = undefined fun x: () fun x = () -//│ fun x: [] -//│ fun x: [] +//│ fun x: () +//│ fun x: () x -//│ [] +//│ () //│ res -//│ = [] +//│ = undefined -// :e // TODO – currently we treat () as an empty array; should in fact be JS's `undefined` +:e // we used to treat () as an empty array; should in fact be JS's `undefined` x : Array['a] -//│ Array[nothing] -//│ res -//│ = [] - -// TODO -x : undefined //│ ╔══[ERROR] Type mismatch in type ascription: -//│ ║ l.27: x : undefined +//│ ║ l.21: x : Array['a] //│ ║ ^ -//│ ╟── type `[]` does not match type `undefined` +//│ ╟── type `()` does not match type `Array['a]` //│ ║ l.9: fun x: () //│ ║ ^^ -//│ ╟── but it flows into reference with expected type `undefined` -//│ ║ l.27: x : undefined +//│ ╟── but it flows into reference with expected type `Array['a]` +//│ ║ l.21: x : Array['a] //│ ║ ^ -//│ ╟── Note: constraint arises from literal type: -//│ ║ l.27: x : undefined +//│ ╟── Note: constraint arises from applied type reference: +//│ ║ l.21: x : Array['a] //│ ╙── ^^^^^^^^^ -//│ undefined +//│ Array[nothing] +//│ res +//│ = undefined + +x : undefined +//│ () //│ res -//│ = [] +//│ = undefined -// TODO fun x: () fun x = undefined -//│ ╔══[ERROR] Type mismatch in definition: -//│ ║ l.46: fun x = undefined -//│ ║ ^^^^^^^^^^^^^ -//│ ╟── undefined literal of type `undefined` is not a 0-element tuple -//│ ║ l.46: fun x = undefined -//│ ║ ^^^^^^^^^ -//│ ╟── but it flows into definition of method x with expected type `[]` -//│ ║ l.46: fun x = undefined -//│ ║ ^^^^^^^^^^^^^ -//│ ╟── Note: constraint arises from tuple type: -//│ ║ l.45: fun x: () -//│ ╙── ^^ -//│ fun x: undefined -//│ fun x: [] +//│ fun x: () +//│ fun x: () :e fun x: () fun x = 1 //│ ╔══[ERROR] Type mismatch in definition: -//│ ║ l.65: fun x = 1 +//│ ║ l.51: fun x = 1 //│ ║ ^^^^^ -//│ ╟── integer literal of type `1` is not a 0-element tuple -//│ ║ l.65: fun x = 1 +//│ ╟── integer literal of type `1` does not match type `()` +//│ ║ l.51: fun x = 1 //│ ║ ^ -//│ ╟── but it flows into definition of method x with expected type `[]` -//│ ║ l.65: fun x = 1 +//│ ╟── but it flows into definition of method x with expected type `()` +//│ ║ l.51: fun x = 1 //│ ║ ^^^^^ -//│ ╟── Note: constraint arises from tuple type: -//│ ║ l.64: fun x: () +//│ ╟── Note: constraint arises from literal type: +//│ ║ l.50: fun x: () //│ ╙── ^^ //│ fun x: 1 -//│ fun x: [] +//│ fun x: () + + +(1) +//│ 1 +//│ res +//│ = 1 + +// :pe // TODO? +(1,) +//│ 1 +//│ res +//│ = 1 + +:pe +(1,2) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.80: (1,2) +//│ ╙── ^^^^^ +//│ [1, 2] +//│ res +//│ = [ 1, 2 ] + +(let x = 1) +//│ () +//│ res +//│ = undefined + +:pe +(let x = 1 in) +//│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here +//│ ║ l.94: (let x = 1 in) +//│ ╙── ^ +//│ () +//│ res +//│ = undefined + +(log(1)) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ 1 + +:pe +(log(1);) +//│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here +//│ ║ l.110: (log(1);) +//│ ╙── ^ +//│ () +//│ res +//│ = undefined +//│ // Output +//│ 1 + +(log(1); 2) +//│ 2 +//│ res +//│ = 2 +//│ // Output +//│ 1 + +(log(1); ()) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ 1 + +(((log((()))))) +//│ () +//│ res +//│ = undefined +//│ // Output +//│ undefined + + + +:pe +(1, 2) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.144: (1, 2) +//│ ╙── ^^^^^^ +//│ [1, 2] +//│ res +//│ = [ 1, 2 ] + + +x => x +//│ forall 'a. 'a -> 'a +//│ res +//│ = [Function: res] + +(x) => x +//│ forall 'a. 'a -> 'a +//│ res +//│ = [Function: res] + +(x, y) => x + y +//│ (Int, Int) -> Int +//│ res +//│ = [Function: res] + + +(1, 2) => 3 +//│ (1, 2) -> 3 +//│ res +//│ = [Function: res] + + +:pe +1 => (2, 3) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.176: 1 => (2, 3) +//│ ╙── ^^^^^^ +//│ 1 -> [2, 3] +//│ res +//│ = [Function: res] + + +fun f(x, y) = x + y +//│ fun f: (Int, Int) -> Int + +f(1, 2) +//│ Int +//│ res +//│ = 3 + +f of 1, 2 +//│ Int +//│ res +//│ = 3 + +:pe +:e +f of (1, 2) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.200: f of (1, 2) +//│ ╙── ^^^^^^ +//│ ╔══[ERROR] Type mismatch in application: +//│ ║ l.200: f of (1, 2) +//│ ║ ^^^^^^^^^^^ +//│ ╟── argument of type `[[1, 2]]` does not match type `[?a, ?b]` +//│ ║ l.200: f of (1, 2) +//│ ║ ^^^^^^ +//│ ╟── Note: constraint arises from tuple literal: +//│ ║ l.185: fun f(x, y) = x + y +//│ ╙── ^^^^^^ +//│ Int | error +//│ res +//│ = '1,2undefined' + + + +:w +0; 0 +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.220: 0; 0 +//│ ╙── ^ +//│ 0 +//│ res +//│ = 0 + +:w +succ(0); 0 +//│ ╔══[WARNING] Expression in statement position should have type `unit`. +//│ ╟── Use the `discard` function to discard non-unit values, making the intent clearer. +//│ ╟── Type mismatch in application: +//│ ║ l.229: succ(0); 0 +//│ ║ ^^^^^^^ +//│ ╙── application of type `Int` does not match type `()` +//│ 0 +//│ res +//│ = 0 + +discard(succ(0)); 0 +//│ 0 +//│ res +//│ = 0 + +discard of succ(0);; 0 +//│ 0 +//│ res +//│ = undefined +//│ res +//│ = 0 + +let _ = succ(0);; 0 +//│ let _: Int +//│ 0 +//│ _ +//│ = 1 +//│ res +//│ = 0 + + +x => x; () +//│ () -> () +//│ res +//│ = [Function: res] + +x => x;; () +//│ () +//│ res +//│ = [Function: res] +//│ res +//│ = undefined + +:w +fun f = + x => x;; () +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.275: x => x;; () +//│ ╙── ^^^^^^ +//│ fun f: () + +fun f = + discard of x => x;; () +//│ fun f: () + +:w +fun f = + x => x + () +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.287: x => x +//│ ╙── ^^^^^^ +//│ fun f: () + + +:w +module Test { + 123 +} +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.297: 123 +//│ ╙── ^^^ +//│ module Test + +:w +module Test { + 123 + 456 +} +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.306: 123 +//│ ╙── ^^^ +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.307: 456 +//│ ╙── ^^^ +//│ module Test + +:w +module Test { + x => x +} +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.319: x => x +//│ ╙── ^^^^^^ +//│ module Test + + + +:e +fun foo = + let tmp = 0 +foo + 1 +//│ ╔══[ERROR] Type mismatch in operator application: +//│ ║ l.331: foo + 1 +//│ ║ ^^^^^^^ +//│ ╟── definition of method foo of type `()` is not an instance of type `Int` +//│ ║ l.329: fun foo = +//│ ║ ^^^^^ +//│ ║ l.330: let tmp = 0 +//│ ║ ^^^^^^^^^^^^^ +//│ ╟── but it flows into reference with expected type `Int` +//│ ║ l.331: foo + 1 +//│ ╙── ^^^ +//│ fun foo: () +//│ Int | error +//│ res +//│ = NaN + diff --git a/shared/src/test/diff/nu/Unsupported.mls b/shared/src/test/diff/nu/Unsupported.mls index abd78c31c..d329f88f8 100644 --- a/shared/src/test/diff/nu/Unsupported.mls +++ b/shared/src/test/diff/nu/Unsupported.mls @@ -5,8 +5,8 @@ declare class Foo() { val x = 42 } //│ declare class Foo() { -//│ let index: nothing -//│ let x: 42 +//│ val index: nothing +//│ val x: 42 //│ } declare fun call: unsupported["(source: string, subString: string): boolean;", "Invoker.ts", 31, 54] diff --git a/shared/src/test/diff/nu/ValSigs.mls b/shared/src/test/diff/nu/ValSigs.mls index 134efcb94..01cc07e75 100644 --- a/shared/src/test/diff/nu/ValSigs.mls +++ b/shared/src/test/diff/nu/ValSigs.mls @@ -1,27 +1,51 @@ :NewDefs +val x: Int +//│ val x: Int +//│ x +//│ = + +// * Note that this counts as a completely new `val` since it's in a new block +val x = "hi" +//│ val x: "hi" +//│ x +//│ = 'hi' + + val x: Int val x = 1 -//│ let x: Int -//│ let x: 1 +//│ val x: 1 +//│ val x: Int //│ x //│ = //│ x //│ = 1 +val x = 1 +//│ val x: 1 +//│ x +//│ = 1 -// * FIXME type x //│ 1 //│ res //│ = 1 -// :e // FIXME should be an error +:e val x: Int val x = "oops" -//│ let x: Int -//│ let x: "oops" +//│ ╔══[ERROR] Type mismatch in definition: +//│ ║ l.37: val x = "oops" +//│ ║ ^^^^^^^^^^ +//│ ╟── string literal of type `"oops"` is not an instance of type `Int` +//│ ║ l.37: val x = "oops" +//│ ║ ^^^^^^ +//│ ╟── Note: constraint arises from type reference: +//│ ║ l.36: val x: Int +//│ ╙── ^^^ +//│ val x: "oops" +//│ val x: Int //│ x //│ = //│ x diff --git a/shared/src/test/diff/nu/Vals.mls b/shared/src/test/diff/nu/Vals.mls index 14602aa1a..5a5a62a81 100644 --- a/shared/src/test/diff/nu/Vals.mls +++ b/shared/src/test/diff/nu/Vals.mls @@ -3,8 +3,8 @@ val a = 1 val b = a + 1 -//│ let a: 1 -//│ let b: Int +//│ val a: 1 +//│ val b: Int //│ a //│ = 1 //│ b @@ -15,21 +15,21 @@ val b = a + 1 :ge val c = d + 1 val d = 1 -//│ let c: Int -//│ let d: 1 +//│ val c: Int +//│ val d: 1 //│ Code generation encountered an error: //│ unresolved symbol d // :e // FIXME should not type check val a = a -//│ let a: nothing +//│ val a: nothing //│ a //│ = 1 val f(x) = x -//│ let f: forall 'a. 'a -> 'a +//│ val f: forall 'a. 'a -> 'a //│ f //│ = [Function: f] @@ -44,7 +44,7 @@ module M { val f(x) = x + tmp } //│ module M { -//│ let f: Int -> Int +//│ val f: Int -> Int //│ let tmp: 2 //│ } diff --git a/shared/src/test/diff/nu/Virtual.mls b/shared/src/test/diff/nu/Virtual.mls index 847fb2a43..8782ab7cd 100644 --- a/shared/src/test/diff/nu/Virtual.mls +++ b/shared/src/test/diff/nu/Virtual.mls @@ -6,7 +6,7 @@ class Foo() { } //│ class Foo() { //│ fun f: (x: Int) -> Int -//│ let g: Int +//│ val g: Int //│ } class Bar() extends Foo { @@ -14,7 +14,7 @@ class Bar() extends Foo { } //│ class Bar() extends Foo { //│ fun f: (x: Int) -> Int -//│ let g: Int +//│ val g: Int //│ } Bar().f(40) @@ -29,12 +29,12 @@ class Baz() extends Foo { //│ ╔══[ERROR] Value member `g` is not virtual and cannot be overridden //│ ║ l.27: val g = 1 //│ ║ ^^^^^ -//│ ╟── Declared here: +//│ ╟── Originally declared here: //│ ║ l.5: val g: Int = 0 //│ ╙── ^^^^^^^^^^ //│ class Baz() extends Foo { //│ fun f: (x: Int) -> Int -//│ let g: 1 +//│ val g: 1 //│ } mixin X { @@ -60,18 +60,18 @@ T().f(0 - 42) //│ res //│ = 42 -class M1() { +abstract class M1() { val foo: Str } class M2(s: Str) extends M1 { val foo = s } M2("foo").foo -//│ class M1() { -//│ let foo: Str +//│ abstract class M1() { +//│ val foo: Str //│ } //│ class M2(s: Str) extends M1 { -//│ let foo: Str +//│ val foo: Str //│ } //│ Str //│ res @@ -98,7 +98,7 @@ class V1() { //│ ╙── ^^^^^^ //│ class V1() { //│ fun foo: 42 -//│ let x: 42 +//│ val x: 42 //│ } class V2() { @@ -108,7 +108,7 @@ class V2() { } //│ class V2() { //│ fun foo: Int -//│ let x: Int +//│ val x: Int //│ } diff --git a/shared/src/test/diff/nu/WeirdUnions.mls b/shared/src/test/diff/nu/WeirdUnions.mls index b81b6fbe2..0b4e81c38 100644 --- a/shared/src/test/diff/nu/WeirdUnions.mls +++ b/shared/src/test/diff/nu/WeirdUnions.mls @@ -11,14 +11,22 @@ fun f: [Str] | [Str, Int] fun f: (Str | [Str, Int]) //│ fun f: Str | [Str, Int] +:pe fun f: Str | (Str, Int) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.15: fun f: Str | (Str, Int) +//│ ╙── ^^^^^^^^^^ //│ fun f: Str | [Str, Int] fun f: Str | ([Str, Int]) //│ fun f: Str | [Str, Int] +:pe fun f: Str | ((Str, Int)) +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.26: fun f: Str | ((Str, Int)) +//│ ╙── ^^^^^^^^^^ //│ fun f: Str | [Str, Int] @@ -39,15 +47,14 @@ fun f: (Str => Str) & ((Str, Int) => Int) //│ fun f: Str -> Str & (Str, Int) -> Int // * ...resulting in approximation at call sites (we don't handle overloading) -:e f("abc", "abc") -//│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.43: f("abc", "abc") -//│ ║ ^^^^^^^^^^^^^^^ -//│ ╟── argument list of type `["abc", "abc"]` does not match type `nothing` -//│ ║ l.43: f("abc", "abc") -//│ ╙── ^^^^^^^^^^^^^^ -//│ Int | Str | error +//│ Int | Str +//│ res +//│ = +//│ f is not implemented + +f("abcabc") +//│ Int | Str //│ res //│ = //│ f is not implemented @@ -55,7 +62,7 @@ f("abc", "abc") // * Mismatched argument list sizes yields surprising results: -let r = if true then id else [x, y] => [y, x] +let r = if true then id else (x, y) => [y, x] //│ let r: (...nothing) -> [nothing, nothing] //│ r //│ = [Function: id] @@ -64,19 +71,19 @@ let r = if true then id else [x, y] => [y, x] r(error) r(error, error) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.64: r(error) +//│ ║ l.71: r(error) //│ ║ ^^^^^^^^ //│ ╟── argument of type `[nothing]` does not match type `[?a, ?b]` -//│ ║ l.64: r(error) +//│ ║ l.71: r(error) //│ ║ ^^^^^^^ //│ ╟── Note: constraint arises from tuple literal: -//│ ║ l.58: let r = if true then id else [x, y] => [y, x] +//│ ║ l.65: let r = if true then id else (x, y) => [y, x] //│ ╙── ^^^^ //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.65: r(error, error) +//│ ║ l.72: r(error, error) //│ ║ ^^^^^^^^^^^^^^^ //│ ╟── argument list of type `[nothing, nothing]` does not match type `[?a]` -//│ ║ l.65: r(error, error) +//│ ║ l.72: r(error, error) //│ ╙── ^^^^^^^^^^^^^^ //│ error | [nothing, nothing] //│ res @@ -97,5 +104,10 @@ r of [0, 1] //│ res //│ = [ 0, 1 ] +// Also currently parses the same: +let r = if true then id else [x, y] => [y, x] +//│ let r: forall 'a 'b 'c. (['b, 'c] & 'a) -> (['c, 'b] | 'a) +//│ r +//│ = [Function: id] diff --git a/shared/src/test/diff/nu/i180.mls b/shared/src/test/diff/nu/i180.mls new file mode 100644 index 000000000..39013ced9 --- /dev/null +++ b/shared/src/test/diff/nu/i180.mls @@ -0,0 +1,79 @@ +:NewDefs + + +fun (++) stringConcat(a, b) = concat(a)(b) +//│ fun (++) stringConcat: (Str, Str) -> Str + +type List[out A] = Cons[A] | Nil +class Cons[out A](head: A, tail: List[A]) { + fun join(sep: Str): Str + fun join(sep) = + if tail is + Nil then toString(head) + Cons(x, Nil) then toString(head) ++ sep ++ toString(x) + Cons(x, xs) then toString(head) ++ sep ++ toString(x) ++ sep ++ xs.join(sep) +} +module Nil { + fun join(sep: Str): Str = "" + fun contains(x): Bool = false +} +//│ type List[A] = Cons[A] | Nil +//│ class Cons[A](head: A, tail: List[A]) { +//│ fun join: (sep: Str) -> Str +//│ } +//│ module Nil { +//│ fun contains: anything -> Bool +//│ fun join: (sep: Str) -> Str +//│ } + + +fun (::) cons[A](x: A, xs: List[A]): List[A] = Cons(x, xs) +//│ fun (::) cons: forall 'A. (x: 'A, xs: List['A]) -> List['A] + +(1 :: Nil).join(", ") +(1 :: (2 :: Nil)).join(", ") +(1 :: (2 :: (3 :: Nil))).join(", ") +(1 :: (2 :: (3 :: (4 :: Nil)))).join(", ") +(1 :: (2 :: (3 :: (4 :: (5 :: Nil))))).join(", ") +//│ Str +//│ res +//│ = '1' +//│ res +//│ = '1, 2' +//│ res +//│ = '1, 2, 3' +//│ res +//│ = '1, 2, 3, 4' +//│ res +//│ = '1, 2, 3, 4, 5' + + +fun (:-) listExclude(xs, x) = + if xs is + Nil then Nil + Cons(x', xs') and + x === x' then xs' :- x + else x' :: (xs' :- x) +//│ fun (:-) listExclude: forall 'A. (Cons['A] | Nil, Eql['A]) -> (Nil | List['A]) + +(Nil :- 0).join(", ") +((0 :: Nil) :- 0).join(", ") +((1 :: Nil) :- 0).join(", ") +((1 :: (2 :: Nil)) :- 0).join(", ") +//│ Str +//│ res +//│ = '' +//│ res +//│ = '' +//│ res +//│ = '1' +//│ res +//│ = '1, 2' + + +("x" :: Nil).join(", ") +//│ Str +//│ res +//│ = 'x' + + diff --git a/shared/src/test/diff/nu/repro0.mls b/shared/src/test/diff/nu/repro0.mls index 15a4cb739..b9f0b47ce 100644 --- a/shared/src/test/diff/nu/repro0.mls +++ b/shared/src/test/diff/nu/repro0.mls @@ -2,7 +2,7 @@ :NoJS -class Add[E](lhs: E) +class Add[E](val lhs: E) val add11 = Add(add11) module EvalAddLit { fun eval(e: Add['A]) = @@ -10,14 +10,13 @@ module EvalAddLit { } let res = EvalAddLit.eval(add11) //│ class Add[E](lhs: E) -//│ let add11: 'E +//│ val add11: 'E //│ module EvalAddLit { -//│ fun eval: forall 'lhs 'A. (e: 'lhs) -> nothing +//│ fun eval: forall 'A. (e: Add['A]) -> nothing //│ } //│ let res: nothing //│ where -//│ 'lhs <: Add['A] -//│ 'A <: 'lhs +//│ 'A <: Add['A] //│ 'E :> Add['E] diff --git a/shared/src/test/diff/nu/repro1.mls b/shared/src/test/diff/nu/repro1.mls index b7f0f9a1d..09c7cb832 100644 --- a/shared/src/test/diff/nu/repro1.mls +++ b/shared/src/test/diff/nu/repro1.mls @@ -2,7 +2,7 @@ :NoJS -class Union[out Region](a: Region) +class Union[out Region](val a: Region) // class Union[Region](a: Region) //│ class Union[Region](a: Region) diff --git a/shared/src/test/diff/nu/repro_EvalNegNeg.mls b/shared/src/test/diff/nu/repro_EvalNegNeg.mls index 50eee1b07..99f982406 100644 --- a/shared/src/test/diff/nu/repro_EvalNegNeg.mls +++ b/shared/src/test/diff/nu/repro_EvalNegNeg.mls @@ -37,9 +37,9 @@ fun mk(n) = if n is 0 then Lit(0) 1 then Neg(mk(n)) _ then Add(mk(n), mk(n)) -//│ fun mk: forall 'E. Object -> 'E +//│ fun mk: forall 'a. Object -> (Lit | 'a) //│ where -//│ 'E :> Add['E] | Lit | Neg['E] +//│ 'a :> Neg[Lit | 'a] | Add[Lit | 'a] :stats TestLang.eval(mk(0)) diff --git a/shared/src/test/diff/nu/repro_PolymorphicVariants.mls b/shared/src/test/diff/nu/repro_PolymorphicVariants.mls index 58f555fc3..461bada4e 100644 --- a/shared/src/test/diff/nu/repro_PolymorphicVariants.mls +++ b/shared/src/test/diff/nu/repro_PolymorphicVariants.mls @@ -15,7 +15,7 @@ class App[A](s: A, t: A) fun eval(sub, v) = if v is Abs(x, t) then - eval(Cons((error, error), Nil), error) + eval(Cons([error, error], Nil), error) eval(Cons(error, sub), error) error //│ fun eval: (Cons[anything] | Nil, Abs[anything]) -> nothing @@ -24,12 +24,12 @@ mixin EvalLambda { fun eval(sub, v) = if v is Abs(x, t) then - this.eval(Cons((error, error), Nil), error) - this.eval(Cons((x, error), sub), error) + this.eval(Cons([error, error], Nil), error) + this.eval(Cons([x, error], sub), error) error } //│ mixin EvalLambda() { -//│ this: {eval: (Cons[[string, nothing] | 'A], nothing) -> anything} +//│ this: {eval: (Cons[[string, nothing] | 'A], nothing) -> ()} //│ fun eval: (Cons['A] | Nil, Abs[anything]) -> nothing //│ } diff --git a/shared/src/test/diff/parser/Arrays.mls b/shared/src/test/diff/parser/Arrays.mls index e7c41dbdd..56248ffb8 100644 --- a/shared/src/test/diff/parser/Arrays.mls +++ b/shared/src/test/diff/parser/Arrays.mls @@ -3,23 +3,23 @@ [] //│ |[||]| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {[]} [1] //│ |[|1|]| -//│ Parsed: {'(' [1,] ')'} +//│ Parsed: {[1,]} [1,] //│ |[|1|,|]| -//│ Parsed: {'(' [1,] ')'} +//│ Parsed: {[1,]} [1, 2, 3] //│ |[|1|,| |2|,| |3|]| -//│ Parsed: {'(' [1, 2, 3,] ')'} +//│ Parsed: {[1, 2, 3,]} () //│ |(||)| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {undefined} (1) //│ |(|1|)| @@ -31,7 +31,10 @@ (1, 2, 3) //│ |(|1|,| |2|,| |3|)| -//│ Parsed: {'(' [1, 2, 3,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.32: (1, 2, 3) +//│ ╙── ^^^^^^^^^ +//│ Parsed: {[1, 2, 3,]} 1 @@ -41,14 +44,14 @@ 1, //│ |1|,| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead -//│ ║ l.41: 1, +//│ ║ l.44: 1, //│ ╙── ^ //│ Parsed: {1} 1, 2, 3 //│ |1|,| |2|,| |3| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead -//│ ║ l.48: 1, 2, 3 +//│ ║ l.51: 1, 2, 3 //│ ╙── ^ //│ Parsed: {1} @@ -71,42 +74,42 @@ f of let arr = [] //│ |#let| |arr| |#=| |[||]| -//│ Parsed: {let arr = '(' [] ')'} +//│ Parsed: {let arr = []} let arr = [ ] //│ |#let| |arr| |#=| |[|↵|]| -//│ Parsed: {let arr = '(' [] ')'} +//│ Parsed: {let arr = []} let arr = [ ] //│ |#let| |arr| |#=|↵|[|↵|]| //│ ╔══[PARSE ERROR] Unexpected newline in expression position -//│ ║ l.81: let arr = +//│ ║ l.84: let arr = //│ ║ ^ -//│ ║ l.82: [ +//│ ║ l.85: [ //│ ╙── -//│ Parsed: {let arr = '(' [] ')'} +//│ Parsed: {let arr = []} let arr = [ 1 ] //│ |#let| |arr| |#=| |[|→|1|←|↵|]| -//│ Parsed: {let arr = '(' [1,] ')'} +//│ Parsed: {let arr = [1,]} let arr = [ 1, 2 ] //│ |#let| |arr| |#=| |[|→|1|,| |2|←|↵|]| -//│ Parsed: {let arr = '(' [1, 2,] ')'} +//│ Parsed: {let arr = [1, 2,]} let arr = [ 1, 2 ] //│ |#let| |arr| |#=| |[|→|1|,|↵|2|←|↵|]| -//│ Parsed: {let arr = '(' [1, 2,] ')'} +//│ Parsed: {let arr = [1, 2,]} // :pe f [1, 2, 3] @@ -115,10 +118,10 @@ f [1, 2, 3] f([1, 2, 3]) //│ |f|(|[|1|,| |2|,| |3|]|)| -//│ Parsed: {f('(' [1, 2, 3,] ')',)} +//│ Parsed: {f([1, 2, 3,],)} f of [1, 2, 3] //│ |f| |#of| |[|1|,| |2|,| |3|]| -//│ Parsed: {f('(' [1, 2, 3,] ')',)} +//│ Parsed: {f([1, 2, 3,],)} diff --git a/shared/src/test/diff/parser/BasicSyntax.mls b/shared/src/test/diff/parser/BasicSyntax.mls index 7e3b3b0f9..3b2d1c466 100644 --- a/shared/src/test/diff/parser/BasicSyntax.mls +++ b/shared/src/test/diff/parser/BasicSyntax.mls @@ -13,7 +13,7 @@ f 1 () //│ |(||)| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {undefined} f() //│ |f|(||)| @@ -180,7 +180,10 @@ foo foo of (1, 2, 3) //│ |foo|→|#of| |(|1|,| |2|,| |3|)|←| -//│ Parsed: {foo('(' [1, 2, 3,] ')',)} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.181: of (1, 2, 3) +//│ ╙── ^^^^^^^^^ +//│ Parsed: {foo([1, 2, 3,],)} foo of @@ -226,28 +229,28 @@ foo (1 //│ ╔══[PARSE ERROR] Unmatched opening parenthesis -//│ ║ l.227: (1 +//│ ║ l.230: (1 //│ ╙── ^ //│ |1| //│ Parsed: {1} (1)) //│ ╔══[PARSE ERROR] Unexpected closing parenthesis -//│ ║ l.234: (1)) +//│ ║ l.237: (1)) //│ ╙── ^ //│ |(|1|)| //│ Parsed: {'(' 1 ')'} ( //│ ╔══[PARSE ERROR] Unmatched opening parenthesis -//│ ║ l.241: ( +//│ ║ l.244: ( //│ ╙── ^ //│ || //│ Parsed: {} ) //│ ╔══[PARSE ERROR] Unexpected closing parenthesis -//│ ║ l.248: ) +//│ ║ l.251: ) //│ ╙── ^ //│ || //│ Parsed: {} @@ -255,17 +258,17 @@ foo 1+ //│ |1|+| //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.255: 1+ +//│ ║ l.258: 1+ //│ ╙── ^ //│ Parsed: {+(1,)(undefined,)} * //│ |*| //│ ╔══[PARSE ERROR] Unexpected operator in expression position -//│ ║ l.262: * +//│ ║ l.265: * //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.262: * +//│ ║ l.265: * //│ ╙── ^ //│ Parsed: {undefined} @@ -273,7 +276,7 @@ foo f 1 //│ |f| |1| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.273: f 1 +//│ ║ l.276: f 1 //│ ╙── ^^^ //│ Parsed: {f(1,)} @@ -289,7 +292,7 @@ f (1) f 1, 2, 3 //│ |f| |1|,| |2|,| |3| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.289: f 1, 2, 3 +//│ ║ l.292: f 1, 2, 3 //│ ╙── ^^^^^^^^^ //│ Parsed: {f(1, 2, 3,)} @@ -317,21 +320,21 @@ f[1, 2, 3] f{} //│ |f|{||}| //│ ╔══[PARSE ERROR] Expected end of input; found curly brace section instead -//│ ║ l.317: f{} +//│ ║ l.320: f{} //│ ╙── ^^ //│ Parsed: {f} f{1} //│ |f|{|1|}| //│ ╔══[PARSE ERROR] Expected end of input; found curly brace section instead -//│ ║ l.324: f{1} +//│ ║ l.327: f{1} //│ ╙── ^^^ //│ Parsed: {f} f{1, 2, 3} //│ |f|{|1|,| |2|,| |3|}| //│ ╔══[PARSE ERROR] Expected end of input; found curly brace section instead -//│ ║ l.331: f{1, 2, 3} +//│ ║ l.334: f{1, 2, 3} //│ ╙── ^^^^^^^^^ //│ Parsed: {f} @@ -339,10 +342,10 @@ f{1, 2, 3} f 1,, 2 //│ |f| |1|,|,| |2| //│ ╔══[PARSE ERROR] Unexpected comma in expression position -//│ ║ l.339: f 1,, 2 +//│ ║ l.342: f 1,, 2 //│ ╙── ^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.339: f 1,, 2 +//│ ║ l.342: f 1,, 2 //│ ╙── ^^^^^^^ //│ Parsed: {f(1, 2,)} @@ -354,10 +357,10 @@ f of x f g x //│ |f| |g| |x| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.354: f g x +//│ ║ l.357: f g x //│ ╙── ^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.354: f g x +//│ ║ l.357: f g x //│ ╙── ^^^^^ //│ Parsed: {f(g(x,),)} @@ -368,7 +371,7 @@ f of g of x f of of g //│ |f| |#of| |#of| |g| //│ ╔══[PARSE ERROR] Unexpected 'of' keyword in expression position -//│ ║ l.368: f of of g +//│ ║ l.371: f of of g //│ ╙── ^^ //│ Parsed: {f(g,)} @@ -376,52 +379,52 @@ f of of g f x: 1 //│ |f| |x|#:| |1| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.376: f x: 1 +//│ ║ l.379: f x: 1 //│ ╙── ^^^^^^ //│ Parsed: {f(x: 1,)} f x: 1, //│ |f| |x|#:| |1|,| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.383: f x: 1, +//│ ║ l.386: f x: 1, //│ ╙── ^^^^^^ //│ Parsed: {f(x: 1,)} f x : 1 //│ |f| |x| |#:| |1| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.390: f x : 1 +//│ ║ l.393: f x : 1 //│ ╙── ^^^ //│ Parsed: {f(x : 1,)} f x: 1, y: 2 //│ |f| |x|#:| |1|,| |y|#:| |2| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.397: f x: 1, y: 2 +//│ ║ l.400: f x: 1, y: 2 //│ ╙── ^^^^^^^^^^^^ //│ Parsed: {f(x: 1, y: 2,)} f x : 1, y: 2 //│ |f| |x| |#:| |1|,| |y|#:| |2| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.404: f x : 1, y: 2 +//│ ║ l.407: f x : 1, y: 2 //│ ╙── ^^^^^^^^^^^^^ //│ Parsed: {f(x : 1, y: 2,)} f x: 1, y: 2, z: 3 //│ |f| |x|#:| |1|,| |y|#:| |2|,| |z|#:| |3| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.411: f x: 1, y: 2, z: 3 +//│ ║ l.414: f x: 1, y: 2, z: 3 //│ ╙── ^^^^^^^^^^^^^^^^^^ //│ Parsed: {f(x: 1, y: 2, z: 3,)} f x: 1, y: g 2, z: 3 //│ |f| |x|#:| |1|,| |y|#:| |g| |2|,| |z|#:| |3| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.418: f x: 1, y: g 2, z: 3 +//│ ║ l.421: f x: 1, y: g 2, z: 3 //│ ╙── ^^^^^^^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.418: f x: 1, y: g 2, z: 3 +//│ ║ l.421: f x: 1, y: g 2, z: 3 //│ ╙── ^^^^^^^^^^^^^^^^^^^^ //│ Parsed: {f(x: 1, y: g(2, z: 3,),)} @@ -436,10 +439,10 @@ f(x: 1, y: g(2), z: 3) f x: 1, y: g 2, z: 3 //│ |f| |x|#:| |1|,| |y|#:| |g| |2|,| |z|#:| |3| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.436: f x: 1, y: g 2, z: 3 +//│ ║ l.439: f x: 1, y: g 2, z: 3 //│ ╙── ^^^^^^^^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.436: f x: 1, y: g 2, z: 3 +//│ ║ l.439: f x: 1, y: g 2, z: 3 //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^ //│ Parsed: {f(x: 1, y: g(2, z: 3,),)} @@ -450,13 +453,13 @@ f of x: 1, y: g of 2, z: 3 f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 //│ |f| |x|#:| |1| |+| |1|,| |y|#:| |2| |2|,| |z|#:| |3| |+| |2| |4| |-| |1| //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.450: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 +//│ ║ l.453: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 //│ ╙── ^^^^^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.450: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 +//│ ║ l.453: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.450: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 +//│ ║ l.453: f x: 1 + 1, y: 2 2, z: 3 + 2 4 - 1 //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ Parsed: {f(x: +(1,)(1,), y: 2(2, z: +(3,)(2(-(4,)(1,),),),),)} @@ -468,10 +471,10 @@ x.y .y //│ |.y| //│ ╔══[PARSE ERROR] Unexpected selector in expression position -//│ ║ l.468: .y +//│ ║ l.471: .y //│ ╙── ^^ //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here -//│ ║ l.468: .y +//│ ║ l.471: .y //│ ╙── ^ //│ Parsed: {undefined} diff --git a/shared/src/test/diff/parser/Blocks.mls b/shared/src/test/diff/parser/Blocks.mls index ee3801c4f..1f1dd0ef6 100644 --- a/shared/src/test/diff/parser/Blocks.mls +++ b/shared/src/test/diff/parser/Blocks.mls @@ -164,3 +164,28 @@ fun foo = //│ Parsed: {fun foo = {fun local = (x,) => {class Foo {fun bar = +(x,)(1,)}; (Foo()).bar}; print(+(local(0,),)(local(1,),),); print(+('(' local(0,) ')',)(local(1,),),); fun tmp = 1; print(local(+(0,)(local(1,),),),); fun tmp = 2}} + +log(1); log(a) +//│ |log|(|1|)|;| |log|(|a|)| +//│ Parsed: {{log(1,); log(a,)}} + +constructor(){ + a = 1 + a = 2 +} +//│ |#constructor|(||)|{|→|a| |#=| |1|↵|a| |#=| |2|←|↵|}| +//│ Parsed: {constructor() {a = 1; a = 2}} + +a = 1; log(a) +//│ |a| |#=| |1|;| |log|(|a|)| +//│ Parsed: {a = {1; log(a,)}} + +:pe +f(a) = 1 +//│ |f|(|a|)| |#=| |1| +//│ ╔══[PARSE ERROR] Expected end of input; found '=' instead +//│ ║ l.184: f(a) = 1 +//│ ╙── ^ +//│ Parsed: {f(a,)} + + diff --git a/shared/src/test/diff/parser/Brackets.mls b/shared/src/test/diff/parser/Brackets.mls index a6df1948f..b12bb2610 100644 --- a/shared/src/test/diff/parser/Brackets.mls +++ b/shared/src/test/diff/parser/Brackets.mls @@ -1,11 +1,11 @@ () //│ |(||)| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {undefined} [] //│ |[||]| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {[]} {} //│ |{||}| @@ -20,11 +20,11 @@ //│ ║ l.15: (} //│ ╙── ^ //│ |(||)| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {undefined} (([{}])) //│ |(|(|[|{||}|]|)|)| -//│ Parsed: {'(' '(' '(' ['{' {} '}',] ')' ')' ')'} +//│ Parsed: {'(' '(' ['{' {} '}',] ')' ')'} :pe (([{})]) @@ -41,10 +41,10 @@ //│ ║ l.30: (([{})]) //│ ╙── ^ //│ |(|(|[|{||}|]|)|)| -//│ Parsed: {'(' '(' '(' ['{' {} '}',] ')' ')' ')'} +//│ Parsed: {'(' '(' ['{' {} '}',] ')' ')'} fun f = () //│ |#fun| |f| |#=| |(||)| -//│ Parsed: {fun f = '(' [] ')'} +//│ Parsed: {fun f = undefined} diff --git a/shared/src/test/diff/parser/ControversialIfSplits.mls b/shared/src/test/diff/parser/ControversialIfSplits.mls index e3c82524c..3be9c4973 100644 --- a/shared/src/test/diff/parser/ControversialIfSplits.mls +++ b/shared/src/test/diff/parser/ControversialIfSplits.mls @@ -8,12 +8,12 @@ if f of //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here //│ ║ l.5: 0 then "ok" //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead //│ ║ l.4: if f of //│ ║ ^^^^ //│ ║ l.5: 0 then "ok" //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.4: if f of //│ ╙── ^^ //│ Parsed: {if (f(0,)) then undefined} @@ -26,7 +26,7 @@ if f ( //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here //│ ║ l.22: 0 then "ok" //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead //│ ║ l.21: if f ( //│ ║ ^^^ //│ ║ l.22: 0 then "ok" @@ -35,7 +35,7 @@ if f ( //│ ║ ^^^^^^^^^^^^^ //│ ║ l.24: ) //│ ║ ^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.21: if f ( //│ ╙── ^^ //│ Parsed: {if (f(0,)) then undefined} @@ -48,12 +48,12 @@ if f of //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here //│ ║ l.44: 0 then "ok" //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead //│ ║ l.43: if f of //│ ║ ^^^^ //│ ║ l.44: 0 then "ok" //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.43: if f of //│ ╙── ^^ //│ Parsed: {if (f(0,)) then undefined} @@ -65,12 +65,12 @@ if f of //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here //│ ║ l.62: 0 is 0 then "ok" //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead //│ ║ l.61: if f of //│ ║ ^^^^ //│ ║ l.62: 0 is 0 then "ok" //│ ║ ^^^^^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.61: if f of //│ ╙── ^^ //│ Parsed: {if (f(is(0,)(0,),)) then undefined} diff --git a/shared/src/test/diff/parser/Forall.mls b/shared/src/test/diff/parser/Forall.mls index 9cf0e0445..c6296bf9a 100644 --- a/shared/src/test/diff/parser/Forall.mls +++ b/shared/src/test/diff/parser/Forall.mls @@ -1,17 +1,17 @@ -forall 'a; 'a => 'a -//│ |#forall| |'a|#;| |'a| |=>| |'a| +forall 'a: 'a => 'a +//│ |#forall| |'a|#:| |'a| |#=>| |'a| //│ Parsed: {forall 'a. ('a,) => 'a} -forall 'a, 'b; ('a, 'b) => ('b, 'a) -//│ |#forall| |'a|,| |'b|#;| |(|'a|,| |'b|)| |=>| |(|'b|,| |'a|)| -//│ Parsed: {forall 'a, 'b. ('a, 'b,) => '(' ['b, 'a,] ')'} +forall 'a, 'b: ['a, 'b] => ['b, 'a] +//│ |#forall| |'a|,| |'b|#:| |[|'a|,| |'b|]| |#=>| |[|'b|,| |'a|]| +//│ Parsed: {forall 'a, 'b. (['a, 'b,],) => ['b, 'a,]} -fun f: forall 'a; 'a => 'a -//│ |#fun| |f|#:| |#forall| |'a|#;| |'a| |=>| |'a| +fun f: forall 'a: 'a => 'a +//│ |#fun| |f|#:| |#forall| |'a|#:| |'a| |#=>| |'a| //│ Parsed: {fun f: forall 'a. 'a -> 'a} -fun f: forall 'a, 'b; ('a, 'b) => ('b, 'a) -//│ |#fun| |f|#:| |#forall| |'a|,| |'b|#;| |(|'a|,| |'b|)| |=>| |(|'b|,| |'a|)| -//│ Parsed: {fun f: forall 'a 'b. ('a, 'b) -> ['b, 'a]} +fun f: forall 'a, 'b: ['a, 'b] => ['b, 'a] +//│ |#fun| |f|#:| |#forall| |'a|,| |'b|#:| |[|'a|,| |'b|]| |#=>| |[|'b|,| |'a|]| +//│ Parsed: {fun f: forall 'a 'b. (['a, 'b]) -> ['b, 'a]} diff --git a/shared/src/test/diff/parser/Fun.mls b/shared/src/test/diff/parser/Fun.mls index c1a3f2180..4f1dae5e9 100644 --- a/shared/src/test/diff/parser/Fun.mls +++ b/shared/src/test/diff/parser/Fun.mls @@ -17,13 +17,13 @@ fun f x = x //│ Parsed: {fun f = x} fun f = x => x -//│ |#fun| |f| |#=| |x| |=>| |x| +//│ |#fun| |f| |#=| |x| |#=>| |x| //│ Parsed: {fun f = (x,) => x} // TODO fun x => x -//│ |#fun| |x| |=>| |x| -//│ ╔══[PARSE ERROR] Expected function parameter list; found operator instead +//│ |#fun| |x| |#=>| |x| +//│ ╔══[PARSE ERROR] Expected function parameter list; found '=>' instead //│ ║ l.24: fun x => x //│ ╙── ^^ //│ ╔══[PARSE ERROR] Expected ':' or '=' followed by a function body or signature; found identifier instead @@ -32,12 +32,12 @@ fun x => x //│ Parsed: {fun x = undefined} let f = x => x -//│ |#let| |f| |#=| |x| |=>| |x| +//│ |#let| |f| |#=| |x| |#=>| |x| //│ Parsed: {let f = (x,) => x} // TODO let f = fun x => x -//│ |#let| |f| |#=| |#fun| |x| |=>| |x| +//│ |#let| |f| |#=| |#fun| |x| |#=>| |x| //│ ╔══[PARSE ERROR] Unexpected 'fun' keyword in expression position //│ ║ l.39: let f = fun x => x //│ ╙── ^^^ @@ -182,13 +182,13 @@ fun add(x: number, y: number): number //│ Parsed: {fun add: (x: number, y: number) -> number} fun apply(x: int, f: int => int): int -//│ |#fun| |apply|(|x|#:| |int|,| |f|#:| |int| |=>| |int|)|#:| |int| +//│ |#fun| |apply|(|x|#:| |int|,| |f|#:| |int| |#=>| |int|)|#:| |int| //│ Parsed: {fun apply: (x: int, f: int -> int) -> int} fun apply2(x: number, f: int => number => number): number -//│ |#fun| |apply2|(|x|#:| |number|,| |f|#:| |int| |=>| |number| |=>| |number|)|#:| |number| +//│ |#fun| |apply2|(|x|#:| |number|,| |f|#:| |int| |#=>| |number| |#=>| |number|)|#:| |number| //│ Parsed: {fun apply2: (x: number, f: int -> number -> number) -> number} fun apply3(x: number, f: (int => number) => number): number -//│ |#fun| |apply3|(|x|#:| |number|,| |f|#:| |(|int| |=>| |number|)| |=>| |number|)|#:| |number| +//│ |#fun| |apply3|(|x|#:| |number|,| |f|#:| |(|int| |#=>| |number|)| |#=>| |number|)|#:| |number| //│ Parsed: {fun apply3: (x: number, f: (int -> number) -> number) -> number} diff --git a/shared/src/test/diff/parser/IfThenElse.mls b/shared/src/test/diff/parser/IfThenElse.mls index 79d96cec6..606640c2f 100644 --- a/shared/src/test/diff/parser/IfThenElse.mls +++ b/shared/src/test/diff/parser/IfThenElse.mls @@ -192,10 +192,10 @@ a == 1 and b == 2 :pe if lol //│ |#if| |lol| -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found reference instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found reference instead //│ ║ l.193: if lol //│ ║ ^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.193: if lol //│ ╙── ^^ //│ Parsed: {if (lol) then undefined} @@ -248,10 +248,10 @@ else :pe if lol else 2 //│ |#if| |lol| |#else| |2| -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found reference followed by 'else' keyword instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found reference followed by 'else' keyword instead //│ ║ l.249: if lol else 2 //│ ║ ^^^^^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.249: if lol else 2 //│ ╙── ^^ //│ ╔══[PARSE ERROR] Expected end of input; found 'else' keyword instead @@ -405,10 +405,10 @@ if let Some(x) = v then 123 //│ ╔══[PARSE ERROR] Expected an expression; found a 'then'/'else' clause instead //│ ║ l.397: if let Some(x) = v then 123 //│ ╙── ^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found let binding instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found let binding instead //│ ║ l.397: if let Some(x) = v then 123 //│ ║ ^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.397: if let Some(x) = v then 123 //│ ╙── ^^ //│ Parsed: {if (let Some = undefined in undefined) then undefined} @@ -426,10 +426,10 @@ if let Some(x) = v and cond then 123 //│ ╔══[PARSE ERROR] Expected an expression; found a 'then'/'else' clause instead //│ ║ l.418: if let Some(x) = v and cond then 123 //│ ╙── ^^^^^^^^^^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found let binding instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found let binding instead //│ ║ l.418: if let Some(x) = v and cond then 123 //│ ║ ^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.418: if let Some(x) = v and cond then 123 //│ ╙── ^^ //│ Parsed: {if (let Some = undefined in undefined) then undefined} @@ -531,10 +531,10 @@ if true :pe (if true) //│ |(|#if| |true|)| -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found reference instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found reference instead //│ ║ l.532: (if true) //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.532: (if true) //│ ╙── ^^ //│ Parsed: {'(' if (true) then undefined ')'} @@ -547,21 +547,32 @@ if true //│ ╙── ^ //│ Parsed: {'(' if (true) then undefined ')'} +:pe if true then; -//│ |#if| |true| |#then|#;| +//│ |#if| |true| |#then|;| +//│ ╔══[PARSE ERROR] Unexpected operator in expression position +//│ ║ l.551: if true then; +//│ ╙── ^ +//│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here +//│ ║ l.551: if true then; +//│ ╙── ^ +//│ Parsed: {if (true) then undefined} + +if true then;; +//│ |#if| |true| |#then|#;;| //│ Parsed: {if (true) then undefined} :pe -if true then; else; -//│ |#if| |true| |#then|#;| |#else|#;| +if true then;; else;; +//│ |#if| |true| |#then|#;;| |#else|#;;| //│ ╔══[PARSE ERROR] Unexpected 'then'/'else' clause -//│ ║ l.555: if true then; else; -//│ ╙── ^^^^ +//│ ║ l.566: if true then;; else;; +//│ ╙── ^^^^^^ //│ Parsed: {if (true) then undefined; undefined} -if true then () else; -//│ |#if| |true| |#then| |(||)| |#else|#;| -//│ Parsed: {if (true) then '(' [] ')' else undefined} +if true then () else;; +//│ |#if| |true| |#then| |(||)| |#else|#;;| +//│ Parsed: {if (true) then undefined else undefined} diff --git a/shared/src/test/diff/parser/Lambdas.mls b/shared/src/test/diff/parser/Lambdas.mls index b0de021f2..74771e5cb 100644 --- a/shared/src/test/diff/parser/Lambdas.mls +++ b/shared/src/test/diff/parser/Lambdas.mls @@ -2,17 +2,17 @@ x => x -//│ |x| |=>| |x| +//│ |x| |#=>| |x| //│ Parsed: {(x,) => x} (x) => x -//│ |(|x|)| |=>| |x| +//│ |(|x|)| |#=>| |x| //│ Parsed: {('(' x ')',) => x} // TODO fun x => x -//│ |#fun| |x| |=>| |x| -//│ ╔══[PARSE ERROR] Expected function parameter list; found operator instead +//│ |#fun| |x| |#=>| |x| +//│ ╔══[PARSE ERROR] Expected function parameter list; found '=>' instead //│ ║ l.13: fun x => x //│ ╙── ^^ //│ ╔══[PARSE ERROR] Expected ':' or '=' followed by a function body or signature; found identifier instead @@ -22,7 +22,7 @@ fun x => x // TODO let f = fun x => x -//│ |#let| |f| |#=| |#fun| |x| |=>| |x| +//│ |#let| |f| |#=| |#fun| |x| |#=>| |x| //│ ╔══[PARSE ERROR] Unexpected 'fun' keyword in expression position //│ ║ l.24: let f = fun x => x //│ ╙── ^^^ @@ -38,26 +38,26 @@ fun f x = x (x, y) => x -//│ |(|x|,| |y|)| |=>| |x| +//│ |(|x|,| |y|)| |#=>| |x| //│ Parsed: {(x, y,) => x} => 1 -//│ |=>| |1| -//│ ╔══[PARSE ERROR] Unexpected operator in expression position +//│ |#=>| |1| +//│ ╔══[PARSE ERROR] Unexpected '=>' in expression position //│ ║ l.45: => 1 //│ ╙── ^^ //│ Parsed: {1} x => -//│ |x| |=>| +//│ |x| |#=>| //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here //│ ║ l.52: x => //│ ╙── ^ //│ Parsed: {(x,) => undefined} (x =>) -//│ |(|x| |=>|)| +//│ |(|x| |#=>|)| //│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here //│ ║ l.59: (x =>) //│ ╙── ^ @@ -68,48 +68,48 @@ a --> b --> c //│ Parsed: {-->(a,)(-->(b,)(c,),)} a => b => c -//│ |a| |=>| |b| |=>| |c| +//│ |a| |#=>| |b| |#=>| |c| //│ Parsed: {(a,) => (b,) => c} (a => b) => c -//│ |(|a| |=>| |b|)| |=>| |c| +//│ |(|a| |#=>| |b|)| |#=>| |c| //│ Parsed: {('(' (a,) => b ')',) => c} a => (b => c) -//│ |a| |=>| |(|b| |=>| |c|)| +//│ |a| |#=>| |(|b| |#=>| |c|)| //│ Parsed: {(a,) => '(' (b,) => c ')'} xs.forall(x => x > 0) -//│ |xs|.forall|(|x| |=>| |x| |>| |0|)| +//│ |xs|.forall|(|x| |#=>| |x| |>| |0|)| //│ Parsed: {(xs).forall((x,) => >(x,)(0,),)} xs.forall of x => x > 0 -//│ |xs|.forall| |#of| |x| |=>| |x| |>| |0| +//│ |xs|.forall| |#of| |x| |#=>| |x| |>| |0| //│ Parsed: {(xs).forall((x,) => >(x,)(0,),)} :pe a => b then c -//│ |a| |=>| |b| |#then| |c| +//│ |a| |#=>| |b| |#then| |c| //│ ╔══[PARSE ERROR] Unexpected 'then'/'else' clause //│ ║ l.91: a => b then c //│ ╙── ^^^^^^^^^^^^^ //│ Parsed: {undefined} if a => b then c -//│ |#if| |a| |=>| |b| |#then| |c| +//│ |#if| |a| |#=>| |b| |#then| |c| //│ Parsed: {if ((a,) => b) then c} if xs.forall(a => b) then c -//│ |#if| |xs|.forall|(|a| |=>| |b|)| |#then| |c| +//│ |#if| |xs|.forall|(|a| |#=>| |b|)| |#then| |c| //│ Parsed: {if ((xs).forall((a,) => b,)) then c} if xs.forall of a => b then c -//│ |#if| |xs|.forall| |#of| |a| |=>| |b| |#then| |c| +//│ |#if| |xs|.forall| |#of| |a| |#=>| |b| |#then| |c| //│ Parsed: {if ((xs).forall((a,) => b,)) then c} id + of x => x + 1 -//│ |id| |+| |#of| |x| |=>| |x| |+| |1| +//│ |id| |+| |#of| |x| |#=>| |x| |+| |1| //│ ╔══[PARSE ERROR] Unexpected 'of' keyword in expression position //│ ║ l.111: id + of x => x + 1 //│ ╙── ^^ diff --git a/shared/src/test/diff/parser/Lets.mls b/shared/src/test/diff/parser/Lets.mls index a23ddda65..61d18990f 100644 --- a/shared/src/test/diff/parser/Lets.mls +++ b/shared/src/test/diff/parser/Lets.mls @@ -48,11 +48,11 @@ let in 123 //│ Parsed: {let = undefined} let x = 1; x + 1 -//│ |#let| |x| |#=| |1|#;| |x| |+| |1| -//│ Parsed: {let x = 1; +(x,)(1,)} +//│ |#let| |x| |#=| |1|;| |x| |+| |1| +//│ Parsed: {let x = {1; +(x,)(1,)}} let x = 1, y = 2; x + y -//│ |#let| |x| |#=| |1|,| |y| |#=| |2|#;| |x| |+| |y| +//│ |#let| |x| |#=| |1|,| |y| |#=| |2|;| |x| |+| |y| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead //│ ║ l.54: let x = 1, y = 2; x + y //│ ╙── ^ diff --git a/shared/src/test/diff/parser/Misc.mls b/shared/src/test/diff/parser/Misc.mls index e0dec04ce..0e20bd8aa 100644 --- a/shared/src/test/diff/parser/Misc.mls +++ b/shared/src/test/diff/parser/Misc.mls @@ -3,7 +3,7 @@ fun discard(x) = () //│ |#fun| |discard|(|x|)| |#=| |(||)| -//│ Parsed: {fun discard = (x,) => '(' [] ')'} +//│ Parsed: {fun discard = (x,) => undefined} // FIXME parses wrong: foo of @@ -21,7 +21,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.12: None then 0 //│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application followed by newline instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application followed by newline instead //│ ║ l.10: discard of if f of x is //│ ║ ^^^^^^^^^ //│ ║ l.11: Some(v) then v + 1 @@ -32,7 +32,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^ //│ ║ l.14: Some(v) then v + 1 //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.10: discard of if f of x is //│ ╙── ^^ //│ ╔══[PARSE ERROR] Unexpected comma here @@ -45,12 +45,12 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.15: None then 0, //│ ╙── ^^^^^^^^^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead //│ ║ l.13: if g of y is //│ ║ ^^^^^^^^^ //│ ║ l.14: Some(v) then v + 1 //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.13: if g of y is //│ ╙── ^^ //│ Parsed: {foo({discard(if (f(undefined,)) then undefined,); if (g(undefined,)) then undefined},)} @@ -77,7 +77,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.61: None then 0, //│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application followed by newline instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application followed by newline instead //│ ║ l.59: if f of x is //│ ║ ^^^^^^^^^ //│ ║ l.60: Some v then v + 1 @@ -92,7 +92,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.65: //│ ║ ^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.59: if f of x is //│ ╙── ^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword @@ -108,7 +108,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.64: None then 0, //│ ╙── ^^^^^^^^^^^^^^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found application followed by newline instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application followed by newline instead //│ ║ l.62: if g of y is //│ ║ ^^^^^^^^^ //│ ║ l.63: Some v then v + 1 @@ -117,7 +117,7 @@ foo of //│ ║ ^^^^^^^^^^^^^^^^^^ //│ ║ l.65: //│ ║ ^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.62: if g of y is //│ ╙── ^^ //│ Parsed: {foo({if (f(undefined,)) then undefined; if (g(undefined,)) then undefined},)} diff --git a/shared/src/test/diff/parser/NamedArrays.mls b/shared/src/test/diff/parser/NamedArrays.mls index 5feeda316..6151c63db 100644 --- a/shared/src/test/diff/parser/NamedArrays.mls +++ b/shared/src/test/diff/parser/NamedArrays.mls @@ -3,33 +3,33 @@ [] //│ |[||]| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {[]} [x: 1] //│ |[|x|#:| |1|]| -//│ Parsed: {'(' [x: 1,] ')'} +//│ Parsed: {[x: 1,]} [x : 1] //│ |[|x| |#:| |1|]| -//│ Parsed: {'(' [x : 1,] ')'} +//│ Parsed: {[x : 1,]} [x: 1,] //│ |[|x|#:| |1|,|]| -//│ Parsed: {'(' [x: 1,] ')'} +//│ Parsed: {[x: 1,]} [x: 1, y:] //│ |[|x|#:| |1|,| |y|#:|]| //│ ╔══[PARSE ERROR] Unexpected end of square bracket section; an expression was expected here //│ ║ l.20: [x: 1, y:] //│ ╙── ^ -//│ Parsed: {'(' [x: 1, y: undefined,] ')'} +//│ Parsed: {[x: 1, y: undefined,]} [x:, y: 1] //│ |[|x|#:|,| |y|#:| |1|]| //│ ╔══[PARSE ERROR] Unexpected comma in expression position //│ ║ l.27: [x:, y: 1] //│ ╙── ^ -//│ Parsed: {'(' [x: y : 1,] ')'} +//│ Parsed: {[x: y : 1,]} [x:, y:] //│ |[|x|#:|,| |y|#:|]| @@ -39,50 +39,68 @@ //│ ╔══[PARSE ERROR] Unexpected end of square bracket section; an expression was expected here //│ ║ l.34: [x:, y:] //│ ╙── ^ -//│ Parsed: {'(' [x: y : undefined,] ')'} +//│ Parsed: {[x: y : (),]} [x: 1, 2, 3] //│ |[|x|#:| |1|,| |2|,| |3|]| -//│ Parsed: {'(' [x: 1, 2, 3,] ')'} +//│ Parsed: {[x: 1, 2, 3,]} [1, y: 2, 3] //│ |[|1|,| |y|#:| |2|,| |3|]| -//│ Parsed: {'(' [1, y: 2, 3,] ')'} +//│ Parsed: {[1, y: 2, 3,]} [x: 1, y: 2, z: 3] //│ |[|x|#:| |1|,| |y|#:| |2|,| |z|#:| |3|]| -//│ Parsed: {'(' [x: 1, y: 2, z: 3,] ')'} +//│ Parsed: {[x: 1, y: 2, z: 3,]} () //│ |(||)| -//│ Parsed: {'(' [] ')'} +//│ Parsed: {undefined} (x: 1) //│ |(|x|#:| |1|)| -//│ Parsed: {'(' [x: 1,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.60: (x: 1) +//│ ╙── ^^^^^^ +//│ Parsed: {[x: 1,]} (x:) //│ |(|x|#:|)| //│ ╔══[PARSE ERROR] Unexpected end of parenthesis section; an expression was expected here -//│ ║ l.64: (x:) +//│ ║ l.67: (x:) //│ ╙── ^ -//│ Parsed: {'(' [x: undefined,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.67: (x:) +//│ ╙── ^^^^ +//│ Parsed: {[x: undefined,]} (x: 1,) //│ |(|x|#:| |1|,|)| -//│ Parsed: {'(' [x: 1,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.77: (x: 1,) +//│ ╙── ^^^^^^^ +//│ Parsed: {[x: 1,]} (x: 1, 2, 3) //│ |(|x|#:| |1|,| |2|,| |3|)| -//│ Parsed: {'(' [x: 1, 2, 3,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.84: (x: 1, 2, 3) +//│ ╙── ^^^^^^^^^^^^ +//│ Parsed: {[x: 1, 2, 3,]} (1, y: 2, 3) //│ |(|1|,| |y|#:| |2|,| |3|)| -//│ Parsed: {'(' [1, y: 2, 3,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.91: (1, y: 2, 3) +//│ ╙── ^^^^^^^^^^^^ +//│ Parsed: {[1, y: 2, 3,]} (x: 1, y: 2, z: 3) //│ |(|x|#:| |1|,| |y|#:| |2|,| |z|#:| |3|)| -//│ Parsed: {'(' [x: 1, y: 2, z: 3,] ')'} +//│ ╔══[PARSE ERROR] Expected '=>' or '->' after this parameter section +//│ ║ l.98: (x: 1, y: 2, z: 3) +//│ ╙── ^^^^^^^^^^^^^^^^^^ +//│ Parsed: {[x: 1, y: 2, z: 3,]} 1 @@ -96,21 +114,21 @@ x: 1 1, //│ |1|,| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead -//│ ║ l.96: 1, -//│ ╙── ^ +//│ ║ l.114: 1, +//│ ╙── ^ //│ Parsed: {1} x: 1, //│ |x|#:| |1|,| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead -//│ ║ l.103: x: 1, +//│ ║ l.121: x: 1, //│ ╙── ^ //│ Parsed: {x : 1} 1, 2, 3 //│ |1|,| |2|,| |3| //│ ╔══[PARSE ERROR] Expected end of input; found comma instead -//│ ║ l.110: 1, 2, 3 +//│ ║ l.128: 1, 2, 3 //│ ╙── ^ //│ Parsed: {1} @@ -144,10 +162,10 @@ f of z: 3 //│ |f| |#of|→|x|#:| |1|↵|y|#:| |2|↵|z|#:| |3|←| //│ ╔══[PARSE ERROR] Unexpected named argument name here -//│ ║ l.142: x: 1 +//│ ║ l.160: x: 1 //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected named argument name here -//│ ║ l.143: y: 2 +//│ ║ l.161: y: 2 //│ ╙── ^ //│ Parsed: {f(z: {1; 2; 3},)} @@ -157,7 +175,7 @@ f of z: 3 //│ |f| |#of|→|x|#:| |1|↵|2|↵|z|#:| |3|←| //│ ╔══[PARSE ERROR] Unexpected named argument name here -//│ ║ l.155: x: 1 +//│ ║ l.173: x: 1 //│ ╙── ^ //│ Parsed: {f(z: {1; 2; 3},)} @@ -167,10 +185,10 @@ f of 3 //│ |f| |#of|→|x|#:| |1|↵|y|#:| |2|↵|3|←| //│ ╔══[PARSE ERROR] Unexpected named argument name here -//│ ║ l.165: x: 1 +//│ ║ l.183: x: 1 //│ ╙── ^ //│ ╔══[PARSE ERROR] Unexpected named argument name here -//│ ║ l.166: y: 2 +//│ ║ l.184: y: 2 //│ ╙── ^ //│ Parsed: {f({1; 2; 3},)} diff --git a/shared/src/test/diff/parser/NegativeLits.mls b/shared/src/test/diff/parser/NegativeLits.mls index 6dbcfff44..4290b760b 100644 --- a/shared/src/test/diff/parser/NegativeLits.mls +++ b/shared/src/test/diff/parser/NegativeLits.mls @@ -2,7 +2,7 @@ :ParseOnly type MinusOne = -1 -//│ |#type| |MinusOne| |#=| |-1| +//│ |#type| |MinusOne| |#=| |-|1| //│ Parsed: {type alias MinusOne: -1 {}} fun f(x: MinusOne) = x @@ -10,5 +10,5 @@ fun f(x: MinusOne) = x //│ Parsed: {fun f = (x: MinusOne,) => x} f(-1) -//│ |f|(|-1|)| +//│ |f|(|-|1|)| //│ Parsed: {f(-1,)} diff --git a/shared/src/test/diff/parser/Subscripts.mls b/shared/src/test/diff/parser/Subscripts.mls index 21846e563..a37f7ea27 100644 --- a/shared/src/test/diff/parser/Subscripts.mls +++ b/shared/src/test/diff/parser/Subscripts.mls @@ -53,30 +53,30 @@ a + [22] [333] //│ |a| |+|→|111|→|[|22|]|←|↵|[|333|]|←| -//│ Parsed: {+(a,)({111‹22›; '(' [333,] ')'},)} +//│ Parsed: {+(a,)({111‹22›; [333,]},)} Foo(bar) + 1 [1] [2] //│ |Foo|(|bar|)| |+|→|1|→|[|1|]|←|↵|[|2|]|←| -//│ Parsed: {+(Foo(bar,),)({1‹1›; '(' [2,] ')'},)} +//│ Parsed: {+(Foo(bar,),)({1‹1›; [2,]},)} a of [333] //│ |a| |#of| |[|333|]| -//│ Parsed: {a('(' [333,] ')',)} +//│ Parsed: {a([333,],)} a of [333] //│ |a| |#of|→|[|333|]|←| -//│ Parsed: {a('(' [333,] ')',)} +//│ Parsed: {a([333,],)} a of 111 [22] [333] //│ |a| |#of|→|111|→|[|22|]|←|↵|[|333|]|←| -//│ Parsed: {a({111‹22›; '(' [333,] ')'},)} +//│ Parsed: {a({111‹22›; [333,]},)} a( 111 @@ -84,5 +84,5 @@ a( [333] ) //│ |a|(|→|111|→|[|22|]|←|↵|[|333|]|←|↵|)| -//│ Parsed: {a({111‹22›; '(' [333,] ')'},)} +//│ Parsed: {a({111‹22›; [333,]},)} diff --git a/shared/src/test/diff/parser/WeirdIfs.mls b/shared/src/test/diff/parser/WeirdIfs.mls index e2c99b339..0bfb8c315 100644 --- a/shared/src/test/diff/parser/WeirdIfs.mls +++ b/shared/src/test/diff/parser/WeirdIfs.mls @@ -17,12 +17,12 @@ if x is //│ ╔══[PARSE ERROR] Unexpected end of input; an expression was expected here //│ ║ l.12: else e //│ ╙── ^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead //│ ║ l.11: if x is //│ ║ ^^^^ //│ ║ l.12: else e //│ ║ ^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.11: if x is //│ ╙── ^^ //│ Parsed: {if (is(x,)(undefined,)) then undefined} @@ -34,12 +34,12 @@ if x is //│ ╔══[PARSE ERROR] Unexpected 'else' keyword here //│ ║ l.32: P else e //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead //│ ║ l.31: if x is //│ ║ ^^^^ //│ ║ l.32: P else e //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.31: if x is //│ ╙── ^^ //│ Parsed: {if (is(x,)({P},)) then undefined} diff --git a/shared/src/test/diff/parser/Where.mls b/shared/src/test/diff/parser/Where.mls index c4c9fabdc..43ff785a1 100644 --- a/shared/src/test/diff/parser/Where.mls +++ b/shared/src/test/diff/parser/Where.mls @@ -4,7 +4,7 @@ //│ Parsed: {+(1,)(1,) where {1}} a => a + 1 where foo -//│ |a| |=>| |a| |+| |1| |#where| |foo| +//│ |a| |#=>| |a| |+| |1| |#where| |foo| //│ Parsed: {(a,) => +(a,)(1,) where {foo}} a + 1 where let a = 1 @@ -12,7 +12,7 @@ a + 1 where let a = 1 //│ Parsed: {+(a,)(1,) where {let a = 1}} fun foo: 'a => 'a => 'a where 'a : int -//│ |#fun| |foo|#:| |'a| |=>| |'a| |=>| |'a| |#where| |'a| |#:| |int| +//│ |#fun| |foo|#:| |'a| |#=>| |'a| |#=>| |'a| |#where| |'a| |#:| |int| //│ Parsed: {fun foo: 'a -> 'a -> ('a //│ where //│ 'a <: int)} @@ -20,7 +20,7 @@ fun foo: 'a => 'a => 'a where 'a : int :e fun foo: 'a + 'a + 'a where 'a : int //│ |#fun| |foo|#:| |'a| |+| |'a| |+| |'a| |#where| |'a| |#:| |int| -//│ ╔══[ERROR] not a recognized type +//│ ╔══[ERROR] Not a recognized type //│ ║ l.21: fun foo: 'a + 'a + 'a where 'a : int //│ ╙── ^^^^^^^ //│ Parsed: {fun foo: anything} @@ -28,7 +28,7 @@ fun foo: 'a + 'a + 'a where 'a : int :e fun foo: 'a -> 'a -> 'a where 'a : int //│ |#fun| |foo|#:| |'a| |->| |'a| |->| |'a| |#where| |'a| |#:| |int| -//│ ╔══[ERROR] not a recognized type +//│ ╔══[ERROR] Not a recognized type //│ ║ l.29: fun foo: 'a -> 'a -> 'a where 'a : int //│ ╙── ^^^^^^^^^^^^^^ //│ Parsed: {fun foo: anything} diff --git a/shared/src/test/diff/scalac/i13162.mls b/shared/src/test/diff/scalac/i13162.mls new file mode 100644 index 000000000..90e605fb7 --- /dev/null +++ b/shared/src/test/diff/scalac/i13162.mls @@ -0,0 +1,131 @@ +:NewDefs + + +// https://github.com/lampepfl/dotty/issues/13162 + +fun method = + class Person(val name: Str) + module Person_ { // TODO change when module overloading is supported + val me = Person("Cameron") + } + let m = Person_.me + m +method.name +//│ fun method: Person +//│ Str +//│ res +//│ = 'Cameron' + + +// https://github.com/lampepfl/dotty/issues/13162#issuecomment-887557311 + +// * We don't currently have self bindings + +// def method(): Unit = { +// final case class Person(name: String) +// object Person { self => +// val me = self.apply("Cameron") +// } +// val _ = Person.me +// } +// method() + +:w +:e +fun method: () = + class Person(val name: Str) + module Person_ { self => // * defines a useless lambda! + val me = self.apply("Cameron") + } + let m = Person_.me + m +method +//│ ╔══[WARNING] Pure expression does nothing in statement position. +//│ ║ l.37: module Person_ { self => // * defines a useless lambda! +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.38: val me = self.apply("Cameron") +//│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ╔══[ERROR] Type `Person_` does not contain member `me` +//│ ║ l.40: let m = Person_.me +//│ ╙── ^^^ +//│ fun method: () +//│ () +//│ res +//│ = undefined + + +// https://github.com/lampepfl/dotty/issues/13162#issuecomment-888188804 + +:re +module Person { + fun f: () + fun f = Person2.f +} +module Person2 { + fun f = () + val me = Person.f +} +//│ module Person { +//│ fun f: () +//│ } +//│ module Person2 { +//│ fun f: () +//│ val me: () +//│ } +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + +fun test = Person2.me +//│ fun test: () + + +// * FIXME initialization check? or different codegen? +fun test = + module Person { + fun f: () + fun f = Person2.f + } + module Person2 { + fun f = () + val me = Person.f + } + Person2.me +//│ fun test: () + +:re +test +//│ () +//│ res +//│ Runtime error: +//│ ReferenceError: Cannot access 'Person2' before initialization + +module Test { + module Person { + fun f: () + fun f = Person2.f + } + module Person2 { + fun f = () + val me = Person.f + } + fun test = Person2.me +} +//│ module Test { +//│ module Person { +//│ fun f: () +//│ } +//│ module Person2 { +//│ fun f: () +//│ val me: () +//│ } +//│ fun test: () +//│ } + +:re +Test.test +//│ () +//│ res +//│ Runtime error: +//│ RangeError: Maximum call stack size exceeded + + diff --git a/shared/src/test/diff/tapl/NuUntyped.mls b/shared/src/test/diff/tapl/NuUntyped.mls index d9dbb5202..29ff0ec93 100644 --- a/shared/src/test/diff/tapl/NuUntyped.mls +++ b/shared/src/test/diff/tapl/NuUntyped.mls @@ -319,7 +319,7 @@ fun subst(t, n, v) = _ then Abs(Var(name), subst(body, n, v)) App(lhs, rhs) then App(subst(lhs, n, v), subst(rhs, n, v)) _ then t -//│ fun subst: forall 'a. (Abs | App | Term & Object & 'a & ~#Abs & ~#App & ~#Var | Var, anything, Term & Object & 'a) -> (Abs | App | Var | 'a) +//│ fun subst: forall 'a. (Abs | App | Term & Object & 'a & ~#Abs & ~#App & ~#Var | Var, anything, Term & Object & 'a) -> ('a | Abs | App | Var) fun showSubst(t, n, v) = showTerm(t) ++ " [" ++ n ++ " / " ++ showTerm(v) ++ "]" ++ " => " ++ showTerm(subst(t, n, v)) diff --git a/shared/src/test/diff/tapl/SimplyTyped.mls b/shared/src/test/diff/tapl/SimplyTyped.mls index 18429f0a0..400be3d6e 100644 --- a/shared/src/test/diff/tapl/SimplyTyped.mls +++ b/shared/src/test/diff/tapl/SimplyTyped.mls @@ -129,16 +129,26 @@ fun find(t, k) = Empty then None() //│ empty: Empty //│ = [Function: empty] -//│ insert: ('a, string & 'key, 'value,) -> 'right +//│ insert: (Empty | Node & 'a, string & 'key, 'value,) -> (Node & {key: 'key, left: Empty | 'left, right: Empty | 'right, value: 'value} | 'b) //│ where -//│ 'right :> Node & {key: 'key, left: Empty | 'left | 'right, right: Empty | 'right | 'right0, value: 'value} -//│ 'a <: Empty | Node & {key: string & 'key, left: 'left, right: 'right0} -//│ 'right0 <: 'a -//│ 'left <: 'a +//│ 'b :> Node & { +//│ key: 'key0, +//│ left: Node & {key: 'key, left: Empty | 'left, right: Empty | 'right, value: 'value} | 'b, +//│ right: 'right, +//│ value: 'value +//│ } | Node & { +//│ key: 'key0, +//│ left: 'left, +//│ right: Node & {key: 'key, left: Empty | 'left, right: Empty | 'right, value: 'value} | 'b, +//│ value: 'value +//│ } +//│ 'a <: {key: string & 'key0, left: 'left, right: 'right} +//│ 'right <: Empty | Node & 'a +//│ 'left <: Empty | Node & 'a //│ = [Function: insert] -//│ find: ('right, string,) -> (Some & {value: 'value} | None) +//│ find: (Empty | Node & 'a, string,) -> (Some & {value: 'value} | None) //│ where -//│ 'right <: Empty | Node & {key: string, left: 'right, right: 'right, value: 'value} +//│ 'a <: {key: string, left: Empty | Node & 'a, right: Empty | Node & 'a, value: 'value} //│ = [Function: find] fun showType(ty) = @@ -146,9 +156,12 @@ fun showType(ty) = FunctionType(PrimitiveType(name), rhs) then concat3(name, " -> ", showType(rhs)) FunctionType(lhs, rhs) then concat4("(", showType(lhs), ") -> ", showType(rhs)) PrimitiveType(name) then name -//│ showType: 'lhs -> string +//│ showType: (FunctionType & 'a | PrimitiveType & {name: string}) -> string //│ where -//│ 'lhs <: FunctionType & {lhs: 'lhs & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs} | PrimitiveType & {name: string} +//│ 'a <: { +//│ lhs: FunctionType & 'a | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'a | PrimitiveType & {name: string} +//│ } //│ = [Function: showType] showType(_t("int")) @@ -170,10 +183,16 @@ fun typeEqual(t1, t2) = t1 is FunctionType(lhs1, rhs1) and t2 is FunctionType(lhs2, rhs2) then typeEqual(lhs1, lhs2) and typeEqual(rhs1, rhs2) _ then false -//│ typeEqual: ('rhs, 'rhs0,) -> bool +//│ typeEqual: (FunctionType & 'a | PrimitiveType | ~FunctionType & ~PrimitiveType, FunctionType & 'b | PrimitiveType | ~FunctionType & ~PrimitiveType,) -> bool //│ where -//│ 'rhs0 <: FunctionType & {lhs: 'rhs0, rhs: 'rhs0} | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'rhs <: FunctionType & {lhs: 'rhs, rhs: 'rhs} | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ 'b <: { +//│ lhs: FunctionType & 'b | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'b | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'a <: { +//│ lhs: FunctionType & 'a | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'a | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } //│ = [Function: typeEqual] fun showTerm(t) = @@ -184,10 +203,24 @@ fun showTerm(t) = App(Abs(lhs0, ty, lhs1), rhs) then concat5("((", showTerm(Abs(lhs0, ty, rhs)), ") ", showTerm(rhs), ")") App(lhs, rhs) then par(concat3(showTerm(lhs), " ", showTerm(rhs))) -//│ showTerm: 'rhs -> string +//│ showTerm: (Abs & 'a | App & 'b | Lit | Var) -> string //│ where -//│ 'rhs <: Abs & {lhs: 'rhs, lty: 'lty, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, lty: 'lty} | ~#Abs), rhs: 'rhs} | Lit | Var -//│ 'lty <: FunctionType & {lhs: 'lty & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lty} | PrimitiveType & {name: string} +//│ 'a <: { +//│ lhs: Abs & 'a | App & 'b | Lit | Var, +//│ lty: FunctionType & 'c | PrimitiveType & {name: string}, +//│ rhs: Abs & 'a | App & 'b | Lit | Var +//│ } +//│ 'b <: { +//│ lhs: App & 'b | Lit | Var | 'a & (Abs & { +//│ lhs: Abs & 'a | App & 'b | Lit | Var, +//│ lty: FunctionType & 'c | PrimitiveType & {name: string} +//│ } | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'b | Lit | Var +//│ } +//│ 'c <: { +//│ lhs: FunctionType & 'c | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'c | PrimitiveType & {name: string} +//│ } //│ = [Function: showTerm] showTerm(Var("x")) @@ -222,126 +255,234 @@ fun typeTerm(t, ctx) = Ok(PrimitiveType(name)) then Err(concat3("cannot apply primitive type `", name, "`")) Err(message) then Err(message) //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.207: fun typeTerm(t, ctx) = +//│ ║ l.240: fun typeTerm(t, ctx) = //│ ║ ^^^^^^^^^^ -//│ ║ l.208: if t is +//│ ║ l.241: if t is //│ ║ ^^^^^^^^^ -//│ ║ l.209: Lit(_, ty) then Ok(ty) +//│ ║ l.242: Lit(_, ty) then Ok(ty) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.210: Var(name) and find(ctx, name) is +//│ ║ l.243: Var(name) and find(ctx, name) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.211: Some(ty) then Ok(ty) +//│ ║ l.244: Some(ty) then Ok(ty) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.212: None then Err(concat3("unbound variable `", name, "`")) +//│ ║ l.245: None then Err(concat3("unbound variable `", name, "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.213: Abs(Var(name), ty, body) and typeTerm(body, insert(ctx, name, ty)) is +//│ ║ l.246: Abs(Var(name), ty, body) and typeTerm(body, insert(ctx, name, ty)) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.214: Ok(resTy) then Ok(FunctionType(ty, resTy)) +//│ ║ l.247: Ok(resTy) then Ok(FunctionType(ty, resTy)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.215: Err(message) then Err(message) +//│ ║ l.248: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.216: App(lhs, rhs) and typeTerm(lhs, ctx) is +//│ ║ l.249: App(lhs, rhs) and typeTerm(lhs, ctx) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.217: Ok(FunctionType(pTy, resTy)) and typeTerm(rhs, ctx) is +//│ ║ l.250: Ok(FunctionType(pTy, resTy)) and typeTerm(rhs, ctx) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.218: Ok(aTy) and +//│ ║ l.251: Ok(aTy) and //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.219: typeEqual(pTy, aTy) then Ok(resTy) +//│ ║ l.252: typeEqual(pTy, aTy) then Ok(resTy) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.220: _ then Err(concat5("expect the argument to be of type `", showType(pTy), "` but found `", showType(aTy), "`")) +//│ ║ l.253: _ then Err(concat5("expect the argument to be of type `", showType(pTy), "` but found `", showType(aTy), "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.221: Err(message) then Err(message) +//│ ║ l.254: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.222: Ok(PrimitiveType(name)) then Err(concat3("cannot apply primitive type `", name, "`")) +//│ ║ l.255: Ok(PrimitiveType(name)) then Err(concat3("cannot apply primitive type `", name, "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.223: Err(message) then Err(message) +//│ ║ l.256: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. //│ ╔══[ERROR] Cyclic-looking constraint while typing binding of lambda expression; a type annotation may be required -//│ ║ l.207: fun typeTerm(t, ctx) = +//│ ║ l.240: fun typeTerm(t, ctx) = //│ ║ ^^^^^^^^^^ -//│ ║ l.208: if t is +//│ ║ l.241: if t is //│ ║ ^^^^^^^^^ -//│ ║ l.209: Lit(_, ty) then Ok(ty) +//│ ║ l.242: Lit(_, ty) then Ok(ty) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.210: Var(name) and find(ctx, name) is +//│ ║ l.243: Var(name) and find(ctx, name) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.211: Some(ty) then Ok(ty) +//│ ║ l.244: Some(ty) then Ok(ty) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.212: None then Err(concat3("unbound variable `", name, "`")) +//│ ║ l.245: None then Err(concat3("unbound variable `", name, "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.213: Abs(Var(name), ty, body) and typeTerm(body, insert(ctx, name, ty)) is +//│ ║ l.246: Abs(Var(name), ty, body) and typeTerm(body, insert(ctx, name, ty)) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.214: Ok(resTy) then Ok(FunctionType(ty, resTy)) +//│ ║ l.247: Ok(resTy) then Ok(FunctionType(ty, resTy)) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.215: Err(message) then Err(message) +//│ ║ l.248: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.216: App(lhs, rhs) and typeTerm(lhs, ctx) is +//│ ║ l.249: App(lhs, rhs) and typeTerm(lhs, ctx) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.217: Ok(FunctionType(pTy, resTy)) and typeTerm(rhs, ctx) is +//│ ║ l.250: Ok(FunctionType(pTy, resTy)) and typeTerm(rhs, ctx) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.218: Ok(aTy) and +//│ ║ l.251: Ok(aTy) and //│ ║ ^^^^^^^^^^^^^^^^^^^ -//│ ║ l.219: typeEqual(pTy, aTy) then Ok(resTy) +//│ ║ l.252: typeEqual(pTy, aTy) then Ok(resTy) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.220: _ then Err(concat5("expect the argument to be of type `", showType(pTy), "` but found `", showType(aTy), "`")) +//│ ║ l.253: _ then Err(concat5("expect the argument to be of type `", showType(pTy), "` but found `", showType(aTy), "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.221: Err(message) then Err(message) +//│ ║ l.254: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.222: Ok(PrimitiveType(name)) then Err(concat3("cannot apply primitive type `", name, "`")) +//│ ║ l.255: Ok(PrimitiveType(name)) then Err(concat3("cannot apply primitive type `", name, "`")) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.223: Err(message) then Err(message) +//│ ║ l.256: Err(message) then Err(message) //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╙── Note: use flag `:ex` to see internal error info. -//│ typeTerm: ('rhs, 'right,) -> (Err & {message: 'message} | Ok & {value: 'ty}) -//│ where -//│ 'right <: 'right0 & (Empty | Node & {key: string, left: 'right, right: 'right}) -//│ 'right0 <: Empty | Node & {key: string, left: 'right0, right: 'right0, value: 'lhs & 'ty & (PrimitiveType & {name: string} | 'a & (FunctionType & 'b | FunctionType & ~#FunctionType))} -//│ 'rhs <: Abs & {lhs: Var & {name: string}, lty: 'lhs & 'rhs0 & 'lhs0 & 'lty & (PrimitiveType & {name: string} | 'a & (FunctionType & 'b | FunctionType & ~#FunctionType)), rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Lit & {ty: 'lhs & 'ty & (PrimitiveType & {name: string} | 'a & (FunctionType & 'b | FunctionType & ~#FunctionType))} | Var & {name: string} -//│ 'a <: {lhs: 'rhs0 & 'lhs0, rhs: 'rhs1} -//│ 'rhs1 :> 'ty -//│ <: 'lhs & (PrimitiveType & {name: string} | 'a & (FunctionType & 'b | FunctionType & ~#FunctionType)) -//│ 'b <: {lhs: 'rhs2, rhs: 'rhs2} -//│ 'rhs2 <: FunctionType & 'b | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'ty :> 'lty | FunctionType & {lhs: 'lty, rhs: 'ty} | 'rhs1 -//│ 'lhs0 <: FunctionType & {lhs: 'lhs0 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs0} | PrimitiveType & {name: string} -//│ 'rhs0 <: FunctionType & {lhs: 'rhs0, rhs: 'rhs0} | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs <: FunctionType & {lhs: 'lhs & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs} | PrimitiveType & {name: string} +//│ typeTerm: (Abs & 'a | App & 'b | Lit & {ty: 'ty & (FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string})} | Var & {name: string}, Empty | Node & 'f & 'g,) -> (Err & { +//│ message: forall 'message 'message0 'message1. string | 'message | 'message0 | 'message1 +//│ } | Ok & {value: forall 'h. 'lty | 'rhs | 'ty | 'h}) +//│ where +//│ 'message :> forall 'message0 'message1. string | 'message0 | 'message1 +//│ 'message0 :> forall 'message 'message1. 'message | 'message1 +//│ 'message1 :> forall 'message 'message0. 'message | 'message0 +//│ 'g <: {key: string, left: Empty | Node & 'f & 'g, right: Empty | Node & 'f & 'g} +//│ 'f <: { +//│ key: string, +//│ left: Empty | Node & 'f, +//│ right: Empty | Node & 'f, +//│ value: 'ty & (FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string}) +//│ } +//│ 'a <: { +//│ lhs: Var & {name: string}, +//│ lty: 'lty & (FunctionType & 'c & 'd & 'e & 'i & 'j | PrimitiveType & {name: string}), +//│ rhs: Abs & 'a | App & 'b | Lit & {ty: 'ty & (FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string})} | Var & {name: string} +//│ } +//│ 'b <: { +//│ lhs: Abs & 'a | App & 'b | Lit & {ty: 'ty & (FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string})} | Var & {name: string}, +//│ rhs: Abs & 'a | App & 'b | Lit & {ty: 'ty & (FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string})} | Var & {name: string} +//│ } +//│ 'e <: { +//│ lhs: PrimitiveType & {name: string} | 'j & (FunctionType & 'i | FunctionType & ~#FunctionType), +//│ rhs: 'rhs +//│ } +//│ 'rhs :> forall 'value. 'value +//│ <: FunctionType & 'c & 'd & 'e | PrimitiveType & {name: string} +//│ 'value :> forall 'h. 'lty | 'rhs | 'ty | 'h +//│ 'h :> FunctionType & {lhs: 'lty, rhs: forall 'value. 'value} +//│ 'i <: { +//│ lhs: FunctionType & 'i | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'i | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'j <: { +//│ lhs: FunctionType & 'j | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'j | PrimitiveType & {name: string} +//│ } +//│ 'd <: { +//│ lhs: FunctionType & 'd | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'd | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'c <: { +//│ lhs: FunctionType & 'c | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'c | PrimitiveType & {name: string} +//│ } //│ = [Function: typeTerm] fun showTypeTerm(t, ctx) = if typeTerm(t, ctx) is Ok(ty) then concat3(showTerm(t), " : ", showType(ty)) Err(message) then concat2("Type error: ", message) -//│ showTypeTerm: ('rhs & 'rhs0, 'right & (Empty | Node & 'a),) -> string +//│ showTypeTerm: (Abs & 'a & 'b | App & 'c & 'd | Lit & {ty: FunctionType & 'e & 'f & 'g & 'h | PrimitiveType & {name: string}} | Var & {name: string}, Empty | Node & 'i & 'j,) -> string //│ where -//│ 'a <: {key: string, left: 'right0, right: 'right0} -//│ 'right0 <: 'right1 & (Empty | Node & 'a) -//│ 'right1 <: Empty | Node & {key: string, left: 'right1, right: 'right1, value: 'rhs1} -//│ 'rhs1 <: 'lhs & 'lhs0 & (FunctionType & {lhs: 'rhs2 & 'lhs1, rhs: 'rhs1} & ~#FunctionType | FunctionType & {lhs: 'rhs2 & 'lhs1, rhs: 'rhs1} & 'b | PrimitiveType & {name: string}) -//│ 'b <: {lhs: 'rhs3, rhs: 'rhs3} -//│ 'rhs3 <: FunctionType & 'b | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs1 <: FunctionType & {lhs: 'lhs1 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs1} | PrimitiveType & {name: string} -//│ 'rhs2 <: FunctionType & {lhs: 'rhs2, rhs: 'rhs2} | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs0 <: FunctionType & {lhs: 'lhs0 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs0} | PrimitiveType & {name: string} -//│ 'right <: Empty | Node & {key: string, left: 'right, right: 'right, value: 'rhs4} -//│ 'rhs4 <: 'lhs2 & 'lhs & (FunctionType & {lhs: 'rhs5 & 'lhs3, rhs: 'rhs4} & ~#FunctionType | FunctionType & {lhs: 'rhs5 & 'lhs3, rhs: 'rhs4} & 'c | PrimitiveType & {name: string}) -//│ 'c <: {lhs: 'rhs6, rhs: 'rhs6} -//│ 'rhs6 <: FunctionType & 'c | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs3 <: FunctionType & {lhs: 'lhs3 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs3} | PrimitiveType & {name: string} -//│ 'rhs5 <: FunctionType & {lhs: 'rhs5, rhs: 'rhs5} | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs2 <: FunctionType & {lhs: 'lhs2 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs2} | PrimitiveType & {name: string} -//│ 'rhs0 <: Abs & {lhs: 'rhs0, lty: 'lty, rhs: 'rhs0} | App & {lhs: 'rhs0 & (Abs & {lhs: 'rhs0, lty: 'lty} | ~#Abs), rhs: 'rhs0} | Lit | Var -//│ 'lty <: FunctionType & {lhs: 'lty & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lty} | PrimitiveType & {name: string} -//│ 'rhs <: Abs & {lhs: Var & {name: string}, lty: 'lhs4 & 'rhs7 & 'lhs5 & 'lhs & (PrimitiveType & {name: string} | 'd & (FunctionType & 'e | FunctionType & ~#FunctionType)), rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Lit & {ty: 'rhs8} | Var & {name: string} -//│ 'd <: {lhs: 'rhs7 & 'lhs5, rhs: 'rhs8} -//│ 'rhs8 <: 'lhs4 & 'lhs & (PrimitiveType & {name: string} | 'd & (FunctionType & 'e | FunctionType & ~#FunctionType)) -//│ 'e <: {lhs: 'rhs9, rhs: 'rhs9} -//│ 'rhs9 <: FunctionType & 'e | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs <: FunctionType & {lhs: 'lhs & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs} | PrimitiveType & {name: string} -//│ 'lhs5 <: FunctionType & {lhs: 'lhs5 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs5} | PrimitiveType & {name: string} -//│ 'rhs7 <: FunctionType & {lhs: 'rhs7, rhs: 'rhs7} | PrimitiveType | ~FunctionType & ~PrimitiveType -//│ 'lhs4 <: FunctionType & {lhs: 'lhs4 & (PrimitiveType & {name: string} | ~#PrimitiveType), rhs: 'lhs4} | PrimitiveType & {name: string} +//│ 'j <: { +//│ key: string, +//│ left: Empty | Node & 'j, +//│ right: Empty | Node & 'j, +//│ value: FunctionType & 'h & 'k & 'l & 'm | PrimitiveType & {name: string} +//│ } +//│ 'm <: { +//│ lhs: PrimitiveType & {name: string} | 'n & (FunctionType & 'o | FunctionType & ~#FunctionType), +//│ rhs: FunctionType & 'h & 'k & 'l & 'm | PrimitiveType & {name: string} +//│ } +//│ 'o <: { +//│ lhs: FunctionType & 'o | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'o | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'n <: { +//│ lhs: FunctionType & 'n | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'n | PrimitiveType & {name: string} +//│ } +//│ 'l <: { +//│ lhs: FunctionType & 'l | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'l | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'k <: { +//│ lhs: FunctionType & 'k | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'k | PrimitiveType & {name: string} +//│ } +//│ 'i <: {key: string, left: Empty | Node & 'i & 'p, right: Empty | Node & 'i & 'p} +//│ 'p <: { +//│ key: string, +//│ left: Empty | Node & 'p, +//│ right: Empty | Node & 'p, +//│ value: FunctionType & 'h & 'q & 'r & 's | PrimitiveType & {name: string} +//│ } +//│ 's <: { +//│ lhs: PrimitiveType & {name: string} | 't & (FunctionType & 'u | FunctionType & ~#FunctionType), +//│ rhs: FunctionType & 'h & 'q & 'r & 's | PrimitiveType & {name: string} +//│ } +//│ 'u <: { +//│ lhs: FunctionType & 'u | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'u | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 't <: { +//│ lhs: FunctionType & 't | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 't | PrimitiveType & {name: string} +//│ } +//│ 'r <: { +//│ lhs: FunctionType & 'r | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'r | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'q <: { +//│ lhs: FunctionType & 'q | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'q | PrimitiveType & {name: string} +//│ } +//│ 'b <: { +//│ lhs: Abs & 'b | App & 'd | Lit | Var, +//│ lty: FunctionType & 'v | PrimitiveType & {name: string}, +//│ rhs: Abs & 'b | App & 'd | Lit | Var +//│ } +//│ 'd <: { +//│ lhs: App & 'd | Lit | Var | 'b & (Abs & { +//│ lhs: Abs & 'b | App & 'd | Lit | Var, +//│ lty: FunctionType & 'v | PrimitiveType & {name: string} +//│ } | Abs & ~#Abs), +//│ rhs: Abs & 'b | App & 'd | Lit | Var +//│ } +//│ 'v <: { +//│ lhs: FunctionType & 'v | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'v | PrimitiveType & {name: string} +//│ } +//│ 'a <: { +//│ lhs: Var & {name: string}, +//│ lty: FunctionType & 'e & 'f & 'g & 'w & 'x & 'h | PrimitiveType & {name: string}, +//│ rhs: Abs & 'a | App & 'c | Lit & {ty: FunctionType & 'e & 'f & 'g & 'h | PrimitiveType & {name: string}} | Var & {name: string} +//│ } +//│ 'c <: { +//│ lhs: Abs & 'a | App & 'c | Lit & {ty: FunctionType & 'e & 'f & 'g & 'h | PrimitiveType & {name: string}} | Var & {name: string}, +//│ rhs: Abs & 'a | App & 'c | Lit & {ty: FunctionType & 'e & 'f & 'g & 'h | PrimitiveType & {name: string}} | Var & {name: string} +//│ } +//│ 'g <: { +//│ lhs: PrimitiveType & {name: string} | 'x & (FunctionType & 'w | FunctionType & ~#FunctionType), +//│ rhs: FunctionType & 'e & 'f & 'g & 'h | PrimitiveType & {name: string} +//│ } +//│ 'h <: { +//│ lhs: FunctionType & 'h | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'h | PrimitiveType & {name: string} +//│ } +//│ 'w <: { +//│ lhs: FunctionType & 'w | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'w | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'x <: { +//│ lhs: FunctionType & 'x | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'x | PrimitiveType & {name: string} +//│ } +//│ 'f <: { +//│ lhs: FunctionType & 'f | PrimitiveType | ~FunctionType & ~PrimitiveType, +//│ rhs: FunctionType & 'f | PrimitiveType | ~FunctionType & ~PrimitiveType +//│ } +//│ 'e <: { +//│ lhs: FunctionType & 'e | PrimitiveType & {name: string}, +//│ rhs: FunctionType & 'e | PrimitiveType & {name: string} +//│ } //│ = [Function: showTypeTerm] // FIXME diff --git a/shared/src/test/diff/tapl/Untyped.mls b/shared/src/test/diff/tapl/Untyped.mls index ccbd405bf..65d6ead64 100644 --- a/shared/src/test/diff/tapl/Untyped.mls +++ b/shared/src/test/diff/tapl/Untyped.mls @@ -86,25 +86,70 @@ fun list8(x, y, z, w, v, u, t, s) = Cons(x, list7(y, z, w, v, u, t, s)) //│ = [Function: list2] //│ list3: ('head, 'head0, 'head1,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Nil}}}) //│ = [Function: list3] -//│ list4: ('head, 'head0, 'head1, 'head2,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Nil}}}}) +//│ list4: ('head, 'head0, 'head1, 'head2,) -> (Cons & { +//│ head: 'head, +//│ tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Nil}}} +//│ }) //│ = [Function: list4] -//│ list5: ('head, 'head0, 'head1, 'head2, 'head3,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Nil}}}}}) +//│ list5: ('head, 'head0, 'head1, 'head2, 'head3,) -> (Cons & { +//│ head: 'head, +//│ tail: Cons & { +//│ head: 'head0, +//│ tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Nil}}} +//│ } +//│ }) //│ = [Function: list5] -//│ list6: ('head, 'head0, 'head1, 'head2, 'head3, 'head4,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Cons & {head: 'head4, tail: Nil}}}}}}) +//│ list6: ('head, 'head0, 'head1, 'head2, 'head3, 'head4,) -> (Cons & { +//│ head: 'head, +//│ tail: Cons & { +//│ head: 'head0, +//│ tail: Cons & { +//│ head: 'head1, +//│ tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Cons & {head: 'head4, tail: Nil}}} +//│ } +//│ } +//│ }) //│ = [Function: list6] -//│ list7: ('head, 'head0, 'head1, 'head2, 'head3, 'head4, 'head5,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Cons & {head: 'head4, tail: Cons & {head: 'head5, tail: Nil}}}}}}}) +//│ list7: ('head, 'head0, 'head1, 'head2, 'head3, 'head4, 'head5,) -> (Cons & { +//│ head: 'head, +//│ tail: Cons & { +//│ head: 'head0, +//│ tail: Cons & { +//│ head: 'head1, +//│ tail: Cons & { +//│ head: 'head2, +//│ tail: Cons & {head: 'head3, tail: Cons & {head: 'head4, tail: Cons & {head: 'head5, tail: Nil}}} +//│ } +//│ } +//│ } +//│ }) //│ = [Function: list7] -//│ list8: ('head, 'head0, 'head1, 'head2, 'head3, 'head4, 'head5, 'head6,) -> (Cons & {head: 'head, tail: Cons & {head: 'head0, tail: Cons & {head: 'head1, tail: Cons & {head: 'head2, tail: Cons & {head: 'head3, tail: Cons & {head: 'head4, tail: Cons & {head: 'head5, tail: Cons & {head: 'head6, tail: Nil}}}}}}}}) +//│ list8: ('head, 'head0, 'head1, 'head2, 'head3, 'head4, 'head5, 'head6,) -> (Cons & { +//│ head: 'head, +//│ tail: Cons & { +//│ head: 'head0, +//│ tail: Cons & { +//│ head: 'head1, +//│ tail: Cons & { +//│ head: 'head2, +//│ tail: Cons & { +//│ head: 'head3, +//│ tail: Cons & {head: 'head4, tail: Cons & {head: 'head5, tail: Cons & {head: 'head6, tail: Nil}}} +//│ } +//│ } +//│ } +//│ } +//│ }) //│ = [Function: list8] fun listConcat(xs, ys) = if xs is Nil() then ys Cons(x, xs') then Cons(x, listConcat(xs', ys)) -//│ listConcat: ('tail, 'tail0,) -> 'tail0 +//│ listConcat: (Cons & 'a | Nil, 'b,) -> 'b //│ where -//│ 'tail0 :> Cons & {head: 'head, tail: 'tail0} -//│ 'tail <: Cons & {head: 'head, tail: 'tail} | Nil +//│ 'b :> Cons & {head: 'head, tail: 'b} +//│ 'a <: {head: 'head, tail: Cons & 'a | Nil} //│ = [Function: listConcat] fun listContains(xs, x) = @@ -113,9 +158,9 @@ fun listContains(xs, x) = Cons(x', xs') and eq(x)(x') then true _ then listContains(xs', x) -//│ listContains: ('tail, anything,) -> Bool +//│ listContains: (Cons & 'a | Nil, anything,) -> Bool //│ where -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: listContains] // Remove all occurrences of x from xs. @@ -125,10 +170,10 @@ fun listWithout(xs, x) = Cons(x', xs') and eq(x)(x') then listWithout(xs', x) _ then Cons(x', listWithout(xs', x)) -//│ listWithout: ('tail, anything,) -> 'tail0 +//│ listWithout: (Cons & 'a | Nil, anything,) -> 'b //│ where -//│ 'tail0 :> Nil | Cons & {head: 'head, tail: 'tail0} -//│ 'tail <: Cons & {head: 'head, tail: 'tail} | Nil +//│ 'b :> Nil | Cons & {head: 'head, tail: 'b} +//│ 'a <: {head: 'head, tail: Cons & 'a | Nil} //│ = [Function: listWithout] fun listJoin(xs, sep) = @@ -136,9 +181,9 @@ fun listJoin(xs, sep) = Nil() then "" Cons(x, Nil()) then toString(x) Cons(x, xs') then concat3(toString(x), sep, listJoin(xs', sep)) -//│ listJoin: ('tail, string,) -> string +//│ listJoin: (Cons & 'a | Nil, string,) -> string //│ where -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: listJoin] listJoin(list3("x", "y", "z"), ", ") @@ -169,9 +214,13 @@ fun showTerm(t) = App(Abs(lhs0, lhs1), rhs) then concat8("((", "&", showTerm(lhs0), ". ", showTerm(lhs1), ") ", showTerm(rhs), ")") App(lhs, rhs) then par(concat3(showTerm(lhs), " ", showTerm(rhs))) -//│ showTerm: 'rhs -> string +//│ showTerm: (Abs & 'a | App & 'b | Var) -> string //│ where -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, rhs: 'rhs} | ~#Abs), rhs: 'rhs} | Var +//│ 'a <: {lhs: Abs & 'a | App & 'b | Var, rhs: Abs & 'a | App & 'b | Var} +//│ 'b <: { +//│ lhs: App & 'b | Var | 'a & (Abs & 'a | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'b | Var +//│ } //│ = [Function: showTerm] showTerm(Var("x")) @@ -213,17 +262,29 @@ fun hasFree(t, n) = Abs(Var(name), body) then hasFree(body, n) App(lhs, rhs) then hasFree(lhs, n) || hasFree(rhs, n) _ then false -//│ hasFree: ('rhs, anything,) -> bool +//│ hasFree: (Abs & 'a | App & 'b | Var | ~Abs & ~App & ~Var, anything,) -> bool //│ where -//│ 'rhs <: Abs & {rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Var | ~Abs & ~App & ~Var +//│ 'a <: {lhs: anything, rhs: Abs & 'a | App & 'b | Var | ~Abs & ~App & ~Var} +//│ 'b <: { +//│ lhs: Abs & 'a | App & 'b | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'a | App & 'b | Var | ~Abs & ~App & ~Var +//│ } //│ = [Function: hasFree] fun showHasFree(t, n) = concat4(showTerm(t), if hasFree(t, n) then " has " else " DOES NOT have ", "free variable ", n) -//│ showHasFree: ('rhs & 'rhs0, string,) -> string +//│ showHasFree: (Abs & 'a & 'b | App & 'c & 'd | Var, string,) -> string //│ where -//│ 'rhs0 <: Abs & {rhs: 'rhs0} | App & {lhs: 'rhs0, rhs: 'rhs0} | Var | ~Abs & ~App & ~Var -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, rhs: 'rhs} | ~#Abs), rhs: 'rhs} | Var +//│ 'b <: {lhs: anything, rhs: Abs & 'b | App & 'd | Var | ~Abs & ~App & ~Var} +//│ 'd <: { +//│ lhs: Abs & 'b | App & 'd | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'b | App & 'd | Var | ~Abs & ~App & ~Var +//│ } +//│ 'a <: {lhs: Abs & 'a | App & 'c | Var, rhs: Abs & 'a | App & 'c | Var} +//│ 'c <: { +//│ lhs: App & 'c | Var | 'a & (Abs & 'a | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'c | Var +//│ } //│ = [Function: showHasFree] showHasFree(Var("x"), "x") @@ -268,13 +329,20 @@ fun fv(t) = Var(name) then list1(name) Abs(Var(name), body) then listWithout(fv(body), name) App(lhs, rhs) then listConcat(fv(lhs), fv(rhs)) -//│ fv: 'rhs -> 'a +//│ fv: (Abs & 'a | App & 'b | Var & {name: 'name}) -> (Cons & {head: 'name, tail: Nil} | 'c | 'd) //│ where -//│ 'a :> forall 'tail 'tail0. Cons & {head: 'name, tail: Nil} | 'tail | 'tail0 -//│ 'tail0 :> Cons & {head: 'head, tail: 'tail0} | 'a -//│ 'tail :> Nil | Cons & {head: 'head, tail: 'tail} -//│ 'head :> 'name -//│ 'rhs <: Abs & {lhs: Var, rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Var & {name: 'name} +//│ 'd :> forall 'e. 'f | 'e +//│ 'e :> Cons & {head: forall 'head. 'head, tail: 'f | 'e} +//│ 'f :> forall 'g. Cons & {head: 'name, tail: Nil} | 'g | 'd +//│ 'g :> Nil | Cons & {head: forall 'head0. 'head0, tail: 'g} +//│ 'c :> Nil | Cons & {head: forall 'head0. 'head0, tail: 'c} +//│ 'head0 :> forall 'head. 'head | 'name +//│ 'head :> forall 'head0. 'head0 | 'name +//│ 'a <: {lhs: Var, rhs: Abs & 'a | App & 'b | Var & {name: 'name}} +//│ 'b <: { +//│ lhs: Abs & 'a | App & 'b | Var & {name: 'name}, +//│ rhs: Abs & 'a | App & 'b | Var & {name: 'name} +//│ } //│ = [Function: fv] fun showFv(t) = @@ -282,11 +350,17 @@ fun showFv(t) = Nil then " DOES NOT have free variables" _ then concat2(" has free variables: ", listJoin(fv(t), ", ")) ) -//│ showFv: ('rhs & 'rhs0 & 'rhs1) -> string +//│ showFv: (Abs & 'a & 'b & 'c | App & 'd & 'e & 'f | Var) -> string //│ where -//│ 'rhs1 <: Abs & {lhs: Var, rhs: 'rhs1} | App & {lhs: 'rhs1, rhs: 'rhs1} | Var -//│ 'rhs0 <: Abs & {lhs: Var, rhs: 'rhs0} | App & {lhs: 'rhs0, rhs: 'rhs0} | Var -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, rhs: 'rhs} | ~#Abs), rhs: 'rhs} | Var +//│ 'c <: {lhs: Var, rhs: Abs & 'c | App & 'f | Var} +//│ 'f <: {lhs: Abs & 'c | App & 'f | Var, rhs: Abs & 'c | App & 'f | Var} +//│ 'b <: {lhs: Var, rhs: Abs & 'b | App & 'e | Var} +//│ 'e <: {lhs: Abs & 'b | App & 'e | Var, rhs: Abs & 'b | App & 'e | Var} +//│ 'a <: {lhs: Abs & 'a | App & 'd | Var, rhs: Abs & 'a | App & 'd | Var} +//│ 'd <: { +//│ lhs: App & 'd | Var | 'a & (Abs & 'a | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'd | Var +//│ } //│ = [Function: showFv] showFv(Var("x")) @@ -313,9 +387,9 @@ fun tryNextAlphabet(initialCode, currentCode, freeNames) = let name = fromCharCode(currentCode) listContains(freeNames, name) then tryNextAlphabet(initialCode, currentCode + 1, freeNames) _ then Some(name) -//│ tryNextAlphabet: (number, int, 'tail,) -> (None | Some & {value: string}) +//│ tryNextAlphabet: (number, int, Cons & 'a | Nil,) -> (Some & {value: string} | None) //│ where -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: tryNextAlphabet] tryNextAlphabet(97, 97, list1("a")) @@ -323,15 +397,15 @@ tryNextAlphabet(97, 98, list1("a")) tryNextAlphabet(97, 98, list2("a", "b")) tryNextAlphabet(121, 122, list1("y")) tryNextAlphabet(121, 122, list2("y", "z")) -//│ res: None | Some & {value: string} +//│ res: Some & {value: string} | None //│ = None {} -//│ res: None | Some & {value: string} +//│ res: Some & {value: string} | None //│ = Some { value: 'b' } -//│ res: None | Some & {value: string} +//│ res: Some & {value: string} | None //│ = Some { value: 'c' } -//│ res: None | Some & {value: string} +//│ res: Some & {value: string} | None //│ = Some { value: 'z' } -//│ res: None | Some & {value: string} +//│ res: Some & {value: string} | None //│ = Some { value: 'a' } fun tryAppendDigits(name, index, freeNames) = @@ -340,9 +414,9 @@ fun tryAppendDigits(name, index, freeNames) = listContains(freeNames, currentName) then tryAppendDigits(name, index + 1, freeNames) _ then currentName -//│ tryAppendDigits: (string, int, 'tail,) -> string +//│ tryAppendDigits: (string, int, Cons & 'a | Nil,) -> string //│ where -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: tryAppendDigits] // Note: some weird behavior here... Just try the commented code. @@ -353,19 +427,20 @@ fun findFreshName(name, freeNames) = tryNextAlphabet(charCode, charCode + 1, freeNames) is Some(newName) then newName _ then tryAppendDigits(name, 0, freeNames) -//│ findFreshName: (string, 'tail & 'tail0 & 'tail1,) -> string +//│ findFreshName: (string, Cons & 'a & 'b & 'c | Nil,) -> string //│ where -//│ 'tail1 <: Cons & {tail: 'tail1} | Nil -//│ 'tail0 <: Cons & {tail: 'tail0} | Nil -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'c <: {head: anything, tail: Cons & 'c | Nil} +//│ 'b <: {head: anything, tail: Cons & 'b | Nil} +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: findFreshName] // Find a fresh name to replace `name` that does not conflict with any bound // variables in the `body`. fun freshName(name, body) = findFreshName(name, fv(body)) -//│ freshName: (string, 'rhs,) -> string +//│ freshName: (string, Abs & 'a | App & 'b | Var,) -> string //│ where -//│ 'rhs <: Abs & {lhs: Var, rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Var +//│ 'a <: {lhs: Var, rhs: Abs & 'a | App & 'b | Var} +//│ 'b <: {lhs: Abs & 'a | App & 'b | Var, rhs: Abs & 'a | App & 'b | Var} //│ = [Function: freshName] fun subst(t, n, v) = @@ -377,37 +452,64 @@ fun subst(t, n, v) = _ then Abs(Var(name), subst(body, n, v)) App(lhs, rhs) then App(subst(lhs, n, v), subst(rhs, n, v)) _ then t -//│ subst: ('rhs, anything, 'rhs & 'rhs0 & 'rhs1 & 'rhs2,) -> 'rhs0 +//│ subst: (Abs & 'a | App & 'b | Var & 'c | 'd & ~#Abs & ~#App & ~#Var, anything, 'e & (Var & 'c | 'b & 'f & (App & ~#App | App & 'g) | 'a & 'h & (Abs & ~#Abs | Abs & 'i) | 'd & (Abs & 'h & ~#Abs | App & 'f & ~#App | Var & ~#Var)),) -> (Var & {name: string} | 'e | 'c | 'a | 'd) //│ where -//│ 'rhs2 <: Abs & {rhs: 'rhs2} | App & {lhs: 'rhs2, rhs: 'rhs2} | Var | ~Abs & ~App & ~Var -//│ 'rhs <: Abs & 'a | App & 'b | Var & 'c | 'd & ~#Abs & ~#App & ~#Var -//│ 'a :> Abs & {lhs: Var & {name: string}, rhs: 'rhs0} | 'e -//│ <: 'rhs1 & (Abs & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs & 'rhs1} | App & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs & 'rhs1} & 'b | Var & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs & 'rhs1} & 'c | {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs & 'rhs1} & 'd & ~#Abs & ~#App & ~#Var) -//│ 'rhs0 :> Var & {name: string} | 'c | 'a | 'd | (forall 'e. 'e) | App & {lhs: 'rhs0, rhs: 'rhs0} -//│ 'e :> Abs & {lhs: Var & {name: 'name}, rhs: 'rhs0} -//│ 'name <: string +//│ 'g <: { +//│ lhs: Abs & 'i | App & 'g | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'i | App & 'g | Var | ~Abs & ~App & ~Var +//│ } +//│ 'i <: {lhs: anything, rhs: Abs & 'i | App & 'g | Var | ~Abs & ~App & ~Var} +//│ 'a :> Abs & {lhs: Var & {name: string}, rhs: Var & {name: string} | 'rhs | 'e | 'c | 'a | 'd} +//│ <: Abs & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'a & 'h | App & 'b & 'f | Var & 'c} & 'h | App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'a & 'h | App & 'b & 'f | Var & 'c} & 'b & 'f | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'a & 'h | App & 'b & 'f | Var & 'c} & 'c | 'd & (App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'a & 'h | App & 'b & 'f | Var & 'c} & 'f & ~#App | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'a & 'h | App & 'b & 'f | Var & 'c} & ~#Var) +//│ 'rhs :> Var & {name: string} | 'e | 'c | 'a | 'd +//│ 'e :> Var & {name: string} | 'c | 'a | 'd | App & { +//│ lhs: Var & {name: string} | 'e | 'c | 'a | 'd, +//│ rhs: Var & {name: string} | 'e | 'c | 'a | 'd +//│ } | Abs & {lhs: Var & {name: string}, rhs: 'rhs} //│ 'c :> Var & {name: string} -//│ <: 'rhs1 & (Abs & {name: anything} & 'a | App & {name: anything} & 'b | Var | {name: anything} & 'd & ~#Abs & ~#App & ~#Var) -//│ 'd <: 'rhs1 & (Abs & 'a | App & 'b | Var & 'c | ~#Abs & ~#App & ~#Var) -//│ 'b <: {lhs: 'rhs, rhs: 'rhs} -//│ 'rhs1 <: Abs & {lhs: Var, rhs: 'rhs1} | App & {lhs: 'rhs1, rhs: 'rhs1} | Var +//│ <: Abs & {name: anything} & 'a & 'h | App & {name: anything} & 'b & 'f | Var | 'd & (Abs & {name: anything} & 'h & ~#Abs | App & {name: anything} & 'f & ~#App) +//│ 'b <: { +//│ lhs: Abs & 'a | App & 'b | Var & 'c | 'd & ~#Abs & ~#App & ~#Var, +//│ rhs: Abs & 'a | App & 'b | Var & 'c | 'd & ~#Abs & ~#App & ~#Var +//│ } +//│ 'd <: Var & ~#Var | Var & 'c | 'f & (App & ~#App | App & 'b) | 'h & (Abs & ~#Abs | Abs & 'a) +//│ 'h <: {lhs: Var, rhs: Abs & 'h | App & 'f | Var} +//│ 'f <: {lhs: Abs & 'h | App & 'f | Var, rhs: Abs & 'h | App & 'f | Var} //│ = [Function: subst] fun showSubst(t, n, v) = concat8(showTerm(t), " [", n, " / ", showTerm(v), "]", " => ", showTerm(subst(t, n, v))) -//│ showSubst: ('rhs & 'rhs0, string, 'rhs0 & 'rhs1 & 'lhs & 'rhs2 & 'rhs3 & 'rhs4,) -> string +//│ showSubst: (Abs & 'a & 'b | App & 'c & 'd | Var & 'e, string, Abs & 'b & 'f & 'g & 'h & 'i | App & 'j & 'd & 'k & 'l & 'm | Var & 'e,) -> string //│ where -//│ 'rhs4 <: Abs & {rhs: 'rhs4} | App & {lhs: 'rhs4, rhs: 'rhs4} | Var | ~Abs & ~App & ~Var -//│ 'rhs3 <: Abs & {lhs: 'rhs3, rhs: 'rhs3} | App & {lhs: 'rhs3 & (Abs & {lhs: 'rhs3, rhs: 'rhs3} | ~#Abs), rhs: 'rhs3} | Var -//│ 'rhs0 <: Abs & 'a | App & 'b | Var & 'c | 'd & ~#Abs & ~#App & ~#Var -//│ 'a <: 'lhs & 'rhs2 & 'rhs1 & (Abs & {lhs: Var & {name: string} | ~Var, rhs: 'rhs0 & 'rhs1} | App & {lhs: Var & {name: string} | ~Var, rhs: 'rhs0 & 'rhs1} & 'b | Var & {lhs: Var & {name: string} | ~Var, rhs: 'rhs0 & 'rhs1} & 'c | {lhs: Var & {name: string} | ~Var, rhs: 'rhs0 & 'rhs1} & 'd & ~#Abs & ~#App & ~#Var) -//│ 'c <: 'lhs & 'rhs2 & 'rhs1 & (Abs & {name: anything} & 'a | App & {name: anything} & 'b | Var | {name: anything} & 'd & ~#Abs & ~#App & ~#Var) -//│ 'd <: 'lhs & 'rhs2 & 'rhs1 & (Abs & 'a | App & 'b | Var & 'c | ~#Abs & ~#App & ~#Var) -//│ 'b <: {lhs: 'rhs0, rhs: 'rhs0} -//│ 'rhs1 <: Abs & {lhs: Var, rhs: 'rhs1} | App & {lhs: 'rhs1, rhs: 'rhs1} | Var -//│ 'lhs <: Abs & {lhs: 'rhs2, rhs: 'rhs2} | ~Abs -//│ 'rhs2 <: Abs & {lhs: 'rhs2, rhs: 'rhs2} | App & {lhs: 'lhs & 'rhs2, rhs: 'rhs2} | Var -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, rhs: 'rhs} | ~#Abs), rhs: 'rhs} | Var +//│ 'i <: {lhs: anything, rhs: Abs & 'i | App & 'm | Var | ~Abs & ~App & ~Var} +//│ 'm <: { +//│ lhs: Abs & 'i | App & 'm | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'i | App & 'm | Var | ~Abs & ~App & ~Var +//│ } +//│ 'h <: {lhs: Abs & 'h | App & 'l | Var, rhs: Abs & 'h | App & 'l | Var} +//│ 'l <: { +//│ lhs: App & 'l | Var | 'h & (Abs & 'h | Abs & ~#Abs), +//│ rhs: Abs & 'h | App & 'l | Var +//│ } +//│ 'b <: Abs & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'b & 'f | App & 'j & 'd | Var & 'e} & 'f & 'g | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'b & 'f | App & 'j & 'd | Var & 'e} & 'e | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'b & 'f | App & 'j & 'd | Var & 'e} & 'n & ~#Var | 'j & 'k & (App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'b & 'f | App & 'j & 'd | Var & 'e} & 'd | App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'b & 'f | App & 'j & 'd | Var & 'e} & 'n & ~#App) +//│ 'd <: { +//│ lhs: Abs & 'b | App & 'd | Var & 'e | 'n & ~#Abs & ~#App & ~#Var, +//│ rhs: Abs & 'b | App & 'd | Var & 'e | 'n & ~#Abs & ~#App & ~#Var +//│ } +//│ 'e <: Var | 'j & 'k & (App & {name: anything} & 'd | App & {name: anything} & 'n & ~#App) | 'f & 'g & (Abs & {name: anything} & 'n & ~#Abs | Abs & {name: anything} & 'b) +//│ 'n <: Var & ~#Var | Var & 'e | 'j & 'k & (App & ~#App | App & 'd) | 'f & 'g & (Abs & ~#Abs | Abs & 'b) +//│ 'k <: { +//│ lhs: App & 'k | Var | 'g & (Abs & ~#Abs | Abs & 'g), +//│ rhs: Abs & 'g | App & 'k | Var +//│ } +//│ 'g <: {lhs: Abs & 'g | App & 'k | Var, rhs: Abs & 'g | App & 'k | Var} +//│ 'f <: {lhs: Var, rhs: Abs & 'f | App & 'j | Var} +//│ 'j <: {lhs: Abs & 'f | App & 'j | Var, rhs: Abs & 'f | App & 'j | Var} +//│ 'a <: {lhs: Abs & 'a | App & 'c | Var, rhs: Abs & 'a | App & 'c | Var} +//│ 'c <: { +//│ lhs: App & 'c | Var | 'a & (Abs & 'a | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'c | Var +//│ } //│ = [Function: showSubst] showSubst(Var("x"), "x", Var("y")) @@ -437,25 +539,40 @@ fun stepByValue(t) = None and lhs is Abs(Var(name), body) then Some(subst(body, name, rhs)) _ then None() -//│ stepByValue: 'a -> (None | Some & {value: 'value}) -//│ where -//│ 'value :> 'value0 | App & {lhs: 'value, rhs: 'rhs} | App & {lhs: 'lhs, rhs: 'value} -//│ 'a <: Abs | App & {lhs: 'lhs, rhs: 'rhs} | Var -//│ 'lhs <: 'a & (Abs & {rhs: 'rhs0} | ~#Abs) -//│ 'rhs0 <: Abs & 'b | App & 'c | Var & 'd | 'e & ~#Abs & ~#App & ~#Var -//│ 'b :> Abs & {lhs: Var & {name: string}, rhs: 'value0} | 'f -//│ <: 'rhs1 & (Abs & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs2} | App & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs2} & 'c | Var & {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs2} & 'd | {lhs: Var & {name: 'name} | ~Var, rhs: 'rhs2} & 'e & ~#Abs & ~#App & ~#Var) -//│ 'value0 :> Var & {name: string} | 'rhs | 'd | 'b | 'e | (forall 'f. 'f) | App & {lhs: 'value0, rhs: 'value0} -//│ 'f :> Abs & {lhs: Var & {name: 'name}, rhs: 'value0} -//│ 'name <: string -//│ 'd :> Var & {name: string} -//│ <: 'rhs1 & (Abs & {name: anything} & 'b | App & {name: anything} & 'c | Var | {name: anything} & 'e & ~#Abs & ~#App & ~#Var) -//│ 'e <: 'rhs1 & (Abs & 'b | App & 'c | Var & 'd | ~#Abs & ~#App & ~#Var) -//│ 'c <: {lhs: 'rhs0, rhs: 'rhs0} -//│ 'rhs <: 'a & 'rhs2 & 'rhs3 -//│ 'rhs3 <: Abs & {rhs: 'rhs3} | App & {lhs: 'rhs3, rhs: 'rhs3} | Var | ~Abs & ~App & ~Var -//│ 'rhs2 <: 'rhs0 & 'rhs1 -//│ 'rhs1 <: Abs & {lhs: Var, rhs: 'rhs1} | App & {lhs: 'rhs1, rhs: 'rhs1} | Var +//│ stepByValue: (Abs | App & 'a | Var) -> (None | Some & { +//│ value: Var & {name: string} | 'rhs | App & { +//│ lhs: Var & {name: string} | 'rhs | App & {lhs: 'lhs, rhs: Var & {name: string} | 'rhs | 'b | 'c | 'd | 'e} | 'b | 'c | 'd | 'e, +//│ rhs: 'rhs +//│ } | App & {lhs: 'lhs, rhs: Var & {name: string} | 'rhs | 'b | 'c | 'd | 'e} | 'b | 'c | 'd | 'e +//│ }) +//│ where +//│ 'a <: {lhs: 'lhs, rhs: 'rhs} +//│ 'lhs <: Abs & {rhs: Abs & 'c | App & 'f | Var & 'b | 'e & ~#Abs & ~#App & ~#Var} | Abs & ~#Abs | App & 'a | Var +//│ 'c :> Abs & { +//│ lhs: Var & {name: string}, +//│ rhs: Var & {name: string} | 'rhs0 | 'rhs | 'b | 'c | 'd | 'e +//│ } +//│ <: Abs & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'c & 'g | App & 'h & 'f | Var & 'b} & 'g | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'c & 'g | App & 'h & 'f | Var & 'b} & 'b | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'c & 'g | App & 'h & 'f | Var & 'b} & 'e & ~#Var | 'h & (App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'c & 'g | App & 'h & 'f | Var & 'b} & 'f | App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'c & 'g | App & 'h & 'f | Var & 'b} & 'e & ~#App) +//│ 'rhs0 :> Var & {name: string} | 'rhs | 'b | 'c | 'd | 'e +//│ 'd :> Var & {name: string} | 'rhs | 'b | 'c | 'e | Abs & {lhs: Var & {name: string}, rhs: 'rhs0} | App & { +//│ lhs: Var & {name: string} | 'rhs | 'b | 'c | 'd | 'e, +//│ rhs: Var & {name: string} | 'rhs | 'b | 'c | 'd | 'e +//│ } +//│ 'rhs <: Abs & 'c & 'g & 'i | App & 'a & 'h & 'f & 'j | Var & 'b +//│ 'f <: { +//│ lhs: Abs & 'c | App & 'f | Var & 'b | 'e & ~#Abs & ~#App & ~#Var, +//│ rhs: Abs & 'c | App & 'f | Var & 'b | 'e & ~#Abs & ~#App & ~#Var +//│ } +//│ 'b :> Var & {name: string} +//│ <: Var | 'h & (App & {name: anything} & 'f | App & {name: anything} & 'e & ~#App) | 'g & (Abs & {name: anything} & 'e & ~#Abs | Abs & {name: anything} & 'c) +//│ 'e <: Var & ~#Var | Var & 'b | 'h & (App & ~#App | App & 'f) | 'g & (Abs & ~#Abs | Abs & 'c) +//│ 'i <: {lhs: anything, rhs: Abs & 'i | App & 'j | Var | ~Abs & ~App & ~Var} +//│ 'j <: { +//│ lhs: Abs & 'i | App & 'j | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'i | App & 'j | Var | ~Abs & ~App & ~Var +//│ } +//│ 'g <: {lhs: Var, rhs: Abs & 'g | App & 'h | Var} +//│ 'h <: {lhs: Abs & 'g | App & 'h | Var, rhs: Abs & 'g | App & 'h | Var} //│ = [Function: stepByValue] fun showStepByValue(t) = @@ -463,20 +580,36 @@ fun showStepByValue(t) = Some(t) then showTerm(t) None then "stuck" ) -//│ showStepByValue: ('rhs & (Abs | App & 'a | Var)) -> string +//│ showStepByValue: (Abs & 'a | App & 'b & 'c | Var) -> string //│ where -//│ 'a <: {lhs: 'lhs & 'rhs0 & (Abs & {rhs: 'rhs1} | Abs & ~#Abs | App & 'a | Var), rhs: 'lhs & 'rhs0 & 'rhs2 & 'rhs3 & (Abs | App & 'a | Var)} -//│ 'rhs2 <: Abs & {rhs: 'rhs2} | App & {lhs: 'rhs2, rhs: 'rhs2} | Var | ~Abs & ~App & ~Var -//│ 'rhs1 <: Abs & 'b | App & 'c | Var & 'd | 'e & ~#Abs & ~#App & ~#Var -//│ 'b <: 'lhs & 'rhs0 & 'rhs4 & (Abs & {lhs: Var & {name: string} | ~Var, rhs: 'rhs3} | App & {lhs: Var & {name: string} | ~Var, rhs: 'rhs3} & 'c | Var & {lhs: Var & {name: string} | ~Var, rhs: 'rhs3} & 'd | {lhs: Var & {name: string} | ~Var, rhs: 'rhs3} & 'e & ~#Abs & ~#App & ~#Var) -//│ 'd <: 'lhs & 'rhs0 & 'rhs4 & (Abs & {name: anything} & 'b | App & {name: anything} & 'c | Var | {name: anything} & 'e & ~#Abs & ~#App & ~#Var) -//│ 'e <: 'lhs & 'rhs0 & 'rhs4 & (Abs & 'b | App & 'c | Var & 'd | ~#Abs & ~#App & ~#Var) -//│ 'c <: {lhs: 'rhs1, rhs: 'rhs1} -//│ 'rhs3 <: 'rhs1 & 'rhs4 -//│ 'rhs4 <: Abs & {lhs: Var, rhs: 'rhs4} | App & {lhs: 'rhs4, rhs: 'rhs4} | Var -//│ 'lhs <: Abs & {lhs: 'rhs0, rhs: 'rhs0} | ~Abs -//│ 'rhs0 <: Abs & {lhs: 'rhs0, rhs: 'rhs0} | App & {lhs: 'lhs & 'rhs0, rhs: 'rhs0} | Var -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs & (Abs & {lhs: 'rhs, rhs: 'rhs} | ~#Abs), rhs: 'rhs} | Var +//│ 'c <: { +//│ lhs: App & 'c & 'd | Var | 'e & (Abs & {rhs: Abs & 'f | App & 'g | Var & 'h | 'i & ~#Abs & ~#App & ~#Var} | Abs & ~#Abs), +//│ rhs: Abs & 'f & 'j & 'e & 'k | App & 'c & 'l & 'g & 'd & 'm | Var & 'h +//│ } +//│ 'k <: {lhs: anything, rhs: Abs & 'k | App & 'm | Var | ~Abs & ~App & ~Var} +//│ 'm <: { +//│ lhs: Abs & 'k | App & 'm | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'k | App & 'm | Var | ~Abs & ~App & ~Var +//│ } +//│ 'f <: Abs & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'f & 'j | App & 'l & 'g | Var & 'h} & 'j & 'e | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'f & 'j | App & 'l & 'g | Var & 'h} & 'h | Var & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'f & 'j | App & 'l & 'g | Var & 'h} & 'i & ~#Var | 'l & 'd & (App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'f & 'j | App & 'l & 'g | Var & 'h} & 'g | App & {lhs: Var & {name: string} | ~Var, rhs: Abs & 'f & 'j | App & 'l & 'g | Var & 'h} & 'i & ~#App) +//│ 'g <: { +//│ lhs: Abs & 'f | App & 'g | Var & 'h | 'i & ~#Abs & ~#App & ~#Var, +//│ rhs: Abs & 'f | App & 'g | Var & 'h | 'i & ~#Abs & ~#App & ~#Var +//│ } +//│ 'h <: Var | 'l & 'd & (App & {name: anything} & 'g | App & {name: anything} & 'i & ~#App) | 'j & 'e & (Abs & {name: anything} & 'i & ~#Abs | Abs & {name: anything} & 'f) +//│ 'i <: Var & ~#Var | Var & 'h | 'l & 'd & (App & ~#App | App & 'g) | 'j & 'e & (Abs & ~#Abs | Abs & 'f) +//│ 'j <: {lhs: Var, rhs: Abs & 'j | App & 'l | Var} +//│ 'l <: {lhs: Abs & 'j | App & 'l | Var, rhs: Abs & 'j | App & 'l | Var} +//│ 'd <: { +//│ lhs: App & 'd | Var | 'e & (Abs & ~#Abs | Abs & 'e), +//│ rhs: Abs & 'e | App & 'd | Var +//│ } +//│ 'e <: {lhs: Abs & 'e | App & 'd | Var, rhs: Abs & 'e | App & 'd | Var} +//│ 'a <: {lhs: Abs & 'a | App & 'b | Var, rhs: Abs & 'a | App & 'b | Var} +//│ 'b <: { +//│ lhs: App & 'b | Var | 'a & (Abs & 'a | Abs & ~#Abs), +//│ rhs: Abs & 'a | App & 'b | Var +//│ } //│ = [Function: showStepByValue] showStepByValue(Var("x")) @@ -498,9 +631,14 @@ fun equalTerm(a, b) = Abs(la, ra) and b is Abs(lb, rb) then equalTerm(la, lb) && equalTerm(ra, rb) App(la, ra) and b is App(lb, rb) then equalTerm(la, lb) && equalTerm(ra, rb) _ then false -//│ equalTerm: ('rhs, 'rhs0,) -> bool +//│ equalTerm: (Abs & 'a | App & 'a | Var | ~Abs & ~App & ~Var, Abs & 'b | App & 'b | Var | ~Abs & ~App & ~Var,) -> bool //│ where -//│ 'rhs0 <: Abs & 'a | App & 'a | Var | ~Abs & ~App & ~Var -//│ 'a <: {lhs: 'rhs0, rhs: 'rhs0} -//│ 'rhs <: Abs & {lhs: 'rhs, rhs: 'rhs} | App & {lhs: 'rhs, rhs: 'rhs} | Var | ~Abs & ~App & ~Var +//│ 'b <: { +//│ lhs: Abs & 'b | App & 'b | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'b | App & 'b | Var | ~Abs & ~App & ~Var +//│ } +//│ 'a <: { +//│ lhs: Abs & 'a | App & 'a | Var | ~Abs & ~App & ~Var, +//│ rhs: Abs & 'a | App & 'a | Var | ~Abs & ~App & ~Var +//│ } //│ = [Function: equalTerm] diff --git a/shared/src/test/diff/tricky/Pottier.fun b/shared/src/test/diff/tricky/Pottier.fun index cc0bcee14..31db27735 100644 --- a/shared/src/test/diff/tricky/Pottier.fun +++ b/shared/src/test/diff/tricky/Pottier.fun @@ -26,12 +26,14 @@ let rec f = x => y => add (f x.tail y) (f y.tail x) //│ f: 'a -> 'a -> int //│ where //│ 'a <: {tail: 'a} -//│ f: 'a -> 'a -> int +//│ f: 'a -> 'b -> int //│ where -//│ 'a <: {tail: 'a} -//│ f: 'a -> 'a -> int +//│ 'a <: {tail: 'a} & 'b +//│ 'b <: {tail: 'a} +//│ f: 'a -> 'b -> int //│ where -//│ 'a <: {tail: 'a} +//│ 'a <: {tail: 'a} & 'b +//│ 'b <: {tail: 'a} let f = x => y => if true then { l: x; r: y } else { l: y; r: x } // 2-crown //│ f: 'a -> 'a -> {l: 'a, r: 'a} diff --git a/shared/src/test/diff/ucs/AppSplits.mls b/shared/src/test/diff/ucs/AppSplits.mls new file mode 100644 index 000000000..f6f81f173 --- /dev/null +++ b/shared/src/test/diff/ucs/AppSplits.mls @@ -0,0 +1,76 @@ +:NewDefs + + +fun foo(x) = x > 1 +//│ fun foo: Num -> Bool + +:pe // TODO +:e +if foo of + 0 then "a" + 1 then "b" +//│ ╔══[PARSE ERROR] Unexpected 'then' keyword here +//│ ║ l.10: 0 then "a" +//│ ╙── ^^^^ +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead +//│ ║ l.9: if foo of +//│ ║ ^^^^^^ +//│ ║ l.10: 0 then "a" +//│ ║ ^^^^ +//│ ╟── Note: 'if' expression starts here: +//│ ║ l.9: if foo of +//│ ╙── ^^ +//│ ╔══[ERROR] The case when this is false is not handled: foo(0,) +//│ ║ l.9: if foo of +//│ ║ ^^^^^^ +//│ ║ l.10: 0 then "a" +//│ ╙── ^^^^ +//│ error +//│ Code generation encountered an error: +//│ if expression was not desugared + +:pe // TODO +:e +if foo of 1, + 0 then "a" + 1 then "b" +//│ ╔══[PARSE ERROR] Unexpected 'then'/'else' clause +//│ ║ l.35: 0 then "a" +//│ ║ ^^^^^^^^^^ +//│ ║ l.36: 1 then "b" +//│ ╙── ^^^^^^^^^^^^ +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found application instead +//│ ║ l.34: if foo of 1, +//│ ║ ^^^^^^^^^ +//│ ║ l.35: 0 then "a" +//│ ║ ^^ +//│ ╟── Note: 'if' expression starts here: +//│ ║ l.34: if foo of 1, +//│ ╙── ^^ +//│ ╔══[ERROR] The case when this is false is not handled: foo(1, undefined,) +//│ ║ l.34: if foo of 1, +//│ ║ ^^^^^^^^^ +//│ ║ l.35: 0 then "a" +//│ ╙── ^^ +//│ error +//│ Code generation encountered an error: +//│ if expression was not desugared + +:pe // TODO +:e +if foo + (0) then "a" + (1) then "b" +//│ ╔══[PARSE ERROR] Unexpected parenthesis section here +//│ ║ l.63: (1) then "b" +//│ ╙── ^^^ +//│ ╔══[ERROR] The case when this is false is not handled: foo(0,) +//│ ║ l.61: if foo +//│ ║ ^^^ +//│ ║ l.62: (0) then "a" +//│ ╙── ^^^^^ +//│ error +//│ Code generation encountered an error: +//│ if expression was not desugared + + diff --git a/shared/src/test/diff/ucs/Humiliation.mls b/shared/src/test/diff/ucs/Humiliation.mls index 72c293c0b..878fb0537 100644 --- a/shared/src/test/diff/ucs/Humiliation.mls +++ b/shared/src/test/diff/ucs/Humiliation.mls @@ -88,17 +88,17 @@ fun foo(x) = if x is :e :ge fun foo(x) = if x is - (Z(), Z()) then "zeros" - (O(), O()) then "ones" + [Z(), Z()] then "zeros" + [O(), O()] then "ones" //│ ╔══[ERROR] The match is not exhaustive. //│ ║ l.90: fun foo(x) = if x is //│ ║ ^^^^ //│ ╟── The scrutinee at this position misses 1 case. -//│ ║ l.91: (Z(), Z()) then "zeros" +//│ ║ l.91: [Z(), Z()] then "zeros" //│ ║ ^^^ //│ ╟── [Missing Case 1/1] `O` //│ ╟── It first appears here. -//│ ║ l.92: (O(), O()) then "ones" +//│ ║ l.92: [O(), O()] then "ones" //│ ╙── ^^^ //│ foo: anything -> error //│ Code generation encountered an error: diff --git a/shared/src/test/diff/ucs/HygienicBindings.mls b/shared/src/test/diff/ucs/HygienicBindings.mls index 9207fb8dc..5e5d577f9 100644 --- a/shared/src/test/diff/ucs/HygienicBindings.mls +++ b/shared/src/test/diff/ucs/HygienicBindings.mls @@ -136,11 +136,11 @@ h3("anything", "anything", _ => "not me", _ => false) //│ fun h3: forall 'a 'b. (None | Object & 'a & ~#None, 'b, (None | 'a) -> anything, (None | 'a) -> Object) -> ("anyway" | 'b) //│ "anything" | "anyway" //│ res -//│ = [Function: h3] -//│ res //│ = 'not me' //│ res //│ = 'should be me' +//│ res +//│ = 'anyway' // FIXME: Some results are wrong. fun h4(x, y, p) = @@ -155,10 +155,10 @@ h4("anything", "not me", _ => false) //│ fun h4: forall 'a 'b. (None | Object & 'a & ~#None, 'b, (None | 'a) -> Object) -> ("default" | 'b) //│ "default" | "not me" //│ res -//│ = [Function: h4] -//│ res //│ = 'not me' //│ res //│ = 'not me' //│ res //│ = 'should be me' +//│ res +//│ = 'default' diff --git a/shared/src/test/diff/ucs/InterleavedLet.mls b/shared/src/test/diff/ucs/InterleavedLet.mls index ab8f32b37..cb69a5eeb 100644 --- a/shared/src/test/diff/ucs/InterleavedLet.mls +++ b/shared/src/test/diff/ucs/InterleavedLet.mls @@ -227,13 +227,16 @@ fun showList(xs) = //│ })()); //│ }; //│ // End of generated code -//│ showList: 'tail -> string +//│ showList: (Cons & 'a | Nil) -> string //│ where -//│ 'tail <: Cons & {tail: 'tail} | Nil +//│ 'a <: {head: anything, tail: Cons & 'a | Nil} //│ = [Function: showList] let zeroToThree = Cons(0, Cons(1, Cons(2, Cons(3, Nil())))) -//│ zeroToThree: Cons & {head: 0, tail: Cons & {head: 1, tail: Cons & {head: 2, tail: Cons & {head: 3, tail: Nil}}}} +//│ zeroToThree: Cons & { +//│ head: 0, +//│ tail: Cons & {head: 1, tail: Cons & {head: 2, tail: Cons & {head: 3, tail: Nil}}} +//│ } //│ = Cons { //│ head: 0, //│ tail: Cons { head: 1, tail: Cons { head: 2, tail: [Cons] } } @@ -252,18 +255,21 @@ fun mapPartition(f, xs) = let r = res.snd Left(v) then Pair(Cons(v, l), r) Right(v) then Pair(l, Cons(v, r)) -//│ mapPartition: ('head -> (Left & {leftValue: 'leftValue} | Right & {rightValue: 'rightValue}), 'tail,) -> (Pair & {fst: 'fst, snd: 'snd}) +//│ mapPartition: ('head -> (Left & {leftValue: 'leftValue} | Right & {rightValue: 'rightValue}), Cons & 'a | Nil,) -> (Pair & {fst: forall 'b 'c. Nil | 'c | 'b, snd: Nil | Cons & {head: 'rightValue, tail: Nil}}) //│ where -//│ 'snd :> Cons & {head: 'rightValue, tail: 'snd} -//│ 'fst :> Cons & {head: 'leftValue, tail: 'fst} -//│ 'tail <: Cons & {head: 'head, tail: 'tail} | Nil +//│ 'b :> Cons & {head: 'leftValue, tail: forall 'd. Nil | 'd} +//│ 'c :> Cons & {head: 'leftValue, tail: forall 'd. Nil | 'd} +//│ 'a <: {head: 'head, tail: Cons & 'a | Nil} //│ = [Function: mapPartition] mapPartition(x => if x % 2 == 0 then Left(x) else Right(x), zeroToThree) -//│ res: Pair & {fst: 'fst, snd: 'snd} -//│ where -//│ 'snd :> Cons & {head: 0 | 1 | 2 | 3, tail: 'snd} | Nil -//│ 'fst :> Nil | Cons & {head: 0 | 1 | 2 | 3, tail: 'fst} +//│ res: Pair & { +//│ fst: forall 'a 'b. Nil | 'b | 'a, +//│ snd: Nil | Cons & {head: 0 | 1 | 2 | 3, tail: Nil} +//│ } +//│ where +//│ 'a :> Cons & {head: 0 | 1 | 2 | 3, tail: forall 'c. Nil | 'c} +//│ 'b :> Cons & {head: 0 | 1 | 2 | 3, tail: forall 'c. Nil | 'c} //│ = Pair { //│ fst: Cons { head: 0, tail: Cons { head: 2, tail: Nil {} } }, //│ snd: Cons { head: 1, tail: Cons { head: 3, tail: Nil {} } } @@ -276,29 +282,45 @@ fun mapPartition2(f, xs) = Cons(x, xs) and mapPartition(f, xs) is res and res.fst is l and res.snd is r and f(x) is Left(v) then Pair(Cons(v, l), r) Right(v) then Pair(l, Cons(v, r)) -//│ mapPartition2: ('head -> (Left & {leftValue: 'leftValue} | Right & {rightValue: 'rightValue}) & 'head0 -> (Left & {leftValue: 'leftValue0} | Right & {rightValue: 'rightValue0}), Cons & {head: 'head0, tail: 'tail} | Nil,) -> (Pair & {fst: forall 'fst. Cons & {head: 'leftValue0, tail: forall 'fst0. Nil | 'fst0 | Cons & {head: 'leftValue, tail: Nil | 'fst0}} | Nil | 'fst | Cons & {head: 'leftValue, tail: Nil | 'fst}, snd: forall 'snd. Cons & {head: 'rightValue0, tail: forall 'snd0. Nil | 'snd0 | Cons & {head: 'rightValue, tail: Nil | 'snd0}} | Nil | 'snd | Cons & {head: 'rightValue, tail: Nil | 'snd}}) -//│ where -//│ 'snd :> Nil | Cons & {head: 'rightValue, tail: 'snd} -//│ 'snd0 :> Nil | Cons & {head: 'rightValue, tail: 'snd0} -//│ 'fst :> Nil | Cons & {head: 'leftValue, tail: 'fst} -//│ 'fst0 :> Nil | Cons & {head: 'leftValue, tail: 'fst0} -//│ 'tail <: Cons & {head: 'head, tail: 'tail} | Nil +//│ mapPartition2: ('head -> (Left & {leftValue: 'leftValue} | Right & {rightValue: 'rightValue}) & 'head0 -> (Left & {leftValue: 'leftValue0} | Right & {rightValue: 'rightValue0}), Cons & {head: 'head0, tail: Cons & 'a | Nil} | Nil,) -> (Pair & { +//│ fst: forall 'b. Cons & { +//│ head: 'leftValue0, +//│ tail: forall 'c. Nil | 'c | Cons & {head: 'leftValue, tail: forall 'fst. Nil | 'fst} +//│ } | Nil | 'b | Cons & {head: 'leftValue, tail: forall 'fst0. Nil | 'fst0}, +//│ snd: Cons & {head: 'rightValue0, tail: Nil | Cons & {head: 'rightValue, tail: Nil}} | Nil | Cons & {head: 'rightValue, tail: Nil} +//│ }) +//│ where +//│ 'b :> Cons & {head: 'leftValue, tail: forall 'fst0. Nil | 'fst0} +//│ 'fst0 :> forall 'd. Nil | 'd +//│ 'd :> Cons & {head: 'leftValue, tail: forall 'fst0. Nil | 'fst0} +//│ 'c :> Cons & {head: 'leftValue, tail: forall 'fst. Nil | 'fst} +//│ 'fst :> forall 'e. Nil | 'e +//│ 'e :> Cons & {head: 'leftValue, tail: forall 'fst. Nil | 'fst} +//│ 'a <: {head: 'head, tail: Cons & 'a | Nil} //│ = [Function: mapPartition2] mapPartition2(x => if x % 2 == 0 then Left(x) else Right(x), zeroToThree) -//│ res: Pair & {fst: forall 'fst. Cons & {head: 0, tail: forall 'fst0. Nil | 'fst0 | Cons & {head: 1 | 2 | 3, tail: Nil | 'fst0}} | Nil | 'fst | Cons & {head: 1 | 2 | 3, tail: Nil | 'fst}, snd: forall 'snd. Cons & {head: 0, tail: forall 'snd0. Nil | 'snd0 | Cons & {head: 1 | 2 | 3, tail: Nil | 'snd0}} | Nil | 'snd | Cons & {head: 1 | 2 | 3, tail: Nil | 'snd}} -//│ where -//│ 'snd :> Nil | Cons & {head: 1 | 2 | 3, tail: 'snd} -//│ 'snd0 :> Nil | Cons & {head: 1 | 2 | 3, tail: 'snd0} -//│ 'fst :> Nil | Cons & {head: 1 | 2 | 3, tail: 'fst} -//│ 'fst0 :> Nil | Cons & {head: 1 | 2 | 3, tail: 'fst0} +//│ res: Pair & { +//│ fst: forall 'a. Cons & { +//│ head: 0, +//│ tail: forall 'b. Nil | 'b | Cons & {head: 1 | 2 | 3, tail: forall 'fst. Nil | 'fst} +//│ } | Nil | 'a | Cons & {head: 1 | 2 | 3, tail: forall 'fst0. Nil | 'fst0}, +//│ snd: Cons & {head: 0, tail: Nil | Cons & {head: 1 | 2 | 3, tail: Nil}} | Nil | Cons & {head: 1 | 2 | 3, tail: Nil} +//│ } +//│ where +//│ 'a :> Cons & {head: 1 | 2 | 3, tail: forall 'fst0. Nil | 'fst0} +//│ 'fst0 :> forall 'c. Nil | 'c +//│ 'c :> Cons & {head: 1 | 2 | 3, tail: forall 'fst0. Nil | 'fst0} +//│ 'b :> Cons & {head: 1 | 2 | 3, tail: forall 'fst. Nil | 'fst} +//│ 'fst :> forall 'd. Nil | 'd +//│ 'd :> Cons & {head: 1 | 2 | 3, tail: forall 'fst. Nil | 'fst} //│ = Pair { //│ fst: Cons { head: 0, tail: Cons { head: 2, tail: Nil {} } }, //│ snd: Cons { head: 1, tail: Cons { head: 3, tail: Nil {} } } //│ } fun log(x) = () -//│ log: anything -> () +//│ log: anything -> undefined //│ = [Function: log] fun mn(a) = diff --git a/shared/src/test/diff/ucs/JSON.mls b/shared/src/test/diff/ucs/JSON.mls index 62c9a44f4..245463cbc 100644 --- a/shared/src/test/diff/ucs/JSON.mls +++ b/shared/src/test/diff/ucs/JSON.mls @@ -8,10 +8,10 @@ let asNativeString: anything => { length: Int, charCodeAt: Int => Int, charAt: I let StringInstance: { fromCharCode: Int => Str } = String // We will validate our implementation with the built-in `JSON.parse`. let JSON: { parse: Str => anything, stringify: anything => Str } -//│ let String: nothing //│ let asNativeString: anything -> {charAt: Int -> Str, charCodeAt: Int -> Int, length: Int, slice: Int -> Str} //│ let StringInstance: {fromCharCode: Int -> Str} //│ let JSON: {parse: Str -> anything, stringify: anything -> Str} +//│ let String: nothing //│ String //│ = //│ asNativeString @@ -205,7 +205,7 @@ toString of JsonObject of insert(Empty, "hello", JsonString("world")) //│ res //│ = '{ hello: "world" }' -class Scanner(source: Str, at: Int) { +class Scanner(source: Str, val at: Int) { fun peek: Option[Str] = if at < strlen(source) then Some(getCharAtIndex(source, at)) else None fun advance: Scanner = @@ -245,7 +245,7 @@ fun expect(scanner, ch) = eq(ch)(ch') then ParseSuccess((), scanner.advance) else ParseFailure(concat4("expect '", ch, "' but found ", ch'), scanner) None then ParseFailure(concat3("expect '", ch, "' but found EOF"), scanner) -//│ fun expect: (Scanner & {advance: Scanner}, Str) -> (ParseFailure | ParseSuccess[[]]) +//│ fun expect: (Scanner & {advance: Scanner}, Str) -> (ParseFailure | ParseSuccess[()]) fun expectWord(scanner, word, result) = if diff --git a/shared/src/test/diff/ucs/LitUCS.mls b/shared/src/test/diff/ucs/LitUCS.mls index 095d00af4..6c77687f0 100644 --- a/shared/src/test/diff/ucs/LitUCS.mls +++ b/shared/src/test/diff/ucs/LitUCS.mls @@ -16,6 +16,9 @@ fun test(x: 0 | A) = if x === 0 then 0 x is A then A +//│ ╔══[ERROR] Module 'A' does not support equality comparison because it does not have a parameter list +//│ ║ l.17: x === 0 then 0 +//│ ╙── ^^^^^^^ //│ ╔══[ERROR] Type mismatch in `case` expression: //│ ║ l.18: x is A then A //│ ║ ^^^^^^^^^^^^^ @@ -39,22 +42,26 @@ fun test2(x) = :e test2(0) //│ ╔══[ERROR] Type mismatch in application: -//│ ║ l.40: test2(0) +//│ ║ l.43: test2(0) //│ ║ ^^^^^^^^ //│ ╟── integer literal of type `0` is not an instance of type `A` -//│ ║ l.40: test2(0) +//│ ║ l.43: test2(0) //│ ║ ^ //│ ╟── Note: constraint arises from class pattern: -//│ ║ l.36: x is A then A +//│ ║ l.39: x is A then A //│ ║ ^ //│ ╟── from reference: -//│ ║ l.36: x is A then A +//│ ║ l.39: x is A then A //│ ╙── ^ //│ 0 | A | error //│ res //│ = 0 +:e test2(A) -//│ 0 | A +//│ ╔══[ERROR] Module 'A' does not support equality comparison because it does not have a parameter list +//│ ║ l.61: test2(A) +//│ ╙── ^^^^^^^^ +//│ 0 | A | error //│ res //│ = A { class: [class A] } diff --git a/shared/src/test/diff/ucs/NestedBranches.mls b/shared/src/test/diff/ucs/NestedBranches.mls index 389e6062f..9a45add38 100644 --- a/shared/src/test/diff/ucs/NestedBranches.mls +++ b/shared/src/test/diff/ucs/NestedBranches.mls @@ -1,6 +1,7 @@ :NewParser :NewDefs + class Some[A](val value: A) module None class Left[A](val leftValue: A) @@ -16,6 +17,7 @@ class Pair[A, B](val fst: A, val snd: B) //│ class Cons[A](head: A, tail: Cons[A] | Nil) //│ class Pair[A, B](fst: A, snd: B) + fun optionApply(x, y, f) = if x is Some(xv) and y is @@ -95,43 +97,43 @@ mapPartition(f, zeroToThree) //│ res //│ = Pair {} -// TODO make this one work (needs tuple support) +:e // TODO make this one work (needs tuple support) fun mapPartition(f, xs) = if xs is - Nil then (Nil, Nil) - Cons(x, xs) and mapPartition(f, xs) is (l, r) and f(x) is - Left(v) then (Cons(v, l), r) - Right(v) then (l, Cons(v, r)) + Nil then [Nil, Nil] + Cons(x, xs) and mapPartition(f, xs) is [l, r] and f(x) is + Left(v) then [Cons(v, l), r] + Right(v) then [l, Cons(v, r)] //│ ╔══[ERROR] type identifier not found: Tuple#2 //│ ╙── //│ ╔══[ERROR] Type mismatch in definition: -//│ ║ l.99: fun mapPartition(f, xs) = if xs is -//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.100: Nil then (Nil, Nil) +//│ ║ l.101: fun mapPartition(f, xs) = if xs is +//│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +//│ ║ l.102: Nil then [Nil, Nil] //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.101: Cons(x, xs) and mapPartition(f, xs) is (l, r) and f(x) is +//│ ║ l.103: Cons(x, xs) and mapPartition(f, xs) is [l, r] and f(x) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.102: Left(v) then (Cons(v, l), r) +//│ ║ l.104: Left(v) then [Cons(v, l), r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.103: Right(v) then (l, Cons(v, r)) +//│ ║ l.105: Right(v) then [l, Cons(v, r)] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── tuple literal of type `[Nil, Nil]` is not an instance of type `Object` -//│ ║ l.100: Nil then (Nil, Nil) -//│ ║ ^^^^^^^^ +//│ ║ l.102: Nil then [Nil, Nil] +//│ ║ ^^^^^^^^^^ //│ ╟── Note: constraint arises from `case` expression: -//│ ║ l.101: Cons(x, xs) and mapPartition(f, xs) is (l, r) and f(x) is +//│ ║ l.103: Cons(x, xs) and mapPartition(f, xs) is [l, r] and f(x) is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.102: Left(v) then (Cons(v, l), r) +//│ ║ l.104: Left(v) then [Cons(v, l), r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.103: Right(v) then (l, Cons(v, r)) +//│ ║ l.105: Right(v) then [l, Cons(v, r)] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── from application: -//│ ║ l.101: Cons(x, xs) and mapPartition(f, xs) is (l, r) and f(x) is +//│ ║ l.103: Cons(x, xs) and mapPartition(f, xs) is [l, r] and f(x) is //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ fun mapPartition: forall 'A. (anything, Cons['A] | Nil) -> (error | [Nil, Nil]) //│ Code generation encountered an error: //│ unknown match case: Tuple#2 -// TODO +:re // TODO mapPartition(f, zeroToThree) //│ error | [Nil, Nil] //│ res @@ -145,44 +147,45 @@ mapPartition(f, zeroToThree) :e :ge fun mapPartition(f, xs) = if xs is - Nil then (Nil, Nil) - Cons(x, xs) and mapPartition(f, xs) is (l, r) - and f(x) is Left(v) then (Cons(v, l), r) - Right(v) then (l, Cons(v, r)) + Nil then [Nil, Nil] + Cons(x, xs) and mapPartition(f, xs) is [l, r] + and f(x) is Left(v) then [Cons(v, l), r] + Right(v) then [l, Cons(v, r)] //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here -//│ ║ l.151: Right(v) then (l, Cons(v, r)) +//│ ║ l.153: Right(v) then [l, Cons(v, r)] //│ ╙── ^^^^ //│ ╔══[WARNING] Paren-less applications should use the 'of' keyword -//│ ║ l.150: and f(x) is Left(v) then (Cons(v, l), r) +//│ ║ l.152: and f(x) is Left(v) then [Cons(v, l), r] //│ ║ ^^^^^^^^^^^^^^^ -//│ ║ l.151: Right(v) then (l, Cons(v, r)) +//│ ║ l.153: Right(v) then [l, Cons(v, r)] //│ ╙── ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╔══[ERROR] type identifier not found: Tuple#2 //│ ╙── //│ ╔══[ERROR] Type mismatch in definition: -//│ ║ l.147: fun mapPartition(f, xs) = if xs is +//│ ║ l.149: fun mapPartition(f, xs) = if xs is //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.148: Nil then (Nil, Nil) +//│ ║ l.150: Nil then [Nil, Nil] //│ ║ ^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.149: Cons(x, xs) and mapPartition(f, xs) is (l, r) +//│ ║ l.151: Cons(x, xs) and mapPartition(f, xs) is [l, r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.150: and f(x) is Left(v) then (Cons(v, l), r) +//│ ║ l.152: and f(x) is Left(v) then [Cons(v, l), r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.151: Right(v) then (l, Cons(v, r)) +//│ ║ l.153: Right(v) then [l, Cons(v, r)] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── tuple literal of type `[Nil, Nil]` is not an instance of type `Object` -//│ ║ l.148: Nil then (Nil, Nil) -//│ ║ ^^^^^^^^ +//│ ║ l.150: Nil then [Nil, Nil] +//│ ║ ^^^^^^^^^^ //│ ╟── Note: constraint arises from `case` expression: -//│ ║ l.149: Cons(x, xs) and mapPartition(f, xs) is (l, r) +//│ ║ l.151: Cons(x, xs) and mapPartition(f, xs) is [l, r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.150: and f(x) is Left(v) then (Cons(v, l), r) +//│ ║ l.152: and f(x) is Left(v) then [Cons(v, l), r] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -//│ ║ l.151: Right(v) then (l, Cons(v, r)) +//│ ║ l.153: Right(v) then [l, Cons(v, r)] //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ╟── from application: -//│ ║ l.149: Cons(x, xs) and mapPartition(f, xs) is (l, r) +//│ ║ l.151: Cons(x, xs) and mapPartition(f, xs) is [l, r] //│ ╙── ^^^^^^^^^^^^^^^^^^^ //│ fun mapPartition: forall 'A. (anything, Cons['A] | Nil) -> (error | [Nil, Nil]) //│ Code generation encountered an error: //│ unknown match case: Tuple#2 + diff --git a/shared/src/test/diff/ucs/NestedPattern.mls b/shared/src/test/diff/ucs/NestedPattern.mls index 5d9b919bd..c292de557 100644 --- a/shared/src/test/diff/ucs/NestedPattern.mls +++ b/shared/src/test/diff/ucs/NestedPattern.mls @@ -41,8 +41,8 @@ fun crazy(v) = :e fun f(x) = if x is - (0, 0) then "zeros" - (1, 1) then "ones" + [0, 0] then "zeros" + [1, 1] then "ones" _ then "bruh" //│ ╔══[ERROR] type identifier not found: Tuple#2 //│ ╙── @@ -51,9 +51,9 @@ fun f(x) = :e fun f(x) = if x is - (0, 0) then "zeros" - (1, 1) then "ones" - (y, 1) then x + [0, 0] then "zeros" + [1, 1] then "ones" + [y, 1] then x _ then "que?" //│ ╔══[ERROR] type identifier not found: Tuple#2 //│ ╙── @@ -62,7 +62,7 @@ fun f(x) = :e fun f(p) = if p is - Some((x, y)) then x + y + Some([x, y]) then x + y None() then 0 //│ ╔══[ERROR] type identifier not found: Tuple#2 //│ ╙── diff --git a/shared/src/test/diff/ucs/SimpleUCS.mls b/shared/src/test/diff/ucs/SimpleUCS.mls index 80906e9ab..d74a1b06e 100644 --- a/shared/src/test/diff/ucs/SimpleUCS.mls +++ b/shared/src/test/diff/ucs/SimpleUCS.mls @@ -338,7 +338,9 @@ fun p(e, context) = Some(BoolVal(v)) then Right(v) Lit(IntVal(v)) then Left(v) Lit(BoolVal(v)) then Right(v) -//│ p: (Lit & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}} | Var & {name: 'name}, {get: 'name -> (Some & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}})},) -> (Left & {leftValue: 'value0} | Right & {rightValue: 'value}) +//│ p: (Lit & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}} | Var & {name: 'name}, { +//│ get: 'name -> (Some & {value: BoolVal & {value: 'value} | IntVal & {value: 'value0}}) +//│ },) -> (Left & {leftValue: 'value0} | Right & {rightValue: 'value}) //│ = [Function: p1] class Nil() @@ -354,7 +356,7 @@ fun f(x) = 0 :: Nil() then "oh" //│ ╔══[ERROR] Cannot find operator `::` in the context -//│ ║ l.354: 0 :: +//│ ║ l.356: 0 :: //│ ╙── ^^ //│ f: anything -> error //│ Code generation encountered an error: diff --git a/shared/src/test/diff/ucs/SplitAfterOp.mls b/shared/src/test/diff/ucs/SplitAfterOp.mls index d79edec27..09e828989 100644 --- a/shared/src/test/diff/ucs/SplitAfterOp.mls +++ b/shared/src/test/diff/ucs/SplitAfterOp.mls @@ -149,12 +149,12 @@ fun toEnglish(x) = //│ ╔══[PARSE ERROR] Unexpected end of indented block; an expression was expected here //│ ║ l.145: else 1 //│ ╙── ^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead //│ ║ l.144: if x == //│ ║ ^^^^ //│ ║ l.145: else 1 //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.144: if x == //│ ╙── ^^ //│ ╔══[ERROR] The case when this is false is not handled: ==(x,)(undefined,) diff --git a/shared/src/test/diff/ucs/ThenIndent.mls b/shared/src/test/diff/ucs/ThenIndent.mls new file mode 100644 index 000000000..1ca90defc --- /dev/null +++ b/shared/src/test/diff/ucs/ThenIndent.mls @@ -0,0 +1,31 @@ +:NewDefs + + +// FIXME +x => if x == + 0 + then "a" + _ then "b" +//│ ╔══[PARSE ERROR] Unexpected indented block here +//│ ║ l.7: then "a" +//│ ║ ^^^^^^^^^^^^ +//│ ║ l.8: _ then "b" +//│ ╙── ^^ +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead +//│ ║ l.5: x => if x == +//│ ║ ^^^^ +//│ ║ l.6: 0 +//│ ║ ^^^ +//│ ╟── Note: 'if' expression starts here: +//│ ║ l.5: x => if x == +//│ ╙── ^^ +//│ ╔══[ERROR] The case when this is false is not handled: ==(x, {0},) +//│ ║ l.5: x => if x == +//│ ║ ^^^^ +//│ ║ l.6: 0 +//│ ╙── ^^^ +//│ anything -> error +//│ Code generation encountered an error: +//│ if expression was not desugared + + diff --git a/shared/src/test/diff/ucs/TrivialIf.mls b/shared/src/test/diff/ucs/TrivialIf.mls index 2d160cb73..0fa422ee8 100644 --- a/shared/src/test/diff/ucs/TrivialIf.mls +++ b/shared/src/test/diff/ucs/TrivialIf.mls @@ -78,12 +78,12 @@ fun foo(x) = if x is Some of //│ ╔══[PARSE ERROR] Unexpected 'then' keyword here //│ ║ l.76: 0 then 0 //│ ╙── ^^^^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead //│ ║ l.75: fun foo(x) = if x is Some of //│ ║ ^^^^^^^^^^^^ //│ ║ l.76: 0 then 0 //│ ║ ^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.75: fun foo(x) = if x is Some of //│ ╙── ^^ //│ foo: (Some & {value: 0}) -> undefined diff --git a/shared/src/test/diff/ucs/WeirdIf.mls b/shared/src/test/diff/ucs/WeirdIf.mls index 8e76a6124..5f4d44439 100644 --- a/shared/src/test/diff/ucs/WeirdIf.mls +++ b/shared/src/test/diff/ucs/WeirdIf.mls @@ -75,12 +75,12 @@ fun f(x) = //│ ╔══[PARSE ERROR] Unexpected end of indented block; an expression was expected here //│ ║ l.71: else "bruh" //│ ╙── ^ -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application instead //│ ║ l.70: if x === //│ ║ ^^^^^ //│ ║ l.71: else "bruh" //│ ║ ^^^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.70: if x === //│ ╙── ^^ //│ ╔══[ERROR] The case when this is false is not handled: ===(x, undefined,) diff --git a/shared/src/test/diff/ucs/zipWith.mls b/shared/src/test/diff/ucs/zipWith.mls index 42398ff53..bc15416c2 100644 --- a/shared/src/test/diff/ucs/zipWith.mls +++ b/shared/src/test/diff/ucs/zipWith.mls @@ -45,12 +45,12 @@ fun zipWith_wrong(f, xs, ys) = and zipWith_wrong(f, xs, ys) is Some(tail) then Some(Cons(f(x, y), tail)) else None -//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause; found operator application followed by newline instead +//│ ╔══[PARSE ERROR] Expected 'then'/'else' clause after 'if'; found operator application followed by newline instead //│ ║ l.43: if xs is Cons(x, xs) //│ ║ ^^^^^^^^^^^^^^^^^ //│ ║ l.44: and ys is Cons(y, ys) //│ ║ ^^ -//│ ╟── Note: 'if' expression started here: +//│ ╟── Note: 'if' expression starts here: //│ ║ l.43: if xs is Cons(x, xs) //│ ╙── ^^ //│ ╔══[PARSE ERROR] Unexpected operator in expression position @@ -70,7 +70,7 @@ fun zipWith_wrong(f, xs, ys) = //│ ║ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ //│ ║ l.47: else None //│ ╙── ^^^^^^^^^^^ -//│ fun zipWith_wrong: (anything, anything, anything) -> undefined +//│ fun zipWith_wrong: (anything, anything, anything) -> () // FIXME parsing diff --git a/shared/src/test/scala/mlscript/DiffTests.scala b/shared/src/test/scala/mlscript/DiffTests.scala index 48a543462..e22bfd536 100644 --- a/shared/src/test/scala/mlscript/DiffTests.scala +++ b/shared/src/test/scala/mlscript/DiffTests.scala @@ -39,6 +39,7 @@ abstract class ModeType { def expectCodeGenErrors: Bool def showRepl: Bool def allowEscape: Bool + def mono: Bool } class DiffTests @@ -159,13 +160,14 @@ class DiffTests expectCodeGenErrors: Bool = false, showRepl: Bool = false, allowEscape: Bool = false, + mono: Bool = false, // noProvs: Bool = false, ) extends ModeType { def isDebugging: Bool = dbg || dbgSimplif } val defaultMode = Mode() - var parseOnly = basePath.headOption.contains("parser") || basePath.headOption.contains("compiler") + var parseOnly = basePath.headOption.contains("parser") var allowTypeErrors = false var allowParseErrors = false var showRelativeLineNums = false @@ -254,8 +256,9 @@ class DiffTests case "dv" => mode.copy(debugVariance = true) case "ge" => mode.copy(expectCodeGenErrors = true) case "re" => mode.copy(expectRuntimeErrors = true) - case "ShowRepl" => mode.copy(showRepl = true) + case "r" | "showRepl" => mode.copy(showRepl = true) case "escape" => mode.copy(allowEscape = true) + case "mono" => {mode.copy(mono = true)} case "exit" => out.println(exitMarker) ls.dropWhile(_ =:= exitMarker).tails.foreach { @@ -555,9 +558,9 @@ class DiffTests // (Nil, Nil, N) (Nil, Nil, S(p.tops.collect { // case LetS(isRec, pat, bod) => ("res", Nil, Nil, false) - case NuFunDef(isLet @ S(_), nme, snme, tparams, bod) => - (nme.name + " ", nme.name :: Nil, Nil, false) - case t: Term => ("res ", "res" :: Nil, Nil, false) + case NuFunDef(isLet, nme, snme, tparams, bod) => + (nme.name + " ", nme.name :: Nil, Nil, false, isLet.isEmpty) + case t: Term => ("res ", "res" :: Nil, Nil, false, false) })) } else { @@ -684,8 +687,8 @@ class DiffTests // all `Def`s and `Term`s are processed here // generate typescript types if generateTsDeclarations flag is // set in the mode - // The tuple type means: (, , , ) - val typerResults: Ls[(Str, Ls[Str], Ls[Str], Bool)] = newDefsResults getOrElse stmts.map { stmt => + // The tuple type means: (, , , , ) + val typerResults: Ls[(Str, Ls[Str], Ls[Str], Bool, Bool)] = newDefsResults getOrElse stmts.map { stmt => // Because diagnostic lines are after the typing results, // we need to cache the diagnostic blocks and add them to the // `typerResults` buffer after the statement has been processed. @@ -771,9 +774,9 @@ class DiffTests } } typingResults match { - case N => ("", Nil, diagnosticLines.toList, false) + case N => ("", Nil, diagnosticLines.toList, false, false) case S(name -> typingLines) => - (name, typingLines, diagnosticLines.toList, typeBeforeDiags) + (name, typingLines, diagnosticLines.toList, typeBeforeDiags, false) } } @@ -871,7 +874,13 @@ class DiffTests } } - def checkReply(replyQueue: mutable.Queue[(ReplHost.Reply, Str)], prefixLength: Int, errorOnly: Boolean = false): Unit = + def checkReply( + replyQueue: mutable.Queue[(ReplHost.Reply, Str)], + prefixLength: Int, + hide: Boolean, // Show nothing except errors if `hide` is true. + errorOnly: Boolean + ): Unit = { + val indent = " " * prefixLength replyQueue.headOption.foreach { case (head, log) => head match { case ReplHost.Error(isSyntaxError, content) => @@ -894,44 +903,46 @@ class DiffTests totalRuntimeErrors += 1 } content.linesIterator.foreach { s => output(" " + s) } - case ReplHost.Unexecuted(reason) => - output(" " * prefixLength + "= ") - output(" " * (prefixLength + 2) + reason) - case ReplHost.Result(result, _) if (!errorOnly) => + case ReplHost.Unexecuted(reason) if (!hide) => + output(indent + "= ") + output(indent + " " + reason) + case ReplHost.Result(result, _) if (!errorOnly && !hide) => result.linesIterator.zipWithIndex.foreach { case (line, i) => - if (i =:= 0) output(" " * prefixLength + "= " + line) - else output(" " * (prefixLength + 2) + line) + if (i =:= 0) output(indent + "= " + line) + else output(indent + " " + line) } - case ReplHost.Empty if (!errorOnly) => - output(" " * prefixLength + "= ") + case ReplHost.Empty if (!errorOnly && !hide) => + output(indent + "= ") case _ => () } outputLog(log) replyQueue.dequeue() } + } // If code generation fails, show the error message. executionResults match { case R(replies) => val replyQueue = mutable.Queue.from(replies) if (typerResults.isEmpty) - checkReply(replyQueue, 0, true) + checkReply(replyQueue, 0, false, true) else { - typerResults.foreach { case (name, typingLines, diagnosticLines, typeBeforeDiags) => - if (typeBeforeDiags) { - typingLines.foreach(output) - diagnosticLines.foreach(output) - } else { - diagnosticLines.foreach(output) - typingLines.foreach(output) + typerResults.foreach { case (name, typingLines, diagnosticLines, typeBeforeDiags, hide) => + if (!hide) { + if (typeBeforeDiags) { + typingLines.foreach(output) + diagnosticLines.foreach(output) + } else { + diagnosticLines.foreach(output) + typingLines.foreach(output) + } } - val prefixLength = name.length - checkReply(replyQueue, prefixLength) + checkReply(replyQueue, name.length, hide, false) } } case L(other) => // Print type checking results first. - if (!newDefs) typerResults.foreach { case (_, typingLines, diagnosticLines, typeBeforeDiags) => + if (!newDefs) typerResults.foreach { case (_, typingLines, diagnosticLines, typeBeforeDiags, _) => if (typeBeforeDiags) { typingLines.foreach(output) diagnosticLines.foreach(output) @@ -942,7 +953,7 @@ class DiffTests } other match { case _: TestCode => () // Impossible case. - case IllFormedCode(message) => + case e @ IllFormedCode(message) => totalCodeGenErrors += 1 if (!mode.expectCodeGenErrors && !mode.fixme && !mode.expectTypeErrors) failures += blockLineNum diff --git a/shared/src/test/scala/mlscript/NodeTest.scala b/shared/src/test/scala/mlscript/NodeTest.scala index e9628619f..1d23160af 100644 --- a/shared/src/test/scala/mlscript/NodeTest.scala +++ b/shared/src/test/scala/mlscript/NodeTest.scala @@ -16,6 +16,7 @@ class NodeTests extends org.scalatest.funsuite.AnyFunSuite { || v.startsWith("v17") || v.startsWith("v18") || v.startsWith("v19") + || v.startsWith("v20") ) } diff --git a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala index d9f60f754..3c6bc6a04 100644 --- a/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala +++ b/ts2mls/js/src/main/scala/ts2mls/types/Converter.scala @@ -52,13 +52,13 @@ object Converter { case TSReferenceType(name) => name case TSFunctionType(params, res, typeVars) => val tpNames = typeVars.map(_.name) - val tpList = tpNames.foldLeft("")((res, tp) => s"${res}forall '$tp; ") + val tpList = tpNames.foldLeft("")((res, tp) => s"${res}forall '$tp: ") val pList = generateFunParamsList(params) s"$tpList($pList) => ${convert(res)}" case TSUnionType(lhs, rhs) => s"(${convert(lhs)}) | (${convert(rhs)})" case TSIntersectionType(lhs, rhs) => s"(${convert(lhs)}) & (${convert(rhs)})" case TSTypeParameter(name, _) => s"'$name" // Constraints should be translated where the type parameters were created rather than be used - case TSTupleType(lst) => s"(${lst.foldLeft("")((p, t) => s"$p${convert(t)}, ")})" + case TSTupleType(lst) => s"[${lst.foldLeft("")((p, t) => s"$p${convert(t)}, ")}]" case TSArrayType(element) => s"MutArray[${convert(element)}]" case TSEnumType => "Int" case TSMemberType(base, _) => convert(base) // TODO: support private/protected members diff --git a/ts2mls/js/src/test/diff/Cycle2.mlsi b/ts2mls/js/src/test/diff/Cycle2.mlsi index b4c950651..bb3e4ebe2 100644 --- a/ts2mls/js/src/test/diff/Cycle2.mlsi +++ b/ts2mls/js/src/test/diff/Cycle2.mlsi @@ -9,6 +9,3 @@ export declare module Cycle2 { //| ╔══[ERROR] Module `Cycle1` has a cyclic type dependency that is not supported yet. //| ║ l.7: val a: Cycle1.A //| ╙── ^^ -//| ╔══[ERROR] Module `Cycle1` has a cyclic type dependency that is not supported yet. -//| ║ l.7: val a: Cycle1.A -//| ╙── ^^ diff --git a/ts2mls/js/src/test/diff/Export.mlsi b/ts2mls/js/src/test/diff/Export.mlsi index d4aee3377..c6348e516 100644 --- a/ts2mls/js/src/test/diff/Export.mlsi +++ b/ts2mls/js/src/test/diff/Export.mlsi @@ -22,6 +22,9 @@ export declare module Export { //| ╔══[ERROR] type identifier not found: IBar //| ║ l.11: export val baz: IBar //| ╙── ^^^^ -//| ╔══[ERROR] access to class member not yet supported +//| ╔══[ERROR] Class E cannot be instantiated as it exposes no such constructor +//| ║ l.15: export val F = E +//| ╙── ^ +//| ╔══[ERROR] Access to class member not yet supported //| ║ l.16: export val G = Dependency.B //| ╙── ^^ diff --git a/ts2mls/js/src/test/diff/Intersection.mlsi b/ts2mls/js/src/test/diff/Intersection.mlsi index 0b7c59c5a..dc7cd7019 100644 --- a/ts2mls/js/src/test/diff/Intersection.mlsi +++ b/ts2mls/js/src/test/diff/Intersection.mlsi @@ -12,7 +12,7 @@ export declare module Intersection { declare fun uu['U, 'V, 'T, 'P](x: (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P))): (((('U) & ('T)) | (('U) & ('P))) | (('V) & ('T))) | (('V) & ('P)) declare fun iiii['U, 'T, 'V](x: (('U) & ('T)) & ('V)): (('U) & ('T)) & ('V) declare fun arr['U, 'T](a: (MutArray['U]) & (MutArray['T])): (MutArray['U]) & (MutArray['T]) - declare fun tt['U, 'T, 'V](x: (('U, 'T, )) & (('V, 'V, ))): (('U, 'T, )) & (('V, 'V, )) + declare fun tt['U, 'T, 'V](x: (['U, 'T, ]) & (['V, 'V, ])): (['U, 'T, ]) & (['V, 'V, ]) declare class A {} declare class B {} declare fun inter(c: (A) & (B)): (A) & (B) diff --git a/ts2mls/js/src/test/diff/Optional.mlsi b/ts2mls/js/src/test/diff/Optional.mlsi index 318f485b5..480a92113 100644 --- a/ts2mls/js/src/test/diff/Optional.mlsi +++ b/ts2mls/js/src/test/diff/Optional.mlsi @@ -12,7 +12,7 @@ export declare module Optional { declare class ABC {} declare fun testABC(abc: (ABC) | (undefined)): unit declare fun testSquareConfig(conf: (SquareConfig) | (undefined)): unit - declare fun err(msg: ((Num, Str, )) | (undefined)): unit + declare fun err(msg: ([Num, Str, ]) | (undefined)): unit declare fun toStr(x: (((Num) | (false)) | (true)) | (undefined)): Str declare fun boo['T, 'U](x: (('T) & ('U)) | (undefined)): unit declare class B['T] { diff --git a/ts2mls/js/src/test/diff/TSArray.mlsi b/ts2mls/js/src/test/diff/TSArray.mlsi index ea958902b..c5ef46d71 100644 --- a/ts2mls/js/src/test/diff/TSArray.mlsi +++ b/ts2mls/js/src/test/diff/TSArray.mlsi @@ -10,7 +10,7 @@ export declare module TSArray { declare fun doCs(c: MutArray[C]): MutArray[C] declare fun doIs(i: MutArray[I]): MutArray[I] declare fun inter['U, 'T](x: MutArray[('U) & ('T)]): MutArray[('U) & ('T)] - declare fun clean(x: MutArray[(Str, Num, )]): MutArray[(Str, Num, )] + declare fun clean(x: MutArray[[Str, Num, ]]): MutArray[[Str, Num, ]] declare fun translate['T, 'U](x: MutArray['T]): MutArray['U] declare fun uu(x: MutArray[((Num) | (false)) | (true)]): MutArray[((Num) | (false)) | (true)] declare class Temp['T] { diff --git a/ts2mls/js/src/test/diff/Tuple.mlsi b/ts2mls/js/src/test/diff/Tuple.mlsi index 00cd8208a..ae51b2749 100644 --- a/ts2mls/js/src/test/diff/Tuple.mlsi +++ b/ts2mls/js/src/test/diff/Tuple.mlsi @@ -1,30 +1,30 @@ export declare module Tuple { - declare fun key(x: (Str, (false) | (true), )): Str - declare fun value(x: (Str, (false) | (true), )): (false) | (true) - declare fun third(x: (Num, Num, Num, )): Num - declare fun vec2(x: Num, y: Num): (Num, Num, ) - declare fun twoFunctions(ff: ((x: Num) => Num, (x: Num) => Num, ), x: Num): Num - declare fun tupleIt(x: Str): (() => Str, ) - declare fun s(flag: (false) | (true)): ((Str) | (Num), ((Num) | (false)) | (true), ) - declare fun s2(t: ((false) | (true), (Str) | (Num), )): (Str) | (Num) - declare fun ex['T, 'U](x: 'T, y: 'U): ('T, 'U, ('T) & ('U), ) - declare fun foo['T, 'U](x: (('T) & ('U), )): unit - declare fun conv(x: {y: Num,}): ({y: Num,}, {z: Str,}, ) + declare fun key(x: [Str, (false) | (true), ]): Str + declare fun value(x: [Str, (false) | (true), ]): (false) | (true) + declare fun third(x: [Num, Num, Num, ]): Num + declare fun vec2(x: Num, y: Num): [Num, Num, ] + declare fun twoFunctions(ff: [(x: Num) => Num, (x: Num) => Num, ], x: Num): Num + declare fun tupleIt(x: Str): [() => Str, ] + declare fun s(flag: (false) | (true)): [(Str) | (Num), ((Num) | (false)) | (true), ] + declare fun s2(t: [(false) | (true), (Str) | (Num), ]): (Str) | (Num) + declare fun ex['T, 'U](x: 'T, y: 'U): ['T, 'U, ('T) & ('U), ] + declare fun foo['T, 'U](x: [('T) & ('U), ]): unit + declare fun conv(x: {y: Num,}): [{y: Num,}, {z: Str,}, ] declare class A { val x: Num } declare class B {} - declare fun swap(x: (A, B, )): (B, A, ) + declare fun swap(x: [A, B, ]): [B, A, ] } //| ╔══[ERROR] type identifier not found: A -//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ║ l.17: declare fun swap(x: [A, B, ]): [B, A, ] //| ╙── ^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ║ l.17: declare fun swap(x: [A, B, ]): [B, A, ] //| ╙── ^ //| ╔══[ERROR] type identifier not found: B -//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ║ l.17: declare fun swap(x: [A, B, ]): [B, A, ] //| ╙── ^ //| ╔══[ERROR] type identifier not found: A -//| ║ l.17: declare fun swap(x: (A, B, )): (B, A, ) +//| ║ l.17: declare fun swap(x: [A, B, ]): [B, A, ] //| ╙── ^ diff --git a/ts2mls/js/src/test/diff/Type.mlsi b/ts2mls/js/src/test/diff/Type.mlsi index 15f8a5005..2c9647fab 100644 --- a/ts2mls/js/src/test/diff/Type.mlsi +++ b/ts2mls/js/src/test/diff/Type.mlsi @@ -8,7 +8,7 @@ export declare module Type { } type Option['A] = (None) | (Some['A]) type Func = (x: Num) => Num - type S2 = (Str, Str, ) + type S2 = [Str, Str, ] declare trait I1 {} declare trait I2 {} type I3 = (I1) & (I2) @@ -16,7 +16,7 @@ export declare module Type { type SomeInterface = {x: Num,y: Num,} declare class ABC {} type DEF = ABC - type TP['A, 'B, 'C] = ('A, 'B, 'C, ) + type TP['A, 'B, 'C] = ['A, 'B, 'C, ] declare module NA { declare fun fb(b: Str): unit export type B = Str diff --git a/ts2mls/js/src/test/diff/TypeParameter.mlsi b/ts2mls/js/src/test/diff/TypeParameter.mlsi index 2d3162072..a2104c5ee 100644 --- a/ts2mls/js/src/test/diff/TypeParameter.mlsi +++ b/ts2mls/js/src/test/diff/TypeParameter.mlsi @@ -24,8 +24,8 @@ export declare module TypeParameter { } declare fun fff(p: FFF[Str], s: Str): unit declare fun getFFF(): FFF[Num] - type PolyToString = forall 'T; (x: 'T) => Str - type PolyID = forall 'T; (x: 'T) => 'T + type PolyToString = forall 'T: (x: 'T) => Str + type PolyID = forall 'T: (x: 'T) => 'T } //| ╔══[ERROR] type identifier not found: Printer //| ║ l.10: declare fun setStringPrinter(p: Printer[Str]): unit diff --git a/ts2mls/js/src/test/diff/Union.mlsi b/ts2mls/js/src/test/diff/Union.mlsi index 16128f502..bf028e12e 100644 --- a/ts2mls/js/src/test/diff/Union.mlsi +++ b/ts2mls/js/src/test/diff/Union.mlsi @@ -3,7 +3,7 @@ export declare module Union { declare fun test(x: (false) | (true)): (Str) | (Num) declare fun run(f: ((x: Num) => Num) | ((x: Num) => Str)): anything declare fun get(arr: (MutArray[Num]) | (MutArray[Str])): unit - declare fun get2(t: ((Str, Str, )) | ((Num, Str, ))): Str + declare fun get2(t: ([Str, Str, ]) | ([Num, Str, ])): Str declare fun typeVar['T, 'U](x: ('T) | ('U)): ('T) | ('U) declare fun uuuu(x: (((Str) | (Num)) | (false)) | (true)): (((Str) | (Num)) | (false)) | (true) } From 5408fc4c44e49292768765cdc666c575c51bda58 Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Fri, 27 Oct 2023 15:59:38 +0800 Subject: [PATCH 201/202] Remove redundant type annos --- .../test/esprojects/.interfaces/mlscript/Cycle1.mlsi | 2 +- .../test/esprojects/.interfaces/mlscript/Cycle3.mlsi | 2 +- .../test/esprojects/.interfaces/mlscript/Cycle4.mlsi | 12 ++++++++++++ driver/js/src/test/esprojects/mlscript/Cycle1.mls | 2 +- driver/js/src/test/esprojects/mlscript/Cycle3.mls | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi index 4eb09cb21..2321bfb1e 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle1.mlsi @@ -2,5 +2,5 @@ declare module Cycle2 { fun g: (x: Int) -> Int } export declare module Cycle1 { - fun f: (x: Int) -> Int + fun f: (0 | Int & ~0) -> Int } diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi index 20f9bdcec..28b5202d0 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle3.mlsi @@ -1,5 +1,5 @@ export declare module Cycle3 { - fun f: (x: Int) -> Int + fun f: (0 | Int & ~0) -> (114 | error) } //| Use `weak import` to break the cycle dependency `import "./Cycle4.mls"` //| ╔══[ERROR] identifier not found: Cycle4 diff --git a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi index bb3a8f60a..89276a837 100644 --- a/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi +++ b/driver/js/src/test/esprojects/.interfaces/mlscript/Cycle4.mlsi @@ -3,3 +3,15 @@ export declare module Cycle4 { fun g: (x: Int) -> Int () } +//| ╔══[ERROR] Type mismatch in type ascription: +//| ║ l.4: export fun g(x: Int): Int = Cycle3.f(x) +//| ║ ^^^^^^^^^^^ +//| ╟── type `error` is not an instance of `Int` +//| ║ l.2: fun f: (0 | Int & ~0) -> (114 | error) +//| ║ ^^^^^ +//| ╟── but it flows into application with expected type `Int` +//| ║ l.4: export fun g(x: Int): Int = Cycle3.f(x) +//| ║ ^^^^^^^^^^^ +//| ╟── Note: constraint arises from type reference: +//| ║ l.4: export fun g(x: Int): Int = Cycle3.f(x) +//| ╙── ^^^ diff --git a/driver/js/src/test/esprojects/mlscript/Cycle1.mls b/driver/js/src/test/esprojects/mlscript/Cycle1.mls index bcf63a5f9..29e843ee0 100644 --- a/driver/js/src/test/esprojects/mlscript/Cycle1.mls +++ b/driver/js/src/test/esprojects/mlscript/Cycle1.mls @@ -1,5 +1,5 @@ weak import "./Cycle2.mls" -export fun f(x: Int): Int = if x is +export fun f(x) = if x is 0 then 114 _ then Cycle2.g(x - 1) diff --git a/driver/js/src/test/esprojects/mlscript/Cycle3.mls b/driver/js/src/test/esprojects/mlscript/Cycle3.mls index b547c08c1..8f003642e 100644 --- a/driver/js/src/test/esprojects/mlscript/Cycle3.mls +++ b/driver/js/src/test/esprojects/mlscript/Cycle3.mls @@ -1,5 +1,5 @@ import "./Cycle4.mls" -export fun f(x: Int): Int = if x is +export fun f(x) = if x is 0 then 114 _ then Cycle4.g(x - 1) From 022ff54c266ca3c85c942f9de44c208c10a9c52b Mon Sep 17 00:00:00 2001 From: NeilKleistGao Date: Sat, 30 Dec 2023 12:07:49 +0800 Subject: [PATCH 202/202] Minor changes --- ts2mls/js/src/main/scala/ts2mls/TSProgram.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala index 4afe533d4..61a5cfdc4 100644 --- a/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala +++ b/ts2mls/js/src/main/scala/ts2mls/TSProgram.scala @@ -17,13 +17,13 @@ class TSProgram( typer: (FileInfo, JSWriter) => Unit, gitHelper: Option[JSGitHelper] ) { - private implicit val configContent = TypeScript.parseOption(file.workDir, tsconfig) + private implicit val configContent: js.Dynamic = TypeScript.parseOption(file.workDir, tsconfig) private val program = TypeScript.createProgram(Seq( if (file.isNodeModule) file.resolve else file.filename )) private val cache = new HashMap[String, TSSourceFile]() - private implicit val checker = TSTypeChecker(program.getTypeChecker()) + private implicit val checker: TSTypeChecker = TSTypeChecker(program.getTypeChecker()) import TSPathResolver.{basename, extname, isLocal, resolve, dirname, relative, normalize} @@ -73,7 +73,8 @@ class TSProgram( generate(imp, None)(filename :: stack) || r }) - if (!dependentRecompile && !shouldRecompile(filename, interfaceFilename)) return false + if (file.isNodeModule && JSFileSystem.exists(interfaceFilename)) return false // * We do not check files in node modules if the interfaces exist + else if (!dependentRecompile && !shouldRecompile(filename, interfaceFilename)) return false System.out.println(s"generating interface for ${file.filename}...") sourceFile.parse