Skip to content

Remove LazyContent.Create identity wrappers in resolution phase #12997

Description

@chsienki

Background

PR #12957's resolution phase uses LazyContent.Create(str, static s => s) in several places to wrap string content. This looks like a no-op but actually controls the IR node type: using LazyContent produces LazyIntermediateToken in the IR tree, while using a plain string produces IntermediateToken. These wrappers were kept for IR baseline compatibility during the refactoring.

What to change

Remove the 4 identity LazyContent.Create wrappers and update IR baselines to use IntermediateToken instead of LazyIntermediateToken:

  1. DefaultTagHelperResolutionPhase.ComponentTagHelperResolver.cs — search for LazyContent.Create
  2. DefaultTagHelperResolutionPhase.LegacyTagHelperResolver.cs — search for LazyContent.Create

Each site looks like:

new HtmlIntermediateToken(LazyContent.Create(content, static s => s), source)

Should become:

new HtmlIntermediateToken(content, source)
// or
new IntermediateToken(content, source)

IR baseline updates

  • .ir.txt test baseline files will change: LazyIntermediateTokenIntermediateToken
  • No codegen baselines (.codegen.cs, .codegen.html, .mappings.txt) should change — only IR representation differs.

Notes

  • Removing these wrappers caused ~105 IR baseline test failures when attempted during PR Deferred tag helper lowering: separate resolution from lowering phase #12957. The failures are all mechanical baseline updates (node type name change), not behavioral.
  • Run .build.cmd -test -projects srcCompilerMicrosoft.AspNetCore.Razor.LanguagetestMicrosoft.AspNetCore.Razor.Language.Test.csproj` to find affected baselines and update them.

ref: PR #12957 review comments #12957 (comment)

Metadata

Metadata

Labels

area-compilerUmbrella for all compiler issues

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions