Skip to content

feat: validate and lower properties by language - #162

Merged
adamcavendish merged 1 commit into
mainfrom
adamcavendish/property-capability-lowering
Aug 23, 2026
Merged

adamcavendish merged 1 commit into
mainfrom
adamcavendish/property-capability-lowering

Conversation

@adamcavendish

@adamcavendish adamcavendish commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add semantic property capability profiles and complete language-local property
lowering. Property declarations now validate before lowering, preserve
structured types and metadata, and fail closed when a target cannot represent
the requested behavior. A validation-only owner view also covers relationships
between properties and explicit members without introducing shared grammar.

Problem

PropertySpec previously selected a shared accessor-versus-field grammar and
assembled target syntax from general configuration hooks. That allowed
unsupported contexts and invalid language forms to reach plausible-looking
output, kept property preamble ownership in the generic spec layer, and left
target-derived cross-member name collisions unchecked.

Behavior

Situation Behavior
JavaScript or TypeScript concrete property Lower to native getter and setter declarations
Kotlin or Swift computed property Lower with target-owned computed-property grammar
PHP or Scala property intent Lower to target-local getter and setter methods
Exact duplicate property names Return one crate-owned structured error
PHP accessor or explicit-method collision Reject the case-insensitive target member-name collision
Unsupported context or semantic combination Return a structured validation error before lowering
Property type or importable annotation Preserve structured references through import and alias resolution
Pre-0.6.8 external adapter Use the frozen compatibility lowerer and deprecated grammar hooks

Compatibility

PropertyStyle, CodeLang::property_style(), and
CodeLang::property_getter_keyword() remain available but are deprecated.
External adapters that rely on the 0.6.8 defaults retain frozen compatibility
lowering, including valid split-member placement and preamble behavior.
Built-in adapters use strict property profiles and complete local lowerers.
Invalid legacy output may now be rejected.

TypeMembersIntent is a validation-only view with no lowering counterpart.
It carries semantic fields, computed properties, and explicit methods for one
owner; it does not contain placement or target grammar.

Validation

  • just check
  • just coverage-nextest
  • just book
  • just book-test
  • RUSTDOCFLAGS=-Dwarnings cargo doc --workspace --no-deps
  • cargo semver-checks check-release --baseline-rev origin/main
  • git diff --check

Normal nextest passed 2,341 tests. Coverage nextest passed 2,191 tests. The new
owner-wide validation modules have 100% line and function coverage. The semver
comparison against origin/main passed all 196 applicable checks.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.26942% with 45 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/lang/capability.rs 81.33% 14 Missing ⚠️
src/error.rs 0.00% 9 Missing ⚠️
src/lang/property_lowering/compatibility.rs 96.26% 8 Missing ⚠️
src/lang/php.rs 81.81% 6 Missing ⚠️
src/lang/mod.rs 93.93% 2 Missing ⚠️
src/lang/property_lowering/kotlin.rs 98.30% 2 Missing ⚠️
src/lang/property_lowering/php.rs 98.27% 2 Missing ⚠️
src/spec/property_spec.rs 99.16% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@adamcavendish
adamcavendish force-pushed the adamcavendish/property-capability-lowering branch from 9343a22 to 685e68a Compare August 23, 2026 07:55
- add semantic property capabilities and owner-aware complete lowering
- keep accessor and computed-property grammar in target language adapters
- validate intrinsic operands, required semantics, visibility, and identifiers
- reject bodyful property specs in unsupported contract and declaration contexts
- validate exact property duplicates and PHP-derived member-name collisions
- preserve TypeName and annotation imports through structured CodeBlock output
- retain valid 0.6.8 external adapters through a frozen compatibility lowerer
- deprecate legacy property grammar hooks with migration guidance
- cover matrices, owner-wide validation, preambles, imports, and renderer parity
- document property ownership, compatibility boundaries, and language-author rules
@adamcavendish
adamcavendish force-pushed the adamcavendish/property-capability-lowering branch from 685e68a to 82580f5 Compare August 23, 2026 14:24
@adamcavendish
adamcavendish merged commit 0bae2ad into main Aug 23, 2026
9 checks passed
@adamcavendish
adamcavendish deleted the adamcavendish/property-capability-lowering branch August 23, 2026 16:55
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