Support "records" in Podlang (#507)
* Support both integer and string keys in anchored keys * Podlang parser support for records * Validate record usage in Podlang * Lower records to middleware * Cross-module record imports * Tidying * Record entry name literal * More tidying * More tests, make sure qualified record literals are supported * Use snake-case for record entry names * Review feedback
This commit is contained in:
parent
5e3ac9a101
commit
e9e3241263
15 changed files with 2020 additions and 198 deletions
|
|
@ -164,6 +164,52 @@ pub enum ValidationError {
|
|||
|
||||
#[error("Requests must contain a REQUEST block")]
|
||||
NoRequestBlock,
|
||||
|
||||
#[error("Duplicate record definition: {name}")]
|
||||
DuplicateRecord {
|
||||
name: String,
|
||||
first_span: Option<Span>,
|
||||
second_span: Option<Span>,
|
||||
},
|
||||
|
||||
#[error("Record '{name}' has {count} entries, exceeding the limit of {max}")]
|
||||
RecordTooManyEntries {
|
||||
name: String,
|
||||
count: usize,
|
||||
max: usize,
|
||||
span: Option<Span>,
|
||||
},
|
||||
|
||||
#[error("Duplicate entry name '{entry}' in record '{record}'")]
|
||||
DuplicateRecordEntry {
|
||||
record: String,
|
||||
entry: String,
|
||||
span: Option<Span>,
|
||||
},
|
||||
|
||||
#[error("Unknown record type: {name}")]
|
||||
UnknownRecord { name: String, span: Option<Span> },
|
||||
|
||||
#[error("Record '{record}' has no entry '{entry}'")]
|
||||
UnknownRecordEntry {
|
||||
record: String,
|
||||
entry: String,
|
||||
span: Option<Span>,
|
||||
},
|
||||
|
||||
#[error("Duplicate entry '{entry}' in record literal '{record}'")]
|
||||
DuplicateLiteralRecordEntry {
|
||||
record: String,
|
||||
entry: String,
|
||||
span: Option<Span>,
|
||||
},
|
||||
|
||||
#[error("Bracket access '{wildcard}[...]' is not allowed on a wildcard typed as record '{record}'; use `{wildcard}.entry` instead")]
|
||||
BracketAccessOnTypedWildcard {
|
||||
wildcard: String,
|
||||
record: String,
|
||||
span: Option<Span>,
|
||||
},
|
||||
}
|
||||
|
||||
/// Lowering errors from frontend AST lowering to middleware
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue