Fix qualification of enum values in template specialization args (#56070)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/56070

Changelog: [Internal]

Fixes qualification of unscoped enum values used as template specialization arguments.

Reviewed By: cipolleschi

Differential Revision: D96279462

fbshipit-source-id: d151b069124b352451964a31da0385744d21013f
This commit is contained in:
Dawid Małecki authored and meta-codesync[bot] committed 2026-03-18 09:29:02 -07:00
1 parent d0ec2956f8
commit 248d38e5c1
3 files changed
+57 -1

No files matched your search

+6 -1
View File
@@ -396,8 +396,13 @@ class Scope(Generic[ScopeKindT]):
elif any(
m.name == base_name and not isinstance(m, FriendMember)
for m in current_scope._members
) or any(
any(m.name == base_name for m in inner._members)
for inner in current_scope.inner_scopes.values()
if isinstance(inner.kind, EnumScopeKind)
):
# Found as a member, assume following segments exist in the scope
# Found as a member (or as an unscoped enum value accessible
# from the parent scope), assume following segments exist
prefix = "::".join(matched_segments)
suffix = "::".join(path[i:])
anchor_prefix = anchor_scope.get_qualified_name()
@@ -0,0 +1,19 @@
struct test::Event {
}
enum test::Event::Type {
NodeAllocation,
NodeDeallocation,
}
template <test::Event::Type E>
struct test::Event::TypedData {
}
struct test::Event::TypedData<test::Event::NodeAllocation> {
public int config;
}
struct test::Event::TypedData<test::Event::NodeDeallocation> {
public int config;
}
@@ -0,0 +1,32 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#pragma once
namespace test {
struct Event {
enum Type {
NodeAllocation,
NodeDeallocation,
};
template <Type E>
struct TypedData {};
};
template <>
struct Event::TypedData<Event::NodeAllocation> {
int config;
};
template <>
struct Event::TypedData<Event::NodeDeallocation> {
int config;
};
} // namespace test