You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>If you are a Linux or Windows user, download the <ahref="https://github.com/lampepfl/dotty/releases">latest release</a>. Optionally add path of the folder <code>bin/</code> to the system environment variable <code>PATH</code>. </p>
9
9
10
10
<p>Now you can compile Scala source code:</p>
11
-
<pre><code>dotc hello.scala</code></pre>
11
+
<pre><code>scalac hello.scala</code></pre>
12
12
13
-
<p>To start the REPL, run: <code>dotr</code>.</p>
13
+
<p>To start the REPL, run: <code>scala</code>.</p>
14
14
15
15
<p>Or, you can try Dotty in your browser with <ahref="https://scastie.scala-lang.org/?target=dotty">Scastie</a>.</p>
Copy file name to clipboardExpand all lines: docs/docs/contributing/debugging.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ object Playground {
32
32
}
33
33
```
34
34
35
-
Then, you can debug Dotty by compiling this file via `dotc ../issues/Playground.scala` (from the SBT console) and collecting various debug output in process. This section documents techniques you can use to collect the debug info.
35
+
Then, you can debug Dotty by compiling this file via `scalac ../issues/Playground.scala` (from the SBT console) and collecting various debug output in process. This section documents techniques you can use to collect the debug info.
36
36
37
37
[This](https://github.com/lampepfl/dotty/blob/10526a7d0aa8910729b6036ee51942e05b71abf6/compiler/src/dotty/tools/dotc/typer/Typer.scala#L2231) is the entry point to the Typer. The job of the Typer is to take an untyped tree, compute its type and turn it into a typed tree by attaching the type information to that tree. We will use this entry point to practice debugging techniques. E.g.:
38
38
@@ -46,7 +46,7 @@ Then, you can debug Dotty by compiling this file via `dotc ../issues/Playground.
46
46
Then:
47
47
48
48
```shell
49
-
dotc ../issues/Playground.scala
49
+
scalac ../issues/Playground.scala
50
50
```
51
51
52
52
The techniques discussed below can be tried out in place of `println("Hello Debug")` in that location. They are of course applicable throughout the codebase.
@@ -70,9 +70,9 @@ if (tree.show == """println("Hello World")""")
70
70
71
71
The intention above is to output an extended debug info on a tree that matches a particular human-readable representation. However, because of the color characters, the comparison will fail.
72
72
73
-
To disable color output from `show`, run `dotc` asfollows:
73
+
To disable color output from `show`, run `scalac` asfollows:
74
74
75
-
`dotc -color:never ../issues/Playground.scala`
75
+
`scalac -color:never ../issues/Playground.scala`
76
76
77
77
##Reportingasa non-intrusive println
78
78
Consider you want to debug the `tree` that goes into `assertPositioned(tree)` in the `typed` method. You can do:
@@ -94,19 +94,19 @@ assertPositioned(tree.reporting(s"Tree is: $result"))
94
94
To print out the trees you are compiling after the FrontEnd (scanner, parser, namer, typer) phases:
95
95
96
96
```shell
97
-
dotc-Xprint:typer ../issues/Playground.scala
97
+
scalac-Xprint:typer ../issues/Playground.scala
98
98
```
99
99
100
100
To print out the trees after Frontend and CollectSuperCallsphases:
To find out the list of all the phases and their names, check out [this](https://github.com/lampepfl/dotty/blob/10526a7d0aa8910729b6036ee51942e05b71abf6/compiler/src/dotty/tools/dotc/Compiler.scala#L34) line in `Compiler.scala`. Each `Phase` objecthas `phaseName` defined on it, this is the phase name.
@@ -119,7 +119,7 @@ object Foo
119
119
objectFoo
120
120
```
121
121
122
-
Clearly we cannot define an object`Foo` twice. Now compile it asfollows: `dotc -Ydebug-error ../issues/Playground.scala` (use whatever path you saved it under). The result will be asfollows:
122
+
Clearly we cannot define an object`Foo` twice. Now compile it asfollows: `scalac -Ydebug-error ../issues/Playground.scala` (use whatever path you saved it under). The result will be asfollows:
Every [Positioned](https://github.com/lampepfl/dotty/blob/10526a7d0aa8910729b6036ee51942e05b71abf6/compiler/src/dotty/tools/dotc/ast/Positioned.scala) (a parent class of `Tree`) object has a `uniqueId` field. It is an integer that is unique for that tree and doesn't change from compile run to compile run. You can output these IDs from any printer (such as the ones used by `.show` and `-Xprint`) via `-Yshow-tree-ids` flag, e.g.:
Defined in [Reporter.scala](https://github.com/lampepfl/dotty/blob/10526a7d0aa8910729b6036ee51942e05b71abf6/compiler/src/dotty/tools/dotc/reporting/Reporter.scala). Enables calls such as `report.log`. To enable, run dotcwith`-Ylog:typer` option.
366
+
Defined in [Reporter.scala](https://github.com/lampepfl/dotty/blob/10526a7d0aa8910729b6036ee51942e05b71abf6/compiler/src/dotty/tools/dotc/reporting/Reporter.scala). Enables calls such as `report.log`. To enable, run scalacwith`-Ylog:typer` option.
Copy file name to clipboardExpand all lines: docs/docs/contributing/testing.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,9 +9,9 @@ Running all tests in Dotty is as simple as:
9
9
$ sbt test
10
10
```
11
11
12
-
Specifically, `sbt test` runs all tests that do _not_ require a bootstrapped
13
-
compiler. In practice, this means that it runs all compilation tests meeting
14
-
this criterion, as well as all non-compiler tests.
12
+
Specifically, `sbt test` runs all tests that do _not_ require a bootstrapped
13
+
compiler. In practice, this means that it runs all compilation tests meeting
14
+
this criterion, as well as all non-compiler tests.
15
15
16
16
The entire suite of tests can be run using the bootstrapped compiler as follows:
17
17
@@ -87,7 +87,7 @@ Test output dumped in: tests/playground/neg/Sample.check.out
87
87
To create a checkfile for a test, you can do one of the following:
88
88
89
89
- Create a dummy checkfile with a random content, run the test, and, when it fails, use the `mv` command reported by the test to replace the dummy checkfile with the actual output.
90
-
- Manually compile the file you are testing with `dotc` and copy-paste whatever console output the compiler produces to the checkfile.
90
+
- Manually compile the file you are testing with `scalac` and copy-paste whatever console output the compiler produces to the checkfile.
91
91
92
92
## Integration tests
93
93
These tests are Scala source files expected to compile with Dotty (pos tests),
|`dotc ../issues/Playground.scala`| Compile the given file – path relative to the Dotty directory. Output the compiled class files to the Dotty directory itself. |
74
-
|`dotr Playground`| Run the compiled class `Playground`. Dotty directory is on classpath by default. |
73
+
|`scalac ../issues/Playground.scala`| Compile the given file – path relative to the Dotty directory. Output the compiled class files to the Dotty directory itself. |
74
+
|`scala Playground`| Run the compiled class `Playground`. Dotty directory is on classpath by default. |
75
75
|`repl`| Start REPL |
76
76
|`testOnly dotty.tools.dotc.CompilationTests -- *pos`| Run test (method) `pos` from `CompilationTests` suite. |
77
77
|`testCompilation sample`| In all test suites, run test files containing the word `sample` in their title. |
0 commit comments