Skip to content

Casting to constrained existential in correct availability context fails at link time on older OSs #64858

Open
@AnthonyLatsis

Description

@AnthonyLatsis

Running the following code on macOS 12.6.3 (no runtime support for constrained existentials) fails with JIT session error: Symbols not found: [ _swift_getExtendedExistentialTypeMetadata_unique ].

protocol P<T> {
  associatedtype T
}

public func foo<Bound>(x: Any, _: Bound.Type) {
  if #available(macOS 13.0, *) {
    if x is any P<Bound> {
      return
    }
  }
}

Environment

  • Swift version 5.9-dev (LLVM 6a04c4848990c70, Swift f2bac1a22939a4d)

Extracted from #64657.

Metadata

Metadata

Assignees

No one assigned

    Labels

    IRGenLLVM IR generationbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.castingFeature: explicit casting (is, as, as? and as!)compilerThe Swift compiler itselfconstrained existentialsFeature → existentials: constrained existentials such as 'any Collection<Int>'existentialsFeature: values of types like `any Collection`, `Any` and `AnyObject`; type-erased valuesexpressionsFeature: expressionsswift 5.9unexpected errorBug: Unexpected error

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions