From 15d7810dee66c4ed177dff9a671bd60b0a1a31ad Mon Sep 17 00:00:00 2001 From: jackdotink Date: Tue, 4 Jun 2024 16:28:47 -0500 Subject: [PATCH] add test for mixed intersection and union --- tests/Parser.test.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/Parser.test.cpp b/tests/Parser.test.cpp index d5c673e0..bf707080 100644 --- a/tests/Parser.test.cpp +++ b/tests/Parser.test.cpp @@ -3182,4 +3182,11 @@ TEST_CASE_FIXTURE(Fixture, "can_parse_leading_ampersand_intersections_successful parse(R"(type A = & { string } & { number })"); } +TEST_CASE_FIXTURE(Fixture, "mixed_leading_intersection_and_union_not_allowed") +{ + ScopedFastFlag sff{FFlag::LuauLeadingBarAndAmpersand, true}; + + matchParseError("type A = & number | string | boolean", "Mixing union and intersection types is not allowed; consider wrapping in parentheses."); +} + TEST_SUITE_END();