Skip to content

🐛 Getting panic on execution with multiple constructor function signatures #9483

@planttheidea

Description

@planttheidea

Environment information

Details
CLI:
  Version:                      2.4.7
  Color support:                true

Platform:
  CPU Architecture:             x86_64
  OS:                           linux

Environment:
  BIOME_LOG_PATH:                    unset
  BIOME_LOG_PREFIX_NAME:             unset
  BIOME_LOG_LEVEL:                   unset
  BIOME_LOG_KIND:                    unset
  BIOME_CONFIG_PATH:                 unset
  BIOME_THREADS:                     unset
  BIOME_WATCHER_KIND:                unset
  BIOME_WATCHER_POLLING_INTERVAL:    unset
  NO_COLOR:                     unset
  TERM:                         xterm-256color
  JS_RUNTIME_VERSION:           v20.20.1
  JS_RUNTIME_NAME:              node
  NODE_PACKAGE_MANAGER:         yarn/4.12.0

Biome Configuration:
  Status:                       Loaded successfully
  Path:                         biome.json
  Formatter enabled:            true
  Linter enabled:               true
  Assist enabled:               true
  VCS enabled:                  true
  HTML full support enabled:    unset

Workspace:
  Open Documents:               0

What happened?

When running biome (locally and in CI) I get this error:

Biome encountered an unexpected error

This is a bug in Biome, not an error in your code, and we would appreciate it if you could report it to https://github.com/biomejs/biome/issues/ along with the following information to help us fixing the issue.

When opening the issue, please provide a minimal reproduction, or identify and share the file/code that triggers it. Without a way to reproduce the error, the error can't be fixed:

Source Location: crates/biome_js_semantic/src/semantic_model/scope.rs:150:38
Thread Name: biome::workspace_worker_2
Message: no entry found for key
Stack Trace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>
  24: <unknown>

<<filepath>> internalError/panic  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ processing panicked: no entry found for key
  
  ⚠ This diagnostic was derived from an internal Biome error. Potential bug, please report it if necessary.

I realize the unknown spam output may not be super helpful, and even worse I cannot reproduce this in the playground, but I've narrowed it down a bit; it seems to be complaining due to the multiple constructor signatures; when I remove them in favor of the final one I no longer get the panic. I can reproduce locally with code as simple as this:

export class Foo<O extends Record<string, any>> {
  name: string;
  options: O;

  constructor(name: string, opts?: 0);
  constructor(options: O)
  constructor(nameOrOptions: string | O, opts?: O) {
    this.name = typeof nameOrOptions === 'string' ? nameOrOptions : 'unknown';
    this.options = opts ?? {} as O;
  }
} 

I have a simple repro repository as the playground is insufficient.

Expected result

No panic is created, naturally haha.

Code of Conduct

  • I agree to follow Biome's Code of Conduct

Metadata

Metadata

Assignees

Labels

A-AnalyzerArea: analyzerA-CoreArea: coreS-Bug-confirmedStatus: report has been confirmed as a valid bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions