Files
swift-mirror/test/Frontend/DiagnosticVerifier/verify-group-name.swift
Allan Shortlidge d37010c23c Frontend: Verify diagnostic group names with {{group-name=...}}.
The new verifier specifier asserts that the emitted diagnostic belongs to the
named diagnostic group. Multiple specifiers may appear on a single expectation,
in which case the diagnostic must belong to every named group.
2026-05-28 21:43:48 -07:00

19 lines
1.2 KiB
Swift

// RUN: not %target-swift-frontend -typecheck -verify %s 2>&1 | %FileCheck %s --implicit-check-not error: --implicit-check-not note: --implicit-check-not warning:
typealias FnType = () -> ()
// Positive case: the diagnostic belongs to the expected group.
extension FnType {} // expected-error {{non-nominal type 'FnType' (aka '() -> ()') cannot be extended}} {{group-name=NominalTypes}}
// Wrong group name: the diagnostic belongs to a different group.
extension FnType {} // expected-error {{non-nominal type 'FnType' (aka '() -> ()') cannot be extended}} {{group-name=FooBarBaz}}
// CHECK: error: expected group name not seen; actual group name: {{[{][{]}}group-name=NominalTypes{{[}][}]}}
// One of multiple expected group names doesn't match.
extension FnType {} // expected-error {{non-nominal type 'FnType' (aka '() -> ()') cannot be extended}} {{group-name=NominalTypes}} {{group-name=FooBarBaz}}
// CHECK: error: expected group name not seen{{$}}
// Diagnostic has no group at all.
let x: Int = "hello, world!" // expected-error {{cannot convert value of type 'String' to specified type 'Int'}} {{group-name=NominalTypes}}
// CHECK: error: expected group name not seen