Files
swift-mirror/test/diagnostics/default-ignore-groups.swift
Artem Chikin 9e35f82b2c [Diagnostics] Replace diagnostics' 'DefaultIgnore' option with a corresponding option on diagnostic groups
This brings this control in line with other diagnostic controls we have which operate on a per-group level.
'DefaultIgnoreWarnings' diagnostic group option applies to all warnings belonging to a certain diagnostic group.

The inheritance rules are:
- Marking a diagnostic group as 'DefaultIgnoreWarnings' means warnings belonging to this group will not be emitted by-default
  - Warnings belonging to sub-groups of this group will also not be emitted by-default
- Enabling a 'DefaultIgnoreWarnings' group (with '-Werror','-Wwarning', etc.) means warnings belonging to this group will be emitted.
  - Warnings belonging to sub-groups of this group will also be emitted.
  - Warnings belonging to super-groups of this group will not be affected.
2025-10-29 09:42:03 -07:00

27 lines
1.5 KiB
Swift

// RUN: %empty-directory(%t)
// Ignore `ReturnTypeImplicitCopy` warnings by-default, because its parent group (`PerformanceHints`) is marked `DefaultIgnoreWarnings`
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -verify
// Ensure enabled with `-Wwarning`
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -Wwarning ReturnTypeImplicitCopy -verify -verify-additional-prefix warnonly-
// Ensure enabled with `-Wwarning` on the parent group
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -Wwarning PerformanceHints -verify -verify-additional-prefix warnonly-
// Ensure enabled with `-Werror`
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -Werror ReturnTypeImplicitCopy -verify -verify-additional-prefix erronly-
// Ensure enabled with `-Werror` on the parent group
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -Werror PerformanceHints -verify -verify-additional-prefix erronly-
// Ensure enabling sibling group does not enable this group
// RUN: %target-swift-frontend -typecheck %s -diagnostic-style llvm -verify -Werror ExistentialType
func foo() -> [Int] {
// expected-erronly-error@-1 {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead}}
// expected-warnonly-warning@-2 {{Performance: 'foo()' returns an array, leading to implicit copies. Consider using an 'inout' parameter instead}}
return [1,2,3,4,5,6]
}