File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -2164,6 +2164,17 @@ impl Compiler {
21642164
21652165 // Compile exception type
21662166 if let Some ( exc_type) = type_ {
2167+ // Check for unparenthesized tuple (e.g., `except* A, B:` instead of `except* (A, B):`)
2168+ if let Expr :: Tuple ( ExprTuple { elts, range, .. } ) = exc_type. as_ref ( ) {
2169+ if let Some ( first) = elts. first ( ) {
2170+ // If tuple starts at same column as first element, it's unparenthesized
2171+ if range. start ( ) . to_u32 ( ) == first. range ( ) . start ( ) . to_u32 ( ) {
2172+ return Err ( self . error ( CodegenErrorType :: SyntaxError (
2173+ "multiple exception types must be parenthesized" . to_owned ( ) ,
2174+ ) ) ) ;
2175+ }
2176+ }
2177+ }
21672178 self . compile_expression ( exc_type) ?;
21682179 } else {
21692180 return Err ( self . error ( CodegenErrorType :: SyntaxError (
You can’t perform that action at this time.
0 commit comments