microsoft / microsoft/qdk

Report error on empty array return

Open
#3,379 2 comments 0 reactions 0 assignees View on GitHub
bug needs triage
Dominant language
Rust
Stars
1k
Forks
212
Avg merge
3d 8h
Merged PRs (30d)
65

Description

**Describe the bug**

An empty array result isn't allowed and we could detect it at compile time.

**To Reproduce**

Steps to reproduce the behavior:

Generate QIR for

```qsharp
operation Main() : Int[] {
use q = Qubit();
MResetZ(q);
[]
}
```

**Expected behavior**

An error is reported

Contributor guide

Open the contributing guide

Research direction

Start by generating QIR for the provided Q# operation and trace where the compiler handles the empty array return and diagnostics. The change is complete when this invalid return produces a compile-time error without affecting valid array returns.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, quantum-computing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.