본문으로 건너뛰기
토파즈6.0 · 출시 전
다운로드 →

문서 검색

명세 6.0

방향키로 결과를 고르고 Enter를 눌러 여세요.

API 이름, 진단 번호, 규칙 또는 프로젝트 주제를 입력하세요.

    진단 TPZ5001

    Runtime value guards produce TPZ5001 when a value or pattern fails an operation requirement.

    Diagnostic and cause

    링크

    Runtime value guard

    계열
    topaz
    단계
    run
    코드
    TPZ5001

    원인과 조건

    At runtime TPZ5001 reports a value that fails the operation guard. Decimal scales follow Decimal rounding. Invalid scales fail before division classifies a zero divisor. BigInt radix and ByteBuffer byte guards use the same runtime identity. A comprehension stops when its pattern does not match a reached element.

    대응

    Use a valid value for the operation. Check its scale, radix or byte bounds. Use an explicit filter when a comprehension should skip unmatched values.

    Compiler phase: check/runtime.

    Compiler explanation: A value's type does not match the type required by its context.

    Message templates. The marker ⟨value⟩ stands for text computed for the reported program.

    • const initializers must be constant expressions (§4) Source
    • ⟨value⟩ is not iterable (§10) Source
    • return outside a function Source
    • a placeholder _ is valid only inside a pipeline stage (§11) Source
    • expected ⟨value⟩, found ⟨value⟩ Source
    • ⟨value⟩ outside a loop Source
    • bare ⟨value⟩ cannot target ⟨value⟩ Source
    • concurrent timeout duration must fit in u64 milliseconds (§15) Source
    • the range step must not be zero (§10) Source
    • ?? needs an Option or nullable left operand, found ⟨value⟩ Source
    • Length operation requires compatible units and scalar operands, found ⟨value⟩ and ⟨value⟩ Source
    • arithmetic needs matching numeric operands, found ⟨value⟩ and ⟨value⟩ Source
    • % needs int operands in v5.2, found ⟨value⟩ and ⟨value⟩ Source
    • + needs matching int, float, string, BigInt, or Decimal operands, found ⟨value⟩ and ⟨value⟩ Source
    • in does not apply to a Map; use in map.keys Source
    • in does not apply to strings Source
    • integer literal is out of range Source
    • unary operator cannot apply to ⟨value⟩ Source
    • ? propagates an error, but the function returns ⟨value⟩, not a Result Source
    • ? requires a Result value, found ⟨value⟩ Source
    • ⟨value⟩ is not index-readable; only arrays support […] indexing (§9) Source
    • integer literal ⟨value⟩ is out of range Source
    • a placeholder _ is valid only in a pipeline stage's argument list (§11) Source
    • ⟨value⟩ is not iterable (§10) Source
    • ByteBuffer values cannot be interpolated; snapshot to Bytes and encode explicitly Source
    • array spread needs an Array, found ⟨value⟩ Source
    • ?. needs an Option or nullable receiver, found namespace Source
    • ?. needs an Option or nullable receiver, found ⟨value⟩ Source
    • record spread ... needs a declared record; ⟨value⟩ is not one Source
    • record update needs a record, found ⟨value⟩ Source
    • integer literal type ⟨value⟩ is out of range Source
    • Length requires one compiler-owned Pt, Mm, Cm, In or Em marker Source
    • this pattern can never match ⟨value⟩ Source
    • a ⟨value⟩ pattern cannot establish nominal identity for rigid scrutinee type ⟨value⟩ Source
    • this ⟨value⟩ pattern can never match ⟨value⟩ Source
    • this ⟨value⟩ pattern can never match ⟨value⟩ Source
    • a Map is not index-assignable; use m.insert (§22) Source
    • cannot assign through optional access ?. (§4) Source
    • ??= needs an Option or nullable target, found ⟨value⟩ Source
    • constant expression error: ⟨value⟩ Source

    A checked program can still receive an invalid value during execution. Invalid numeric parameters and byte values use TPZ5001. A failed comprehension pattern uses the same runtime code. Each operation keeps its own cause and source location.

    규칙diagnostics.tpz5001.runtime.p5.rule

    Reject invalid values during execution

    At runtime TPZ5001 reports a value that fails the operation guard. Decimal scales follow Decimal rounding. Invalid scales fail before division classifies a zero divisor. BigInt radix and ByteBuffer byte guards use the same runtime identity. A comprehension stops when its pattern does not match a reached element.

    Response

    링크

    Use a valid value for the operation. Check its scale, radix or byte bounds. Use an explicit filter when a comprehension should skip unmatched values.

    Reproduction and verification

    링크

    Rejected program

    링크
    example.tpzRejected program
    1. import std.decimal { Decimal }
    2. let one: Decimal = (1).toDecimal()
    3. one.round(-1)
    기대 출력0이 아닌 종료 코드
    표준 출력 없음.
    $ topaz run example.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    거절 단계 run. 종료 코드가 0이 아닙니다.

    Pinned source identifies the guard and call location. This pair has not been run with the public CLI.

    Repaired program

    링크
    example.tpzRepaired program
    1. import std.decimal { Decimal }
    2. import std.io
    3. let one: Decimal = (1).toDecimal()
    4. io.writeLine(one.round(0).toString())
    기대 출력종료 코드 0
    1
    
    $ topaz run example.tpz · 대상 제품 5.21.3
    기대 결과

    기대 결과

    실행을 마칩니다. 종료 코드 0.

    기대 표준 출력
    1. 1

    Pinned source identifies the guard and call location. This pair has not been run with the public CLI.

    메뉴

    다운로드 →