Skip to content
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

improve 1164 #1166

Merged
merged 5 commits into from Mar 10, 2024
Merged

improve 1164 #1166

merged 5 commits into from Mar 10, 2024

Conversation

johnynek
Copy link
Owner

@johnynek johnynek commented Mar 8, 2024

This improves type inference on function application in the common case that the fn and argument types are simple.

This seems to fix the issue with #1164 for now, but does not address the unshadowing approach I thought would be useful (that turns out to never actually be a codepath hit for reasons I don't understand).

@codecov-commenter
Copy link

codecov-commenter commented Mar 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.50%. Comparing base (04a0e87) to head (d0d643a).
Report is 5 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1166      +/-   ##
==========================================
+ Coverage   91.32%   91.50%   +0.18%     
==========================================
  Files          96       96              
  Lines       11846    11970     +124     
  Branches     2675     2750      +75     
==========================================
+ Hits        10818    10953     +135     
+ Misses       1028     1017      -11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

refl_sub: forall a. Sub[a, a] = Sub(x -> x)
refl_any: Sub[forall a. a, exists a. a] = refl_sub
#ignore: Tup[forall a. Sub[a, a], Sub[forall a. a, exists a. a]] = Tup(refl_sub, refl_any)
ignore = Tup(refl_sub, refl_any)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add more tests here, looks like we haven't solved it yet.

}
case _ =>
None
})
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to match on any Quantification and instantiate it correctly. The existential and universal require instantiating two different directions to only one or the other is easy.

@@ -1462,6 +1479,130 @@ object Infer {
}
}

// noshadow must include any free vars of args
def liftQuantification[A](
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add direct tests of this in simple cases and possibly property checks. For instance, if there is a quantification on any arg, it should be lifted up. Or rather the result should not have quantification on any argument.

@johnynek johnynek merged commit f813e1d into main Mar 10, 2024
9 checks passed
@johnynek johnynek deleted the oscar/20240307_improve_1164 branch March 10, 2024 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants