Diagnostic and cause
링크Comprehension body type mismatch
- 계열
- topaz
- 단계
- check
- 코드
TPZ5610
원인과 조건
A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.
대응
Make the body produce the expected element type, or change the collection annotation to match the intended data.
Compiler phase: check.
Compiler explanation: A comprehension body does not match the element type required by its expected context.
Message templates are Pending. The explanation above is not an observed CLI message.
A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.
Comprehension body and expected element type
A comprehension body must satisfy the element type required by its collection context. An Array<int> comprehension whose body produces string must be rejected with the registered TPZ5610 diagnostic.
Response
링크Make the body produce the expected element type, or change the collection annotation to match the intended data.
Reproduction and verification
링크Rejected program
링크let values: Array<int> = [for value in ([1]) => "text"]
표준 출력 없음.기대 결과
The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.
Repaired program
링크let values: Array<int> = [for value in ([1]) => value]
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
The source establishes a TPZ5001 collection mismatch for this input. The product assertion retains the intended TPZ5610 identity. Its dedicated message and primary location remain undetermined; the cause matcher recognizes the actual source-backed mismatch text.