Closed tdp2110 closed 1 month ago
Describe the bug Consider test.sv:
class foo # (type T); endclass module top; endmodule
./bin/slang test.sv --ast-json test.json produces
./bin/slang test.sv --ast-json test.json
{ "design": { "name": "$root", "kind": "Root", "addr": 6583145610400, "members": [ { "name": "", "kind": "CompilationUnit", "addr": 6583146894560, "members": [ { "name": "foo", "kind": "GenericClassDef", "addr": 6583146874256, "specializations": [ { "name": "foo", "kind": "ClassType", "addr": 6583146895168, "members": [ { "name": "T", "kind": "TypeParameter", "addr": 6583146895416, "type": "<error>", "isLocal": false, "isPort": true, "isBody": false } ], "isAbstract": false, "isInterface": false, "isFinal": false, "genericClass": "6583146874256 foo", "implements": [ ] } ] } ] }, { "name": "top", "kind": "Instance", "addr": 6583146895040, "body": { "name": "top", "kind": "InstanceBody", "addr": 6583146894856, "definition": "6583145479168 top" }, "connections": [ ] } ] }, "definitions": [ { "name": "top", "kind": "Definition", "addr": 6583145479168, "defaultNetType": "6583145608160 wire", "definitionKind": "Module", "defaultLifetime": "Static", "unconnectedDrive": "None" } ] }
Notice specializations of the generic class contains one member, which has an invalid type parameter. These are created, on purpose, for diagnostic purposes (see https://github.com/MikePopoloski/slang/blob/master/source/ast/ElabVisitors.h#L447-L454), but they probably shouldn't persist in the AST. Am I wrong?
To Reproduce
See above commands.
Additional context Thanks, you rock.
Yeah, probably the invalid specialization should not be added to the specialization map. Or at the very least it can be filtered out during serialization.
Fixed in ff952d50165efb354988a7df629e14ae964a787a
Describe the bug Consider test.sv:
./bin/slang test.sv --ast-json test.json
producesNotice specializations of the generic class contains one member, which has an invalid type parameter. These are created, on purpose, for diagnostic purposes (see https://github.com/MikePopoloski/slang/blob/master/source/ast/ElabVisitors.h#L447-L454), but they probably shouldn't persist in the AST. Am I wrong?
To Reproduce
See above commands.
Additional context Thanks, you rock.