microsoft / typespec

https://typespec.io/
MIT License
4.13k stars 199 forks source link

Method cannot be `virtual` when the type is generated as a struct #4348

Open ArcturusZhang opened 2 weeks ago

ArcturusZhang commented 2 weeks ago

This code cannot compile:

public readonly struct Foo
{
    protected virtual void WriteCore() {}
}

It should be:

public readonly struct Foo
{
    private void WriteCore() {}
}

if we want to keep this method, or generate it inline.

m-nash commented 1 week ago

@JoshLove-msft can you verify if this affects OAI.

JoshLove-msft commented 1 week ago

Yes, there are numerous structs in OAI.