Skip to content

Conversation

@dolio
Copy link
Contributor

@dolio dolio commented Aug 14, 2025

This tweaks to type checking aspects to attempt to get nicer errors.

  1. Remove the InMatch scope from the checking path. This causes the error extractor that reports incoherent branch types from triggering, so that you don't get the error when annotating the match with a different type. This is similar to how if statements are set up, which didn't seem subject to the same problem.

  2. Add an InActionRestriction scope to the checker and use it around subtyping checks against Unit in blocks. This allows us to match the extra scope information and report a customized error.

    This allows circumventing another situation where the block failure would be reported as a "branches have different types" error when it happened inside a match, even though that makes no sense.

Fixes #5283 and #5217

dolio added 2 commits August 14, 2025 11:39
This tweaks to type checking aspects to attempt to get nicer errors.

1. Remove the `InMatch` scope from the _checking_ path. This causes the
   error extractor that reports incoherent branch types from triggering, so
   that you don't get the error when _annotating_ the match with a
   different type. This is similar to how if statements are set up, which
   didn't seem subject to the same problem.

2. Add an `InActionRestriction` scope to the checker and use it around
   subtyping checks against `Unit` in blocks. This allows us to match the
   extra scope information and report a customized error.

   This allows circumventing another situation where the block failure
   would be reported as a "branches have different types" error when it
   happened inside a match, even though that makes no sense.
Copy link
Member

@pchiusano pchiusano left a comment

Choose a reason for hiding this comment

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

nice! Looks great.

@aryairani aryairani enabled auto-merge August 14, 2025 15:58
@aryairani aryairani merged commit 4d04ae4 into trunk Aug 14, 2025
13 checks passed
@aryairani aryairani deleted the topic/type-errors branch August 14, 2025 16:12
@aryairani
Copy link
Contributor

Oh gosh. Github's auto-merge doesn't wait for CI. What a useless feature.

@dolio
Copy link
Contributor Author

dolio commented Aug 14, 2025

So, wait, are there still CI failures from this?

@aryairani
Copy link
Contributor

@dolio Yes; looks like probably a merge issue with trunk and the transcript.
Sorry about prematurely merging; I didn't mean to.

aryairani added a commit that referenced this pull request Aug 14, 2025
@ChrisPenner
Copy link
Member

Oh gosh. Github's auto-merge doesn't wait for CI. What a useless feature.

There's some way to tweak those settings; it works great in share-api; but unison has more conditional build steps, so maybe tougher to configure?

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.

Bad error message on case-match with mismatched return type

5 participants