File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/com/google/javascript/jscomp Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1818
1919import com .google .auto .value .AutoValue ;
2020import com .google .common .collect .ImmutableCollection ;
21+ import com .google .common .collect .ImmutableList ;
2122import javax .annotation .Nullable ;
2223
2324/**
@@ -57,6 +58,10 @@ public ImmutableCollection<Color> getAlternates() {
5758 @ Nullable
5859 public abstract Color getInstanceColor ();
5960
61+ // List of other colors directly above this in the subtyping graph for the purposes of property
62+ // (dis)ambiguation.
63+ public abstract ImmutableList <Color > getDisambiguationSupertypes ();
64+
6065 @ Override
6166 public abstract boolean isInvalidating ();
6267
@@ -69,6 +74,8 @@ public abstract static class Builder {
6974
7075 public abstract Builder setInvalidating (boolean value );
7176
77+ public abstract Builder setDisambiguationSupertypes (ImmutableList <Color > supertypes );
78+
7279 public abstract Builder setPrototype (Color prototype );
7380
7481 public abstract Builder setInstanceColor (Color instanceColor );
@@ -77,6 +84,8 @@ public abstract static class Builder {
7784 }
7885
7986 public static Builder builder () {
80- return new AutoValue_ObjectColor .Builder ().setInvalidating (false );
87+ return new AutoValue_ObjectColor .Builder ()
88+ .setInvalidating (false )
89+ .setDisambiguationSupertypes (ImmutableList .of ());
8190 }
8291}
Original file line number Diff line number Diff line change 2121import com .google .common .truth .FailureMetadata ;
2222import com .google .common .truth .Subject ;
2323import com .google .javascript .jscomp .colors .Color ;
24+ import com .google .javascript .jscomp .colors .ObjectColor ;
2425import javax .annotation .Nullable ;
2526
2627/** Subject for {@link Color} */
@@ -75,4 +76,12 @@ public void hasAlternates(Color... alternates) {
7576 // cast to Object[] to suppress warning about varargs vs. non-varargs call confusion
7677 .containsExactly ((Object []) alternates );
7778 }
79+
80+ public void hasDisambiguationSupertypes (Color ... alternates ) {
81+ isObject ();
82+ check ("getDirectSupertypes().containsExactly()" )
83+ .that (((ObjectColor ) actualNonNull ()).getDisambiguationSupertypes ())
84+ // cast to Object[] to suppress warning about varargs vs. non-varargs call confusion
85+ .containsExactly ((Object []) alternates );
86+ }
7887}
You can’t perform that action at this time.
0 commit comments