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

fix: errors for undefined terms in Style selectors #660

Merged
merged 2 commits into from Oct 11, 2021

Conversation

wodeni
Copy link
Member

@wodeni wodeni commented Oct 8, 2021

Description

Related issue/PR: #626, #453, #446

When checking Style selectors, the Style compiler runs some of the Substance checker functions. However, some errors are not propagated through, leading to unclear error messages. Also, the Substance AST is only disambiguated in the Style compiler, which is not logical and can lead to unclear errors. This PR addresses both issues.

Implementation strategy and design decisions

  • Removed SelectorDeclTypeError, which doesn't report source location and is unclear
  • Moved disambiguateFunctions and its helper to Substance.ts and disambiguated Substance ASTs after type-checking.
    • The rationale for this is that we want to catch errors in the checker, not ad-hoc while fixing the AST

Examples with steps to reproduce them

See Style.test.ts for examples.

Checklist

  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing tests pass locally using yarn test
  • I ran yarn docs and there were no errors when generating the HTML site
  • My code follows the style guidelines of this project (e.g.: no ESLint warnings)

@codecov
Copy link

codecov bot commented Oct 8, 2021

Codecov Report

Merging #660 (58c1891) into main (1a3df91) will increase coverage by 0.06%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #660      +/-   ##
==========================================
+ Coverage   66.56%   66.62%   +0.06%     
==========================================
  Files          44       44              
  Lines        7109     7107       -2     
  Branches     1338     1337       -1     
==========================================
+ Hits         4732     4735       +3     
+ Misses       2368     2363       -5     
  Partials        9        9              
Impacted Files Coverage Δ
packages/core/src/compiler/Substance.ts 91.04% <85.00%> (+0.56%) ⬆️
packages/core/src/compiler/Style.ts 87.46% <100.00%> (+0.03%) ⬆️
packages/core/src/utils/Error.ts 34.08% <100.00%> (+0.30%) ⬆️

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 1a3df91...58c1891. Read the comment docs.

@wodeni wodeni merged commit e7f1f5f into main Oct 11, 2021
@wodeni wodeni deleted the fix-selector-not-found branch October 11, 2021 14:31
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

1 participant