Skip to content

Missing availability diagnostic on literal implicit init base type  #61890

@LucianoPAlmeida

Description

@LucianoPAlmeida

Describe the bug
No diagnostic is being emitted when base type for implicit init from literal expression is unavailable.

@available(*, unavailable)
struct S: ExpressibleByIntegerLiteral {
  init(integerLiteral value: Int) {}
}
@available(*, unavailable)
typealias IntegerLiteralType = S

let i = 0 // implicit resolves to S(integerLiteral: 0) but S is unavailable so we should emit availability diagnostic

Steps To Reproduce
Steps to reproduce the behavior:

  1. Try compile the snippet above
    ...

Expected behavior
Unavailable diagnostic should be emitted.

Environment (please fill out the following information)

  • Xcode Version/Tag/Branch: main at 66f6769

Metadata

Metadata

Labels

availabilityThe @available attribute and availability checking in generalbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfdiagnostics QoIBug: Diagnostics Quality of Implementationtype checkerArea → compiler: Semantic analysis

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions