Skip to content

Commit

Permalink
Fix labels for list-types in $SetReplaceTypeGraph (#625)
Browse files Browse the repository at this point in the history
## Changes

* Labels for types that are lists (e.g., `{MultisetSubstitutionSystem, 0}`) don't currently show correctly due to `Graph` interpreting `MultisetSubstitutionSystem` and `0` as separate labels and plotting them on top of each other.
* This PR fixes that by converting labels to strings.

## Examples

* Declare a type:

```wl
SetReplace`PackageScope`declareTypeTranslation[Identity, {String, 0}, {Integer, 0}];
Unprotect[$SetReplaceTypes];
Unprotect[$SetReplaceProperties];
Unprotect[$SetReplaceTypeGraph];
SetReplace`PackageScope`initializeTypeSystem[];
```

* Show a type graph which is now rendered correctly:

```wl
In[] := $SetReplaceTypeGraph
```

<img width="478" alt="image" src="https://user-images.githubusercontent.com/1479325/111526067-47551080-872c-11eb-86db-235d9d17f16d.png">
  • Loading branch information
maxitg authored Mar 17, 2021
1 parent 5707163 commit daaa3c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Kernel/A1$typeSystem.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@

typeGraphVertexLabel[kind_, name_] :=
If[!freeFromInternalSymbolsQ[name] || kind === SetReplaceMethodImplementation, Placed[#, Tooltip] &, Identity] @
If[kind === SetReplaceProperty, ToString[#] <> "[\[Ellipsis]]" &, Identity] @
If[kind === SetReplaceProperty, ToString[#] <> "[\[Ellipsis]]" &, ToString] @
name;

insertImplementationVertex[inputEdge : DirectedEdge[from_, to_]] := ModuleScope[
Expand Down

0 comments on commit daaa3c7

Please sign in to comment.