Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic with multiple reexports and namespace #351

Closed
EdJoPaTo opened this issue Jan 9, 2024 · 1 comment · Fixed by #353
Closed

Panic with multiple reexports and namespace #351

EdJoPaTo opened this issue Jan 9, 2024 · 1 comment · Fixed by #353
Labels
bug Something isn't working

Comments

@EdJoPaTo
Copy link

EdJoPaTo commented Jan 9, 2024

deno doc panics with multiple reexports and namespace.

Minimal Example Code

a.ts

export * from "./b.ts";

b.ts

export * from "./c.ts";

c.ts

export declare namespace MessageEntity {
  export interface TextLinkMessageEntity {
    type: "text_link";
  }
}

main.ts

// import type { MessageEntity } from 'https://deno.land/x/[email protected]/types.ts';
import type { MessageEntity } from "./a.ts";
export type UrlMessageEntity = MessageEntity.TextLinkMessageEntity;

Importing b.ts works fine. Omitting the namespace also works fine. So they seem to relevant and can not be removed from this minimal example.

$ RUST_BACKTRACE=1 deno doc main.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.39.2
Args: ["deno", "doc", "main.ts"]

thread 'main' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_graph-0.62.2/src/symbols/cross_module.rs:629:60:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

The mentioned line is still the same in the current main branch so updating to its new release from a few hours ago will not fix this.

reexport creates another panic

Funnily changing to a reexport creates a panic in the deno_doc crate and not anymore in deno_graph.

main.ts

export type { MessageEntity } from "./a.ts";
$ RUST_BACKTRACE=1 deno doc main.ts

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.39.2
Args: ["deno", "doc", "main.ts"]

thread 'main' panicked at /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_doc-0.85.0/src/visibility.rs:212:66:
called `Option::unwrap()` on a `None` value
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Again changing to b.ts works fine so the deep reexport is required.

The mentioned code line still exists on a different line number on the current main: https://github.com/denoland/deno_doc/blob/0cd916e066edba623c809a3d16a3144d5d07200d/src/visibility.rs#L221

Should I also create an issue in the deno_doc repo?

@dsherret
Copy link
Member

Thanks for the report and simple reproduction!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants