Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
104 changes: 104 additions & 0 deletions compiler/cases/bounded.json
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,110 @@
"builds": true,
"diagnostics": []
}
},
{
"id": "bounded/unreached-unmarked",
"description": "a struct no protocol reaches, with a string without a maximum, is an error: it is a type another package can use",
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"schemas": [
{
"path": "src/models.ids",
"text": "struct Blob {\n data: string\n}\n"
}
],
"dependencies": []
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [
{
"code": "bounds::unbounded",
"severity": "error"
}
]
}
},
{
"id": "bounded/unreached-list-unmarked",
"description": "a struct no protocol reaches, with a list without a maximum, is an error too",
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"schemas": [
{
"path": "src/models.ids",
"text": "struct Blob {\n data: u8[]\n}\n"
}
],
"dependencies": []
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [
{
"code": "bounds::unbounded",
"severity": "error"
}
]
}
},
{
"id": "bounded/unreached-allowed-still-unmarked",
"description": "allowing @unverified in the package doesn't cover a type no protocol reaches: nothing marked it",
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/models.ids",
"text": "struct Blob {\n data: string\n}\n"
}
],
"dependencies": []
}
],
"build": "app",
"expect": {
"builds": false,
"diagnostics": [
{
"code": "bounds::unbounded",
"severity": "error"
}
]
}
},
{
"id": "bounded/unreached-bounded",
"description": "a struct no protocol reaches, bounded, gives nothing up and builds",
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"schemas": [
{
"path": "src/models.ids",
"text": "struct Blob {\n data: char[max 64]\n tags: u8[max 16]\n}\n"
}
],
"dependencies": []
}
],
"build": "app",
"expect": {
"protocols": [],
"builds": true,
"diagnostics": []
}
}
]
}
124 changes: 107 additions & 17 deletions compiler/cases/references.json
Original file line number Diff line number Diff line change
Expand Up @@ -907,11 +907,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand All @@ -928,13 +928,31 @@
"build": "app",
"expect": {
"protocols": [
{
"name": "Dump",
"given_up": [
"bounded_size"
],
"acknowledged": [
{
"guarantee": "bounded_size",
"scope": "protocol",
"reason": "the archive keeps what it is given"
}
]
},
{
"name": "Orders",
"given_up": []
}
],
"builds": true,
"diagnostics": []
"diagnostics": [
{
"code": "unverified::bounded-size",
"severity": "warning"
}
]
}
},
{
Expand All @@ -943,11 +961,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand All @@ -964,13 +982,31 @@
"build": "app",
"expect": {
"protocols": [
{
"name": "Dump",
"given_up": [
"bounded_size"
],
"acknowledged": [
{
"guarantee": "bounded_size",
"scope": "protocol",
"reason": "the archive keeps what it is given"
}
]
},
{
"name": "Orders",
"given_up": []
}
],
"builds": true,
"diagnostics": []
"diagnostics": [
{
"code": "unverified::bounded-size",
"severity": "warning"
}
]
}
},
{
Expand All @@ -979,11 +1015,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand All @@ -1000,13 +1036,31 @@
"build": "app",
"expect": {
"protocols": [
{
"name": "Dump",
"given_up": [
"bounded_size"
],
"acknowledged": [
{
"guarantee": "bounded_size",
"scope": "protocol",
"reason": "the archive keeps what it is given"
}
]
},
{
"name": "Orders",
"given_up": []
}
],
"builds": true,
"diagnostics": []
"diagnostics": [
{
"code": "unverified::bounded-size",
"severity": "warning"
}
]
}
},
{
Expand All @@ -1015,11 +1069,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand All @@ -1036,13 +1090,31 @@
"build": "app",
"expect": {
"protocols": [
{
"name": "Dump",
"given_up": [
"bounded_size"
],
"acknowledged": [
{
"guarantee": "bounded_size",
"scope": "protocol",
"reason": "the archive keeps what it is given"
}
]
},
{
"name": "Orders",
"given_up": []
}
],
"builds": true,
"diagnostics": []
"diagnostics": [
{
"code": "unverified::bounded-size",
"severity": "warning"
}
]
}
},
{
Expand All @@ -1051,11 +1123,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand All @@ -1072,13 +1144,31 @@
"build": "app",
"expect": {
"protocols": [
{
"name": "Dump",
"given_up": [
"bounded_size"
],
"acknowledged": [
{
"guarantee": "bounded_size",
"scope": "protocol",
"reason": "the archive keeps what it is given"
}
]
},
{
"name": "Orders",
"given_up": []
}
],
"builds": true,
"diagnostics": []
"diagnostics": [
{
"code": "unverified::bounded-size",
"severity": "warning"
}
]
}
},
{
Expand All @@ -1087,11 +1177,11 @@
"packages": [
{
"name": "app",
"config": "congregation app\nspecification_version = 1\n",
"config": "congregation app\nspecification_version = 1\nsettings = { annotations = { unverified = { allowed = true } } }\n",
"schemas": [
{
"path": "src/archive.ids",
"text": "struct Invoice {\n data: string\n}\n"
"text": "struct Invoice {\n data: string\n}\n\n@unverified = \"the archive keeps what it is given\"\nprotocol Dump {\n function put(i: Invoice);\n}\n"
},
{
"path": "src/billing/api.ids",
Expand Down
2 changes: 1 addition & 1 deletion compiler/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ cases with `dependencies`, which are in `acceptance` and `chain`.
| `marker` | the gate (`annotations.unverified.allowed`); a marker required where a protocol gives something up (its own `@handshake`, the package's default); its reason; a marker where nothing is given up |
| `keyed` | `@unverified = { <guarantee> = "<reason>" }`: the exact set, an unknown id, a missing one, one listed that isn't given up, one listed twice |
| `package` | `unverified` in `config.idp`: the keyed and plain forms covering what a protocol takes from the package's settings; a protocol with its own `@handshake` not covered; `unverified::wrong-scope` for `bounded_size`; a guarantee no protocol gives up through it; the gate; a marker adding `bounded_size` |
| `bounded` | `bounded_size`: a string or list without a maximum, a type that contains itself without `@max_depth`, a type from another schema of the package that holds one, each unmarked (an error) and marked (given up), and the bounded variants |
| `bounded` | `bounded_size`: a string or list without a maximum, a type that contains itself without `@max_depth`, a type from another schema of the package that holds one, each unmarked (an error) and marked (given up), a type no protocol reaches (it has to be bounded: an error where it holds a string or list without a maximum, even where the package allows `@unverified`), and the bounded variants |
| `acceptance` | a dependency's unverified protocols accepted under it in `config.idp`: not at all, exactly, for less, for more; the reasons the consumer is shown; the dependency judged by its own package |
| `imports` | where a `use` path starts: a package's own schemas only through `package::`, `parent::` or `self::` (a bare path to one is `import::bare-own-schema-path`, in each form of a `use`), a dependency's and `std`'s paths as they were, a path matching nothing (`import::unresolved`), a schema named like a dependency, and the names a dependency can't have |
| `references` | how a type is named once imported, the Rust model: a whole-namespace `use` brings in only its name (`types::User`, and a bare `User` is `reference::not-in-scope`); a `use` of an item, `{...}` or `*` brings in the names it lists (and `types::User` after it is `reference::qualifier-not-in-scope`); a full path (`package::`, `parent::`, `self::`, `std::`, a dependency's) in a type position with no `use`; a path going down from a name in scope, a dependency's name included; a name defined twice (`reference::defined-twice`) and an alias resolving it; each spelling reaching the same type, and a package written before the rule unchanged |
Expand Down
Loading
Loading