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

Type-case based on literal value #277

Merged
merged 1 commit into from
Dec 23, 2020
Merged

Type-case based on literal value #277

merged 1 commit into from
Dec 23, 2020

Conversation

soutaro
Copy link
Owner

@soutaro soutaro commented Dec 22, 2020

Steep now analyzes case-when exhaustiveness based on value equality with literal types.

# @type var x: :foo | :bar | nil | Integer
x = nil 

# @type var a: bool
a = case x
    when nil
      true    # x: nil
    when :foo
      false   # x: :foo
    when Symbol
      true    # x: :bar
    when Integer
      false   # x: Integer
    end       # And this case is exhaustive! ❗ 

@soutaro soutaro merged commit 978199c into master Dec 23, 2020
@soutaro soutaro deleted the type-case branch December 23, 2020 02:43
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.

1 participant