Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion checker/internal/type_checker_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ absl::StatusOr<AstType> FlattenType(const Type& type) {
return AstType(ast_internal::PrimitiveType::kBool);
case TypeKind::kInt:
return AstType(ast_internal::PrimitiveType::kInt64);
case TypeKind::kEnum:
return AstType(ast_internal::PrimitiveType::kInt64);
case TypeKind::kUint:
return AstType(ast_internal::PrimitiveType::kUint64);
case TypeKind::kDouble:
Expand Down Expand Up @@ -231,7 +233,8 @@ absl::StatusOr<AstType> FlattenType(const Type& type) {
return AstType(ast_internal::WellKnownType::kAny);
default:
return absl::InternalError(
absl::StrCat("Unsupported type: ", type.DebugString()));
absl::StrCat("unsupported type encountered making AST serializable: ",
type.DebugString()));
}
}

Expand Down
4 changes: 4 additions & 0 deletions checker/internal/type_inference_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,10 @@ bool TypeInferenceContext::IsAssignableInternal(
return true;
}

if (from_subs.kind() == TypeKind::kEnum && to_subs.kind() == TypeKind::kInt) {
return true;
}

if (IsWildCardType(from_subs) || IsWildCardType(to_subs)) {
return true;
}
Expand Down