AugAssignment & Default Parameter Support, and Polymorphism FIxes #95

Closed
ychenfo wants to merge 17 commits from range_with_class into master
Collaborator
  • Add augassign statement support
  • Constant primitive default parameter support
  • Fix polymorphic class method partial instantiation (typevars occuring only in class methods but not in class declarations are now handled correctly)
  • Fix rigid typevar (typevars without bound should now be able to be handled properly)
  • Symbol resolver in nac3artiq and standalone now can handle typevar with forward ref
  • Add virtual in min_artiq

Related to inheritance, super().__init__() are not supported yet (in nac3standalone, we need to manually initialize the base class attributes in the child class' constructor)... But in situations in nac3artiq where class objects are initilized on the host side this should not be a very big problem.

- Add augassign statement support - Constant primitive default parameter support - Fix polymorphic class method partial instantiation (typevars occuring only in class methods but not in class declarations are now handled correctly) - Fix rigid typevar (typevars without bound should now be able to be handled properly) - Symbol resolver in nac3artiq and standalone now can handle typevar with forward ref - Add `virtual` in min_artiq ----- Related to inheritance, `super().__init__()` are not supported yet (in nac3standalone, we need to manually initialize the base class attributes in the child class' constructor)... But in situations in nac3artiq where class objects are initilized on the host side this should not be a very big problem.
ychenfo added 17 commits 2021-11-12 03:54:26 +08:00
Owner

I cherry-picked the first commit because it seemed simple enough and would solve a lot of practical problems.
For the others, please split them into separate self-contained functional PRs for easier review.

I cherry-picked the first commit because it seemed simple enough and would solve a lot of practical problems. For the others, please split them into separate self-contained functional PRs for easier review.
sb10q reviewed 2021-11-13 12:26:12 +08:00
@ -1068,2 +1069,2 @@
args.args
let mut arg_with_defualt: Vec<(&ast::Located<ast::ArgData<()>>, Option<&ast::Expr>)> = args
Owner

typo

typo
sb10q reviewed 2021-11-13 12:26:31 +08:00
@ -1321,1 +1361,3 @@
default_value: None,
default_value: default.map(|default| {
if name == "self".into() {
panic!("`self` parameter cannot take default value at {}", x.location)
Owner

Return an error instead of calling panic!

Return an error instead of calling ``panic!``
sb10q reviewed 2021-11-13 12:27:08 +08:00
@ -69,0 +97,4 @@
);
internal_resolver.add_id_type(
if let ExprKind::Name { id, .. } = &targets[0].node { *id } else {
panic!("must assign simple name variable as type variable for now")
Owner

Remove "for now".

Remove "for now".
sb10q reviewed 2021-11-13 12:27:33 +08:00
@ -344,0 +362,4 @@
Constant::Tuple(tuple) => Ok(SymbolValue::Tuple(
tuple.iter().map(|x| handle_constant(x, loc)).collect::<Result<Vec<_>, _>>()?
)),
_ => unimplemented!("this constant is not supported now at {}", loc),
Owner

remove "now"

remove "now"
Owner

Should we close this PR?

@ychenfo can you keep breaking down the remaining changes into separate PRs, and then delete the range_with_class branch?

Should we close this PR? @ychenfo can you keep breaking down the remaining changes into separate PRs, and then delete the ``range_with_class`` branch?
Author
Collaborator

Should we close this PR?

Yes, this PR can be closed.

@ychenfo can you keep breaking down the remaining changes into separate PRs, and then delete the range_with_class branch?

Sure, but can I do this after the current two PRs is merged? Otherwise I think there seems to be quite a few contents that might cause some conflicts. I will create new PRs as soon as I.

> Should we close this PR? Yes, this PR can be closed. > @ychenfo can you keep breaking down the remaining changes into separate PRs, and then delete the ``range_with_class`` branch? Sure, but can I do this after the current two PRs is merged? Otherwise I think there seems to be quite a few contents that might cause some conflicts. I will create new PRs as soon as I.
sb10q closed this pull request 2021-11-20 13:48:32 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nac3#95
No description provided.