Skip to content

Add documentation: Multi-Target References #282

@Lotes

Description

@Lotes

With the new multi-target references (#1509), references in your language can now target multiple elements at once:

interface Obj {
    A: number
}
interface Obj {
    B: string
}
// `Obj` is a reference to both interfaces (not only one of them)
// Our type system should merge those definitions
const x: Obj = {
    A: 123,
    B: "hello world"
}

There are a lot of existing programming languages out there that provide features like interface merging or partial classes, which allow you to target multiple AST elements with one reference.
This feature is now available in the grammar language via the [+ReferenceType] syntax:

Item: name=ID;
ReferenceElement: item=[+Item]; // Can reference multiple `Item` elements with the same name

This will generate a item: MultiReference<Item> field now.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions