-
Notifications
You must be signed in to change notification settings - Fork 264
Remove throwing/originating errors in expected scenarios (Lookup/TryLookup and Cancel) #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 18 commits
472e8d4
e358b92
a6ab125
cefa5fa
a66ecd3
3972237
72689da
815d734
dd18558
0dfa235
3f44814
cfaa2a6
e69a7fe
7051f24
7b0072a
783413a
18a57a8
2ee9368
050fa7a
dc6777e
4632e57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <RunSettings> | ||
| <RunConfiguration> | ||
| <ResultsDirectory>.\TestResults</ResultsDirectory><!-- Path relative to solution directory --> | ||
| <TestSessionTimeout>60000</TestSessionTimeout><!-- Milliseconds --> | ||
| <ForceListContent>true</ForceListContent> | ||
| </RunConfiguration> | ||
|
|
||
| <!-- Adapter Specific sections --> | ||
|
|
||
| <!-- Catch2 adapter --> | ||
| <Catch2Adapter> | ||
| <ExecutionMode>Single</ExecutionMode> | ||
| <FilenameFilter>(?i:Test)</FilenameFilter><!-- Regex filter --> | ||
| <ForceListContent>true</ForceListContent> | ||
| <DebugBreak>on</DebugBreak> | ||
| <IncludeHidden>true</IncludeHidden> | ||
| <Logging>Verbose</Logging> | ||
| <MessageFormat>AdditionalInfo</MessageFormat> | ||
| <StackTraceFormat>ShortInfo</StackTraceFormat> | ||
| <StackTracePointReplacement>,</StackTracePointReplacement> | ||
| <TestCaseTimeout>20000</TestCaseTimeout><!-- 20s in Milliseconds --> | ||
| </Catch2Adapter> | ||
| </RunSettings> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,10 @@ WINRT_EXPORT namespace winrt | |
| struct take_ownership_from_abi_t {}; | ||
| inline constexpr take_ownership_from_abi_t take_ownership_from_abi{}; | ||
|
|
||
| // Map implementations can implement TryLookup with trylookup_from_abi_t as an optimization | ||
| struct trylookup_from_abi_t {}; | ||
| inline constexpr trylookup_from_abi_t trylookup_from_abi{}; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not convinced that we need this. Can we just call TryLookup if it is present and returns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was added at Ryan's suggestion, to make sure that we don't inadvertently create a new compiler error for possible custom IMap implementations that have their own TryLookup implementations that is incompatible with our usage. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems very unlikely right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i agreed with his suggestion as since is not a "breaking" change, any code that compiled before this change, should compile after this change. So if a custom IMap has TryLookup(key, extra args) or bool TryLookup(key, outval), we won't break compilation of their code by merely updating their cppwinrt versions. |
||
|
|
||
| template <typename T> | ||
| struct com_ptr; | ||
|
|
||
|
|
@@ -298,4 +302,18 @@ namespace winrt::impl | |
| return (func(Types{}) || ...); | ||
| } | ||
| }; | ||
|
|
||
| template <typename D, typename K> | ||
| struct has_TryLookup | ||
| { | ||
| template <typename U, typename = decltype(std::declval<U>().TryLookup(std::declval<K>(), trylookup_from_abi))> static constexpr bool get_value(int) { return true; } | ||
| template <typename> static constexpr bool get_value(...) { return false; } | ||
|
|
||
| public: | ||
|
|
||
antmor marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| static constexpr bool value = get_value<D>(0); | ||
| }; | ||
|
|
||
| template <typename D, typename K> | ||
| inline constexpr bool has_TryLookup_v = has_TryLookup<D, K>::value; | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm trying to decipher if there is also a test case that verifies that a map with a TryLookup lacking |
Uh oh!
There was an error while loading. Please reload this page.