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 when referencing reexported UDT from another package #2122

Open
minestarks opened this issue Jan 23, 2025 · 0 comments
Open

panic when referencing reexported UDT from another package #2122

minestarks opened this issue Jan 23, 2025 · 0 comments
Assignees
Labels
bug Something isn't working needs triage

Comments

@minestarks
Copy link
Member

When a package references a re-exported UDT from a dependency, a panic occurs:

panicked at `compiler/qsc_frontend/src/typeck/convert.rs:123:13:
internal error: entered unreachable code: A path should never resolve to a local or a parameter, as there is syntactic differentiation.

This bug occurs if we try to use TestCaseResult from qtest package today (but you have to work around #1955 first)

export Util.TestCaseResult;

REPRO

We need two Q# packages for this:

dep/qsharp.json

{}

dep/src/Main.qs

namespace Foo {
    struct MyType { a: Int }
}

namespace Main {
    export Foo.MyType as MyType; // work around https://github.com/microsoft/qsharp/issues/1955 by using an alias
}

main/qsharp.json

{
  "dependencies": {
    "dep": {
      "path": "../dep"
    }
  }
}

main/src/Main.qs

operation Main() : Unit {
    let x = new dep.MyType { a = 1 };  // this usage triggers the panic
}

panicked at compiler/qsc_frontend/src/typeck/convert.rs:123:13:
internal error: entered unreachable code: A path should never resolve to a local or a parameter, as there is syntactic differentiation.

Seen in 2a4c335

@minestarks minestarks added bug Something isn't working needs triage labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage
Projects
None yet
Development

No branches or pull requests

2 participants