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

improvement: better literal support #122

Merged
merged 5 commits into from
Apr 19, 2020

Conversation

baszalmstra
Copy link
Collaborator

@baszalmstra baszalmstra commented Apr 9, 2020

This PR will add support for:

Progress

  • Generating typed literals in LLVM
  • Proper parsing of hex integers
  • Proper parsing of binary integers
  • Proper parsing of octal integers
  • Stripping of underscores while parsing
  • Parsing of suffixes in literals
  • Using suffix name for typing information
  • Error handling for invalid suffix names
  • Error handling for invalid literals (0b10102)
  • Error handling for literals that exceed the size of their suffix

Out of scope

This PR does not implement literal type inferencing (#118).

@baszalmstra baszalmstra self-assigned this Apr 9, 2020
@codecov
Copy link

codecov bot commented Apr 9, 2020

Codecov Report

Merging #122 into master will increase coverage by 0.80%.
The diff coverage is 83.92%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #122      +/-   ##
==========================================
+ Coverage   81.92%   82.72%   +0.80%     
==========================================
  Files         141      147       +6     
  Lines        9055     9704     +649     
==========================================
+ Hits         7418     8028     +610     
- Misses       1637     1676      +39     
Impacted Files Coverage Δ
crates/mun_codegen/src/db.rs 100.00% <ø> (ø)
crates/mun_compiler/src/driver.rs 78.84% <ø> (ø)
crates/mun_hir/src/ty.rs 91.02% <ø> (ø)
crates/mun_syntax/src/tests/lexer.rs 100.00% <ø> (ø)
crates/mun_target/src/lib.rs 100.00% <ø> (ø)
crates/mun_target/src/spec.rs 80.00% <ø> (ø)
crates/mun_hir/src/ty/infer.rs 79.29% <47.82%> (-1.27%) ⬇️
crates/mun_target/src/abi/mod.rs 56.73% <56.73%> (ø)
...mun_hir/src/expr/validator/literal_out_of_range.rs 58.33% <58.33%> (ø)
crates/mun_hir/src/diagnostics.rs 70.50% <64.70%> (-1.19%) ⬇️
... and 36 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 5ee17f3...2886280. Read the comment docs.

@baszalmstra baszalmstra force-pushed the feat/literal_parsing branch 3 times, most recently from 4b9b86f to d188cfd Compare April 9, 2020 20:11
Copy link
Collaborator

@Wodann Wodann left a comment

Choose a reason for hiding this comment

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

Once again, a very clean PR. Looking good!

crates/mun_hir/src/expr.rs Show resolved Hide resolved
crates/mun_hir/src/expr.rs Show resolved Hide resolved
crates/mun_syntax/src/ast/expr_extensions.rs Show resolved Hide resolved
crates/mun_syntax/src/ast/expr_extensions.rs Outdated Show resolved Hide resolved
crates/mun_syntax/src/ast/expr_extensions.rs Outdated Show resolved Hide resolved
crates/mun_syntax/src/ast/expr_extensions.rs Outdated Show resolved Hide resolved
@baszalmstra baszalmstra force-pushed the feat/literal_parsing branch 2 times, most recently from 069f7f8 to 940c908 Compare April 17, 2020 09:31
@baszalmstra
Copy link
Collaborator Author

The coverage diff on the last commits is pretty low because I included code from rustc_targets which does not contain tests. I'm also not using everything from the code but I added it nonetheless because I feel like it might benefit us in the future.

@baszalmstra baszalmstra marked this pull request as ready for review April 18, 2020 20:54
@baszalmstra baszalmstra requested a review from Wodann April 18, 2020 20:54
crates/mun_codegen/src/ir/body.rs Outdated Show resolved Hide resolved
crates/mun_target/Cargo.toml Outdated Show resolved Hide resolved
@baszalmstra baszalmstra merged commit 18425e7 into mun-lang:master Apr 19, 2020
@Wodann Wodann changed the title Better literal support improvement: better literal support May 2, 2020
@Wodann Wodann added this to the Mun v0.2 milestone May 14, 2020
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.

2 participants