EnableIfHpbClass was too restrictive in the past; it was toggled only if <T> was extended. This has been rectified to toggle if T extends T::Access, which reflects the true intention. PiperOrigin-RevId: 693368653pull/19123/head
parent
5129d4d24b
commit
471d66961a
4 changed files with 74 additions and 32 deletions
@ -1,17 +0,0 @@ |
||||
#region Copyright notice and license |
||||
// Protocol Buffers - Google's data interchange format |
||||
// Copyright 2008 Google Inc. All rights reserved. |
||||
// |
||||
// Use of this source code is governed by a BSD-style |
||||
// license that can be found in the LICENSE file or at |
||||
// https://developers.google.com/open-source/licenses/bsd |
||||
#endregion |
||||
|
||||
namespace Google.Protobuf.Reflection; |
||||
|
||||
internal sealed partial class FeatureSetDescriptor |
||||
{ |
||||
// Canonical serialized form of the edition defaults, generated by embed_edition_defaults. |
||||
private const string DefaultsBase64 = |
||||
"ChMYhAciACoMCAEQAhgCIAMoATACChMY5wciACoMCAIQARgBIAIoATABChMY6AciDAgBEAEYASACKAEwASoAIOYHKOgH"; |
||||
} |
@ -0,0 +1,40 @@ |
||||
// Protocol Buffers - Google's data interchange format
|
||||
// Copyright 2024 Google LLC. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file or at
|
||||
// https://developers.google.com/open-source/licenses/bsd
|
||||
|
||||
#include "google/protobuf/hpb/internal/template_help.h" |
||||
|
||||
#include <gtest/gtest.h> |
||||
#include "google/protobuf/compiler/hpb/tests/test_model.upb.proto.h" |
||||
|
||||
namespace hpb_unittest::protos { |
||||
|
||||
class NonHpbClass {}; |
||||
|
||||
TEST(TemplateHelp, TestIsHpbClass) { |
||||
static_assert(hpb::internal::IsHpbClass<TestModel>, |
||||
"TestModel must be an hpb class"); |
||||
static_assert(hpb::internal::IsHpbClass<ThemeExtension>, |
||||
"ThemeExtension must be an hpb class"); |
||||
static_assert(!hpb::internal::IsHpbClass<NonHpbClass>, |
||||
"NonHpbClass must not be an hpb class"); |
||||
static_assert(!hpb::internal::IsHpbClass<int>, |
||||
"primitives like int must not be an hpb class"); |
||||
} |
||||
|
||||
TEST(TemplateHelp, TestIsHpbExtendedClass) { |
||||
static_assert( |
||||
hpb::internal::IsHpbClassThatHasExtensions<TestModel>, |
||||
"TestModel must be an hpb extension class, for it has extensions"); |
||||
static_assert(!hpb::internal::IsHpbClassThatHasExtensions<ThemeExtension>, |
||||
"ThemeExtension must not have extensions"); |
||||
static_assert(!hpb::internal::IsHpbClassThatHasExtensions<NonHpbClass>, |
||||
"NonHpbClass must not be an hpb extension class"); |
||||
static_assert(!hpb::internal::IsHpbClassThatHasExtensions<int>, |
||||
"primitives like int must not be an hpb extension class"); |
||||
} |
||||
|
||||
} // namespace hpb_unittest::protos
|
Loading…
Reference in new issue