Skip to content

New scaladoc version #16310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
a5d97b2
Merge branch 'language-reference-stable'
actions-user Jul 7, 2022
f9035c7
Change heading levels
Florian3k Aug 22, 2022
8f18d67
Fix heading levels
Florian3k Aug 23, 2022
a42fe2a
Backport changes from stable documentation branch (#15611)
szymon-rd Sep 2, 2022
d5ac8e5
Adjust headers levels (#15933)
Florian3k Sep 2, 2022
f9a921b
GitHub pages workflow
szymon-rd Aug 29, 2022
6600a2d
pirst part of changes
kamilszewczyk0 Sep 1, 2022
455fbd2
GitHub pages workflow
szymon-rd Aug 29, 2022
3efe571
Display packages in nested way in sidebar
Florian3k Aug 31, 2022
de18cd0
Scaladoc Search Engine fixes
szymon-rd Aug 29, 2022
4b11ad4
Working search engine
szymon-rd Sep 1, 2022
4031e33
Optimized & added features to search
szymon-rd Sep 5, 2022
cb6ef8a
Formatting fixes
szymon-rd Sep 5, 2022
01421ba
Better scoring & faster debounce
szymon-rd Sep 5, 2022
0006447
Testes search engine
szymon-rd Sep 6, 2022
dc1e368
Remove div from search results
szymon-rd Sep 6, 2022
0a0b2fb
Removed Attributes header
szymon-rd Sep 6, 2022
c8b58be
Merge pull request #6 from szymon-rd/fix-search-elements
szymon-rd Sep 6, 2022
3deecb5
Add class for wide cover headers
szymon-rd Sep 6, 2022
b3cfa3f
Merge branch 'scaladoc-fixes' of github.com:szymon-rd/dotty into scal…
szymon-rd Sep 6, 2022
51b7d55
add missing index.md pages
Florian3k Sep 1, 2022
8b6ed58
fix gadts.md layout
Florian3k Sep 1, 2022
9307dc0
GitHub pages workflow
szymon-rd Aug 29, 2022
3550a6d
Group documentableItem elements & adjust event listener
szymon-rd Sep 7, 2022
c53a6ba
Merge branch 'scaladoc-fixes' of github.com:szymon-rd/dotty into scal…
szymon-rd Sep 7, 2022
451db6c
fix nested html tags
Florian3k Sep 8, 2022
f9e4e84
Moved Members header
szymon-rd Sep 8, 2022
38184ec
Attributes only in full member page
szymon-rd Sep 8, 2022
a60ef52
Merge pull request #7 from szymon-rd/fix-nested-html-tags
Florian3k Sep 8, 2022
5fa080b
fix search packages
Florian3k Sep 9, 2022
e725348
Merge pull request #8 from szymon-rd/fix-search-packages
Florian3k Sep 9, 2022
81cc947
ToC in API docs
szymon-rd Sep 12, 2022
06c5c82
Fix links in header
szymon-rd Sep 12, 2022
491720e
Add second line with description to search result
Florian3k Sep 14, 2022
56e925e
Merge pull request #10 from szymon-rd/search-result-description
Florian3k Sep 14, 2022
c7b0991
Fixed hidden docs
szymon-rd Sep 15, 2022
ac76cae
Added non-breaking space in search results
szymon-rd Sep 15, 2022
1874d23
2nd part of layout fixes
kamilszewczyk0 Sep 16, 2022
181c515
Merge pull request #12 from szymon-rd/scaladoc-fixes-part2
kamilszewczyk0 Sep 16, 2022
3732466
Fix recent searches:
szymon-rd Sep 16, 2022
378a478
current page link click no reload
Florian3k Sep 19, 2022
f49cb04
Merge pull request #13 from szymon-rd/current-page-inactive-link
Florian3k Sep 19, 2022
c0657c3
Next part of layout fixes
kamilszewczyk0 Sep 20, 2022
90bc725
Merge pull request #14 from szymon-rd/scaladoc-fixes-part3
kamilszewczyk0 Sep 20, 2022
0805398
Add dynamic page reload
Florian3k Sep 20, 2022
005f66f
fix reloading
Florian3k Sep 20, 2022
cf21401
basic styles for table
kamilszewczyk0 Sep 22, 2022
4559aa4
always render toc
Florian3k Sep 22, 2022
8145775
fix js
Florian3k Sep 22, 2022
ddd37f3
remove obsolete scripts and styles
Florian3k Sep 22, 2022
ed1f15d
disconnect observer
Florian3k Sep 22, 2022
9eb4926
remove obsolete logo js
Florian3k Sep 22, 2022
0f3083c
move js out of function
Florian3k Sep 22, 2022
b89d511
Merge pull request #16 from szymon-rd/always-render-toc
kamilszewczyk0 Sep 22, 2022
16c7a4b
render toc only in docs
Florian3k Sep 22, 2022
7994b8f
Merge pull request #17 from szymon-rd/always-render-toc
Florian3k Sep 22, 2022
18189ee
fixed scrollbar thumb background on hover
kamilszewczyk0 Sep 22, 2022
26f7b94
Do not render empty member list
Florian3k Sep 22, 2022
537c68a
fix document.title setting
Florian3k Sep 23, 2022
2489f1c
fix highlight
Florian3k Sep 23, 2022
1be314d
Merge branch 'scaladoc-fixes' into dynamic-page-reload
Florian3k Sep 23, 2022
ad0b88e
Merge pull request #15 from szymon-rd/dynamic-page-reload
Florian3k Sep 23, 2022
2e488cf
changed color palette and left nav stays after click
kamilszewczyk0 Sep 25, 2022
f5521c8
fixed rwd
kamilszewczyk0 Sep 25, 2022
d8786c1
Merge branch 'scaladoc-fixes' into scaladoc-fixes-part3
kamilszewczyk0 Sep 25, 2022
7883710
Merge branch 'scaladoc-fixes' into scaladoc-fixes-part3 pt 2
kamilszewczyk0 Sep 25, 2022
cce944d
Merge pull request #19 from szymon-rd/scaladoc-fixes-part3
kamilszewczyk0 Sep 25, 2022
1425358
ux fixes
kamilszewczyk0 Sep 25, 2022
2bd9bca
Revert "ux fixes"
Florian3k Sep 26, 2022
29e3639
fix merge
Florian3k Sep 26, 2022
f545c43
Merge pull request #20 from szymon-rd/fix-merge
Florian3k Sep 26, 2022
18ce27f
Revert "Render TOC only in docs"
szymon-rd Sep 26, 2022
f0236af
remove useless old styles
Florian3k Sep 26, 2022
f1f4001
fix TOC links
Florian3k Sep 26, 2022
c716047
adjust header classes in rendered markdown
Florian3k Sep 26, 2022
94988e4
Merge pull request #23 from szymon-rd/revert-17-always-render-toc
szymon-rd Sep 26, 2022
548fa84
Merge pull request #22 from szymon-rd/misc-scaladoc-fixes
szymon-rd Sep 26, 2022
f6286f0
Merge pull request #9 from szymon-rd/scaladoc-toc-in-api
szymon-rd Sep 26, 2022
25eff3c
ToC sticky
kamilszewczyk0 Sep 27, 2022
a2ae349
fix dynamic loading
Florian3k Sep 29, 2022
6a603ad
Merge branch 'scaladoc-fixes' into omit-rendering-empty-members
Florian3k Sep 29, 2022
c8afef1
Merge pull request #18 from szymon-rd/omit-rendering-empty-members
Florian3k Sep 29, 2022
aa4ad38
fix contributors
Florian3k Oct 3, 2022
15ff3ea
implementing ux changes and fixes
kamilszewczyk0 Oct 5, 2022
1df646f
Merge pull request #25 from szymon-rd/scaladoc-fixes-ux-fixes
kamilszewczyk0 Oct 5, 2022
d933e8f
Changing design for members
kamilszewczyk0 Oct 9, 2022
8c28994
Another changes for members
kamilszewczyk0 Oct 9, 2022
2c4bfee
Merge pull request #26 from szymon-rd/member-design
kamilszewczyk0 Oct 9, 2022
fc4241e
Merge branch 'scaladoc-fixes' into dynamic-loading-fixes
Florian3k Oct 10, 2022
ccfc44d
Merge pull request #24 from szymon-rd/dynamic-loading-fixes
szymon-rd Oct 10, 2022
bcdad27
Unique sections in ScalaDoc ToC
szymon-rd Oct 10, 2022
73f9d97
Merge branch 'scaladoc-fixes' of github.com:szymon-rd/dotty into scal…
szymon-rd Oct 10, 2022
189794b
changed colors and color tokens
kamilszewczyk0 Oct 11, 2022
f99aa83
Merge pull request #27 from szymon-rd/changing-color-tokens
kamilszewczyk0 Oct 11, 2022
eb9832c
Changed structure of members list
szymon-rd Oct 11, 2022
622bade
Merge branch 'scaladoc-fixes' of github.com:szymon-rd/dotty into scal…
szymon-rd Oct 11, 2022
7018322
event lister for extending members section fixed
kamilszewczyk0 Oct 12, 2022
ff158f0
Split attrbutes to Value Parameters, Type Parameters and Attributs
szymon-rd Oct 12, 2022
189da2f
Fix ToC and Members List
szymon-rd Oct 12, 2022
b4e65bd
Remove Contributors, fix styles in API docs
szymon-rd Oct 12, 2022
1760e18
Added show/collapse
szymon-rd Oct 12, 2022
057ec7b
fix pathToRoot attr
Florian3k Oct 13, 2022
71a0082
Fix not closing search view on click under it
szymon-rd Oct 13, 2022
a538125
ToC nesting levels
szymon-rd Oct 13, 2022
0877df2
Fix styles in supertypes/subtypes
szymon-rd Oct 13, 2022
760285d
fix clearing filters and filter search optimalization
kamilszewczyk0 Oct 18, 2022
d3c9e8e
Merge pull request #29 from szymon-rd/filters-rebuild
kamilszewczyk0 Oct 18, 2022
9d90892
styles corections according to designer specification
kamilszewczyk0 Oct 19, 2022
532e42c
Merge pull request #30 from szymon-rd/style-fixes
kamilszewczyk0 Oct 19, 2022
603a596
styling only fixes (code snippets, links, headers)
jdudrak Oct 19, 2022
71f8528
minor styles changes:
jdudrak Oct 20, 2022
3a942ff
Icons update + Minor style changes.
jdudrak Oct 20, 2022
8b09349
fixing arrow icons on members
kamilszewczyk0 Oct 20, 2022
6b53e3d
fixed styles for members
kamilszewczyk0 Oct 21, 2022
326a86a
Merge pull request #31 from szymon-rd/style-fixes
kamilszewczyk0 Oct 21, 2022
52947b4
Fixed expand buttons and listeners
kamilszewczyk0 Oct 24, 2022
ff7a5e2
Merge pull request #32 from szymon-rd/arrow-rotation-fix
kamilszewczyk0 Oct 24, 2022
b03b9a4
Merge pull request #28 from szymon-rd/dynamic-loading-fixes
szymon-rd Oct 26, 2022
15879c9
API members styles refinement
jdudrak Oct 27, 2022
19d0a51
fixed toggling sidebar on mobile
kamilszewczyk0 Oct 27, 2022
2bbfd48
Put Scala first and expand it
szymon-rd Oct 27, 2022
ef0a6f9
Lightmode colors refinement
jdudrak Oct 27, 2022
6c73d2b
Layout Fixes
jdudrak Oct 28, 2022
0bdd1d7
implementing counign for displayed members
kamilszewczyk0 Oct 30, 2022
ead2ffc
add no result page to members filters
kamilszewczyk0 Oct 31, 2022
e9520d1
created styles and structure for "no results" page
kamilszewczyk0 Oct 26, 2022
5713a9c
Put no results in search
szymon-rd Oct 26, 2022
c986fc5
fixed navbar layout
kamilszewczyk0 Oct 27, 2022
c181b41
fixed paddings for no result page in searchbar
kamilszewczyk0 Oct 30, 2022
520b10e
adding comment wioth instruction to fix
kamilszewczyk0 Oct 31, 2022
3c6ebd3
No results icon & dispatch event on clear
szymon-rd Oct 31, 2022
a466d82
Merge pull request #33 from szymon-rd/no-result-page
szymon-rd Oct 31, 2022
d62fdf8
clear button invisible if no filters applied
kamilszewczyk0 Oct 31, 2022
95c242c
searchbar z-index increased
kamilszewczyk0 Nov 1, 2022
3c2916d
removed errors when there is no filters
kamilszewczyk0 Nov 1, 2022
55b2cb2
dynamic scroll-margin-top
kamilszewczyk0 Nov 1, 2022
bf8eba8
Merge pull request #34 from szymon-rd/members-area-fixes
kamilszewczyk0 Nov 1, 2022
08b608a
removed console.logs
kamilszewczyk0 Nov 1, 2022
c4191e1
fix for searchbar z-index and dynamic scrollMarginTop
kamilszewczyk0 Nov 2, 2022
98bead0
Fix resources
szymon-rd Nov 2, 2022
87803db
adding layout and ux fixes
kamilszewczyk0 Nov 3, 2022
1a11cfd
Merge branch 'scaladoc-fixes' into ux-fixes
kamilszewczyk0 Nov 3, 2022
2b6cc6a
Merge pull request #35 from szymon-rd/ux-fixes
kamilszewczyk0 Nov 3, 2022
91bc607
added z-index to navbar
kamilszewczyk0 Nov 7, 2022
aa47214
Merge remote-tracking branch 'upstream/language-reference-stable' int…
szymon-rd Nov 9, 2022
6501bb4
Fix building documentation source versions
szymon-rd Nov 9, 2022
3990551
Revert "Fixed hidden docs"
szymon-rd Nov 15, 2022
0712ad9
Hide back more details doc and don't show them in the Next
szymon-rd Nov 15, 2022
24e5f45
Use commas instead of with
szymon-rd Nov 16, 2022
05fb271
Fix “nightly warning”
julienrf Oct 21, 2022
59a355e
fixed mobile menu z-index
kamilszewczyk0 Nov 19, 2022
ba2591f
scrolled toc on horizontal devices
kamilszewczyk0 Nov 19, 2022
cea9d1d
fixed bug with left sidemenu closing on picking category
kamilszewczyk0 Nov 19, 2022
5ede5bc
Merge pull request #36 from szymon-rd/iteration-fixes
kamilszewczyk0 Nov 19, 2022
bca0b44
Remove graph from member details
szymon-rd Nov 22, 2022
0c361cf
Split type signatures into two separate spans (short and long)
szymon-rd Nov 23, 2022
4893f43
removed button from top headers in members area
kamilszewczyk0 Nov 27, 2022
d8b6fcf
created banners and added correct icons to resources
kamilszewczyk0 Nov 27, 2022
391fb4b
created indentation in main signatures
kamilszewczyk0 Nov 27, 2022
08badd0
TODO - tables layout on mobile
kamilszewczyk0 Nov 27, 2022
5289b69
Merge pull request #37 from szymon-rd/iteration-fixes
kamilszewczyk0 Nov 27, 2022
1ed3984
fixed icon for member expanding on hover
kamilszewczyk0 Nov 28, 2022
13536bc
mkae long headers break thw ord on smaller resolutions
kamilszewczyk0 Nov 29, 2022
ee12780
make member headers shorter when member is not open
kamilszewczyk0 Nov 29, 2022
f74dbae
Merge pull request #38 from szymon-rd/member-headers
kamilszewczyk0 Nov 29, 2022
0f94818
fixes fro expandable headers in type members
kamilszewczyk0 Nov 29, 2022
2f94c28
removed doubled piece of code
kamilszewczyk0 Nov 30, 2022
6261d39
updated view for tables on medium and small resolutions
kamilszewczyk0 Nov 30, 2022
27fe46f
Add support for experimental (separate section)
szymon-rd Nov 30, 2022
ba8401d
Revert .github changes
szymon-rd Dec 6, 2022
2271522
Fix grouped members disappearing entire website
szymon-rd Dec 6, 2022
8877ef2
Fix no results component
szymon-rd Dec 9, 2022
e27c7f9
Fix tests for ScalaDoc (with -> ,)
szymon-rd Dec 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/_assets/css/frontpage.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ h1#main {
/* navigation */
header {
font-size: 24px;
margin-block-end: calc(2* var(--base-spacing));
}

header .nav-item i {
Expand Down
5 changes: 0 additions & 5 deletions docs/_assets/docsScalaLangResources/scaladoc-assets.html

This file was deleted.

4 changes: 4 additions & 0 deletions docs/_docs/contributing/procedures/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: index
title: Procedures
---
4 changes: 4 additions & 0 deletions docs/_docs/contributing/tools/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
layout: index
title: IDEs and Tools
---
16 changes: 8 additions & 8 deletions docs/_docs/internals/backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BCodeIdiomatic ----------------> utilities for code generation, e.g.

The `BTypes.scala` class contains the `BType` class and predefined BTypes

### Data Flow ###
## Data Flow ##
Compiler creates a `GenBCode` `Phase`, calls `runOn(compilationUnits)`,
which calls `run(context)`. This:

Expand All @@ -51,12 +51,12 @@ which calls `run(context)`. This:
- `GenBCodePipeline.drainQ3` writes byte arrays to disk


### Architecture ###
## Architecture ##
The architecture of `GenBCode` is the same as in Scalac. It can be partitioned
into weakly coupled components (called "subsystems" below):


#### (a) The queue subsystem ####
### (a) The queue subsystem ###
Queues mediate between processors, queues don't know what each processor does.

The first queue contains AST trees for compilation units, the second queue
Expand All @@ -70,7 +70,7 @@ serialization to disk.

This subsystem is described in detail in `GenBCode.scala`

#### (b) Bytecode-level types, BType ####
### (b) Bytecode-level types, BType ###
The previous bytecode emitter goes to great lengths to reason about
bytecode-level types in terms of Symbols.

Expand All @@ -89,7 +89,7 @@ spec (that's why they aren't documented in `GenBCode`, just read the [JVM 8 spec

All things `BType` can be found in `BCodeGlue.scala`

#### (c) Utilities offering a more "high-level" API to bytecode emission ####
### (c) Utilities offering a more "high-level" API to bytecode emission ###
Bytecode can be emitted one opcode at a time, but there are recurring patterns
that call for a simpler API.

Expand All @@ -100,7 +100,7 @@ of two strategies.
All these utilities are encapsulated in file `BCodeIdiomatic.scala`. They know
nothing about the type checker (because, just between us, they don't need to).

#### (d) Mapping between type-checker types and BTypes ####
### (d) Mapping between type-checker types and BTypes ###
So that (c) can remain oblivious to what AST trees contain, some bookkeepers
are needed:

Expand All @@ -115,7 +115,7 @@ final def exemplar(csym0: Symbol): Tracked = { ... }

Details in `BTypes.scala`

#### (e) More "high-level" utilities for bytecode emission ####
### (e) More "high-level" utilities for bytecode emission ###
In the spirit of `BCodeIdiomatic`, utilities are added in `BCodeHelpers` for
emitting:

Expand All @@ -125,5 +125,5 @@ emitting:
- annotations


#### (f) Building an ASM ClassNode given an AST TypeDef ####
### (f) Building an ASM ClassNode given an AST TypeDef ###
It's done by `PlainClassBuilder`(see `GenBCode.scala`).
6 changes: 3 additions & 3 deletions docs/_docs/internals/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The `Context` contains the state of the compiler, for example
* `typerState` (for example undetermined type variables)
* ...

### Contexts in the typer ###
## Contexts in the typer ##
The type checker passes contexts through all methods and adapts fields where
necessary, e.g.

Expand All @@ -26,7 +26,7 @@ case tree: untpd.Block => typedBlock(desugar.block(tree), pt)(ctx.fresh.withNewS

A number of fields in the context are typer-specific (`mode`, `typerState`).

### In other phases ###
## In other phases ##
Other phases need a context for many things, for example to access the
denotation of a symbols (depends on the period). However they typically don't
need to modify / extend the context while traversing the AST. For these phases
Expand All @@ -36,7 +36,7 @@ all members.
**Careful**: beware of memory leaks. Don't hold on to contexts in long lived
objects.

### Using contexts ###
## Using contexts ##
Nested contexts should be named `ctx` to enable implicit shadowing:

```scala
Expand Down
14 changes: 7 additions & 7 deletions docs/_docs/internals/dotc-scalac.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title: "Differences between Scalac and Dotty"
Overview explanation how symbols, named types and denotations hang together:
[Denotations1]

### Denotation ###
## Denotation ##
Comment with a few details: [Denotations2]

A `Denotation` is the result of a name lookup during a given period
Expand All @@ -21,7 +21,7 @@ A `Denotation` is the result of a name lookup during a given period
Denotations of methods have a signature ([Signature1]), which
uniquely identifies overloaded methods.

#### Denotation vs. SymDenotation ####
### Denotation vs. SymDenotation ###
A `SymDenotation` is an extended denotation that has symbol-specific properties
(that may change over phases)
* `flags`
Expand All @@ -31,7 +31,7 @@ A `SymDenotation` is an extended denotation that has symbol-specific properties
`SymDenotation` implements lazy types (similar to scalac). The type completer
assigns the denotation's `info`.

#### Implicit Conversion ####
### Implicit Conversion ###
There is an implicit conversion:
```scala
core.Symbols.toDenot(sym: Symbol)(implicit ctx: Context): SymDenotation
Expand All @@ -42,7 +42,7 @@ implicit conversion does **not** need to be imported, it is part of the
implicit scope of the type `Symbol` (check the Scala spec). However, it can
only be applied if an implicit `Context` is in scope.

### Symbol ###
## Symbol ##
* `Symbol` instances have a `SymDenotation`
* Most symbol properties in the Scala 2 compiler are now in the denotation (in the Scala 3 compiler).

Expand All @@ -57,7 +57,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
`(*)` Symbols are implicitly converted to their denotation, see above. Each
`SymDenotation` has flags that can be queried using the `is` method.

### Flags ###
## Flags ##
* Flags are instances of the value class `FlagSet`, which encapsulates a
`Long`
* Each flag is either valid for types, terms, or both
Expand All @@ -74,7 +74,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
`ModuleVal` / `ModuleClass` for either of the two.
* `flags.is(Method | Param)`: true if `flags` has either of the two

### Tree ###
## Tree ##
* Trees don't have symbols
- `tree.symbol` is `tree.denot.symbol`
- `tree.denot` is `tree.tpe.denot` where the `tpe` is a `NamdedType` (see
Expand All @@ -87,7 +87,7 @@ if (sym is Flags.PackageClass) // Scala 3 (*)
using `prefix.member(name)`.


### Type ###
## Type ##
* `MethodType(paramSyms, resultType)` from scalac =>
`mt @ MethodType(paramNames, paramTypes)`. Result type is `mt.resultType`

Expand Down
47 changes: 26 additions & 21 deletions docs/_docs/internals/gadts.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# GADTs - Broad overview
---
layout: doc-page
title: "GADTs - Broad overview"
---

## Introduction

There are multiple levels to the implementation. They deal with slightly different problems. The most important levels are the following ones:

Expand All @@ -18,9 +23,9 @@ There are also other parts to supporting GADTs. Roughly in order of importance,
1. Attachment key is named `inferredGadtConstraints`.
4. When we select members on a type that may have GADT constraints, we perform special "healing" by approximating the type using those constraints. We cannot take the constraints into account because member lookup is cached, and GADT constraints are only valid for specific scopes.

# Useful widgets
## Useful widgets

## Expr
### Expr

This is the classical GADT example:

Expand All @@ -36,7 +41,7 @@ enum Expr[T] {
}
```

## EQ
### EQ

The following enum will result in an equality constraint between `S` and `T` if we match on it:

Expand All @@ -46,7 +51,7 @@ enum EQ[S, T] {
}
```

## SUB
### SUB

The following enum will result in a subtyping constraint `S <: T` if we match on it:

Expand All @@ -56,9 +61,9 @@ enum SUB[-S, +T] {
}
```

# Details of above
## Details of above

## What abstract types can have GADT constraints
### What abstract types can have GADT constraints

Right now, we record GADT constraints for:

Expand All @@ -67,9 +72,9 @@ Right now, we record GADT constraints for:

There is a branch on the way which will also record them for type members (so path-dependent types) and singleton types. It has a paper associated: "Implementing path-depepdent GADTs for Scala 3".

## What are necessary relationships? Any examples?
### What are necessary relationships? Any examples?

### Covariance means no constraint is necessary
#### Covariance means no constraint is necessary

Standard (non-case) classes allow "strange" inheritance which means that we cannot infer any information from covariant type parameters.

Expand All @@ -90,7 +95,7 @@ class Weird(list: List[String]) extends IntList with Expr[Nothing]

Case classes have a special check which disallows inheritance like `Weird`. This means we can infer extra information from them.

## Breaking down the constraints
### Breaking down the constraints

```scala
class Expr[A]
Expand All @@ -113,9 +118,9 @@ def foo[T](e: Expr[List[T]]): T =
}
```

## Relation betweeen GadtConstraint and OrderingConstraint
### Relation betweeen GadtConstraint and OrderingConstraint

### Internal and external types
#### Internal and external types

GadtConstraint uses OrderingConstraint as the datastructure to record information about GADT constraints.

Expand All @@ -127,9 +132,9 @@ To solve this, GadtConstraint internally creates TypeParamRefs which it adds to

The TypeParamRefs and TypeVars registered in one constraint cannot ever be present in types mentioned in the other type constraint. The internal TypeParamRefs and TypeVars cannot ever leak out of the GadtConstraint. We cannot ever record a bound in GadtConstraint which mentions TypeParamRefs used for type inference. (That part is ensured by the way TypeComparer is organised &#x2013; we will always try to record bounds in the "normal" constraint before recording a GADT bound.)

# Other details
## Other details

## TypeComparer approximations
### TypeComparer approximations

TypeComparer sometimes approximates the types it compares. Let's see an example based on these definitions:

Expand All @@ -142,11 +147,11 @@ when comparing if `IntList <: Expr[Int]`, `TypeComparer` will approximate `IntLi

The variables which TypeComparer sets are `approxState` and `frozenGadt`.

## Necessary/sufficient either
### Necessary/sufficient either

TypeComparer sometimes needs to approximate some constraints, specifically when dealing with intersection and union types. The way this approximation works changes if we're currently inferring GADT constraints. This is hopefully documented well in TypeComparer in doc comments for `necessaryEither` and `sufficientEither`.

## Types bound in patterns
### Types bound in patterns

```scala
(list : List[Int]) match {
Expand All @@ -161,7 +166,7 @@ TypeComparer sometimes needs to approximate some constraints, specifically when
}
```

## Internal structure of OrderingConstraint
### Internal structure of OrderingConstraint

Imagine we have two type parameters in scope, `A` and `B`.

Expand All @@ -184,19 +189,19 @@ B <: A

The first two constraints are "entries" &#x2013; they are easy to look up whenever we ask for bounds of `A` or `B`. The third constraint is an ordering &#x2013; it helps with correctly propagating the bounds we record.

# Possible broad improvements
## Possible broad improvements

## Allow OrderingConstraint to record bounds for things other than TypeParamRefs
### Allow OrderingConstraint to record bounds for things other than TypeParamRefs

This would mean we no longer need to keep the bidirectional mapping in GadtConstraint.

## Not mixing OrderingConstraint and ConstraintHandling in GadtConstraint
### Not mixing OrderingConstraint and ConstraintHandling in GadtConstraint

GadtConstraint right now mixes OrderingConstraint and ConstraintHandling. The first one is supposed to be the immutable constraint datastructure. The second one implements mutable functionality around a variable containing the immutable datastructure.

GadtConstraint mixes them both. Things would be better organised if GadtConstraint was split like the normal constraint.

## Creating a separate TypeComparer for breaking down types into GADT constraints
### Creating a separate TypeComparer for breaking down types into GADT constraints

TypeComparer is biased towards one specific way of approximating constraints. When we infer types, it's ok to be "optimistic". When inferring GADT constraints, we should be as pessimistic as possible, in order to only infer constraints which are necessary.

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/internals/syntax-3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ |

Informal descriptions are typeset as `“some comment”`.

### Lexical Syntax
## Lexical Syntax
The lexical syntax of Scala is given by the following grammar in EBNF
form.

Expand Down
2 changes: 1 addition & 1 deletion docs/_docs/internals/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ hexDigit ::= ‘0’ | … | ‘9’ | ‘A’ | … | ‘F’ | ‘a’ |

Informal descriptions are typeset as `“some comment”`.

### Lexical Syntax
## Lexical Syntax

The lexical syntax of Scala is given by the following grammar in EBNF
form.
Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/reference/changed-features/imports.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ import scala.annotation as ann
import java as j
```

### Migration
## Migration

To support cross-building, Scala 3.0 supports the old import syntax with `_` for wildcards and `=>` for renamings in addition to the new one. The old syntax
will be dropped in a future versions. Automatic rewritings from old to new syntax
are offered under settings `-source 3.1-migration -rewrite`.

### Syntax
## Syntax

```
Import ::= ‘import’ ImportExpr {‘,’ ImportExpr}
Expand Down
4 changes: 2 additions & 2 deletions docs/_docs/reference/changed-features/wildcards.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ List[?]
Map[? <: AnyRef, ? >: Null]
```

### Motivation
## Motivation

We would like to use the underscore syntax `_` to stand for an anonymous type parameter, aligning it with its meaning in
value parameter lists. So, just as `f(_)` is a shorthand for the lambda `x => f(x)`, in the future `C[_]` will be a shorthand
Expand All @@ -21,7 +21,7 @@ In the future, `F[_]` will mean the same thing, no matter where it is used.
We pick `?` as a replacement syntax for wildcard types, since it aligns with
[Java's syntax](https://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html).

### Migration Strategy
## Migration Strategy

The migration to the new scheme is complicated, in particular since the [kind projector](https://github.com/typelevel/kind-projector)
compiler plugin still uses the reverse convention, with `?` meaning parameter placeholder instead of wildcard. Fortunately, kind projector has added `*` as an alternative syntax for `?`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ val s = summon[Test.Codec[Option[Int]]](

No local given instance was generated because the synthesized argument is not recursive.

### Reference
## Reference

For more information, see [Issue #1998](https://github.com/lampepfl/dotty/issues/1998)
and the associated [Scala SIP](https://docs.scala-lang.org/sips/byname-implicits.html).
2 changes: 1 addition & 1 deletion docs/_docs/reference/contextual/context-functions-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@ See the section on Expressiveness from [Simplicitly: foundations and
applications of implicit function
types](https://dl.acm.org/citation.cfm?id=3158130).

### Type Checking
## Type Checking

After desugaring no additional typing rules are required for context function types.
Loading