Diagnostic and cause
링크Import after non-import item
- 계열
- topaz
- 단계
- parse
- 코드
TPZ2010
원인과 조건
Every top-level import precedes every non-import top-level item.
관련 규칙 · Trigger and repair →대응
Move all imports before the module's declarations and free statements.
Compiler phase: parse.
Compiler explanation: An import appears after a top-level item that ends the import prologue.
Message templates. The marker ⟨value⟩ stands for text computed for the reported program.
- imports form a prologue: every
importprecedes all other top-level items Source
Observed for the candidate in Topaz 5.21.3. Execution
- error[TPZ2010]: imports form a prologue: every
importprecedes all other top-level items
An import follows a non-import top-level item. That item ended the import prologue.
Trigger and repair
Every top-level import precedes every non-import top-level item.
Response
링크Move all imports before the module's declarations and free statements.
Reproduction and verification
링크Rejected program
링크let value = 1import lib
표준 출력 없음.export let exported = 1
기대 결과
The expected diagnostic, cause, source location, and accompanying diagnostics are specified below. The verification status records whether this program has been run.
Corrected program
링크import liblet value = 1
export let exported = 1
기대 결과
기대 결과
검사가 프로그램을 받아들입니다. 종료 코드 0.
This program applies the repair described above. The verification status records whether it has been run.