microsoft / microsoft/typespec
Wrongfully detected cycle drops properties
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
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` 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
```tsp
model DefaultBaseParameters {
...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
Contributor guide
Assessment
This issue has not been assessed yet.