@descryy/adapter-csharp 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/extract.d.ts CHANGED
@@ -1,40 +1,25 @@
1
1
  /**
2
2
  * C# files to Canonical IR.
3
3
  *
4
- * ## Identity is the project plus the declared namespace
4
+ * Identity is project + declared namespace, not namespace alone: namespaces
5
+ * don't follow directories and can span projects, so two `.csproj` files may
6
+ * both declare `Shop.Orders.OrderService` (DEC-077's collision — the project
7
+ * is C#'s equivalent of Java's source set).
5
8
  *
6
- * Not the namespace alone. C# namespaces do not follow directories and the same
7
- * namespace legitimately spans projects, so two `.csproj` files in one
8
- * repository may both declare `Shop.Orders.OrderService`. That is DEC-077's
9
- * collision — the Java case where one fully-qualified name existed under two
10
- * source sets and stopped identifying anything — and the project is C#'s
11
- * equivalent separator.
9
+ * DEC-083: `partial class` is the first multi-file declaration here. Parts
10
+ * merge into one node (ids never carry a file path) — `file` is the
11
+ * lexicographically first declaring path, every part listed in `attrs.declaredIn`.
12
12
  *
13
- * ## Two decisions land here, both taken before this file was written
13
+ * DEC-084: `class A : B, IC` doesn't say which entry is the base class, but
14
+ * the language does — at most one, and it's first. So later entries are
15
+ * `IMPLEMENTS` unconditionally, and only the first entry per class ever needs
16
+ * resolving. The `IFoo` naming convention is never read (`System.Exception`
17
+ * disproves it; golden pattern 12 punishes inferring edges from naming habits).
14
18
  *
15
- * **DEC-083, a declaration that spans files.** `partial class` is the first
16
- * construct in this project whose declaration is legitimately multi-file. The
17
- * merge is free — a node id never contains a file path — so the parts collapse
18
- * to one node with no new machinery. `file` is the lexicographically first
19
- * declaring path and every part is listed in `attrs.declaredIn`, which is what
20
- * a precision adjudicator has to search instead of `file`.
21
- *
22
- * **DEC-084, the base list.** `class A : B, IC` does not say which entry is the
23
- * class, but the language does: at most one base class, and it must be first.
24
- * So entries after the first are `IMPLEMENTS` unconditionally, a struct's and an
25
- * interface's entries are all `IMPLEMENTS`, and exactly one entry per class ever
26
- * needs resolving. The `IFoo` prefix is never read — it is a convention,
27
- * `System.Exception` disproves it in the other direction, and inferring an edge
28
- * from a naming habit is what golden pattern 12 exists to punish.
29
- *
30
- * ## Ambiguity is disclosed, never broken
31
- *
32
- * A `using` imports a whole namespace, so a bare name can be found under two of
33
- * them at once. Real C# resolves that with the full type environment; this
34
- * adapter has names only, so two candidates produce a ledger entry and no edge.
35
- * Extension methods are the same answer for the same reason: `x.Foo()` where
36
- * `Foo` is a static method on an unrelated class, selected by the receiver's
37
- * type, is not decidable from names.
19
+ * Ambiguity is disclosed, not guessed: a `using` imports a whole namespace, so
20
+ * a bare name can match two of them — real C# resolves via the full type
21
+ * environment, this adapter has names only, so two candidates ledger and mint
22
+ * no edge. Extension methods are the same call for the same reason.
38
23
  */
39
24
  import { type IdentityScope, type IREdge, type IRNode, type ResolutionLevel, type UnresolvedRef } from "@descryy/ir";
40
25
  import type { CsFile } from "./parse.ts";
@@ -49,28 +34,20 @@ export interface ExtractInput {
49
34
  /**
50
35
  * Repo-relative path -> source text, for the framework extractors.
51
36
  *
52
- * The Fluent API and minimal-API registrations are call chains rather than
53
- * declarations, and reading them faithfully from the tree would mean modelling
54
- * the whole builder. `efcore.ts` and `aspnetcore.ts` read them textually and
55
- * refuse everything they cannot evaluate, which is a smaller claim honestly
56
- * made — see their file comments. They need the text to do it.
57
- *
58
- * Empty when the caller has none: both extractors then see no files, emit
59
- * nothing, and the language half is unaffected.
37
+ * Fluent API and minimal-API registrations are call chains, not
38
+ * declarations — `efcore.ts`/`aspnetcore.ts` read them textually and refuse
39
+ * what they can't evaluate. Empty when the caller has none: both extractors
40
+ * then emit nothing, and the language half is unaffected.
60
41
  */
61
42
  readonly sources?: ReadonlyMap<string, string>;
62
43
  /**
63
- * The NRT context governing a file, resolved by the caller.
64
- *
65
- * Supplied by the adapter, which is the only layer holding the `.csproj` and
66
- * the `Directory.Build.props` — DEC-180 §1's second and third sources. Without
67
- * it this falls back to `#nullable` directives alone, which answers `absent`
68
- * for a repository whose declaration is in its project files, and every
69
- * reference-typed column comes out `unresolved`.
70
- *
71
- * That fallback is honest degradation rather than a guess, and it is the wrong
72
- * answer for a fixture: the conformance corpus declares `<Nullable>enable</Nullable>`
73
- * in `Shop.csproj` and golden 06's `discount_code` is a nullable `string?`.
44
+ * The NRT context governing a file, resolved by the caller (the adapter,
45
+ * which alone holds `.csproj`/`Directory.Build.props` — DEC-180 §1's 2nd
46
+ * and 3rd sources). Without it, falls back to `#nullable` directives alone,
47
+ * answering `absent` where the declaration is in project files — honest
48
+ * degradation, but the wrong answer for the fixture corpus
49
+ * (`Shop.csproj` declares `<Nullable>enable</Nullable>`, golden 06's
50
+ * `discount_code` is `string?`).
74
51
  */
75
52
  readonly nullableContextOf?: (file: string) => NullableContext;
76
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../src/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAOL,KAAK,aAAa,EAClB,KAAK,MAAM,EACX,KAAK,MAAM,EACX,KAAK,eAAe,EACpB,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,MAAM,EAAwD,MAAM,YAAY,CAAC;AAG/F,OAAO,EAAuC,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAI7F,eAAO,MAAM,QAAQ,WAAW,CAAC;AAgDjC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,OAAO,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