Skip to content

Conversation

@timotheeguerin
Copy link
Member

fix #1991

Compiler would get into a infinite recursion when comparing recursive models.

model A {
  a: A;
}

model B {
  a: B;
}
model Test<T extends A> {}

alias T1 = Test<B>;

Microsoft Auto Changeset Bot added 2 commits September 6, 2023 14:03
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):
Playground: https://cadlplayground.z22.web.core.windows.net/prs/2379/

Website: https://cadlwebsite.z1.web.core.windows.net/prs/2379/

…_2023-09-06-21-08.json

Co-authored-by: Brian Terlson <brian.terlson@microsoft.com>
enum Related {
false = 0,
true = 1,
maybe = 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like "unknown" describes this situation better than "maybe", maybe.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typescript also has unknown so I kept the same naming

from their docs

 * Generally, Ternary.Maybe is used as the result of a relation that depends on itself, and
 * Ternary.Unknown is used as the result of a variance check that depends on itself. We make
 * a distinction because we don't want to cache circular variance check results.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😂 I stand corrected

@timotheeguerin timotheeguerin merged commit adbfc89 into microsoft:main Sep 6, 2023
@timotheeguerin timotheeguerin deleted the fix/relation-recursive-types branch September 6, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stackoverflow when overloading a property with array and not array of self type

2 participants