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

Refactor analyzer name resolution (resolve_name/NamedThing) #555

Merged
merged 1 commit into from
Oct 8, 2021

Conversation

sbillig
Copy link
Collaborator

@sbillig sbillig commented Sep 30, 2021

This consolidates all named things into a NamedThing hierarchy, and name resolution into a single resolve_name chain (block -> fn -> contract -> module), along with some related refactoring. This is mostly groundwork for the module system, and moves us in the direction of representing built-ins as declarative structures that are analyzed using general-purpose code that will work for things defined in fe (when the language is sufficiently powerful).

Notably, checking of generic type parameters for the built-in generic types String and Map is now handled in a general-purpose apply_generic_type_args function which will work for generic types defined in fe, rather than special-case code.

Note that I've postponed the module-level fn definition support functionality for now. I'll do that in a separate PR.

To-Do

  • Add entry to the release notes (may forgo for trivial changes)

  • Clean up commit history

@sbillig sbillig marked this pull request as draft September 30, 2021 05:59
@sbillig sbillig force-pushed the standalone-fns branch 2 times, most recently from 3ded54c to 3c21627 Compare October 7, 2021 22:37
@sbillig sbillig changed the title Allow functions to be defined outside of contracts; refactor analyzer name resolution Refactor analyzer name resolution (resolve_name/NamedThing) Oct 7, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2021

Codecov Report

Merging #555 (c488fd0) into master (262a20a) will decrease coverage by 1.29%.
The diff coverage is 78.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #555      +/-   ##
==========================================
- Coverage   87.49%   86.19%   -1.30%     
==========================================
  Files          88       87       -1     
  Lines        6095     6369     +274     
==========================================
+ Hits         5333     5490     +157     
- Misses        762      879     +117     
Impacted Files Coverage Δ
crates/analyzer/src/traversal/functions.rs 93.22% <ø> (ø)
crates/analyzer/src/context.rs 78.26% <56.52%> (-7.16%) ⬇️
crates/analyzer/src/db/queries/contracts.rs 94.32% <61.53%> (-3.44%) ⬇️
crates/analyzer/src/namespace/items.rs 79.57% <64.03%> (-10.29%) ⬇️
crates/analyzer/src/namespace/types.rs 71.12% <70.96%> (-2.40%) ⬇️
crates/parser/src/ast.rs 78.17% <75.00%> (+0.26%) ⬆️
crates/analyzer/src/namespace/scopes.rs 72.61% <76.82%> (-8.91%) ⬇️
crates/lowering/src/mappers/module.rs 77.35% <78.26%> (-7.43%) ⬇️
crates/analyzer/src/traversal/expressions.rs 88.47% <81.25%> (-2.58%) ⬇️
crates/analyzer/src/traversal/types.rs 85.56% <85.36%> (-8.80%) ⬇️
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 262a20a...c488fd0. Read the comment docs.

@sbillig sbillig marked this pull request as ready for review October 7, 2021 23:35
Copy link
Member

@g-r-a-n-t g-r-a-n-t left a comment

Choose a reason for hiding this comment

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

💯

@g-r-a-n-t g-r-a-n-t merged commit b269d1f into ethereum:master Oct 8, 2021
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.

3 participants