Skip to content

Compilation error regexes don't pick up panic backtrace file locations #560

Open
@rtpg

Description

@rtpg

While working through something I noticed that while the panicing regex does pick up the "panicked at" line and put a link there, it doesn't properly capture the subsequent at lines.

checking "/Users/rtpg/proj/ruff/crates/red_knot_workspace/resources/test/corpus/73_class_generic_cycle.py"
thread 'corpus_no_panic' panicked at crates/red_knot_python_semantic/src/semantic_model.rs:64:32:
Could not find expression for Subscript(ExprSubscript { range: 27..44, value: Name(ExprName { range: 27..31, id: Name("list"), ctx: Load }), slice: BinOp(ExprBinOp { range: 32..43, left: Name(ExprName { range: 32..36, id: Name("Tree"), ctx: Load }), op: BitOr, right: Name(ExprName { range: 39..43, id: Name("Leaf"), ctx: Load }) }), ctx: Load })
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
   2: <ruff_python_ast::expression::ExpressionRef as red_knot_python_semantic::semantic_model::HasTy>::ty::{{closure}}
             at /Users/rtpg/proj/ruff/crates/red_knot_python_semantic/src/semantic_model.rs:64:32
   3: core::option::Option<T>::unwrap_or_else
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/option.rs:1015:21
   4: <ruff_python_ast::expression::ExpressionRef as red_knot_python_semantic::semantic_model::HasTy>::ty
             at /Users/rtpg/proj/ruff/crates/red_knot_python_semantic/src/semantic_model.rs:62:9
   <etc>

This is probably an easy fix with the regex compilations, but having a bit of trouble finding the right incantation here

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions