-
Notifications
You must be signed in to change notification settings - Fork 64
Analyze Subprogram Instantiation Declarations #209
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
Analyze Subprogram Instantiation Declarations #209
Conversation
} | ||
|
||
impl<'a> Signature<'a> { | ||
pub fn new(formals: FormalRegion<'a>, return_type: Option<TypeEnt<'a>>) -> Signature<'a> { | ||
pub fn new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding generics to the signature is a very invasive change. Are you sure this is the right approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what the best place to store the generics is. Putting it here felt like the right place though as the generics can be thought of as a part of the signature. I initially also tried putting it into the Overloaded
enum (creating an UninstSubprogram
and UninstSubprogramDecl
variant) but that was really tedious and cumbersome compared to the current solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isnt an uninstantiated subprogram supposed to be handled very differently from other subprogams? Adding enum variants to the Overloaded enum then seems like a good way to ensure as all existing code that handles normal subprograms should not also run for uninstantiated subprograms without careful consideration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway I am not sure what is the best approach, just want to share my gut feeling. In the end you just have to try the approaches and see which works. The generic subprograms are one of the more complicated features of vhdl, a lot of strange corner cases exists with overloading and adding generics into the mix makes it more complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the implementation slightly. Now, only a SignatureKey
has a boolean value uninstantiated
to differentiate between uninstantiated entities. I cannot remove it there at the moment as this signature key needs to be unambiguous for overloaded entities. Do you think this approach is better?
…on-statement # Conflicts: # vhdl_lang/src/analysis/declarative.rs # vhdl_lang/src/named_entity/overloaded.rs
…subprogram resolution
Alright, I think this is ready for review. I have also added some ignored tests that show the scope of this PR. All in all, this PR should cover most use cases. The ignored tests are mostly some edge-cases (e.g., recursive uninstantiated subprogram calls, uninstantiated subprogram calls as resolution function, e.t.c.). That being said, the ignored tests are obviously far from complete. |
I made a first overview of the code. Looks good and well tested. I will do a deeper review tomorrow. |
I had another look and I think it is solid. The only concern I have is it is really correct to add the struct SubprogramKey {
cat: SignatureCategory,
key: SignatureKey,
} We would use |
…lyze-instantiation-statement # Conflicts: # vhdl_lang/src/analysis/declarative.rs
Uh oh!
There was an error while loading. Please reload this page.