Skip to content

Type constraints using type equality are unsound #45

@mxswd

Description

@mxswd

Radar submitted.
Radar: 17377676


With https://github.com/maxpow4h/swiftz/blob/54870ca7b81a2595b3707646cba4d83a71bb6667/swiftz/TypeEquality.swift and https://github.com/maxpow4h/swiftz/blob/54870ca7b81a2595b3707646cba4d83a71bb6667/swiftz/List.swift#L47-L56 you can show Int =:= String and define the function:

func apply(a: Int) -> String {
  return a
}

that correctly type checks, showing unsoundness.


Commentary:
It appears swift isn't fully obeying the type constraints provided in where clauses.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions