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

[BUG] double negative incorrectly interpreted #1002

Closed
peterfigure opened this issue Feb 3, 2022 · 0 comments · Fixed by #1005
Closed

[BUG] double negative incorrectly interpreted #1002

peterfigure opened this issue Feb 3, 2022 · 0 comments · Fixed by #1005
Labels
bug Something isn't working

Comments

@peterfigure
Copy link

given the code snippet:

 fun domain(): Option<Domain> {
        val parts = value.split("@") // no pattern matching in kotlin :((((
        return if (parts.size != 2)
            None
        else
            Some(Domain(parts[1]))
    }

results in the error:

e: /Users/peter/develop/x.kt: (69, 25): pre-condition `index within bounds` is not satisfied in `parts[1]`
  -> unsatisfiable constraint: `(1 >= 0) && (1 < (parts.size))`
  -> 
`1` bound to param `index` in `kotlin.collections.List.get` 
  -> in branch: value != null, !(parts.size != 2), cond50, parts != null
e: /Users/peter/develop/x.kt: (69, 25): pre-condition `index within bounds` is not satisfied in `parts[1]`
  -> unsatisfiable constraint: `(1 >= 0) && (1 < (parts.size))`
  -> 
`1` bound to param `index` in `kotlin.collections.List.get` 
  -> in branch: value != null, !(parts.size != 2), cond50, parts != null, Domain != null, parts != null

it looks like !(parts.size != 2) is not being correctly interpreted to prove that parts.size == 2

@peterfigure peterfigure added the bug Something isn't working label Feb 3, 2022
serras added a commit that referenced this issue Feb 7, 2022
* Implement checks for getter/setter/delegates in properties
* Missing 'throw' for Kotlin
* Issue warnings if 'require' or 'assert' cannot be parsed
* Improve inference of primitive constraints

Fixes #999, #1000, #1002, #1003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant