[OM] parsing depend on the ordering of Class
- Dominant language
- C++
- Stars
- 2.2k
- Forks
- 524
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 46
Description
Chisel provides a **unsafe** version of get class type: `Class.unsafeGetClassTypeByName`, this is used when user need a Class Type w/o get the Scala val of which.
This will cause an issue:
I guarantee a `Class Foo` will be defined after this `Class Bar`, so I use it at Foo use the unsafe API, see:
```fir
FIRRTL version 4.0.0
circuit Bar :
class Bar :
output foo :Inst
class Foo :
skip
```
However firtool complains:
```
> firtool bug.fir
bug.fir:4:22: error: unknown class 'Foo'
output foo :Inst
```
Proposing checking the unknown class at the last of parser, or create a new pass for validation.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the FIRRTL example with firtool and trace the parser path using Class.unsafeGetClassTypeByName. Inspect how class definitions are resolved when Bar references the later Foo, then determine whether the reported forward reference is accepted while preserving unknown-class validation. Done means the example parses successfully and genuinely unknown classes still produce an error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100