unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.8k stars 271 forks source link

LSP and type checker discrepancy #5295

Open kylegoetz opened 2 months ago

kylegoetz commented 2 months ago

Describe and demonstrate the bug Please attach a ucm transcript if possible, calling out the unexpected behavior in the text. e.g.

Input:

```unison
type CommandResult = CommandResult Text

ability Authenticated where
  create : Text -> {Authenticated} CommandResult

authHandler : '{g, Authenticated} t ->{g} t
authHandler p =
  go : '{g, g1, Authenticated} t -> t
  go p = handle p() with cases
    { pure } -> pure
    { create item -> resume } -> go do resume (CommandResult item)
  go p

The LSP has no problem with this. It doesn't underline any errors in the code. However,

Here I add and ucm fails with a TypeMismatch error including context, which is what I would've expected since go has an extra type generic in the signature compared to authHandler. Adding g1 to authHandler's signature allows me to add, confirming that that was the problem. But LSP doesn't seem to report it.

.> add


**Screenshots**
Screenshot showing no red error indicators in the original code.

<img width="1184" alt="Screen Shot 2024-08-22 at 10 34 58 AM" src="https://github.com/user-attachments/assets/d2c4819f-5ba8-44da-9b85-8fd8908a58c7">

**Environment (please complete the following information):**
 - ucm version: release/0.5.23
 - OS/Architecture: macOS 12.0.1