Skip to content

feat(compiler): add Any as a first-class type in the Wirespec language - #694

Merged
wilmveel merged 2 commits into
masterfrom
feat/any-type
Aug 11, 2026
Merged

feat(compiler): add Any as a first-class type in the Wirespec language#694
wilmveel merged 2 commits into
masterfrom
feat/any-type

Conversation

@wilmveel

Copy link
Copy Markdown
Contributor

What

Any was already representable in the AST (Reference.Any, produced by the OpenAPI/Avro converters) but could not be written in Wirespec source. This PR makes Any a first-class type in the language, with IDE support.

Changes

Language (compiler core)

  • Tokenize Any as a built-in type (WsAny : SpecificType), alongside String, Integer, Unit, …
  • Parse it to the existing Reference.Any, supporting Any, Any?, Any[] and { Any }

IR converter fix

  • Reference.Any now maps to IR Type.Any instead of Type.Custom("Any"), which would have emitted a reference to a non-existent Any class in Java/TypeScript. Emitted types per target: Object (Java), Any (Kotlin/Scala/Python), any (TypeScript), Box<dyn std::any::Any> (Rust). No existing fixtures changed.

IDE

  • IntelliJ plugin: new ANY element type, lexer mapping, and keyword highlighting
  • LSP (VS Code/Zed) needed no change — it already treats every SpecificType generically

Tests

  • Parser coverage for Any, Any?, Any[] in ParseTypeTest
  • New shared CompileAnyTest fixture wired into the fixture updater, with generated fixtures and tests in all six IR emitters (Java, Kotlin, Python, Rust, Scala, TypeScript)
  • Wirespec emitter round-trip test proving Any re-emits as Any

Notes

  • Rust's existing Type.Any mapping (Box<dyn Any> inside #[derive(Clone, PartialEq, …)] structs) likely won't compile as real Rust; that mapping predates this PR and may deserve a follow-up.

🤖 Generated with Claude Code

wilmveel and others added 2 commits August 11, 2026 15:39
Any was already representable in the AST (Reference.Any, produced by the
OpenAPI/Avro converters) but could not be written in Wirespec source. Add
it to the language and tooling:

- tokenize Any as a built-in type (WsAny) and parse it to Reference.Any,
  supporting Any, Any?, Any[] and { Any }
- map Reference.Any to IR Type.Any instead of Type.Custom("Any"), so
  emitters produce Object (Java), Any (Kotlin/Scala/Python), any
  (TypeScript) and Box<dyn std::any::Any> (Rust) instead of a reference
  to a non-existent Any class
- highlight Any as a keyword in the IntelliJ plugin; the LSP already
  covers any SpecificType generically
- add parser coverage plus a shared CompileAnyTest fixture compiled by
  all IR emitters and a Wirespec round-trip test

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fixes the pre-existing format-check failure in the avro integration
module that blocks CI.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@wilmveel
wilmveel merged commit 6fe84f7 into master Aug 11, 2026
26 checks passed
@wilmveel
wilmveel deleted the feat/any-type branch August 11, 2026 14:01
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.

1 participant