|
1 | 1 | // RUN: rm -rf %t && mkdir -p %t && %S/../../utils/gyb %s -o %t/main.swift
|
2 |
| -// RUN: %S/../../utils/line-directive %t/main.swift -- %swift -verify -parse %t/main.swift |
| 2 | +// RUN: %S/../../utils/line-directive %t/main.swift -- %target-build-swift -parse -Xfrontend -verify %t/main.swift |
3 | 3 |
|
4 |
| -% from SwiftIntTypes import all_integer_types |
5 |
| -% integer_types_array = [self_ty.stdlib_name for self_ty in all_integer_types(0)] |
6 |
| -// integer_types_array: ${integer_types_array} |
7 |
| -% floating_types_array = ['Float', 'Double'] |
8 |
| -% typesToTest = floating_types_array + integer_types_array |
9 |
| -// typesToTest: ${typesToTest} |
| 4 | +% from SwiftIntTypes import all_numeric_type_names, all_integer_type_names, \ |
| 5 | +% all_integer_binary_operator_names, all_integer_or_real_binary_operator_names, \ |
| 6 | +% all_arithmetic_comparison_operator_names, all_integer_assignment_operator_names, \ |
| 7 | +% all_integer_or_real_assignment_operator_names |
10 | 8 |
|
11 |
| -% operatorsToTest = ['=', '*', '/', '%', '==', '!=', '>', '<', '>=', '<='] # TODO: Restore '+', '-', when rdar://18695154 is fixed. |
12 |
| -// operatorsToTest: ${operatorsToTest} _The Swift Programming Language_ "Basic Operators," binary non-logical ops |
13 |
| - //TODO: Better error regex, verify the type of the result |
| 9 | +% int_ops = all_integer_binary_operator_names() + all_integer_assignment_operator_names() |
| 10 | +% arith_ops = all_integer_or_real_binary_operator_names() + \ |
| 11 | +% all_arithmetic_comparison_operator_names() + all_integer_or_real_assignment_operator_names() |
| 12 | + |
| 13 | +//TODO: Better error regex, verify the type of the result, Float80 for i386 & x86_64 |
14 | 14 |
|
15 | 15 | func testIteratedOperations() {
|
16 |
| -% for T1 in typesToTest: |
17 |
| - % for T2 in typesToTest: |
18 |
| - % for op in operatorsToTest: |
19 |
| - if true { |
20 |
| - var x1_${T1}: ${T1} = 0 |
21 |
| - var x2_${T2}: ${T2} = 0 |
22 |
| - x1_${T1} ${op} x2_${T2} ${ "// expected-error{{ }}" if T1 != T2 else "" } |
23 |
| - } |
| 16 | +% for typesToTest, operatorsToTest in zip([all_integer_type_names(), all_numeric_type_names()], \ |
| 17 | +% [int_ops, arith_ops]): |
| 18 | + % operatorsToTest = [x for x in operatorsToTest if not '+' in x and not '-' in x] |
| 19 | + %# TODO: rm when rdar://18695154 is fixed. |
| 20 | +// typesToTest: ${typesToTest}, operatorsToTest: ${operatorsToTest} |
| 21 | + % for T1 in typesToTest: |
| 22 | + % for T2 in typesToTest: |
| 23 | + % for op in operatorsToTest: |
| 24 | + if true { |
| 25 | + var x1_${T1}: ${T1} = 0 |
| 26 | + var x2_${T2}: ${T2} = 0 |
| 27 | + x1_${T1} ${op} x2_${T2} ${ "// expected-error{{ }}" if T1 != T2 else "" } |
| 28 | + } |
| 29 | + %end |
24 | 30 | %end
|
25 | 31 | %end
|
26 | 32 | %end
|
| 33 | + |
27 | 34 | }
|
0 commit comments