Description
While working on updating FSAC to .net 7, some of our tests around interface stub generation started to fail, I think in part due to the new GetSetMember concept.
Specifically, the following scenario:
type IPrinter =
abstract member Indentation: int with get, set
type Printer() =
interface IPrinter with
member _.Indentation with get () = 42
When generated with the 'verbose' mode, the output seems to be ok:
type IPrinter =
abstract member Indentation: int with get, set
type Printer() =
interface IPrinter with
member _.Indentation with get () = 42
member _.Indentation
with set (v: int): unit =
failwith "-"
But when generated with the 'non verbose' mode, the output has two problems:
a) the setter line contains type annotations, and
b) the method body isn't indented on the following line
type IPrinter =
abstract member Indentation: int with get, set
type Printer() =
interface IPrinter with
member _.Indentation with get () = 42
member _.Indentation
with set (v: int): unit = // note the annotations on this line
failwith "-" // note the need for one more indentation level
The type annotations seem to come from this line, which should check the verbosity.
The lack of indentation seems to come from an interaction with writeImplementation - when verbosity is off there's an assumption that the body is emitted on the same line, but the use of WriteLine
for the with set v =
line prior breaks that assumption. Perhaps the setter-writing portion of the stub needs to indent one more level before calling writeIndentation
?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status