Repository navigation
Conversation
…in a branch body An assignment may end in a body, as the grammar gives it, so an unnamed one states its ElementId there; an about annotation in an if branch or loop body now annotates the element it names, and an unnamed member of such a body has an identity of its own. Fixes #2713 Co-Authored-By: jason.han <hanhuijun@gmail.com>
A name path before the body was read as a chained name, which lost the receiver of a feature chain and took an invocation's body expression for the assignment's body. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The members are not performed, so a nested step was dropped without a diagnostic; a body that only annotates the assignment still runs. Co-Authored-By: jason.han <hanhuijun@gmail.com>
The refusal counted a rep annotation as a declared member. Co-Authored-By: jason.han <hanhuijun@gmail.com>
A `featuring g by T;` or `featuring tf of g by T;` declaration states the same TypeFeaturing as a `featured by T` clause on the feature, but neither Model.FeaturingTypes nor the constraint checker's featuring contexts read it, so a reference to g from a type outside T was accepted. The semantic model now gathers the standalone featuring declarations of each document and indexes their resolved ends by the featured feature, in a shared frame dropped when a contributing document changes. Model.FeaturingTypes and constraintChecker.featuringOwners both add those types to the inline ones. Fixes #2790 Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ine clause The pinned pilot does not read a standalone `featuring f by T;` for the accessibility of a feature reference or a connector end, a rule that is the pilot's own for a reference. constraintChecker.featuringOwners reads the inline `featured by` clause alone again. Model.FeaturingTypes keeps the standalone declarations (KerML 8.3.3.3.4 deriveFeatureFeaturingType), so the subsetting and redefinition rules (8.3.3.3.10), which ask Model.CanAccess, judge the feature against them. Refs #2790 Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ition divergence Two reject-oracle cases, a feature that subsets and one that redefines a feature whose featuring type a `featuring g by T;` declaration states. The pinned pilot accepts both; KerML 8.3.3.3.10 validateSubsettingFeaturingTypes over 8.3.3.3.4 deriveFeatureFeaturingType rejects them, so they land in ours-only-rejects. Refs #2790 Co-Authored-By: jason.han <hanhuijun@gmail.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
QA: passTested head
Four positions, non-conforming user (CLI, REPL, LSP and gRPC
|
| Position | inline, base = head | standalone, base | standalone, head |
|---|---|---|---|
feature v subsets g; |
subsetting-featuring-types |
accepted | subsetting-featuring-types |
feature v redefines g; |
redefinition-no-inherited |
accepted | redefinition-no-inherited |
feature v = g; |
feature-reference-featuring-types |
accepted | accepted |
connector c from g to h; |
connector-type-featuring |
accepted | accepted |
featuring tf of g by T; and a declaration written before its feature behave like the plain standalone form. A user that specializes T is accepted in every form on both builds.
featuringType on the reflective surfaces
The gap reported on the earlier head is closed: gRPC GetElementProperties and -convert api-json (plain and -interchange) now answer T for a feature featured only by a standalone declaration, plain or identified, in one file or across files. Base answers empty. Turtle is byte-identical on both builds, and the inline fixtures are byte-identical in every format.
Nested feature featured by a type of another document, classifier K { feature g; } with featuring K::g by Lib::T; or feature g featured by Lib::T; (CLI -convert api-json, gRPC Convert with documents, GetElementProperties):
g.featuringType |
base | head |
|---|---|---|
standalone, Lib written |
[K] |
[Lib::T, K] |
standalone, Lib loaded but not written |
[K] |
[Lib::T, K] |
standalone, Lib::T unresolved |
[K] |
[K] |
inline, Lib written |
[Lib::T] |
[Lib::T, K] |
inline, Lib loaded but not written |
[Lib::T] |
[Lib::T, K] |
inline, Lib::T unresolved |
[] |
[K] |
Where head differs from base it follows KerML 8.3.3.3.4 (the owning type together with every TypeFeaturing's type), and the two forms now agree with each other and with GetElementProperties. Head matches base only in the standalone unresolved row. On the intermediate head e4a646d39b the standalone unresolved row was empty; that is fixed here.
What else passed
- Cross-document: with
featuring Lib::g by Lib::T;in its own file, head reports the two errors in the using file only when the declaring file is loaded (CLI, REPL%load, LSP workspace, gRPCParseSources). - Live LSP invalidation, one session, no restart: removing both declarations clears both errors; removing one clears only its error; retargeting, restoring, editing the library or the using file, deleting the declaring file from disk, and creating or changing an unopened declaring file on disk each give the diagnostics of a fresh load.
- Hover and go-to-definition on
gand on the identifiedfeaturing th: same answers on base and head. - Diagnostic sweep,
sysml -validateover every.sysml/.kermlunderexamples/(training, pilot and spec-example corpora included),tests/,internal/andtools/: all 4,428 files of base have identical diagnostics on head. Head has eight more files: the two new fixturesk80andk81, and sixassign_body/assignment_bodyfixtures that came in with the merged fix(export): keep a declared element id on an unnamed assignment and in a branch body #2771 head and are not part of this change. - Past fixes re-checked: package-level redefinition (fix(check): a package-level feature cannot be redefined #1159), inaccessible subsetted feature on a standalone
specialization subset(fix(check): report an inaccessible subsetted feature on a standalone specialization subset member #1402) andTypeFeaturing::owningFeatureOfType(fix(semantic): resolve TypeFeaturing::owningFeatureOfType from the one TypeFeaturing endpoint case #1419) give the same CLI results on base and head. Amember featurewith a standalone featuring (fix(check): a feature declaredmemberis not featured by its owning type #2742) keeps its reference errors and gains the expectedsubsetting-featuring-types. Redefinition against derived featuring types (fix(semantics,check): check a redefinition against the derived featuring types #2306) and chain members (fix(check): report a chain expression member not featured within its argument #2308) were covered by their Go tests only. - Suites on head:
go test ./internal/semantic/... ./internal/check/...,./internal/frontend/lsp/...,./internal/frontend/grpc/...,./tests/grpc/...,./tests/resolve/...,./tests/export/...,TestStdlibConformance, the training, pilot and spec-example corpus gates (required, not skipped),pilot-reject -check(358 cases, 346 both reject, 12 only we reject),derived-census -check -recorded-pilot.
One failure, same on base and head
After the declaring file is deleted and recreated on disk, its open VS Code diagram view keeps showing "no such document" until the file is reopened. Diagnostics refresh correctly. Base behaves the same, so this is not from this PR and does not change the verdict.
| Base after recreating the file | Head after recreating the file |
|---|---|
Not run
- Full
make test,make lint,-race, and the runtime, codegen, translate and client shards locally. CI did not run on this head: the run was cancelled at start, so the red "Build and test" only aggregates cancelled jobs and nothing here is backed by CI. pilot-diffand the pilot validator on hand-written probes.
…ve featuringType GetElementProperties and the api-json element form answer Feature::featuringType from every TypeFeaturing of the feature (KerML 8.3.3.3.4), the standalone `featuring f by T;` declarations included, so they agree with Model.FeaturingTypes. The metamodel evaluator reads the declarations from the semantic model's own index. The api-json differential moves one row: Feature.featuringType in kerml-examples/Simple Tests/Features.kerml, absent-both to pilot-missing, since the pilot's export leaves a standalone declaration out of the derived property. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ten feature A standalone featuring declaration naming a feature of a document that is not written stopped the graph index, so every written feature lost its derived featuringType. Such a declaration now only marks that a feature outside the graph may be featured. Co-Authored-By: jason.han <hanhuijun@gmail.com>
One kerml-examples feature now answers the featuring type a standalone featuring declaration states (KerML 8.3.3.3.4); re-recorded with derived-census -update -recorded-pilot. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…g context The member-feature path of the accessibility check read the derived featuring types, which include standalone featuring declarations (KerML 8.3.3.3.4), so a reference or a connector end naming a member feature with such a declaration was rejected from an unrelated type. It now reads the types the feature and its chained features own, as the pilot does; the derived property is unchanged. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…en feature Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…nt by its id Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ment's Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…aturing declarations Co-Authored-By: jason.han <hanhuijun@gmail.com>
%eval answered `(Base::things meta KerML::Feature).featuringType` from the empty library runtime, so the session's `featuring Base::things by T;` and its `about` annotations of library elements were not read. A reflective expression is now evaluated against the session when it has declarations. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…turing-types Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential.md # docs/project/api-json-differential/index.json # internal/semantic/metamodel/derived_census_records.tsv
… references Co-Authored-By: jason.han <hanhuijun@gmail.com>
…element count Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ce and members with no kind as the pilot does A member's own body inside a body written as an argument reads its sibling members, a directed attribute bound to a feature keeps its warning, the attribute typing rule reads through a reference bound in between, and a body argument declares a feature with no kind keyword. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…pilot does A member of a body argument written with no kind keyword was read as the shorthand parameter when a type was followed by a default, an initial value, a specialization or a further type, and as the result when the name or its multiplicity was followed by ordered or nonunique. The pilot parses each as a feature of the body. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…member as the pilot does
`a : T;` opening a body argument is its shorthand parameter; after a parameter or another member the same text declares a feature, so `F({ a : T; b : T; a + b })` parses as the pilot parses it.
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…he converter's spelling Co-Authored-By: jason.han <hanhuijun@gmail.com>
… with the two spellings 0.13.0 accepted Co-Authored-By: jason.han <hanhuijun@gmail.com>
…3.0 bare-body graph
`in k {}` in a body argument came back as `in k;` from a graph without source text, while a
usage's empty body is kept. The parser now records the body and the graph states it.
The graph release 0.13.0 wrote for `assign x := F { in i; i };` and `attribute z = F { in i; i };`
is committed as a fixture and reads back as `F({ in i; i })`, with and without its source text.
Co-Authored-By: jason.han <hanhuijun@gmail.com>
A parameter of an assignment is bound when the assignment starts, as an action's is, so its default does not see a write an earlier step of the same body makes; a binding does. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…e action starts Co-Authored-By: jason.han <hanhuijun@gmail.com>
…turing-types Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
… every schedule agrees Co-Authored-By: jason.han <hanhuijun@gmail.com>
…dalone-featuring-types
…the attribute typing rule now requires `attribute scaler = holder.scale;` in the function fixture is refused by the rule this branch adds, as the pilot refuses it, so the six scenarios over that fixture stopped at a model that no longer analyses clean. `ref scaler = holder.scale;` reads the same function value. The changelog states the break. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…e client test models Co-Authored-By: jason.han <hanhuijun@gmail.com>
…dalone-featuring-types
…igures after merging develop Co-Authored-By: jason.han <hanhuijun@gmail.com>
…est models Co-Authored-By: jason.han <hanhuijun@gmail.com>
…lder of a member feature Co-Authored-By: jason.han <hanhuijun@gmail.com>
…e-record the moved baselines Co-Authored-By: jason.han <hanhuijun@gmail.com>
…d calculation output Also order a library feature's featuringType on GetElementProperties as the reflective read does, the declared types first and the owning type after. Co-Authored-By: jason.han <hanhuijun@gmail.com>
What and why
A featuring type can be stated on the feature (
feature g featured by T;) or by a declaration of its own (featuring g by T;,featuring tf of g by T;).Model.FeaturingTypesread only the first, soFeature::featuringTypewas missing the second and nothing that depends on it sawT.The semantic model now gathers the standalone
featuringdeclarations of each document and indexes their resolved ends by the featured feature, in a shared frame dropped when a contributing document changes.Model.FeaturingTypesadds those types to the inline ones.The reflective reads of
Feature::featuringTypeagree with it:GetElementProperties(the metamodel evaluator over the model's symbols) and theapi-jsonelement form read every TypeFeaturing of the feature. The evaluator takes the standalone declarations from the semantic model's own index (Model.StandaloneTypeFeaturings), and theapi-jsonwriter from the graph'sTypeFeaturingelements; the statedfeatured byclauses stay insysx:mappingValues.Effect on diagnostics, for a feature
gfeatured byTthrough a standalone declaration and used from a type that does not conform toT:feature v subsets g;subsetting-featuring-typesfeature v redefines g;redefinition-no-inheritedfeature v = g;(reference)connector c from g to h;Fixes #2790
Pilot divergence
The pinned pilot (0.63.1) accepts the standalone form in all four positions and rejects the inline form in all four.
Subsetting and redefinition: this PR diverges from the pilot, on purpose. KerML 8.3.3.3.4
deriveFeatureFeaturingTypederivesfeaturingTypefromtypeFeaturing.type, every TypeFeaturing of the feature and not onlyownedTypeFeaturing. KerML 8.3.3.3.10validateSubsettingFeaturingTypesis a normative constraint overfeaturingType, and a Redefinition is a Subsetting. So both are rejected here where the pilot is permissive. The two shapes are recorded in the rejection oracle assemantic/k80-subsets-feature-featured-by-standalone-featuring.kermlandsemantic/k81-redefines-feature-featured-by-standalone-featuring.kerml, bucketours-only-rejects(358 cases, 346 both reject, 12 only we reject).Reference and connector end: kept pilot-aligned. The accessibility of a feature reference is the pilot's
FeatureUtil.canAccessapplied to a reference, not a normative KerML constraint, and the pilot does not apply it to a standalone featuring.constraintChecker.featuringOwnersis unchanged from develop, so these two positions read the inline clause alone. The connector-end rule (8.3.4.5.3) is normative, so that position is a known inconsistency left for the reviewer to rule on.api-jsonfeaturingType: diverges from the pilot's export, on purpose. Forfeature g; featuring g by T;andfeature h; featuring tf of h by T;the pilot's export states theTypeFeaturingelement withfeatureOfTypeandfeaturingTypeset, and answersfeaturingType = []on the feature. Forfeature i featured by U; featuring i by T;it answers[U], and for a nestedA::mwithfeaturing A::m by T;it answers[A]. Under 8.3.3.3.4 the feature'sfeaturingTypeincludesTin each case, and that is what this PR writes. One row of the committed differential moves, re-recorded withpilot-apijson-diff -update:Feature.featuringTypeinkerml-examples/Simple Tests/Features.kerml(feature y; featuring F of y by C;), absent-both 13 → 12 and pilot-missing 0 → 1; overall absent-both 2642516 → 2642515 and pilot-missing 92358 → 92359. No element match moved.docs/project/api-json-differential.mdrecords the reason.Combined with the member-feature accessibility rule already on develop: pilot-aligned. A reference or connector end naming a feature a type holds as a
member, where a standalonefeaturingalso names that feature, is accepted as the pilot accepts it; a standalone control still reports only the onefeature-reference-featuring-typesdiagnostic the pilot reports.TestMemberFeatureWithStandaloneFeaturing*ininternal/check/passes/member_feature_standalone_featuring_test.gofail without the change.Read surfaces
api-jsonacross documents. The writer works from the written graph. A standalonefeaturing of n by Lib::T;in a written document writesLib::Tby id even whenLibis not written, as an inlinefeatured by Lib::Tdoes, and a feature with both forms writes both. A feature whose onlyfeaturingdeclaration sits in an unwritten document has nofeaturingType: the declaration is no part of the graph, the same rule as an annotation from an unwritten document. No RDF predicate was added. Afeaturingnaming a feature of an unwritten document no longer dropsfeaturingTypefrom the written features.docs/reference/rdf-mapping.mdstates the rule beside thefeaturingTyperow.featuringTypederivation that landed on develop meanwhile. The merge has no textual conflict. The standalone fallback is entered only forFeature::featuringTypewhen the derived read is unavailable, and adds only the types of standaloneTypeFeaturingelements present in the graph; develop's external-graph and interchange tests pass unchanged. On a model with the four standalone shapes the only difference from develop's export is the added standalone types (g: [T],h: [U],C::c: [U, C],k: [U, T]).feature h featured by Lib::T;) or standalone (featuring K::g by Lib::T;), is in an unwritten document,api-jsonwrote[Lib::T]without the owning classifier; it now writes[Lib::T, K]for both forms, as it does when the whole model is written. When the type does not resolve at all (the using file converted alone),featuringTypewas empty for both forms, where develop wrote[K]for the standalone one; both now write[K], and the unresolved type is left out as itsTypeFeaturingleaves it out. The corpus round-trip,pilot-apijson-diffandderived-censusbaselines did not move.GetElementPropertiesleaves out afeaturingdeclaration of a document the model is read without, for model and library features alike.GetElementPropertiesnow adds to a library feature'sfeaturingTypethe types the model's ownfeaturingdeclarations give it (featuring Base::things by T;reads[P::T], was[], whether the property is read by name or among every property), from the index the checker reads; no other library state is overlaid. A model'sapi-jsonwrites no element for the library feature, and writes theTypeFeaturingwith the library feature's id andP::T.%eval (Base::things meta KerML::Feature).featuringTypeanswered[]because an expression naming only library elements was evaluated against an empty library-only runtime. With declarations in the session, a reflective expression (x meta T,x.metadata) is evaluated against the session, so it reads[P::T];x.metadataof a library element likewise now includes the session'saboutannotations. With no declarations, or unrelated ones, the answers are unchanged and pinned.Two older answers fixed here
Both were on develop before this change and were found while qualifying it.
featuringTypeon every read. For a nested feature with afeatured by, the reflective read (%eval, metadata) listed the owning type first whileGetElementPropertiesandapi-jsonlisted the declared types first ([A, U]against[U, A]). Every read now answers the declared types first and the owning type after, the orderDerivedFeaturingTypesalready derived.TestReflectiveOwnershipAndFeaturingTypespinned the old order and fails without the fix;TestElementPropertiesFeaturingTypeReadsStandaloneFeaturingnow compares the two reads in order rather than sorted.member. KerML.xtextTypeFeatureMemberowns the feature through anOwningMembership, so it has noFeatureMembership, noowningType, and its holder is not one of its featuring types (KerML 8.3.3.3.4).api-jsonanswered that;GetElementProperties,%evaland the metadata reads classified the membership as aFeatureMembershipand added the holder. The membership is now classified once, inmembershipMetaclassNameand the evaluator'smembershipKind.TestElementPropertiesFeaturingTypeLeavesOutTheHolderOfAMemberFeature,TestEvalFeaturingTypeLeavesOutTheHolderOfAMemberFeaturefail without the fix;TestAPIJSONFeaturingTypeLeavesOutTheHolderOfAMemberFeaturepins the answer the other two now share.The recorded baselines moved toward agreement only, each re-recorded with its tool: the structure differential (pilot corpora
Feature::featuringType160 → 30 different,Feature::owningType84 → 5,Type::ownedFeature124 → 62;Connector::defaultFeaturingTypenow fully equal), the agreement ratchet (thirteen rows removed, five lowered, none raised) and the derived census (kerml-examplesandspec-examplesrows forFeatureMembership,owningType,featuringTypeand theTypefeature lists).The issue's first model stays accepted: the pilot accepts it and the reference-accessibility rule is not normative; see
docs/project/spec-compliance/02-detailed-semantic-compliance-map/30-kerml-rules-not-reported.md. Nothing remains on the issue after this merges.Why the pilot accepts the standalone form was not established from its source.
Specification basis
KerML 8.3.3.3.4
deriveFeatureFeaturingType; KerML 8.3.3.3.10validateSubsettingFeaturingTypes. Compliance rows edited:02-detailed-semantic-compliance-map/10-redefinition-in-a-specialization.mdand30-kerml-rules-not-reported.md. The clause numbers are taken from the repository's constraint manifest.How it was verified
Fail-first tests, each failing with its part of the change removed:
TestFeaturingTypesReadStandaloneFeaturingandTestW8CStandaloneFeaturing: three standalone forms across the four positions, with conforming and inline controls.TestElementPropertiesFeaturingTypeReadsStandaloneFeaturing(gRPC) andTestAPIJSONFeaturingTypeReadsStandaloneFeaturing(export): plain,tf of, declared-before-the-feature, inline plus standalone, and nested forms, each compared withModel.FeaturingTypes.TestAPIJSONFeaturingTypeAcrossAnUnwrittenDocumentandTestAPIJSONFeaturingTypeBesideAFeaturingOfAnUnwrittenFeature; the omission for a declaration in an unwritten document is pinned in the first.TestElementPropertiesLibraryFeatureReadsTheModelsFeaturing(gRPC) andTestEvalReflectsOnALibraryElementInTheSession(REPL, on the exact expression above).TestEvalReflectsOnALibraryElementAsTheLibraryStatespins the library-only answers and passes with and without the REPL change.TestAPIJSONFeaturingTypeOfANestedFeatureAcrossAnUnwrittenDocument,TestAPIJSONFeaturingTypeOfANestedFeatureWithAnUnresolvedType(export) andTestConvertDocumentsKeepsANestedFeaturesOwningType(Convertwith only the using document written): both forms.TestElementPropertiesFeaturingTypeLeavesOutAnExcludedDocument.Baselines, each regenerated with its tool:
pilot-apijson-diff: one row, described under Pilot divergence.derived-census -update -recorded-pilot: one row,Feature::featuringTypeinkerml-examples, 1754 → 1755 equal and 999 → 998 differing, the samefeature y; featuring F of y by C;.-checkpasses.pilot-reject: the two cases under Pilot divergence.Gates on the pushed head, which merges develop
1b4266551eand, ahead of it in the merge order, the head of #2771 (94b2354444); the diff against develop therefore shows #2771's changes until it lands.gofmt -l .,go build ./...,go vet ./..., the same fortools,doc-counts -check,scripts/changelog.py check,scripts/check-doc-ids.py.go test -count=1without-race, with the corpora present, overinternal/semantic,internal/check,internal/frontend/grpc,internal/frontend/repl,internal/translate/export,internal/workspace,internal/syntax,internal/exec/runtime,tests/parser,tests/hygiene,tests/resolve,tests/grpcandtests/export, plustests/corpus -run TestExamplesSweep: all pass.pilot-apijson-diff -checkpasses unchanged: 955 files, 120678 elements matched.derived-census -check -recorded-pilotpasses on the re-recorded rows.-race,make lint,make test, and the fullgo test ./....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👀 1 finding for you to triage · Follow Devin's work