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 18
18
19
19
import com .google .auto .value .AutoValue ;
20
20
import com .google .common .collect .ImmutableCollection ;
21
+ import com .google .common .collect .ImmutableList ;
21
22
import javax .annotation .Nullable ;
22
23
23
24
/**
@@ -57,6 +58,10 @@ public ImmutableCollection<Color> getAlternates() {
57
58
@ Nullable
58
59
public abstract Color getInstanceColor ();
59
60
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
+
60
65
@ Override
61
66
public abstract boolean isInvalidating ();
62
67
@@ -69,6 +74,8 @@ public abstract static class Builder {
69
74
70
75
public abstract Builder setInvalidating (boolean value );
71
76
77
+ public abstract Builder setDisambiguationSupertypes (ImmutableList <Color > supertypes );
78
+
72
79
public abstract Builder setPrototype (Color prototype );
73
80
74
81
public abstract Builder setInstanceColor (Color instanceColor );
@@ -77,6 +84,8 @@ public abstract static class Builder {
77
84
}
78
85
79
86
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 ());
81
90
}
82
91
}
Original file line number Diff line number Diff line change 21
21
import com .google .common .truth .FailureMetadata ;
22
22
import com .google .common .truth .Subject ;
23
23
import com .google .javascript .jscomp .colors .Color ;
24
+ import com .google .javascript .jscomp .colors .ObjectColor ;
24
25
import javax .annotation .Nullable ;
25
26
26
27
/** Subject for {@link Color} */
@@ -75,4 +76,12 @@ public void hasAlternates(Color... alternates) {
75
76
// cast to Object[] to suppress warning about varargs vs. non-varargs call confusion
76
77
.containsExactly ((Object []) alternates );
77
78
}
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
+ }
78
87
}
You can’t perform that action at this time.
0 commit comments