Steps 272-277: Phase 10c — type system, concurrency & scope annotations (68/68 tests)
- Step 272: Type layout/constraints — BitWidth, Endian, Layout, Nullability, Variance (37 tests) - Step 273: Type identity/mutability — Identity, Mut, TypeState (25 tests) - Step 274: Concurrency primitives — Atomic, Sync, ThreadModel, MemoryBarrier (25 tests) - Step 275: Async/error handling — Exec, Blocking, Parallel, Trap, Exception, Panic (36 tests) - Step 276: Scope/namespace — Binding, Lookup, Capture, Visibility, Namespace, Scope (32 tests) - Step 277: Integration tests — cross-subject workflows, sidecar roundtrip, RPC (16 tests) - 24 new annotation classes with JSON roundtrip, compact AST, sidecar persistence - Generic fallback in getSemanticAnnotations RPC for extensible annotation queries Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -182,3 +182,159 @@ public:
|
||||
std::vector<std::string> tags; // e.g. ["@serialize", "@validation"]
|
||||
SemanticTagAnnotation() { conceptType = "SemanticTagAnnotation"; }
|
||||
};
|
||||
|
||||
// Type System Annotations — Layout & Constraints (Step 272, Subject 2)
|
||||
|
||||
class BitWidthAnnotation : public Annotation {
|
||||
public:
|
||||
int width = 0; // e.g. 32 for Java int
|
||||
BitWidthAnnotation() { conceptType = "BitWidthAnnotation"; }
|
||||
};
|
||||
|
||||
class EndianAnnotation : public Annotation {
|
||||
public:
|
||||
std::string order; // "big" | "little"
|
||||
EndianAnnotation() { conceptType = "EndianAnnotation"; }
|
||||
};
|
||||
|
||||
class LayoutAnnotation : public Annotation {
|
||||
public:
|
||||
std::string mode; // "packed" | "aligned"
|
||||
int alignment = 0;
|
||||
LayoutAnnotation() { conceptType = "LayoutAnnotation"; }
|
||||
};
|
||||
|
||||
class NullabilityAnnotation : public Annotation {
|
||||
public:
|
||||
bool nullable = false;
|
||||
std::string strategy; // "strict" | "nullable"
|
||||
NullabilityAnnotation() { conceptType = "NullabilityAnnotation"; }
|
||||
};
|
||||
|
||||
class VarianceAnnotation : public Annotation {
|
||||
public:
|
||||
std::string variance; // "covariant" | "contravariant" | "invariant"
|
||||
VarianceAnnotation() { conceptType = "VarianceAnnotation"; }
|
||||
};
|
||||
|
||||
// Type System Annotations — Identity & Mutability (Step 273, Subject 2)
|
||||
|
||||
class IdentityAnnotation : public Annotation {
|
||||
public:
|
||||
std::string mode; // "nominal" | "structural"
|
||||
IdentityAnnotation() { conceptType = "IdentityAnnotation"; }
|
||||
};
|
||||
|
||||
class MutAnnotation : public Annotation {
|
||||
public:
|
||||
std::string depth; // "shallow" | "deep" | "interior"
|
||||
MutAnnotation() { conceptType = "MutAnnotation"; }
|
||||
};
|
||||
|
||||
class TypeStateAnnotation : public Annotation {
|
||||
public:
|
||||
std::string state; // "erased" | "reified"
|
||||
TypeStateAnnotation() { conceptType = "TypeStateAnnotation"; }
|
||||
};
|
||||
|
||||
// Concurrency Annotations — Primitives & Memory Model (Step 274, Subject 3)
|
||||
|
||||
class AtomicAnnotation : public Annotation {
|
||||
public:
|
||||
std::string consistency; // "seq_cst" | "relaxed" | "acquire" | "release"
|
||||
AtomicAnnotation() { conceptType = "AtomicAnnotation"; }
|
||||
};
|
||||
|
||||
class SyncAnnotation : public Annotation {
|
||||
public:
|
||||
std::string primitive; // "monitor" | "spin" | "semaphore"
|
||||
SyncAnnotation() { conceptType = "SyncAnnotation"; }
|
||||
};
|
||||
|
||||
class ThreadModelAnnotation : public Annotation {
|
||||
public:
|
||||
std::string model; // "green" | "os" | "fiber"
|
||||
ThreadModelAnnotation() { conceptType = "ThreadModelAnnotation"; }
|
||||
};
|
||||
|
||||
class MemoryBarrierAnnotation : public Annotation {
|
||||
public:
|
||||
MemoryBarrierAnnotation() { conceptType = "MemoryBarrierAnnotation"; }
|
||||
};
|
||||
|
||||
// Async, Parallelism & Error Handling Annotations (Step 275, Subject 3)
|
||||
|
||||
class ExecAnnotation : public Annotation {
|
||||
public:
|
||||
std::string mode; // "async" | "event"
|
||||
std::string runtimeHint; // e.g. "tokio", "libuv"
|
||||
ExecAnnotation() { conceptType = "ExecAnnotation"; }
|
||||
};
|
||||
|
||||
class BlockingAnnotation : public Annotation {
|
||||
public:
|
||||
std::string kind; // "io" | "compute"
|
||||
BlockingAnnotation() { conceptType = "BlockingAnnotation"; }
|
||||
};
|
||||
|
||||
class ParallelAnnotation : public Annotation {
|
||||
public:
|
||||
std::string kind; // "data" | "task"
|
||||
ParallelAnnotation() { conceptType = "ParallelAnnotation"; }
|
||||
};
|
||||
|
||||
class TrapAnnotation : public Annotation {
|
||||
public:
|
||||
std::string signal; // e.g. "SIGSEGV", "SIGFPE"
|
||||
TrapAnnotation() { conceptType = "TrapAnnotation"; }
|
||||
};
|
||||
|
||||
class ExceptionAnnotation : public Annotation {
|
||||
public:
|
||||
std::string style; // "checked" | "unchecked"
|
||||
ExceptionAnnotation() { conceptType = "ExceptionAnnotation"; }
|
||||
};
|
||||
|
||||
class PanicAnnotation : public Annotation {
|
||||
public:
|
||||
std::string behavior; // "abort" | "unwind"
|
||||
PanicAnnotation() { conceptType = "PanicAnnotation"; }
|
||||
};
|
||||
|
||||
// Scope & Namespace Annotations (Step 276, Subject 4)
|
||||
|
||||
class BindingAnnotation : public Annotation {
|
||||
public:
|
||||
std::string time; // "static" | "dynamic"
|
||||
BindingAnnotation() { conceptType = "BindingAnnotation"; }
|
||||
};
|
||||
|
||||
class LookupAnnotation : public Annotation {
|
||||
public:
|
||||
std::string mode; // "lexical" | "hoisted"
|
||||
LookupAnnotation() { conceptType = "LookupAnnotation"; }
|
||||
};
|
||||
|
||||
class CaptureAnnotation : public Annotation {
|
||||
public:
|
||||
std::string strategy; // "value" | "ref" | "move"
|
||||
CaptureAnnotation() { conceptType = "CaptureAnnotation"; }
|
||||
};
|
||||
|
||||
class VisibilityAnnotation : public Annotation {
|
||||
public:
|
||||
std::string level; // "private" | "internal" | "friend" | "public"
|
||||
VisibilityAnnotation() { conceptType = "VisibilityAnnotation"; }
|
||||
};
|
||||
|
||||
class NamespaceAnnotation : public Annotation {
|
||||
public:
|
||||
std::string style; // "qualified" | "flat"
|
||||
NamespaceAnnotation() { conceptType = "NamespaceAnnotation"; }
|
||||
};
|
||||
|
||||
class ScopeAnnotation : public Annotation {
|
||||
public:
|
||||
std::string kind; // "local" | "global_leaked" | "singleton"
|
||||
ScopeAnnotation() { conceptType = "ScopeAnnotation"; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user