Comments (4)
We have a test for this, so I'm not sure how this is arising in the integration test yet:
from apalache.
7ac4e54 adds the support for row-typed records we need to properly type quint records, but the type checking guards in the builder are not hip to row types, so I'm now getting
> Name updateF1 with type (({ f1: Int }) => { f1: Int }) constructed in scope where expected type is (({ f1: Int, f2: Str, a }) => { f1: Int, f2: Str, a }). E@18:16:20.594
from apalache.
Ah, the row typing is getting lost on the quint side actually:
Given
def updateF1(r) = r.with("f1", 1)
action Next = all {
rec1' = updateF1(rec1),
rec2' = rec2.with("f3", true),
rec3' = updateF1(rec3),
}
The source map for the declaration of updateF1
looks like:
{
"id": 20,
"kind": "def",
"name": "updateF1",
"qualifier": "def",
"expr": {
"id": 20,
"kind": "lambda",
"params": [{ "id": 15, "name": "r" }],
"qualifier": "def",
"expr": {
"id": 19,
"kind": "app",
"opcode": "with",
"args": [
{ "id": 16, "kind": "name", "name": "r" },
{ "id": 17, "kind": "str", "value": "f1" },
{ "id": 18, "kind": "int", "value": 1 }
]
}
}
}
But the source map we get for the application of updateF1
looks like this:
{
"id": 43,
"kind": "app",
"opcode": "updateF1",
"args": [{ "id": 42, "kind": "name", "name": "rec1" }]
}
When we then construct the application of updateF1
, we need to supply the type for the operator updateF1
to the builder, but we we deduce this its application context alone, which doesn't give us access to the type of the operator at time of declaration. Instead we only have this to work with:
"43": {
"typeVariables": {},
"rowVariables": {},
"type": {
"kind": "rec",
"fields": {
"kind": "row",
"fields": [{ "fieldName": "f1", "fieldType": { "kind": "int" } }],
"other": {
"kind": "row",
"fields": [
{ "fieldName": "f2", "fieldType": { "id": 2, "kind": "str" } }
],
"other": { "kind": "var", "name": "r1" }
}
}
}
},
Since the "scope safe" builder is policing consistent typing of named expressions, once a closed type has been inferred for the operator application, subsequent applications licensed by the polymorphic type of the declared operator, instead are rejected due to the conflict of the
concrete types.
Options:
- Use the builder that doesn't enforce singular typing of names.
- Extend the context of the converter to track the type of declared operator by name.
- Extend the QuintIR so it includes the ID of a name's definition along with each occurence of the name
from apalache.
@gabrielamafra noted that we're not using the lookup table currently, support for exporting this was just added recently, but it will give us a way to derive the type of the defined operator. 🎉
from apalache.
Related Issues (20)
- Unexpected exception HOT 2
- Document Apalache config format + options
- A set filter over PowSet[FinSet[Int]] is not implemented
- Wrong function sets counterexample? HOT 6
- Add warning for misplaced occurrence of `oneOf` when parsing from quint
- Raise error when an unexpanded type constant is found in quint IR output
- `parse` command adds superfluous `EXTENDS` statement HOT 2
- Use `parse` to format modules. HOT 2
- Unhandled Exception (java.util.NoSuchElementException: None.get) on empty file input HOT 4
- Crash with `funArrays` encoding HOT 2
- Typechecking crashes with `IllegalArgumentException: Unsupported expression` on unbounded quantification (e.g., `\A x: P`). HOT 8
- Operator overriding in annotations
- Include constant value assignments in ITF
- Allow specifying types in separate files
- Name clash leads to operator being incorrectly marked as recursive HOT 3
- Extend the server to be able to reply with formatted TLA+ generated from the IR HOT 1
- Pretty printing the apalache IR into TLA+ does not sanitize identifiers
- Assignments in quint `init` operators need to be unprimed HOT 2
- TLA+ pretty printer produces `[]` on empty tuples, which is invalid syntax
- Add support for Quint's `allListsUpTo`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apalache.