Skip to content

Commit 3b3a51f

Browse files
committed
Merge pull request #531 from dotty-staging/fix/528-compile-predef
Fix/528 compile predef
2 parents 73f74cb + 7500b7f commit 3b3a51f

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

src/dotty/DottyPredef.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ package dotty
22

33
import scala.reflect.ClassTag
44
import scala.reflect.runtime.universe.TypeTag
5+
import scala.Predef.??? // this is currently ineffective, because of #530
56

67
object DottyPredef {
78
/** implicits for ClassTag and TypeTag. Should be implemented with macros */
8-
implicit def classTag[T]: ClassTag[T] = ???
9-
implicit def typeTag[T]: TypeTag[T] = ???
9+
implicit def classTag[T]: ClassTag[T] = scala.Predef.???
10+
implicit def typeTag[T]: TypeTag[T] = scala.Predef.???
1011
}

src/dotty/tools/dotc/Compiler.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,11 @@ class Compiler {
103103
.setMode(Mode.ImplicitsEnabled)
104104
.setTyperState(new MutableTyperState(ctx.typerState, new ConsoleReporter()(ctx), isCommittable = true))
105105
ctx.definitions.init(start) // set context of definitions to start
106+
start.setRunInfo(new RunInfo(start))
106107
def addImport(ctx: Context, sym: Symbol) =
107108
ctx.fresh.setImportInfo(ImportInfo.rootImport(sym)(ctx))
108-
(start.setRunInfo(new RunInfo(start)) /: defn.RootImports)(addImport)
109+
if (ctx.settings.YnoImports.value) start
110+
else (start /: defn.RootImports)(addImport)
109111
}
110112

111113
def reset()(implicit ctx: Context): Unit = {

src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ScalaSettings extends Settings.SettingGroup {
121121
val log = PhasesSetting("-Ylog", "Log operations during")
122122
val Ylogcp = BooleanSetting("-Ylog-classpath", "Output information about what classpath is being applied.")
123123
val Ynogenericsig = BooleanSetting("-Yno-generic-signatures", "Suppress generation of generic signatures for Java.")
124-
val noimports = BooleanSetting("-Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.")
124+
val YnoImports = BooleanSetting("-Yno-imports", "Compile without importing scala.*, java.lang.*, or Predef.")
125125
val nopredef = BooleanSetting("-Yno-predef", "Compile without importing Predef.")
126126
val noAdaptedArgs = BooleanSetting("-Yno-adapted-args", "Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.")
127127
val selfInAnnots = BooleanSetting("-Yself-in-annots", "Include a \"self\" identifier inside of annotations.")
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
object P {
2+
def !#@ : Nothing = ???
3+
}
4+
5+
object Test {
6+
import P.!#@
7+
def f = !#@
8+
}

0 commit comments

Comments
 (0)