Skip to content

Commit e507d71

Browse files
Dustyn Loydacopybara-github
Dustyn Loyda
authored andcommitted
Remove exclusion for object typedefs in conformance rules
PiperOrigin-RevId: 698063949
1 parent daec7d8 commit e507d71

File tree

1 file changed

+1
-17
lines changed

1 file changed

+1
-17
lines changed

src/com/google/javascript/jscomp/ConformanceRules.java

+1-17
Original file line numberDiff line numberDiff line change
@@ -820,9 +820,7 @@ private ConformanceResult matchTypes(JSType foundType, JSType checkType) {
820820
}
821821
} else if (foundType.isSubtypeOf(checkType)) {
822822
return ConformanceResult.VIOLATION;
823-
} else if (checkType.isSubtypeWithoutStructuralTyping(foundType)
824-
// TODO(b/350086590): remove this exclusion once the subtyping relation above is fixed.
825-
&& !isObjectTypedef(foundType)) {
823+
} else if (checkType.isSubtypeWithoutStructuralTyping(foundType)) {
826824
if (matchesPrototype(checkType, foundType)) {
827825
return ConformanceResult.VIOLATION;
828826
} else if (reportLooseTypeViolations) {
@@ -2876,18 +2874,4 @@ private static boolean isStaticMethod(Node n) {
28762874
private static boolean isLooseObject(JSType type, JSTypeRegistry registry) {
28772875
return type.equals(registry.getNativeType(JSTypeNative.OBJECT_TYPE));
28782876
}
2879-
2880-
/**
2881-
* Returns true if the given type is a typedef of a record.
2882-
*
2883-
* <p>Example: @typedef {{foo: string}}
2884-
*
2885-
* <p>This can behave differently from ordinary records as the resulting type will not have a
2886-
* constructor.
2887-
*/
2888-
private static boolean isObjectTypedef(JSType type) {
2889-
// The JSCompiler models object literals as 'anonymous records'.
2890-
ObjectType objType = type.toMaybeObjectType();
2891-
return objType != null && objType.getConstructor() == null && type.isRecordType();
2892-
}
28932877
}

0 commit comments

Comments
 (0)