Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

Default values in uninitialized arrays can contain null #359

@bamarsha

Description

@bamarsha

Describe the bug

The default values for a type T given by (new T[1])[0] or the equivalent library function Default<T>() do not match the documented values here:

https://docs.microsoft.com/en-us/quantum/user-guide/language/expressions#array-creation

Expected behavior

The default values should match the documented values.

Actual behavior

  • Default<String>() is null but should be ""
  • Default<Result>() is null but should be Zero
  • Default<Range>() is 0..1..0 but should be 1..1..0
  • Default<'T[]>() is null but should be new 'T[0]
  • Default<Unit>() is null but should be ()

Additional context
See microsoft/qsharp-compiler#589 for more examples.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions