Skip to content

Consolidate template checking by providing helpers in the compiler - #769

Merged
Timothee Guerin (timotheeguerin) merged 3 commits into
microsoft:mainfrom
timotheeguerin:unify-temlate-check
Jul 26, 2022
Merged

Consolidate template checking by providing helpers in the compiler#769
Timothee Guerin (timotheeguerin) merged 3 commits into
microsoft:mainfrom
timotheeguerin:unify-temlate-check

Conversation

@timotheeguerin

Copy link
Copy Markdown
Member

fix #601

@azure-pipelines

Copy link
Copy Markdown

You can try these changes at https://cadlplayground.z22.web.core.windows.net/prs/769/

@timotheeguerin
Timothee Guerin (timotheeguerin) merged commit f1b8df8 into microsoft:main Jul 26, 2022
@timotheeguerin
Timothee Guerin (timotheeguerin) deleted the unify-temlate-check branch July 26, 2022 17:04
/**
* Resolve if the model is a template type(Non initialized template type).
*/
export function isTemplate(model: ModelType): boolean {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missed that we made a breaking change here, but it shows up on flow to cadl-azure. The new isTemplate checks for declaration or instance.

I'd be tempted to change the new isTemplate to isTemplateDeclarationOrInstance so that we can't get confused. To me at least, a template instance is not really a template.

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.

Consolidate checks for (uninstantiated) templates to use shared helper function in compiler

3 participants