Skip to content

Wrongfully detected cycle drops properties #7972

@timotheeguerin

Description

@timotheeguerin

Follow up to #7899 which fixed most cases.

This similiar to what is blocking #7956 needs a redesign of how we check for circular refernce in alias so we detect that when hitting a model property we break the cycle.

What happens here is that in checkAlias we wrongfully find a cycle but because its a template DefaultBaseParameters<T> the error is not reported(so it wouldn't report duplicate errors) but the alias type is set to errorType resulting in the spread being a noop.

Repro

model DefaultBaseParameters<T> {
  ...Alias;
}

model B {
  prop: C;
}

model C {
  ...DefaultBaseParameters<{}>;
}

alias Alias = B;

https://typespec.io/playground/?e=%40typespec%2Fopenapi3&c=bW9kZWwgRGVmYXVsdEJhc2VQYXJhbWV0ZXJzPFQ%2BIHsKICAuLi5BbGlhczsKfQoKxjBCxRlwcm9wOiBDyxhDyDHWUXt9PsUtYcRPIMVVID0gQjs%3D&options=%7B%7D&vs=%7B%7D

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions