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

Multi-line compiler messages truncated by MSBuild

Open swernli opened this issue 3 years ago • 0 comments

Some errors reported by the compiler can be multiline, but everything after the first newline gets trimmed by dotnet build in the compilation output. For example, the following Q# produces three type errors on the return line:

    operation TypeError() : (Result, Result, Result) {
        let x = ((One, Zero), "hello", 42);
        return x;
    }

These each have multiple lines when viewed as a tooltip in VSCode:

Couldn't match type (Result, Result) with type Result.
Expected: (Result, Result, Result)
  Actual: ((Result, Result), String, Int) ...(QS0001)
Couldn't match type String with type Result.
Expected: (Result, Result, Result)
  Actual: ((Result, Result), String, Int) ...(QS0001)
Couldn't match type Int with type Result.
Expected: (Result, Result, Result)
  Actual: ((Result, Result), String, Int) ...(QS0001)

But when the file is compiled only the first line of each error is reported:

...(13,18): error QS0001: Expected type Result, but actual type was (Result, Result, Result). 
...
...(13,16): error QS0001: Couldn't match type String with type Result. 
...     
...(13,16): error QS0001: Couldn't match type Int with type Result.

This means cmdline compilation is loosing details that could be helpful to the user.

swernli avatar Jun 21 '22 22:06 swernli