Skip to content

RFC: model XAML in the XML LST (type attestation + value layer) - #8663

Draft
macsux wants to merge 1 commit into
mainfrom
macsux/xaml
Draft

RFC: model XAML in the XML LST (type attestation + value layer)#8663
macsux wants to merge 1 commit into
mainfrom
macsux/xaml

Conversation

@macsux

@macsux macsux commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Draft / RFC — for discussion only, not ready to merge. CI is expected to be red; see the blocker below.

Adds a XAML layer to the XML LST, kept in structural sync between rewrite-xml/.../tree/Xml.java and rewrite-csharp/csharp/OpenRewrite/Xml/Xml.cs: JavaType attestation slots on Tag, Ident and the new Literal (semantic identity without node-type proliferation), a polymorphic attribute-value slot (Attribute.AttributeValue, implemented by the unchanged Value for plain XML plus a new ExpressionValue carrying a parsed expression tree), and a value/binding expression layer — MarkupExtension/Argument, PropertyPath with Property/Indexer/Paren/Cast/FunctionCall/Element/Relative/Stream segments, Negation, TypeName, ParenGroup — covering WPF, WinUI (incl. x:Bind), MAUI/Xamarin.Forms, Avalonia and Silverlight. Plain XML documents never contain the new nodes and their values stay Value instances, so existing serialized LSTs deserialize unchanged.

Known blocker, and the main question for reviewers: org.openrewrite.java.tree.JavaType lives in rewrite-java, but rewrite-xml only depends on rewrite-core, so rewrite-xml:compileJava fails. Where should the type model live for a non-Java language module that needs attestation? That decision is what this RFC is asking the team to settle before any parser/printer/visitor work starts.

Design proposal for discussion, not ready to merge.

Adds a XAML layer to the XML LST in parallel on the Java and C# sides:

- JavaType attestation slots on Xml.Tag, Xml.Ident and the new Literal, so
  names carry semantic identity without proliferating node types.
- A polymorphic attribute-value slot: Xml.Attribute.AttributeValue, implemented
  by the existing Value (plain XML, unchanged) and a new ExpressionValue that
  carries a parsed expression tree.
- A value/binding expression layer: Literal, MarkupExtension + Argument,
  PropertyPath with Property/Indexer/Paren/Cast/FunctionCall/Element/Relative/
  Stream segments, Negation, TypeName and ParenGroup — covering WPF, WinUI
  (incl. x:Bind), MAUI/Xamarin.Forms, Avalonia and Silverlight.

Known to not compile: org.openrewrite.java.tree.JavaType lives in rewrite-java
and rewrite-xml only depends on rewrite-core. Resolving where the type model
should live is the main thing this RFC is asking the team to decide.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant