Skip to content

Extend static check for failable cast that will always fail #692

Open

Description

Issue To Be Solved

We currently determine if a failable cast can succeed (in sema.FailableCastCanSucceed), and report an error it can never succeed.

Extend this check to also handle primitive types, e.g. the following examples should be static errors:

let s = ""
let i = s as! Int
struct S {}
let s = S()
let i = s as! Int

Suggested Solution

  • Extend sema.FailableCastCanSucceed
  • Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions