feat(studio): improve compiler reliability and AI diagnostics
Preserve structured diagnostics, source attribution, phase outcomes and revision context through compiler, Studio, LSP, MCP and JavaFX. Add project service discovery and resilient VS Code reconnection. Correct all eight reproduced PBS production failures in expression context, sibling executable bindings and nominal owner identity. Consolidate specs, lessons, immutable baseline evidence and the maintained source-to-guest qualification runner. Validation: required Gradle gate recorded 724 tests, with 711 passed and 13 skipped. Full corpus passed 168 compilation observations and 108 guest runs (104 successes and four deliberate faults); supplemental controls passed 42 compilations and 16 guest runs. TypeScript compilation, two Node discovery tests and discussion validation passed.
This commit is contained in:
@@ -347,3 +347,24 @@ fuel exhaustion across slices and direct/transitive FRAME_SYNC are required;
|
||||
sync fixtures use synthetic common IR because PBS exposes no sync construct.
|
||||
Record revisions, platform/configuration, commands, scenarios, oracles and
|
||||
results. Existing runtime tests alone are not producer integration evidence.
|
||||
|
||||
## Deterministic explanations and observed semantic context
|
||||
|
||||
PBS diagnostics retain their original code/message/template and add a detector-specific checkId, owner explanation and immutable semanticContext. This instrumentation MUST NOT change resolution, visibility, typing, lowering acceptance or source language rules. An observed resolution constraint is evidence about the implementation's lookup, not a declaration that the language requires that constraint.
|
||||
|
||||
| Check | Observed context |
|
||||
| --- | --- |
|
||||
| pbs.lowering.call-resolution | Requested call, receiver/type, argument count, declared candidates, enclosing return type and actual expected-type constraint. |
|
||||
| pbs.lowering.structured-overload | Structured call, actual owner lookup key, parameter/return lookup types and observed lookup result. |
|
||||
| pbs.flow.call-target | Applied symbol/construction, callable classification, argument/constraint, candidates and scope. |
|
||||
| pbs.flow.assignment-target | Assignment symbol/construction, binding classification and scope. |
|
||||
| pbs.lowering.stack-shape | Executable function, declared result slots, instruction count and recorded stack-check condition; known internal failure remains distinct from unsupported source construction. |
|
||||
|
||||
Each semantic fact has {value,availability,reason}. Known null differs from not-recorded/unavailable/not-applicable. Keep declaredTypes, expressionTypes and resolutionConstraints distinct. Unknown module/dependency/expression information is marked not-recorded; source identity is available separately in the origin/input map. Related declarations/candidates are included only when actually recorded. Generic-instantiation diagnostic reconstruction MUST preserve the complete context and reported phase.
|
||||
|
||||
The unchanged frozen cases F1-direct/F1-two-calls/F1-service-this, F3-function/F3-global/F3-service and F4-same-dependency/F4-same-direct qualify these mechanisms through real LSP analysis and Studio build/MCP. F3-service demonstrates that the shared unsupported-lowering code can represent distinct structured-overload and stack-shape checks. The original rejected observations are retained in the Studio diagnostic lesson. Following the production corrections, those eight valid sources MUST compile without their former false rejection; invalid file-private access remains a source rejection. Existing detector IDs, source attribution and operation-failure semantics remain unchanged.
|
||||
|
||||
|
||||
## Production correction regressions
|
||||
|
||||
The compiler must no longer emit the received false call-resolution, peer-binding or nominal-owner rejections for the eight valid production cases. Negative visibility controls still return structured source errors, independently from loader/infrastructure/guest failures. Diagnostics remain producer-owned; a compiler correctness fix does not weaken source attribution or reinterpret callable completion as approval. PbsFacadeDiagnosticTest uses the unchanged F3-file-private negative fixture, and StructuredDiagnosticsIntegrationTest now verifies the corrected positive corpus plus that negative control. The earlier rejection evidence remains immutable.
|
||||
|
||||
@@ -298,3 +298,13 @@ Its requirements apply in addition to this chapter; pause/resume remain independ
|
||||
Emit an existing typed return group: Int32 status 0 for success or canonical nominal error case index 1..N, followed by the complete plain payload group. Unit result has only status. Error payloads use admitted typed defaults, including nullable references, without constructing payload objects. Preserve typed reference/builtin/Fn/trait groups across signatures, Registry, direct/contract calls, branches and discard. Propagation fills the enclosing inactive payload and returns immediately; handle recovers locally or remaps outward. The common backend consumes neutral typed IR with no PBS branches.
|
||||
|
||||
See [Core Sprite and Animation](27.%20Core%20Sprite%20and%20Animation%20Specification.md) for the complete API, ranges, state table and conformance obligations.
|
||||
|
||||
## Production binding preservation
|
||||
|
||||
Comparison lowering MUST scope expected types to the operands rather than leaking the enclosing bool result expectation into nested calls. Type inference does not execute an operand; emission evaluates each receiver and explicit argument once in the existing order. Legitimate contextual overload selection remains available at the owning expression boundary.
|
||||
|
||||
The module assembly supplies admitted sibling declaration/signature identities. Lowering references ordinary sibling functions and service methods/accessors in their defining module. Global accesses resolve to the defining file's single storage slot; they MUST NOT allocate or initialize another global in each caller. Services retain one canonical singleton/accessor at their definition. Internal symbolic global bindings MUST be fully resolved within PBS before publishing common IR; the common instruction contract, ABI and backend remain unchanged.
|
||||
|
||||
Runtime owner lookup and imported callable selection MUST preserve canonical declaration origin, rather than flattening private types into a name-only owner map. Synthesized receiver parameter types retain the defining source scope. Callable shape matching is qualified by the known owner declaration so distinct private owners with identical method spelling cannot replace or ambiguate one another. Aliases remain source-facing names for their original declaration.
|
||||
|
||||
Conformance includes F1-direct/two-calls/service-this, F3-function/global/service and F4-same-dependency/direct with their original files/names/imports. All original F1/F2/F3/F4/F5 controls, file-private rejection and deliberate guest fault remain mandatory. An investigation-only unoptimized probe omits OptimizeIRVMPipelineStage and emits original IRVM; this is not a public compiler optimization option. See [Static Semantics](4.%20Static%20Semantics%20Specification.md) and [Diagnostics](12.%20Diagnostics%20Specification.md).
|
||||
|
||||
@@ -873,3 +873,13 @@ Its requirements apply in addition to this chapter; pause/resume remain independ
|
||||
Factory-only admission uses trusted canonical declaration origin, never visible spelling or slot count. Reject external positional/named construction and forged metadata; omit prohibited constructors from completion/signature help and expose public factories. Result error identity is nominal through imports and aliases; a result-effect function cannot be converted to plain Fn.
|
||||
|
||||
See [Core Sprite and Animation](27.%20Core%20Sprite%20and%20Animation%20Specification.md) for the complete API, ranges, state table and conformance obligations.
|
||||
|
||||
## Production expression and module conformance
|
||||
|
||||
Expected result types constrain the expression node that owns the expectation. A returned bool comparison MUST NOT force an int-returning operand call to return bool. Operand inference/resolution MUST retain its own type and use the opposite operand's known type when contextual disambiguation is required. This does not remove legitimate expected-return overload selection. Receiver/argument evaluation count and order remain those of [Dynamic Semantics](9.%20Dynamic%20Semantics%20Specification.md).
|
||||
|
||||
Sibling-file callable/global/service surfaces MUST use declaration/signature-level admission from mod.barrel. Both mod and pub entries admit same-module access; omission leaves the declaration file-private. Publishing one overload MUST NOT publish every overload sharing its name. Caller-visible names and definition-scoped private dependencies are different surfaces. The existing [syntax visibility contract](3.%20Core%20Syntax%20Specification.md) and [resolution contract](5.%20Manifest%2C%20Stdlib%2C%20and%20SDK%20Resolution%20Specification.md) remain authoritative.
|
||||
|
||||
Nominal receiver/method binding MUST retain the originating declaration and lexical scope, including aliases and synthesized receiver types. A private homonym introduced through a dependency cannot replace a local declaration or create an ambiguous executable target merely by sharing spelling. Transient IDs and PBX byte equality across builds are not nominal-identity requirements.
|
||||
|
||||
Conformance: PbsProductionLoweringRegressionTest and PbsNominalOwnerRegressionTest cover the frozen 28-case corpus, contextual overloads, privacy by signature, shared storage/singletons and order-sensitive effects. The maintained source-to-guest matrix is tools/pbs-production-corpus/run.py.
|
||||
|
||||
Reference in New Issue
Block a user