Skip to content

Invalid type leads to "Failed to produce diagnostic for expression" #77644

Closed
@hamishknight

Description

@hamishknight

The following test case (added in #77643) incorrectly produces failed to produce diagnostic for expression:

func bar(_ x: Int.Type, _: Int) {}
func bar<T>(_ x: T.Type, _: Int) {}

func foo() {
  bar(X<Int?>.self, .zero)
  // expected-error@-1 {{cannot find 'X' in scope}}
  // expected-error@-2 {{failed to produce diagnostic for expression}}
}

Looks like we're ending up with a leftover inactive constraint:

(failed due to remaining inactive constraints:
  $T1 explicit generic argument binding Pack{Int?} @ locator@0x1378873a8 [Error@/Users/hamish/src/swift-test-arena/main.swift:608:7]
)

Swift version 6.1-dev (LLVM 834e05aeccee532, Swift 45d15d1)
Target: arm64-apple-macosx15.0

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