qsharp-compiler icon indicating copy to clipboard operation
qsharp-compiler copied to clipboard

Improved deprecation notes

Open troels-im opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Deprecation notes can at times be difficult to understand. For instance, warning QS3308: Deprecated syntax. Use [] to construct an empty array, or [x, size = n] to construct an array of x repeated n times. is difficult to understand if you do not know what is meant by Use []. This deprecation warning arises when using

let x = new Int[256];

Describe the solution you'd like My prefer solution would be to explicitly write the update statement. For instance, a warning could look like:

warning QS3308: Deprecated syntax:
   mutable arr = new Int[256]; 

Use [x, size = n] to construct an array of x repeated n times.
  mutable arr = [0, size= 256]; 

You can upgrade deprecated syntax automatically by running dotnet [args]

The message explicitly tells the user how to correct the in correct statement leaving out ambiguity and offering an automatic way to upgrade using the syntax formatter.

troels-im avatar May 31 '22 07:05 troels-im