Polymorphism Fixes #104

Merged
sb10q merged 1 commits from polymorphism_fixes into master 2024-08-17 17:37:19 +08:00
Collaborator
  1. Handle polymorphic class methods containing typevars not in class declaration correctly
  2. Fix handling on rigid typevars
  3. Some minor error message improvements.
1. Handle polymorphic class methods containing typevars not in class declaration correctly 2. Fix handling on rigid typevars 3. Some minor error message improvements.
ychenfo added 6 commits 2021-11-21 06:22:35 +08:00
sb10q requested review from pca006132 2021-11-21 11:50:24 +08:00
pca006132 approved these changes 2021-11-21 20:04:35 +08:00
sb10q reviewed 2021-11-22 13:03:21 +08:00
@ -104,0 +103,4 @@
let mut instance =
defs[resolver
.get_identifier_def("run".into())
.unwrap_or_else(|| panic!("cannot find `run() -> int32 entry point`")).0
Owner

I don't think the -> int32 part is relevant. And remove the `

I don't think the ``-> int32`` part is relevant. And remove the `` ` ``
sb10q reviewed 2021-11-22 13:03:49 +08:00
@ -151,1 +150,3 @@
(*name, (self.from_unifier_type(unifier, primitives, ty.0, cache), ty.1))
.filter_map(|(name, ty)| {
// filter out functions as they can have type vars and
// will not affect codegen
Owner

What does this comment mean? Did you mean "cannot have type vars..."?

What does this comment mean? Did you mean "cannot have type vars..."?
Author
Collaborator

Yes, here since we are concretizing types, all class fields should not have type vars. But due to partial instantiation of class methods, there might still be some methods whose signature contains type vars. So I filter out all the functions here since class methods here does not affect codegen.

I will put clearer comments here in a later commit.

Yes, here since we are concretizing types, all class fields should not have type vars. But due to partial instantiation of class methods, there might still be some methods whose signature contains type vars. So I filter out all the functions here since class methods here does not affect codegen. I will put clearer comments here in a later commit.
sb10q reviewed 2021-11-22 13:04:23 +08:00
@ -735,3 +728,1 @@
} else {
instantiated = true;
break;
// need to do this for partial instantiated function
Owner

to do what?

to do what?
Author
Collaborator

To change the way to check whether a function is instantiated (e.g., as long as there exits one uninstantiated type var, the function is not instantiated)

Thanks for pointing it out, I will also put clearer comments here in a later commit.

To change the way to check whether a function is instantiated (e.g., as long as there exits one uninstantiated type var, the function is not instantiated) Thanks for pointing it out, I will also put clearer comments here in a later commit.
ychenfo added 3 commits 2021-11-22 15:06:37 +08:00
sb10q merged commit 49476d06e1 into master 2021-11-22 17:23:12 +08:00
Owner

Thanks

Thanks
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 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#104
No description provided.