-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type mismatch on init of static[T] object with T being a static[U] #11142
Comments
Investigating a bit where the semcheck is failing: Full stacktrace
InvestigationDiving a bit into sigmatch, the failure seems to be triggered on this code path: Lines 2399 to 2408 in bb8e2ee
Small stacktrace before returning from the branch
Diving deeper into sigmatch, it's Line 1968 in bb8e2ee
Tracing typeRelTurning on tracing produces this interesting output for the inner static param, notice that we have tyStatic on one side and tyObject on the other. ----- TYPE REL 4
{
"kind": "tyStatic",
"id": 171017,
"sym": {
"kind": "skGenericParam",
"name": "P",
"id": 171019,
"typ": <defined 7 lines upwards>
},
"flags": ["tfHasMeta", "tfHasStatic", "tfGenericTypeParam"],
"sons": [{
"kind": "tyGenericBody",
"id": 171004,
"sym": {
"kind": "skType",
"name": "MyObjParam",
"id": 171003,
"flags": ["sfUsed", "sfGlobal"],
"typ": <defined 8 lines upwards>
},
"flags": ["tfHasMeta"],
"sons": [{
"kind": "tyStatic",
"id": 171009,
"sym": {
"kind": "skGenericParam",
"name": "N",
"id": 171011,
"typ": <defined 7 lines upwards>
},
"flags": ["tfHasStatic", "tfGenericTypeParam"],
"sons": [{
"kind": "tyInt",
"id": 42006,
"sym": {
"kind": "skType",
"name": "int",
"id": 42005,
"flags": ["sfUsed", "sfExported", "sfGlobal"],
"typ": <defined 8 lines upwards>
},
"flags": ["tfCheckedForDestructor"]
}]
}, {
"kind": "tyObject",
"id": 171013,
"sym": <defined 33 lines upwards>,
"flags": ["tfFinal"],
"sons": [null],
"n": {
"kind": "nkRecList",
"sons": [{
"kind": "nkSym",
"sym": {
"kind": "skField",
"name": "x",
"id": 171014,
"position": 0,
"typ": <defined 27 lines upwards>
}
}]
}
}],
"n": {
"kind": "nkGenericParams",
"sons": [{
"kind": "nkSym",
"sym": <defined 43 lines upwards>
}]
}
}]
}
{
"kind": "tyObject",
"id": 171013,
"sym": {
"kind": "skType",
"name": "MyObjParam",
"id": 171003,
"flags": ["sfUsed", "sfGlobal"],
"typ": {
"kind": "tyGenericBody",
"id": 171004,
"sym": <defined 8 lines upwards>,
"flags": ["tfHasMeta"],
"sons": [{
"kind": "tyStatic",
"id": 171009,
"sym": {
"kind": "skGenericParam",
"name": "N",
"id": 171011,
"typ": <defined 7 lines upwards>
},
"flags": ["tfHasStatic", "tfGenericTypeParam"],
"sons": [{
"kind": "tyInt",
"id": 42006,
"sym": {
"kind": "skType",
"name": "int",
"id": 42005,
"flags": ["sfUsed", "sfExported", "sfGlobal"],
"typ": <defined 8 lines upwards>
},
"flags": ["tfCheckedForDestructor"]
}]
}, <defined 35 lines upwards>],
"n": {
"kind": "nkGenericParams",
"sons": [{
"kind": "nkSym",
"sym": <defined 24 lines upwards>
}]
}
}
},
"flags": ["tfFinal"],
"sons": [null],
"n": {
"kind": "nkRecList",
"sons": [{
"kind": "nkSym",
"sym": {
"kind": "skField",
"name": "x",
"id": 171014,
"position": 0,
"typ": <defined 33 lines upwards>
}
}]
}
}
----- TYPE REL 4 RESULT: isNone |
Works as expected now. My latest change, fixed it. |
* close nim-lang#11142 * fix nim-lang#12636 * undo unwanted changes * fix illegal recursion case
* close nim-lang#11142 * fix nim-lang#12636 * undo unwanted changes * fix illegal recursion case
* close nim-lang#11142 * fix nim-lang#12636 * undo unwanted changes * fix illegal recursion case
* close nim-lang#11142 * fix nim-lang#12636 * undo unwanted changes * fix illegal recursion case
The following works:
But the following fails
The error is:
I expect the issue rootcause is closely related to #9679.
Use case: I'm trying to implement a bigint backend for an elliptic curve crypto library. Everything is done modulo a bigint that is known at compile-time. The types are like this:
I expect that @andreaferretti would also like to use this in Emmy
The text was updated successfully, but these errors were encountered: