Document compiler fixes and repair standalone documentation images

This commit is contained in:
sergeych committed 2026-10-21 00:04:58 +04:00
1 parent c34371b784
commit c76b10e9fd
3 files changed
+31 -2

No files matched your search

+4 -1
View File
@@ -9,7 +9,10 @@ History note:
## Unreleased ## Unreleased
- No unreleased entries yet. - Reject member functions named after their enclosing class and diagnose unsupported `this(...)` constructor delegation at compile time.
- Preserve declared, inferred, and generic return types from static method calls.
- Initialize singleton static members and dispatch their calls through class scope, including trailing-lambda calls.
- Update the language reference and OOP guide with constructor naming rules and typed static factory examples.
## 1.5.6 (2026-05-16) ## 1.5.6 (2026-05-16)
+2 -1
View File
@@ -113,9 +113,10 @@ process_file() {
# - [text](file.md) -> [text](#file.md) # - [text](file.md) -> [text](#file.md)
# - [text](dir/file.md) -> [text](#dir_file.md) # - [text](dir/file.md) -> [text](#dir_file.md)
# - [text](file.md#anchor) -> [text](#anchor) # - [text](file.md#anchor) -> [text](#anchor)
# - Fix image links: [alt](../images/...) -> [alt](images/...) if needed, but none found yet. # - Resolve site-root image URLs against the local site resources for embedding.
cat "$full_path" | \ cat "$full_path" | \
perl -pe 's{(!\[[^\]]*\]\()/}{$1site/src/jsMain/resources/}g' | \
perl -pe 's/\[([^\]]+)\]\(([^)]+)\.md\)/"[$1](#" . ($2 =~ s|\/|_|gr) . ".md)"/ge' | \ perl -pe 's/\[([^\]]+)\]\(([^)]+)\.md\)/"[$1](#" . ($2 =~ s|\/|_|gr) . ".md)"/ge' | \
perl -pe 's/\[([^\]]+)\]\(([^)]+)\.md#([^)]+)\)/[$1](#$3)/g' >> "$MERGED_MD" perl -pe 's/\[([^\]]+)\]\(([^)]+)\.md#([^)]+)\)/[$1](#$3)/g' >> "$MERGED_MD"
+25
View File
@@ -42,6 +42,12 @@ a _constructor_ that requires two parameters for fields. So when creating it wit
Form now on `Point` is a class, it's type is `Class`, and we can create instances with it as in the Form now on `Point` is a class, it's type is `Class`, and we can create instances with it as in the
example above. example above.
A member function cannot have the same name as its enclosing class, including a
static member function. Constructors are declared in the class header; use the
class name to create another instance. `this(...)` and `this@Type(...)` do not
declare or delegate to secondary constructors. Local functions may shadow class
names according to the normal lexical scope rules.
## Singleton Objects ## Singleton Objects
Singleton objects are declared using the `object` keyword. An `object` declaration defines both a class and a single instance of that class at the same time. This is perfect for stateless utilities, global configuration, or shared delegates. Singleton objects are declared using the `object` keyword. An `object` declaration defines both a class and a single instance of that class at the same time. This is perfect for stateless utilities, global configuration, or shared delegates.
@@ -1042,6 +1048,25 @@ Static fields can be accessed from static methods via the class qualifier:
assertEquals("bar", Test.getData() ) assertEquals("bar", Test.getData() )
>>> void >>> void
Static calls preserve their declared or inferred return types, so their results
can be used directly in chained expressions or assigned without a type annotation.
Generic static factories also preserve the type inferred from their arguments:
class StaticBox<T>(val value: T) {
static fun of<T>(value: T): StaticBox<T> = StaticBox(value)
}
val box = StaticBox.of("hello")
assertEquals(5, box.value.length)
>>> void
Named singleton objects also support static methods:
object StaticGreeting {
static fun text(): String = "hello"
}
assertEquals(5, StaticGreeting.text().length)
>>> void
# Extension members # Extension members
Sometimes an existing type or named singleton object is missing some particular functionality that can be _added to it_ without rewriting its inner logic and without using its private state. In this case, _extension members_ can be used. Sometimes an existing type or named singleton object is missing some particular functionality that can be _added to it_ without rewriting its inner logic and without using its private state. In this case, _extension members_ can be used.