fix(semantics): subset the base feature of a usage kind and derive its type from it - #475
Merged
Merged
Conversation
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Empties the "Decisions to Reassess" table of
docs/project/spec-compliance.md. Both rows recorded a workaround whose premise no longer holds:semantics/implicit.goimplicitUsageBasesnamed the stdlib base definition of each usage kind (Parts::Part,Actions::Action, …) because library records once carried no specialization edges, so the base feature would have been a dead end for member lookup. The records have carriedSupersfor a while (libs/record.gofactRecord.Supers→symbols.LibraryFacts.Supers→Model.recordedSupertypes), so the table now names the base feature the spec names (Parts::parts,Items::items,Actions::actions,Connections::binaryConnectionsfor a two-ended connection, …). A SysML usage now implicitly subsets that feature —implicitUsageBaseFeature, a member contributor and implicit general beside the KerMLimplicitKerMLFeatureBase, never aDirectSupertypesentry — and its type is derived from it (baseFeatureTypes: the feature's declared types plus those of the features it subsets, most-specific kept, KerML Feature::type).kindBaseDefinitionFQNskeepsKindBaseFQNs,computeImplicitBasesand the suppression rule (declaredGeneralizationReaches) working on definitions, so the effective typing is unchanged for every kind except a two-ended connection/interface usage, which now derives{Connection, BinaryLinkObject}frombinaryConnectionsas the library states (definitions with two ends still specializeBinaryConnection/BinaryInterface). Member lookup through the feature works:Parts::partsreachesPartanditemsthrough the recorded edges.ownedParametersto read. It does: the on-disk record path re-parses every library document and the embedded snapshot restoresSymbol.Decl, so positional redefinition already holds on every load path. NoIndexRecordchange and no format bump is needed; a test now locks the three paths.The
libs/loader.gorecordEntriesthe first row pointed at no longer exists; the edges live inrecord.go.Specification basis
SysML v2 §7 — each library package states the base feature of its usage kind (⚠️ → ✅; the untyped-connector row names the base features; both "Decisions to Reassess" rows removed.
Parts::parts"is the base feature of all PartUsages",Connections::binaryConnections"of all binary ConnectionUsages", …); KerML 8.3.3.3 (Feature::type through subsetting); KerML 7.4.7.3 / SysML v2 7.17.2 (positional parameter redefinition). Rows moved: "Features of the stdlib base type of an untyped usage"How it was verified
model/implicit_typing_test.goTestImplicitUsageBaseTypesnow asserts, per kind, both the derived definition and the base feature amongImplicitGenerals;TestUsageBaseFeatureSuppressionFollowsDeclaredChain(part p : Vehiclekeepsparts,part p :> qwithqa part does not); a semantics test asserts the derived definitions for every table entry and both binary features (binaryConnections→[Connection, BinaryLinkObject]);libs/loader_cache_test.goTestLibraryBehaviorParametersRedefinedByPosition(cold load, warm disk cache, embedded snapshot).semantics/implicit_test.gogained the base features the real library has; no assertion weakened.go build ./...,go vet ./...,gofmt -l .empty,go test -count=1 ./...,make lint,python3 scripts/check-doc-ids.py,python3 scripts/changelog.py check.OPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1 go test -count=1 ./tests/corpus -run 'TestTrainingExamples|TestPilotCorpora'): no movement. Pilot library identity gate (OPENSYSML_REQUIRE_PILOT_LIBRARY_XMI=1 go test -count=1 ./tests/identity -run TestPilotLibraryXMI): passes.internal/workspace/libs/stdlib.snapshotregenerated (derived supertypes of the two binary base features changed; format version unchanged).Checklist
make testandmake lintpass locallychanges/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelog