Skip to content

Commit 3e65cff

Browse files
authored
Merge pull request #1874 from dotty-staging/topic/dottydoc-markdown
[doctool] Add markdown support && Static site generation
2 parents fc03114 + 6a2d1e0 commit 3e65cff

File tree

128 files changed

+5377
-2274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5377
-2274
lines changed

.drone.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ pipeline:
66
- ln -s /var/cache/drone/scala-scala scala-scala
77
- ./scripts/update-scala-library
88
- sbt -J-Xmx4096m -J-XX:ReservedCodeCacheSize=512m -J-XX:MaxMetaspaceSize=1024m -Ddotty.drone.mem=4096m -ivy /var/cache/drone/ivy2 "${TEST}"
9+
when:
10+
branch:
11+
exclude: gh-pages
12+
13+
documentation:
14+
image: lampepfl/dotty:latest
15+
pull: true
16+
commands:
17+
- ./project/scripts/genDocs "${TEST}" $BOT_PASS
18+
when:
19+
branch: master
20+
21+
slack:
22+
image: plugins/slack
23+
channel: dotty
24+
when:
25+
branch: master
926

1027
matrix:
1128
TEST:

.drone.yml.sig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
eyJhbGciOiJIUzI1NiJ9.cGlwZWxpbmU6CiAgdGVzdDoKICAgIGltYWdlOiBsYW1wZXBmbC9kb3R0eTpsYXRlc3QKICAgIHB1bGw6IHRydWUKICAgIGNvbW1hbmRzOgogICAgICAtIGxuIC1zIC92YXIvY2FjaGUvZHJvbmUvc2NhbGEtc2NhbGEgc2NhbGEtc2NhbGEKICAgICAgLSAuL3NjcmlwdHMvdXBkYXRlLXNjYWxhLWxpYnJhcnkKICAgICAgLSBzYnQgLUotWG14NDA5Nm0gLUotWFg6UmVzZXJ2ZWRDb2RlQ2FjaGVTaXplPTUxMm0gLUotWFg6TWF4TWV0YXNwYWNlU2l6ZT0xMDI0bSAtRGRvdHR5LmRyb25lLm1lbT00MDk2bSAtaXZ5IC92YXIvY2FjaGUvZHJvbmUvaXZ5MiAiJHtURVNUfSIKICAgIHdoZW46CiAgICAgIGJyYW5jaDoKICAgICAgICBleGNsdWRlOiBnaC1wYWdlcwoKICBkb2N1bWVudGF0aW9uOgogICAgaW1hZ2U6IGxhbXBlcGZsL2RvdHR5OmxhdGVzdAogICAgcHVsbDogdHJ1ZQogICAgY29tbWFuZHM6CiAgICAgIC0gLi9wcm9qZWN0L3NjcmlwdHMvZ2VuRG9jcyAiJHtURVNUfSIgJEJPVF9QQVNTCiAgICB3aGVuOgogICAgICBicmFuY2g6IG1hc3RlcgoKICBzbGFjazoKICAgIGltYWdlOiBwbHVnaW5zL3NsYWNrCiAgICBjaGFubmVsOiBkb3R0eQogICAgd2hlbjoKICAgICAgYnJhbmNoOiBtYXN0ZXIKCm1hdHJpeDoKICBURVNUOgogICAgLSB0ZXN0CiAgICAtIDtwdWJsaXNoTG9jYWw7ZG90dHktYm9vdHN0cmFwcGVkL3Rlc3QKICAgIC0gcGFydGVzdC1vbmx5LW5vLWJvb3RzdHJhcCAtLXNob3ctZGlmZiAtLXZlcmJvc2UKICAgIC0gcGFydGVzdC1vbmx5IC0tc2hvdy1kaWZmIC0tdmVyYm9zZQo.l7I2yJ5gewe0ObfP09MyJ9iGlXaPffen5Sh3HjS2oKs

