Skip to content

Conversation

@abs0luty
Copy link
Contributor

@abs0luty abs0luty force-pushed the fix-let-type-checking branch from 2198069 to 15e50a8 Compare October 26, 2025 15:03
@abs0luty abs0luty force-pushed the fix-let-type-checking branch 2 times, most recently from c149a54 to c30ec7c Compare October 27, 2025 20:00
@abs0luty abs0luty requested a review from lpil October 27, 2025 20:00
@abs0luty abs0luty force-pushed the fix-let-type-checking branch 5 times, most recently from 8adc522 to 1af576f Compare October 31, 2025 17:21
@abs0luty abs0luty force-pushed the fix-let-type-checking branch from 1af576f to a79cdaf Compare November 10, 2025 21:06
@abs0luty abs0luty force-pushed the fix-let-type-checking branch 2 times, most recently from 49f73c3 to 8fbd77d Compare December 1, 2025 13:48
@abs0luty abs0luty force-pushed the fix-let-type-checking branch 3 times, most recently from 98f9171 to d3f2ade Compare December 3, 2025 20:35
```gleam
pub fn main() {
  let x: String = 5  // type error: expected String, got Int
  let y: Int = x     // valid
  let z: String = x  // type error: expected String, got Int
}
```

Fix type checking after annotated let errors so the compiler trusts the user annotation
and reports follow up errors on uses that rely on that annotated type.

A let binding that fails its annotation no longer causes later checks to use the
inferred type, which avoids misleading errors and flags the incorrect assignment earlier in the code.
@abs0luty abs0luty force-pushed the fix-let-type-checking branch from d3f2ade to 3a9cc05 Compare December 4, 2025 13:29
@abs0luty abs0luty requested a review from lpil December 4, 2025 13:30
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.

let bindings are typechecked using their inferred type not their (narrowed) annotated type

2 participants