johnynek / bosatsu

A python-ish pure and total functional programming language
Apache License 2.0
224 stars 11 forks source link

Fix long bug in error regions #1049

Closed johnynek closed 11 months ago

johnynek commented 11 months ago

I wanted to merely improve error reporting by showing more than one type error when it was possible (#1044 )

Along the way, I found a long standing bug with locations incorrectly being set to be their outermost scope. I had noticed this before, but hadn't run it down. I had assumed it was part of typechecking and just due to inference being a bit non-specific when unifying across many types.

But in my example, I wound up printing out the Expr and seeing that the Declarations and Regions were set wrong.

The bug turned out to be the .as from Functor. The Expr traverse instance is doing what you say, but .as isn't what we meant. We wanted to only replace the outermost tag, not every tag transitively.

I have removed that code since we were only using it for this one bug. :)

This also should do more parallel checking of errors: if two adjacent lets don't depend on each other, we check in parallel.

We can do a bit better by only skipping lets that depend on a previous failed let, but I will punt that to a later PR.

codecov-commenter commented 11 months ago

Codecov Report

Patch coverage: 96.63% and project coverage change: +0.20% :tada:

Comparison is base (423a144) 91.75% compared to head (66405c8) 91.95%.

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

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1049 +/- ## ========================================== + Coverage 91.75% 91.95% +0.20% ========================================== Files 92 93 +1 Lines 9549 9626 +77 Branches 2255 2258 +3 ========================================== + Hits 8762 8852 +90 + Misses 787 774 -13 ``` | [Files Changed](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin) | Coverage Δ | | |---|---|---| | [...re/src/main/scala/org/bykn/bosatsu/TypedExpr.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L1R5cGVkRXhwci5zY2FsYQ==) | `90.88% <ø> (+1.56%)` | :arrow_up: | | [core/src/main/scala/org/bykn/bosatsu/Expr.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L0V4cHIuc2NhbGE=) | `89.52% <90.32%> (+1.68%)` | :arrow_up: | | [.../src/main/scala/org/bykn/bosatsu/rankn/Infer.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L3JhbmtuL0luZmVyLnNjYWxh) | `95.70% <98.21%> (+0.06%)` | :arrow_up: | | [...ore/src/main/scala/org/bykn/bosatsu/ListUtil.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L0xpc3RVdGlsLnNjYWxh) | `100.00% <100.00%> (ø)` | | | [...src/main/scala/org/bykn/bosatsu/PackageError.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L1BhY2thZ2VFcnJvci5zY2FsYQ==) | `69.68% <100.00%> (+0.99%)` | :arrow_up: | | [.../main/scala/org/bykn/bosatsu/SourceConverter.scala](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin#diff-Y29yZS9zcmMvbWFpbi9zY2FsYS9vcmcvYnlrbi9ib3NhdHN1L1NvdXJjZUNvbnZlcnRlci5zY2FsYQ==) | `97.59% <100.00%> (+<0.01%)` | :arrow_up: | ... and [8 files with indirect coverage changes](https://app.codecov.io/gh/johnynek/bosatsu/pull/1049/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=P.+Oscar+Boykin)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.