compiler/src/dotty/tools/backend/jvm/LabelDefs.scala

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,47 @@ import StdNames.nme
3737

3838
/**
3939
* Verifies that each Label DefDef has only a single address to jump back and
40-
* reorders them such that they are not nested and this address is a fall-through address for JVM
41-
*
42-
* ei such code
43-
*
40+
* reorders them such that they are not nested and this address is a
41+
* fall-through address for the JVM.
4442
*
43+
* ```scala
4544
* <label> def foo(i: Int) = {
4645
* <label> def bar = 0
4746
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
4847
* dough(i)
49-
* }
48+
* }
5049
*
5150
* foo(100)
51+
* ```
5252
*
53-
* will get rewritten to
53+
* will get rewritten to:
5454
*
55-
* \
55+
* ```scala
5656
* <label> def foo(i: Int) = dough(i)
5757
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
5858
* <label> def bar = 2
5959
* foo(100)
60+
* ```
6061
*
61-
* Proposed way to generate this pattern in backend is:
62+
* Proposed way to generate this pattern in backend is:
6263
*
63-
* foo(100)
64-
* <jump foo>
65-
* <label> def foo(i: Int) = dough(i)
66-
* // <jump a> // unreachable
67-
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
68-
* // <jump a> // unreachable
69-
* <label> def bar = 2
70-
* // <jump a> // unreachable
71-
* <asm point a>
64+
* ```scala
65+
* foo(100)
66+
* <jump foo>
67+
* <label> def foo(i: Int) = dough(i)
68+
* // <jump a> // unreachable
69+
* <label> def dough(i: Int) = if (i == 0) bar else foo(i-1)
70+
* // <jump a> // unreachable
71+
* <label> def bar = 2
72+
* // <jump a> // unreachable
73+
* <asm point a>
74+
* ```
7275
*
73-
* Unreachable jumps will be eliminated by local dead code analysis.
74-
* After JVM is smart enough to remove next-line jumps
76+
* Unreachable jumps will be eliminated by local dead code analysis.
77+
* After JVM is smart enough to remove next-line jumps
7578
*
76-
* Note that Label DefDefs can be only nested in Block, otherwise no one would be able to call them
77-
* Other DefDefs are eliminated
79+
* Note that Label DefDefs can be only nested in Block, otherwise no one would
80+
* be able to call them Other DefDefs are eliminated
7881
*/
7982
class LabelDefs extends MiniPhaseTransform {
8083
def phaseName: String = "labelDef"

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class ScalaSettings extends Settings.SettingGroup {
101101
val XoldPatmat = BooleanSetting("-Xoldpatmat", "Use the pre-2.10 pattern matcher. Otherwise, the 'virtualizing' pattern matcher is used in 2.10.")
102102
val XnoPatmatAnalysis = BooleanSetting("-Xno-patmat-analysis", "Don't perform exhaustivity/unreachability analysis. Also, ignore @switch annotation.")
103103
val XfullLubs = BooleanSetting("-Xfull-lubs", "Retains pre 2.10 behavior of less aggressive truncation of least upper bounds.")
104+
val wikiSyntax = BooleanSetting("-Xwiki-syntax", "Retains the Scala2 behavior of using Wiki Syntax in Scaladoc")
104105

105106
/** -Y "Private" settings
106107
*/
@@ -212,11 +213,18 @@ class ScalaSettings extends Settings.SettingGroup {
212213
"A directory containing static resources needed for the API documentation"
213214
)
214215

215-
val DocTitle = StringSetting (
216-
"-Ydoc-title",
217-
"title",
218-
"The overall name of the Scaladoc site",
219-
""
216+
val siteRoot = StringSetting(
217+
"-siteroot",
218+
"site root",
219+
"A directory containing static files from which to generate documentation",
220+
sys.props("user.dir")
221+
)
222+
223+
val projectName = StringSetting (
224+
"-project",
225+
"project title",
226+
"The name of the project",
227+
sys.props("user.dir").split(sys.props("file.separator")).last
220228
)
221229

222230
val DocVersion = StringSetting (

compiler/src/dotty/tools/dotc/core/Phases.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,13 @@ object Phases {
263263

264264
trait Phase extends DotClass {
265265

266+
/** A name given to the `Phase` that can be used to debug the compiler. For
267+
* instance, it is possible to print trees after a given phase using:
268+
*
269+
* ```bash
270+
* $ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
271+
* ```
272+
*/
266273
def phaseName: String
267274

268275
/** List of names of phases that should precede this phase */

compiler/src/dotty/tools/dotc/core/Types.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ object Types {
4141

4242
implicit def eqType: Eq[Type, Type] = Eq
4343

44-
/** The class of types.
44+
/** Main class representing types.
45+
*
4546
* The principal subclasses and sub-objects are as follows:
4647
*
48+
* ```none
4749
* Type -+- ProxyType --+- NamedType ----+--- TypeRef
4850
* | | \
4951
* | +- SingletonType-+-+- TermRef
@@ -74,6 +76,7 @@ object Types {
7476
* +- NoPrefix
7577
* +- ErrorType
7678
* +- WildcardType
79+
* ```
7780
*
7881
* Note: please keep in sync with copy in `docs/docs/internals/type-system.md`.
7982
*/

compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,37 @@ import core._
77
import Contexts.Context, Types._, Constants._, Decorators._, Symbols._
88
import TypeUtils._, TypeErasure._, Flags._
99

10-
1110
/** Implements partial evaluation of `sc.isInstanceOf[Sel]` according to:
1211
*
13-
* +-------------+----------------------------+----------------------------+------------------+
1412
* | Sel\sc | trait | class | final class |
15-
* +-------------+----------------------------+----------------------------+------------------+
13+
* | ----------: | :------------------------: | :------------------------: | :--------------: |
1614
* | trait | ? | ? | statically known |
1715
* | class | ? | false if classes unrelated | statically known |
1816
* | final class | false if classes unrelated | false if classes unrelated | statically known |
19-
* +-------------+----------------------------+----------------------------+------------------+
2017
*
2118
* This is a generalized solution to raising an error on unreachable match
2219
* cases and warnings on other statically known results of `isInstanceOf`.
2320
*
2421
* Steps taken:
2522
*
26-
* 1. evalTypeApply will establish the matrix and choose the appropriate
27-
* handling for the case:
28-
* 2. a) Sel/sc is a value class or scrutinee is `Any`
29-
* b) handleStaticallyKnown
30-
* c) falseIfUnrelated with `scrutinee <:< selector`
31-
* d) handleFalseUnrelated
32-
* e) leave as is (aka `happens`)
33-
* 3. Rewrite according to step taken in `2`
23+
* 1. `evalTypeApply` will establish the matrix and choose the appropriate
24+
* handling for the case:
25+
* - Sel/sc is a value class or scrutinee is `Any`
26+
* - `handleStaticallyKnown`
27+
* - `falseIfUnrelated` with `scrutinee <:< selector`
28+
* - `handleFalseUnrelated`
29+
* - leave as is (`happens`)
30+
* 2. Rewrite according to steps taken in 1
3431
*/
3532
class IsInstanceOfEvaluator extends MiniPhaseTransform { thisTransformer =>
3633

3734
import dotty.tools.dotc.ast.tpd._
3835

39-
def phaseName = "isInstanceOfEvaluator"
36+
val phaseName = "isInstanceOfEvaluator"
37+
38+
/** Transforms a [TypeApply](dotty.tools.dotc.ast.Trees.TypeApply) in order to
39+
* evaluate an `isInstanceOf` check according to the rules defined above.
40+
*/
4041
override def transformTypeApply(tree: TypeApply)(implicit ctx: Context, info: TransformerInfo): Tree = {
4142
val defn = ctx.definitions
4243

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<h1>Some header</h1>

0 commit comments

Comments
 (0)