Skip to content

Failed to produce diagnostic for invalid metatype to existential metatype conversion #83991

@hamishknight

Description

@hamishknight

The following fails to produce a diagnostic:

protocol P {}

func bar<T>(_ x: T) -> T.Type {}
func foo(_ x: P.Type) { }
foo(bar(0)) // error: failed to produce diagnostic for expression; please submit a bug report

It ought to produce the same diagnostic as:

foo(Int.self) // error: cannot convert value of type 'Int.Type' to expected argument type 'any P.Type'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA 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