Skip to content

Commit f26a403

Browse files
committed
Merge branch 'develop' into release
2 parents b574dd2 + e924a8a commit f26a403

File tree

532 files changed

+30034
-62571
lines changed

Some content is hidden

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

532 files changed

+30034
-62571
lines changed

.fleet/run.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"configurations": [
3+
{
4+
"type": "gradle",
5+
"name": "Build web version",
6+
"tasks": [
7+
"buildWeb"
8+
]
9+
},
10+
{
11+
"type": "gradle",
12+
"name": "Build pdf version",
13+
"tasks": [
14+
"buildPdf"
15+
]
16+
}
17+
]
18+
}

.fleet/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"backend.maxHeapSizeMb": 4096
3+
}

docs/build.gradle.kts

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,6 @@ val jsBuildDir = "$resourcesBuildDir/js"
1717
val scriptsDir = "$projectDir/scripts/build"
1818
val ls: String = System.lineSeparator()
1919

20-
fun getScriptText(scriptName: String): String {
21-
val disableTODOS = project.findProperty("disableTODOS") != null
22-
val enableStaticMath = project.findProperty("enableStaticMath") != null
23-
24-
val buildTemplate = File("$scriptsDir/$scriptName.sh").readText()
25-
26-
val res = with(StringBuilder()) {
27-
append("PROJECT_DIR=$projectDir$ls")
28-
if (disableTODOS) append("TODO_OPTION=--disable-todos$ls")
29-
else append("TODO_OPTION=--enable-todos$ls")
30-
31-
if (enableStaticMath) append("STATIC_MATH_OPTION=--enable-static-math$ls")
32-
else append("STATIC_MATH_OPTION=--disable-static-math$ls")
33-
34-
append(buildTemplate)
35-
}
36-
37-
return "$res"
38-
}
39-
4020
repositories {
4121
maven {
4222
url = URI("https://maven.vorpal-research.science")

docs/scripts/build/settings.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ COMMON_PANDOC_OPTIONS="\
1010
--variable filecolor=cyan \
1111
--syntax-definition=kotlin.xml \
1212
--variable=subparagraph \
13+
--variable=math: \
1314
--top-level-division=part"
1415

1516
TOC_PANDOC_OPTIONS="\
@@ -29,5 +30,8 @@ init_settings() {
2930
PREAMBLE_OPTIONS="-H ./preamble.tex"
3031
elif [ "${type}" == "html" ]; then
3132
PREAMBLE_OPTIONS="-H ./preamble.html --include-before-body ./preface.html --include-after-body ./epilogue.html"
33+
if [ "${STATIC_MATH_OPTION}" == "--disable-static-math" ]; then
34+
PREAMBLE_OPTIONS="$PREAMBLE_OPTIONS -H ./dynamic_math.html"
35+
fi
3236
fi
3337
}

docs/src/md/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<#mode quote>
22

3-
\newcommand{\currentKotlinMajorVersion}{\textrm{1.7}}
3+
\newcommand{\currentKotlinMajorVersion}{\textrm{1.8}}
44

55
\newcommand{\opMathTT}[2]{%
66
\expandafter\newcommand{#1}{\operatorname{\texttt{#2}}}%

docs/src/md/dynamic_math.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script type="text/javascript">
2+
require([
3+
"resources/js/katex/katex.min.js"
4+
], katex => {
5+
let render = () => {
6+
let mathElements = document.getElementsByClassName("math");
7+
let macros = [];
8+
for (let i = 0; i < mathElements.length; i++) {
9+
let texText = mathElements[i].firstChild;
10+
if (mathElements[i].tagName == "SPAN") {
11+
katex.render(texText.data, mathElements[i], {
12+
displayMode: mathElements[i].classList.contains("display"),
13+
throwOnError: false,
14+
macros: macros,
15+
fleqn: false
16+
});
17+
}
18+
}
19+
}
20+
21+
if (document.readyState === "loading") {
22+
document.addEventListener("DOMContentLoaded", render);
23+
} else {
24+
render();
25+
}
26+
});
27+
</script>

docs/src/md/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Kotlin language specification
44
author:
55
- Marat Akhin
66
- Mikhail Belyaev
7-
subtitle: Version 1.7-rfc+0.1
7+
subtitle: Version 1.8-rfc+0.1
88
---
99

1010
<#include "commands.md">

docs/src/md/kotlin.core/annotations.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
Annotations are a form of syntactically-defined metadata which may be associated with different entities in a Kotlin program.
44
Annotations are specified in the source code of the program and may be accessed on a particular platform using platform-specific mechanisms both by the compiler (and source-processing tools) and at runtime (using [reflection][Reflection] facilities).
5-
Values of annotation types cannot be created directly, but can be operated on when accessed using platform-specific facilities.
5+
Values of annotation types can also be created directly, but are usually operated on using platform-specific facilities.
6+
7+
> Note: before Kotlin 1.6, annotation types could not be created directly.
68
79
### Annotation values
810

docs/src/md/kotlin.core/cdfa.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ See the [corresponding section][Smart casts] for details.
13901390

13911391
#### Function contracts
13921392

1393-
> Note: as of Kotlin 1.5.0, contracts for user-defined functions are an experimental feature and, thus, not described here
1393+
> Note: as of Kotlin $\currentKotlinMajorVersion{}$, contracts for user-defined functions are an experimental feature and, thus, not described here
13941394
13951395
Some standard-library functions in Kotlin are defined in such a way that they adhere to a specific *call contract* that affects the way calls to such functions are analyzed from the perspective of the caller's control flow graph.
13961396
A function's call contract consists of one or more *effects*.

docs/src/md/kotlin.core/declarations.md

Lines changed: 72 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ There are three kinds of classifier declarations:
3838

3939
> Important: [object literals] are similar to [object declarations][Object declaration] and are considered to be anonymous classifier declarations, despite being [expressions].
4040
41-
42-
4341
#### Class declaration
4442

4543
A simple class declaration consists of the following parts.
@@ -627,7 +625,11 @@ Annotation classes have the following properties:
627625
> Note: annotation classes can have type parameters, but cannot use them as types for their primary constructor parameters.
628626
> Their main use is for various annotation processing tools, which can access the type arguments from the source code.
629627
630-
Annotation classes cannot be constructed directly unless passed as arguments to other annotations, but their primary constructors are used when specifying [code annotations][Annotations] for other entities.
628+
The main use of annotation classes is when specifying [code annotations][Annotations] for other entities.
629+
Additionally, annotation classes can be instantiated directly, for cases when you require working with an annotation instance directly.
630+
For example, this is needed for interoperability with some Java annotation APIs, as in Java you can implement an annotation interface and then instantiate it.
631+
632+
> Note: before Kotlin 1.6, annotation classes could not be instantiated directly.
631633
632634
> Examples:
633635
>
@@ -659,9 +661,6 @@ Annotation classes cannot be constructed directly unless passed as arguments to
659661
660662
#### Value class declaration
661663
662-
> Note: as of Kotlin 1.5.0, user-defined value classes are an experimental feature.
663-
> There is, however, a number of value classes in Kotlin standard library.
664-
665664
A class may be declared a **value** class by using `inline` or `value` modifier in its declaration.
666665
Value classes must adhere to the following limitations:
667666
@@ -670,18 +669,21 @@ Value classes must adhere to the following limitations:
670669
* Value classes must have a primary constructor with a single property constructor parameter, which is the data property of the class;
671670
* This property cannot be specified as `vararg` constructor argument;
672671
* This property must be declared `public`;
673-
* This property must be of [a runtime-available type][Runtime-available types];
674672
* They must not override `equals` and `hashCode` member functions of `kotlin.Any`;
675673
* They must not have any base classes besides `kotlin.Any`;
676674
* No other properties of this class may have backing fields.
677675
678676
> Note: `inline` modifier for value classes is supported as a legacy feature for compatibility with Kotlin 1.4 experimental inline classes and will be deprecated in the future.
679677
678+
> Note: before Kotlin 1.8, value classes supported only properties of [a runtime-available types].
679+
680680
Value classes implicitly override `equals` and `hashCode` member functions of `kotlin.Any` by delegating them to their only data property.
681681
Unless `toString` is overridden by the value class definition, it is also implicitly overridden by delegating to the data property.
682682
In addition to these, an value class is allowed by the implementation to be **inlined** where applicable, so that its data property is operated on instead.
683683
This also means that the property may be boxed back to the value class by using its primary constructor at any time if the compiler decides it is the right thing to do.
684684
685+
> Note: when inlining a data property of a non-runtime-available type $U$ (i.e., a non-reified type parameter), the property is considered to be of type, which is the runtime-available upper bound of $U$.
686+
685687
Due to these restrictions, it is highly discouraged to use value classes with the [reference equality operators][Reference equality expressions].
686688
687689
> Note: in the future versions of Kotlin, value classes may be allowed to have more than one data property.
@@ -694,13 +696,16 @@ In other aspects they are similar to classes, therefore we shall specify their d
694696
* An interface can be declared only in a declaration scope;
695697
* Additionally, an interface cannot be declared in an [object literal][Object literals];
696698
* An interface cannot have a class as its supertype;
699+
* This also means it is not considered to have `kotlin.Any` as its supertype for the purposes of [inheriting] and [overriding] callables;
700+
* However, it is still considered to be a subtype of `kotlin.Any` w.r.t. [subtyping];
697701
* An interface cannot have a constructor;
698702
* Interface properties cannot have initializers or backing fields;
699703
* Interface properties cannot be delegated;
700704
* An interface cannot have inner classes;
701705
* An interface and all its members are implicitly open;
702706
* All interface member properties and functions are implicitly public;
703-
* Trying to declare a non-public member property or function in an interface is an compile-time error.
707+
* Trying to declare a non-public member property or function in an interface is an compile-time error;
708+
* Interface member properties and functions without implementation are implicitly abstract.
704709
705710
##### Functional interface declaration
706711
@@ -947,7 +952,7 @@ In other cases return type $R$ cannot be omitted and must be specified explicitl
947952
> As type `kotlin.Nothing` has a [special meaning][`kotlin.Nothing`-typesystem] in Kotlin type system, it must be specified explicitly, to avoid spurious `kotlin.Nothing` function return types.
948953
949954
Function body $b$ is optional; if it is omitted, a function declaration creates an *abstract* function, which does not have an implementation.
950-
This is allowed only inside an [abstract class][Abstract classes-declarations].
955+
This is allowed only inside an [abstract class][Abstract classes-declarations] or an [interface][Interface declaration].
951956
If a function body $b$ is present, it should evaluate to type $B$ which should satisfy $B <: R$.
952957
953958
[`kotlin.Nothing`-typesystem]: #kotlin.nothing-typesystem
@@ -1128,8 +1133,12 @@ Particular platforms may introduce additional restrictions or guarantees for the
11281133
> Examples:
11291134
>
11301135
> ```kotlin
1131-
> fun bar(value: Any?) {...}
1132-
> inline fun fee(arg: () -> Unit) {...}
1136+
> fun bar(value: Any?) {}
1137+
>
1138+
> inline fun inlineParameter(arg: () -> Unit) { arg() }
1139+
> inline fun noinlineParameter(noinline arg: () -> Unit) { arg() }
1140+
> inline fun crossinlineParameter(crossinline arg: () -> Unit) { arg() }
1141+
>
11331142
> inline fun foo(inl: () -> Unit,
11341143
> crossinline cinl: () -> Unit,
11351144
> noinline noinl: () -> Unit) {
@@ -1138,22 +1147,61 @@ Particular platforms may introduce additional restrictions or guarantees for the
11381147
> cinl()
11391148
> noinl()
11401149
> // all arguments may be passed as inline
1141-
> fee(inl)
1142-
> fee(cinl)
1143-
> fee(noinl)
1144-
> // passing to non-inline function
1145-
> // is allowed only for noinline parameters
1150+
> inlineParameter(inl)
1151+
> inlineParameter(cinl)
1152+
> inlineParameter(noinl)
1153+
> // only noinline arguments may be passed as noinline
1154+
> noinlineParameter(inl) // not allowed
1155+
> noinlineParameter(cinl) // not allowed
1156+
> noinlineParameter(noinl)
1157+
> // noinline/crossinline arguments may be passed as crossinline
1158+
> crossinlineParameter(inl) // not allowed
1159+
> crossinlineParameter(cinl)
1160+
> crossinlineParameter(noinl)
1161+
> // only noinline arguments may be passed to non-inline functions
11461162
> bar(inl) // not allowed
11471163
> bar(cinl) // not allowed
1148-
> bar(noinl) // allowed
1149-
> // capturing in a lambda expression
1150-
> // is allowed for noinline/crossinline parameters
1164+
> bar(noinl)
1165+
> // noinline/crossinline parameters may be captured in lambda literals
11511166
> bar({ inl() }) // not allowed
1152-
> bar({ cinl() }) // allowed
1153-
> bar({ noinl() }) // allowed
1167+
> bar({ cinl() })
1168+
> bar({ noinl() })
11541169
> }
11551170
> ```
11561171
1172+
#### Infix functions
1173+
1174+
A function may be declared as an *infix* function by using a special `infix` modifier.
1175+
An infix function can be called in an [infix form][Infix function call], i.e., `a foo b` instead of `a.foo(b)`.
1176+
1177+
To be a valid infix function, function $F$ must satisfy the following requirements.
1178+
1179+
* $F$ has a dispatch or an extension [receiver][Receivers]
1180+
* $F$ has exactly one parameter
1181+
1182+
TODO(Examples)
1183+
1184+
#### Local function declaration
1185+
1186+
A function may be declared *locally* inside a [statement scope][Scopes and identifiers] (namely, inside another function).
1187+
Such declarations are similar to [function literals] in that they may capture values available in the scope they are declared in.
1188+
Otherwise they are similar to regular function declarations.
1189+
1190+
```kotlin
1191+
fun foo() {
1192+
var x = 2
1193+
1194+
fun bar(): Int {
1195+
return x
1196+
}
1197+
1198+
println(bar()) // 2
1199+
1200+
x = 42
1201+
println(bar()) // 42
1202+
}
1203+
```
1204+
11571205
#### Tail recursion optimization
11581206
11591207
A function may be declared *tail-recursive* by using a special `tailrec` modifier.
@@ -1633,7 +1681,7 @@ The scope where it is accessible is defined by its [*visibility modifiers*][Decl
16331681
16341682
> Examples:
16351683
> ```kotlin
1636-
> // simple typ ealias declaration
1684+
> // simple typealias declaration
16371685
> typealias IntList = List<Int>
16381686
> // parameterized type alias declaration
16391687
> // T has out variance implicitly
@@ -1766,8 +1814,8 @@ In case one needs to explicitly specify some type parameters via [type arguments
17661814
17671815
An underscore type argument does not add any type information to the [constraint system][Kotlin type constraints] *besides the presence of a type parameter*, i.e., parameterized declaration with different number of type parameters could be distinguished by different number of underscore type arguments.
17681816
1769-
If the type inference is successfull, each underscore type argument is considered to be equal to the inferred type for their respective type parameter.
1770-
If the type inference is not successfull, it is a compile-time error.
1817+
If the type inference is successful, each underscore type argument is considered to be equal to the inferred type for their respective type parameter.
1818+
If the type inference is not successful, it is a compile-time error.
17711819
17721820
> Example:
17731821
> ```kotlin

0 commit comments

Comments
 (0)