chore(syntax): Test 仓 R1 + R12 迁移
R1:T | t.CPtr -> T*(40 文件 / 1121 处;含多级 **、强转位 (T*)(x)、下标内 list[AST*]);引号前向引用 'Rect' | t.CPtr 26 处按例外保留,T | t.CPtr | t.State 25 处因 T* 后不能接 | 保持原联合写法。 R12:i = 0 + while i < N: + 尾 i += 1 -> or i in range(N):(10 文件 / 42 处;含 <= -> range(EXPR + 1)、带注解初始化 i: int = 0、尾 i = i + 1)。余 20 处经守卫判定不可安全改写(复合条件 1、尾部非自增 8、体内重绑定/continue 5、while-else 2、循环后仍被读取 2、找不到初始化 2)。
This commit is contained in:
1 parent
f5da836fbb
commit
aa5a7e7250
43 files changed
+851
-935
No files matched your search
@@ -65,8 +65,7 @@ def ForWithElifBranchTest(value: int):
|
||||
|
||||
|
||||
def WhileWithIfElifElseTest(iterations: int):
|
||||
counter: int = 0
|
||||
while counter < iterations:
|
||||
for counter in range(iterations):
|
||||
if counter < 2:
|
||||
print("Phase 1: ", counter)
|
||||
elif counter < 4:
|
||||
@@ -75,7 +74,6 @@ def WhileWithIfElifElseTest(iterations: int):
|
||||
print("Phase 3: ", counter)
|
||||
else:
|
||||
print("Phase 4: ", counter)
|
||||
counter += 1
|
||||
print("While done")
|
||||
|
||||
|
||||
@@ -136,8 +134,7 @@ def ComplexForWhileMatchTest(outer_limit: int, inner_limit: int):
|
||||
j: int = 0
|
||||
result: int = 0
|
||||
for i in range(outer_limit):
|
||||
j = 0
|
||||
while j < inner_limit:
|
||||
for j in range(inner_limit):
|
||||
match (i, j):
|
||||
case (0, 0):
|
||||
result += 1
|
||||
@@ -149,7 +146,6 @@ def ComplexForWhileMatchTest(outer_limit: int, inner_limit: int):
|
||||
result += 1000
|
||||
case _:
|
||||
result += 10000
|
||||
j += 1
|
||||
print("Complex match result: ", result)
|
||||
|
||||
|
||||
@@ -186,19 +182,15 @@ def WhileWithBreakConditionTest(limit: int):
|
||||
|
||||
|
||||
def NestedWhileWithMultipleBreakPoints(depth: int, width: int):
|
||||
d: int = 0
|
||||
w: int = 0
|
||||
count: int = 0
|
||||
while d < depth:
|
||||
w = 0
|
||||
while w < width:
|
||||
for d in range(depth):
|
||||
for w in range(width):
|
||||
if w == 2:
|
||||
break
|
||||
if d == 1 and w == 1:
|
||||
c.Break
|
||||
count += 1
|
||||
w += 1
|
||||
d += 1
|
||||
print("Nested break count: ", count)
|
||||
|
||||
|
||||
@@ -221,9 +213,8 @@ def ForWithMatchCaseInLoopTest(iterations: int):
|
||||
|
||||
|
||||
def ComplexLogicWithElifChains(a: int, b: int, c_val: int):
|
||||
i: int = 0
|
||||
result: int = 0
|
||||
while i < 10:
|
||||
for i in range(10):
|
||||
if i < a:
|
||||
if i < b:
|
||||
result += 1
|
||||
@@ -240,7 +231,6 @@ def ComplexLogicWithElifChains(a: int, b: int, c_val: int):
|
||||
result += 6
|
||||
else:
|
||||
result += 7
|
||||
i += 1
|
||||
print("Complex elif chain result: ", result)
|
||||
|
||||
|
||||
@@ -331,9 +321,8 @@ def ComplexCaseMatchingWithRanges(start: int, end: int):
|
||||
|
||||
|
||||
def WhileWithElifInElifChain(limit: int):
|
||||
i: int = 0
|
||||
result: int = 0
|
||||
while i < limit:
|
||||
for i in range(limit):
|
||||
if i < 2:
|
||||
if i == 0:
|
||||
result = 1
|
||||
@@ -352,7 +341,6 @@ def WhileWithElifInElifChain(limit: int):
|
||||
else:
|
||||
result = 7
|
||||
print("Chain result[", i, "]: ", result)
|
||||
i += 1
|
||||
|
||||
|
||||
def ForWithCaseNoBreakNested(inner_limit: int):
|
||||
|
||||
Reference in new issue
Block a user