Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve reporting of values with cycles #217

Merged
merged 1 commit into from
Jun 18, 2020
Merged

Improve reporting of values with cycles #217

merged 1 commit into from
Jun 18, 2020

Commits on Jun 18, 2020

  1. Improve reporting of values with cycles

    Previously, the reporter could handle formatting values with cycles
    in that it did not crash with a stack overflow. However, the output
    was not particularly understandable as it did not surface to the user
    why a particular value was truncated, and if it was truncated due
    to a cyclic reference, what was the referent.
    
    This change annotates the reporter tree with pointer information
    so that a later pass can inject reference information if it is needed
    to produce more understandable output.
    
    Consider the following example:
      map[string]*cmp_test.CycleAlpha{
      	"Foo": &⟪ref#0⟫{
      		Name: "Foo",
      		Bravos: map[string]*cmp_test.CycleBravo{
      			"FooBravo": &{
    - 				ID:     101,
    + 				ID:     0,
      				Name:   "FooBravo",
      				Mods:   100,
      				Alphas: {"Foo": &⟪ref#0⟫(...)},
      			},
      		},
      	},
      }
    
    This graph contains a cycle. To ensure that a graph can be formatted,
    the cycle is truncated as indicated with: &⟪ref#0⟫(...).
    The referent was identified earlier with: &⟪ref#0⟫{...}.
    dsnet committed Jun 18, 2020
    Configuration menu
    Copy the full SHA
    ae31fba View commit details
    Browse the repository at this point in the history