Files
RedBear-OS/local/recipes/dev/libclc/source/mlir/test/IR/enum-attr-invalid.mlir
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

106 lines
3.2 KiB
MLIR

// RUN: mlir-opt -verify-diagnostics -split-input-file %s
func.func @test_invalid_enum_case() -> () {
// expected-error@+2 {{expected test::TestEnum to be one of: first, second, third}}
// expected-error@+1 {{failed to parse TestEnumAttr}}
test.op_with_enum #test<enum fourth>
}
// -----
func.func @test_invalid_enum_case() -> () {
// expected-error@+1 {{expected test::TestEnum to be one of: first, second, third}}
test.op_with_enum fourth
// expected-error@+1 {{failed to parse TestEnumAttr}}
}
// -----
func.func @test_invalid_attr() -> () {
// expected-error@+1 {{op attribute 'value' failed to satisfy constraint: a test enum}}
"test.op_with_enum"() {value = 1 : index} : () -> ()
}
// -----
func.func @test_parse_invalid_attr() -> () {
// expected-error@+2 {{expected valid keyword}}
// expected-error@+1 {{failed to parse TestEnumAttr parameter 'value'}}
test.op_with_enum 1 : index
}
// -----
func.func @test_non_keyword_prop_enum() -> () {
// expected-error@+2 {{expected keyword for a test enum}}
// expected-error@+1 {{invalid value for property value, expected a test enum}}
test.op_with_enum_prop 0
return
}
// -----
func.func @test_wrong_keyword_prop_enum() -> () {
// expected-error@+2 {{expected one of [first, second, third] for a test enum, got: fourth}}
// expected-error@+1 {{invalid value for property value, expected a test enum}}
test.op_with_enum_prop fourth
}
// -----
func.func @test_bad_integer() -> () {
// expected-error@+1 {{op property 'value' failed to satisfy constraint: a test enum}}
"test.op_with_enum_prop"() <{value = 4 : i32}> {} : () -> ()
}
// -----
func.func @test_bit_enum_prop_not_keyword() -> () {
// expected-error@+2 {{expected keyword for a test bit enum}}
// expected-error@+1 {{invalid value for property value1, expected a test bit enum}}
test.op_with_bit_enum_prop 0
return
}
// -----
func.func @test_bit_enum_prop_wrong_keyword() -> () {
// expected-error@+2 {{expected one of [read, write, execute] for a test bit enum, got: chroot}}
// expected-error@+1 {{invalid value for property value1, expected a test bit enum}}
test.op_with_bit_enum_prop read, chroot : ()
return
}
// -----
func.func @test_bit_enum_prop_bad_value() -> () {
// expected-error@+1 {{op property 'value2' failed to satisfy constraint: a test bit enum}}
"test.op_with_bit_enum_prop"() <{value1 = 7 : i32, value2 = 8 : i32}> {} : () -> ()
return
}
// -----
func.func @test_bit_enum_prop_named_wrong_keyword() -> () {
// expected-error@+2 {{expected 'bit_enum'}}
// expected-error@+1 {{invalid value for property value1, expected a test bit enum}}
test.op_with_bit_enum_prop_named foo<read, execute>
return
}
// -----
func.func @test_bit_enum_prop_named_not_open() -> () {
// expected-error@+2 {{expected '<'}}
// expected-error@+1 {{invalid value for property value1, expected a test bit enum}}
test.op_with_bit_enum_prop_named bit_enum read, execute>
}
// -----
func.func @test_bit_enum_prop_named_not_closed() -> () {
// expected-error@+2 {{expected '>'}}
// expected-error@+1 {{invalid value for property value1, expected a test bit enum}}
test.op_with_bit_enum_prop_named bit_enum<read, execute +
}