escalier-lang / escalier

A compile-to-JavaScript language with tight TypeScript integration.
https://escalier-lang.github.io/escalier/
MIT License
21 stars 1 forks source link

Better inference of methods in classes #722

Closed kevinbarabash closed 11 months ago

kevinbarabash commented 11 months ago

This PR updates the inferred interface (instance scheme) by unifying each method's params and return type with those inferred from the body of each method.

This doesn't handle methods that throw correctly. I'll do that in a separate PR once I fix an ordering issue with thows in regular non-method functions.

codecov[bot] commented 11 months ago

Codecov Report

Merging #722 (5b906ef) into main (74e4e54) will increase coverage by 0.02%. The diff coverage is 95.00%.

@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
+ Coverage   85.10%   85.13%   +0.02%     
==========================================
  Files          62       62              
  Lines       12811    12842      +31     
==========================================
+ Hits        10903    10933      +30     
- Misses       1908     1909       +1     
Files Coverage Δ
crates/escalier_hm/src/types.rs 87.63% <ø> (ø)
crates/escalier_parser/src/expr_parser.rs 97.04% <100.00%> (+<0.01%) :arrow_up:
crates/escalier_hm/src/infer_class.rs 79.89% <94.44%> (+0.93%) :arrow_up:

... and 3 files with indirect coverage changes