From 0c961c3289cc8cba51490b528a7d5881ebddd14e Mon Sep 17 00:00:00 2001 From: Javier Sagredo Date: Thu, 7 May 2026 00:11:33 +0200 Subject: [PATCH] Don't draw the superclass class node when an instance matches locally MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Previously every "superclass needed" arrow pulled in both the matched instance node *and* a class node for the superclass — joined to the matched instance by an extra "defines" edge. The class node duplicated information already on the matched-instance label, just adding clutter. Restrict the class-node side to the no-local-match branch, which still needs somewhere for its needs-external edge to terminate. Co-Authored-By: Claude Opus 4.7 (1M context) --- data/viewer.js | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/data/viewer.js b/data/viewer.js index 85fd532..2ea384e 100644 --- a/data/viewer.js +++ b/data/viewer.js @@ -781,13 +781,14 @@ // Direct-match path uses the reduced args as before. const reqArgs = subbedArgs.map(reduceTypeArg); const matched = findMatchingInstances(sc.seSuperclass, reqArgs); - const scClsId = ensureClassNode(sc.seSuperclass); const reqLabel = 'superclass needed ' + sc.seSuperclass.qnName + ' ' + renderArgsCompact(reqArgs, inst.iiTyVars); if (matched.length === 0) { - // No instance found in our data; link to the class node and mark - // it as external/unresolved. + // No instance found in our data; link to the superclass class + // node (which we have to draw in this branch) and mark it + // external/unresolved. + const scClsId = ensureClassNode(sc.seSuperclass); els.push({ group: 'edges', data: { id: instId + '#sc#' + si + '#none', source: instId, @@ -796,20 +797,16 @@ label: reqLabel + ' (no local match)', }}); } else { + // Local match(es) exist. Connect the focused instance directly + // to each matched instance — we deliberately *don't* also pull + // the superclass class node into the graph, because the same + // information ("instance of class Foo") is already implied by + // the matched instance's own label and is plainly noisy. for (const m of matched) { const mId = ensureInstanceNode( m, sc.seSuperclass, 'inst:' + m._idx ); - // Also draw the matched instance under its class. - ensureClassNode(sc.seSuperclass); - const linkId = scClsId + '=>' + mId; - if (!seenNodes.has(linkId)) { - seenNodes.add(linkId); - els.push({ group: 'edges', data: { - id: linkId, source: scClsId, target: mId, kind: 'defines', - }}); - } els.push({ group: 'edges', data: { id: instId + '#sc#' + si + '#' + m._idx, source: instId, -- 2.54.0